@webskill/sdk 0.21.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +1174 -169
  4. package/dist/{approval-DwN2o2QG.js → approval-7CuZS3Z4.js} +104 -18
  5. package/dist/arc-8U_6NQWm.js +130 -0
  6. package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
  7. package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
  8. package/dist/array-DQfpQNY8.js +8 -0
  9. package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
  10. package/dist/browser.d.ts +455 -49
  11. package/dist/browser.js +2134 -138
  12. package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
  13. package/dist/channel-CZxxLrG7.js +9 -0
  14. package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
  15. package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
  16. package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
  17. package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
  18. package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
  19. package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
  20. package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
  21. package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
  22. package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
  23. package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
  24. package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
  25. package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
  26. package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
  27. package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
  28. package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
  29. package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
  30. package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
  31. package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
  32. package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
  33. package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
  34. package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
  35. package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
  36. package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
  37. package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
  38. package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
  39. package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
  40. package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
  41. package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
  42. package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
  43. package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
  44. package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
  45. package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
  46. package/dist/defaultLocale-B_EoOkSF.js +249 -0
  47. package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
  48. package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
  49. package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
  50. package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
  51. package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
  52. package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
  53. package/dist/dist-UajCDt3n.js +92 -0
  54. package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
  55. package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
  56. package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
  57. package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
  58. package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
  59. package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
  60. package/dist/{toolSource-C9oNuKmr.js → geometry-CRhuySKV.js} +169 -12
  61. package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
  62. package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
  63. package/dist/governance.d.ts +22 -4
  64. package/dist/governance.js +100 -10
  65. package/dist/graphlib-tk9gQYuN.js +4194 -0
  66. package/dist/{index-DHopiH_m.d.ts → index-7No55dRb.d.ts} +161 -11
  67. package/dist/{index-B8Tgmpwh.d.ts → index-ShvCB5I9.d.ts} +2 -2
  68. package/dist/{index-CYLt5u4L.d.ts → index-V76_OFj2.d.ts} +789 -21
  69. package/dist/index.d.ts +4 -4
  70. package/dist/index.js +11 -9
  71. package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
  72. package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
  73. package/dist/init-CMOIWdg-.js +16 -0
  74. package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
  75. package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
  76. package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
  77. package/dist/katex-BcRRvyh_.js +26465 -0
  78. package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
  79. package/dist/line-LgV8iVMV.js +48 -0
  80. package/dist/linear-BWKR0Tqd.js +393 -0
  81. package/dist/linkedDocument-CZZOl9cO.js +456 -0
  82. package/dist/mcp.d.ts +2 -2
  83. package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
  84. package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
  85. package/dist/mermaid.core-DMtwGCHy.js +1756 -0
  86. package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
  87. package/dist/node.d.ts +3 -3
  88. package/dist/node.js +12 -5
  89. package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
  90. package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
  91. package/dist/ordinal-CxA6GHQS.js +84 -0
  92. package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
  93. package/dist/path-C27Z2Bjv.js +106 -0
  94. package/dist/{pathSecurity-B1owvJAF.js → pathSecurity-CirkQwWP.js} +12 -1
  95. package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
  96. package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
  97. package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
  98. package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
  99. package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
  100. package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
  101. package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
  102. package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
  103. package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
  104. package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
  105. package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
  106. package/dist/rough.cjs-AmDd_NQk.js +1395 -0
  107. package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
  108. package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
  109. package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
  110. package/dist/{skill-CAJMsLod.js → skill-WSUDp6A1.js} +1 -1
  111. package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-S4_HJ_Fl-Cvy9LqVu.d.ts} +35 -4
  112. package/dist/src-NkhI3UMl.js +2653 -0
  113. package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
  114. package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
  115. package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
  116. package/dist/testing.d.ts +2 -1
  117. package/dist/testing.js +1 -1
  118. package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
  119. package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
  120. package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
  121. package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BiZBXGm4.d.ts} +66 -8
  122. package/dist/ui-react.d.ts +3 -3
  123. package/dist/ui-react.js +3746 -96
  124. package/dist/ui-vue.d.ts +1 -1
  125. package/dist/ui.d.ts +3 -3
  126. package/dist/ui.js +2 -2
  127. package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
  128. package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
  129. package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
  130. package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
  131. package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-D5VMUnrv.js} +2 -2
  132. package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
  133. package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
  134. package/package.json +1 -1
  135. package/dist/linkedDocument-C0gj1sMq.js +0 -245
@@ -0,0 +1,874 @@
1
+ import { n as parse } from "./mermaid-parser.core-pYR5siSx.js";
2
+ import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
3
+ import { m as log } from "./src-NkhI3UMl.js";
4
+ import { D as getThemeVariables3, H as setAccDescription, U as setAccTitle, a as clear, b as getConfig, c as configureSvgSize, q as setDiagramTitle, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-O7XYJQB3-B6K0KOSL.js";
5
+ import { i as cleanAndMerge } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
6
+ import { t as selectSvgElement } from "./chunk-6AEJRKK7-JXK89I-O.js";
7
+ import { t as populateCommonDb } from "./chunk-JWPE2WC7-D1rC79GS.js";
8
+
9
+ //#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-VNRHLVJA.mjs
10
+ var toPercent = /* @__PURE__ */ __name((value, context) => {
11
+ const normalized = value <= 1 ? value * 100 : value;
12
+ if (normalized < 0 || normalized > 100) throw new Error(`${context} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${value}`);
13
+ return normalized;
14
+ }, "toPercent");
15
+ var toCoordinates = /* @__PURE__ */ __name((visibility, evolution, context) => {
16
+ return {
17
+ x: toPercent(evolution, `${context} evolution`),
18
+ y: toPercent(visibility, `${context} visibility`)
19
+ };
20
+ }, "toCoordinates");
21
+ var getFlowFromPort = /* @__PURE__ */ __name((port) => {
22
+ if (!port) return;
23
+ if (port === "+<>") return "bidirectional";
24
+ if (port === "+<") return "backward";
25
+ if (port === "+>") return "forward";
26
+ }, "getFlowFromPort");
27
+ var extractFlowFromArrow = /* @__PURE__ */ __name((arrow) => {
28
+ if (!arrow?.startsWith("+")) return {};
29
+ const flowLabel = /^\+'([^']*)'/.exec(arrow)?.[1];
30
+ if (arrow.includes("<>")) return {
31
+ flow: "bidirectional",
32
+ label: flowLabel
33
+ };
34
+ if (arrow.includes("<")) return {
35
+ flow: "backward",
36
+ label: flowLabel
37
+ };
38
+ if (arrow.includes(">")) return {
39
+ flow: "forward",
40
+ label: flowLabel
41
+ };
42
+ return { label: flowLabel };
43
+ }, "extractFlowFromArrow");
44
+ var populateDb = /* @__PURE__ */ __name((ast, db) => {
45
+ populateCommonDb(ast, db);
46
+ if (ast.size) db.setSize(ast.size.width, ast.size.height);
47
+ if (ast.evolution) {
48
+ const stages = ast.evolution.stages.map((stage) => {
49
+ if (stage.secondName) return `${stage.name.trim()} / ${stage.secondName.trim()}`;
50
+ return stage.name.trim();
51
+ });
52
+ const stageBoundaries = ast.evolution.stages.filter((stage) => stage.boundary !== void 0).map((stage) => stage.boundary);
53
+ db.updateAxes({
54
+ stages,
55
+ stageBoundaries
56
+ });
57
+ }
58
+ ast.anchors.forEach((anchor) => {
59
+ const coords = toCoordinates(anchor.visibility, anchor.evolution, `Anchor "${anchor.name}"`);
60
+ db.addNode(anchor.name, anchor.name, coords.x, coords.y, "anchor");
61
+ });
62
+ ast.components.forEach((component) => {
63
+ const coords = toCoordinates(component.visibility, component.evolution, `Component "${component.name}"`);
64
+ const labelOffsetX = component.label ? (component.label.negX ? -1 : 1) * component.label.offsetX : void 0;
65
+ const labelOffsetY = component.label ? (component.label.negY ? -1 : 1) * component.label.offsetY : void 0;
66
+ const sourceStrategy = component.decorator?.strategy;
67
+ db.addNode(component.name, component.name, coords.x, coords.y, "component", labelOffsetX, labelOffsetY, component.inertia, sourceStrategy);
68
+ });
69
+ ast.notes.forEach((note) => {
70
+ const coords = toCoordinates(note.visibility, note.evolution, `Note "${note.text}"`);
71
+ db.addNote(note.text, coords.x, coords.y);
72
+ });
73
+ ast.pipelines.forEach((pipeline) => {
74
+ const parentNode = db.getNode(pipeline.parent);
75
+ if (!parentNode || typeof parentNode.y !== "number") throw new Error(`Pipeline "${pipeline.parent}" must reference an existing component with coordinates.`);
76
+ const parentY = parentNode.y;
77
+ db.startPipeline(pipeline.parent);
78
+ pipeline.components.forEach((component) => {
79
+ const componentId = `${pipeline.parent}_${component.name}`;
80
+ const labelOffsetX = component.label ? (component.label.negX ? -1 : 1) * component.label.offsetX : void 0;
81
+ const labelOffsetY = component.label ? (component.label.negY ? -1 : 1) * component.label.offsetY : void 0;
82
+ const x = toPercent(component.evolution, `Pipeline component "${component.name}" evolution`);
83
+ db.addNode(componentId, component.name, x, parentY, "pipeline-component", labelOffsetX, labelOffsetY);
84
+ db.addPipelineComponent(pipeline.parent, componentId);
85
+ });
86
+ });
87
+ ast.links.forEach((link) => {
88
+ const isDashed = !!link.arrow && (link.arrow.includes("-.->") || link.arrow.includes(".-."));
89
+ let flow = getFlowFromPort(link.fromPort) ?? getFlowFromPort(link.toPort);
90
+ const { flow: arrowFlow, label: flowLabel } = extractFlowFromArrow(link.arrow);
91
+ if (!flow && arrowFlow) flow = arrowFlow;
92
+ const annotation = link.linkLabel;
93
+ const label = flowLabel ?? annotation;
94
+ db.addLink(db.resolveNodeId(link.from), db.resolveNodeId(link.to), isDashed, label, flow);
95
+ });
96
+ ast.evolves.forEach((evolve) => {
97
+ const node = db.getNode(evolve.component);
98
+ if (node?.y !== void 0) {
99
+ const target = toPercent(evolve.target, `Evolve target for "${evolve.component}"`);
100
+ db.addTrend(evolve.component, target, node.y);
101
+ }
102
+ });
103
+ if (ast.annotations.length > 0) {
104
+ const annotationsBox = ast.annotations[0];
105
+ const coords = toCoordinates(annotationsBox.x, annotationsBox.y, "Annotations box");
106
+ db.setAnnotationsBox(coords.x, coords.y);
107
+ }
108
+ ast.annotation.forEach((annotation) => {
109
+ const coords = toCoordinates(annotation.x, annotation.y, `Annotation ${annotation.number}`);
110
+ db.addAnnotation(annotation.number, [{
111
+ x: coords.x,
112
+ y: coords.y
113
+ }], annotation.text);
114
+ });
115
+ ast.accelerators.forEach((accelerator) => {
116
+ const coords = toCoordinates(accelerator.x, accelerator.y, `Accelerator "${accelerator.name}"`);
117
+ db.addAccelerator(accelerator.name, coords.x, coords.y);
118
+ });
119
+ ast.deaccelerators.forEach((deaccelerator) => {
120
+ const coords = toCoordinates(deaccelerator.x, deaccelerator.y, `Deaccelerator "${deaccelerator.name}"`);
121
+ db.addDeaccelerator(deaccelerator.name, coords.x, coords.y);
122
+ });
123
+ }, "populateDb");
124
+ var parser = {
125
+ parser: { yy: void 0 },
126
+ parse: /* @__PURE__ */ __name(async (input) => {
127
+ const ast = await parse("wardley", input);
128
+ log.debug(ast);
129
+ const db = parser.parser?.yy;
130
+ if (!db || typeof db.addNode !== "function") throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");
131
+ populateDb(ast, db);
132
+ }, "parse")
133
+ };
134
+ var WardleyBuilder = class {
135
+ constructor() {
136
+ this.nodes = /* @__PURE__ */ new Map();
137
+ this.links = [];
138
+ this.trends = /* @__PURE__ */ new Map();
139
+ this.pipelines = /* @__PURE__ */ new Map();
140
+ this.annotations = [];
141
+ this.notes = [];
142
+ this.accelerators = [];
143
+ this.deaccelerators = [];
144
+ this.axes = {};
145
+ }
146
+ static {
147
+ __name(this, "WardleyBuilder");
148
+ }
149
+ addNode(node) {
150
+ const existing = this.nodes.get(node.id) ?? {
151
+ id: node.id,
152
+ label: node.label
153
+ };
154
+ const merged = {
155
+ ...existing,
156
+ ...node,
157
+ className: node.className ?? existing.className,
158
+ labelOffsetX: node.labelOffsetX ?? existing.labelOffsetX,
159
+ labelOffsetY: node.labelOffsetY ?? existing.labelOffsetY
160
+ };
161
+ this.nodes.set(node.id, merged);
162
+ }
163
+ addLink(link) {
164
+ this.links.push(link);
165
+ }
166
+ addTrend(trend) {
167
+ this.trends.set(trend.nodeId, trend);
168
+ }
169
+ startPipeline(nodeId) {
170
+ this.pipelines.set(nodeId, {
171
+ nodeId,
172
+ componentIds: []
173
+ });
174
+ const node = this.nodes.get(nodeId);
175
+ if (node) node.isPipelineParent = true;
176
+ }
177
+ addPipelineComponent(pipelineNodeId, componentId) {
178
+ const pipeline = this.pipelines.get(pipelineNodeId);
179
+ if (pipeline) pipeline.componentIds.push(componentId);
180
+ const node = this.nodes.get(componentId);
181
+ if (node) node.inPipeline = true;
182
+ }
183
+ addAnnotation(annotation) {
184
+ this.annotations.push(annotation);
185
+ }
186
+ addNote(note) {
187
+ this.notes.push(note);
188
+ }
189
+ addAccelerator(accelerator) {
190
+ this.accelerators.push(accelerator);
191
+ }
192
+ addDeaccelerator(deaccelerator) {
193
+ this.deaccelerators.push(deaccelerator);
194
+ }
195
+ setAnnotationsBox(x, y) {
196
+ this.annotationsBox = {
197
+ x,
198
+ y
199
+ };
200
+ }
201
+ setAxes(partial) {
202
+ this.axes = {
203
+ ...this.axes,
204
+ ...partial
205
+ };
206
+ }
207
+ setSize(width, height) {
208
+ this.size = {
209
+ width,
210
+ height
211
+ };
212
+ }
213
+ getNode(id) {
214
+ return this.nodes.get(id);
215
+ }
216
+ /**
217
+ * Resolve a name to a node ID. Tries exact ID match first,
218
+ * then falls back to finding a node whose label matches the name
219
+ * (handles pipeline components which have synthetic IDs like "Parent_Child").
220
+ */
221
+ resolveNodeId(name) {
222
+ if (this.nodes.has(name)) return name;
223
+ for (const [id, node] of this.nodes) if (node.label === name) return id;
224
+ return name;
225
+ }
226
+ build() {
227
+ const nodes = [];
228
+ for (const node of this.nodes.values()) {
229
+ if (typeof node.x !== "number" || typeof node.y !== "number") throw new Error(`Node "${node.label}" is missing coordinates`);
230
+ nodes.push(node);
231
+ }
232
+ return {
233
+ nodes,
234
+ links: [...this.links],
235
+ trends: [...this.trends.values()],
236
+ pipelines: [...this.pipelines.values()],
237
+ annotations: [...this.annotations],
238
+ notes: [...this.notes],
239
+ accelerators: [...this.accelerators],
240
+ deaccelerators: [...this.deaccelerators],
241
+ annotationsBox: this.annotationsBox,
242
+ axes: { ...this.axes },
243
+ size: this.size
244
+ };
245
+ }
246
+ clear() {
247
+ this.nodes.clear();
248
+ this.links = [];
249
+ this.trends.clear();
250
+ this.pipelines.clear();
251
+ this.annotations = [];
252
+ this.notes = [];
253
+ this.accelerators = [];
254
+ this.deaccelerators = [];
255
+ this.annotationsBox = void 0;
256
+ this.axes = {};
257
+ this.size = void 0;
258
+ }
259
+ };
260
+ var builder = new WardleyBuilder();
261
+ function getConfig3() {
262
+ return getConfig2()["wardley-beta"];
263
+ }
264
+ __name(getConfig3, "getConfig");
265
+ function addNode(id, label, x, y, className, labelOffsetX, labelOffsetY, inertia, sourceStrategy) {
266
+ builder.addNode({
267
+ id,
268
+ label,
269
+ x,
270
+ y,
271
+ className,
272
+ labelOffsetX,
273
+ labelOffsetY,
274
+ inertia,
275
+ sourceStrategy
276
+ });
277
+ }
278
+ __name(addNode, "addNode");
279
+ function addLink(sourceId, targetId, dashed = false, label, flow) {
280
+ builder.addLink({
281
+ source: sourceId,
282
+ target: targetId,
283
+ dashed,
284
+ label,
285
+ flow
286
+ });
287
+ }
288
+ __name(addLink, "addLink");
289
+ function addTrend(nodeId, targetX, targetY) {
290
+ builder.addTrend({
291
+ nodeId,
292
+ targetX,
293
+ targetY
294
+ });
295
+ }
296
+ __name(addTrend, "addTrend");
297
+ function addAnnotation(number, coordinates, text) {
298
+ builder.addAnnotation({
299
+ number,
300
+ coordinates,
301
+ text
302
+ });
303
+ }
304
+ __name(addAnnotation, "addAnnotation");
305
+ function addNote(text, x, y) {
306
+ builder.addNote({
307
+ text,
308
+ x,
309
+ y
310
+ });
311
+ }
312
+ __name(addNote, "addNote");
313
+ function addAccelerator(name, x, y) {
314
+ builder.addAccelerator({
315
+ name,
316
+ x,
317
+ y
318
+ });
319
+ }
320
+ __name(addAccelerator, "addAccelerator");
321
+ function addDeaccelerator(name, x, y) {
322
+ builder.addDeaccelerator({
323
+ name,
324
+ x,
325
+ y
326
+ });
327
+ }
328
+ __name(addDeaccelerator, "addDeaccelerator");
329
+ function setAnnotationsBox(x, y) {
330
+ builder.setAnnotationsBox(x, y);
331
+ }
332
+ __name(setAnnotationsBox, "setAnnotationsBox");
333
+ function setSize(width, height) {
334
+ builder.setSize(width, height);
335
+ }
336
+ __name(setSize, "setSize");
337
+ function startPipeline(nodeId) {
338
+ builder.startPipeline(nodeId);
339
+ }
340
+ __name(startPipeline, "startPipeline");
341
+ function addPipelineComponent(pipelineNodeId, componentId) {
342
+ builder.addPipelineComponent(pipelineNodeId, componentId);
343
+ }
344
+ __name(addPipelineComponent, "addPipelineComponent");
345
+ function updateAxes(partial) {
346
+ builder.setAxes(partial);
347
+ }
348
+ __name(updateAxes, "updateAxes");
349
+ function getNode(id) {
350
+ return builder.getNode(id);
351
+ }
352
+ __name(getNode, "getNode");
353
+ function resolveNodeId(name) {
354
+ return builder.resolveNodeId(name);
355
+ }
356
+ __name(resolveNodeId, "resolveNodeId");
357
+ function getWardleyData() {
358
+ return builder.build();
359
+ }
360
+ __name(getWardleyData, "getWardleyData");
361
+ function clear2() {
362
+ builder.clear();
363
+ clear();
364
+ }
365
+ __name(clear2, "clear");
366
+ var wardleyDb_default = {
367
+ getConfig: getConfig3,
368
+ addNode,
369
+ addLink,
370
+ addTrend,
371
+ addAnnotation,
372
+ addNote,
373
+ addAccelerator,
374
+ addDeaccelerator,
375
+ setAnnotationsBox,
376
+ setSize,
377
+ startPipeline,
378
+ addPipelineComponent,
379
+ updateAxes,
380
+ getNode,
381
+ resolveNodeId,
382
+ getWardleyData,
383
+ clear: clear2,
384
+ setAccTitle,
385
+ getAccTitle,
386
+ setDiagramTitle,
387
+ getDiagramTitle,
388
+ getAccDescription,
389
+ setAccDescription
390
+ };
391
+ var DEFAULT_STAGES = [
392
+ "Genesis",
393
+ "Custom Built",
394
+ "Product",
395
+ "Commodity"
396
+ ];
397
+ var getTheme = /* @__PURE__ */ __name(() => {
398
+ const { themeVariables } = getConfig2();
399
+ return {
400
+ backgroundColor: themeVariables.wardley?.backgroundColor ?? themeVariables.background ?? "#fff",
401
+ axisColor: themeVariables.wardley?.axisColor ?? "#000",
402
+ axisTextColor: themeVariables.wardley?.axisTextColor ?? themeVariables.primaryTextColor ?? "#222",
403
+ gridColor: themeVariables.wardley?.gridColor ?? "rgba(100, 100, 100, 0.2)",
404
+ componentFill: themeVariables.wardley?.componentFill ?? "#fff",
405
+ componentStroke: themeVariables.wardley?.componentStroke ?? "#000",
406
+ componentLabelColor: themeVariables.wardley?.componentLabelColor ?? themeVariables.primaryTextColor ?? "#222",
407
+ linkStroke: themeVariables.wardley?.linkStroke ?? "#000",
408
+ evolutionStroke: themeVariables.wardley?.evolutionStroke ?? "#dc3545",
409
+ annotationStroke: themeVariables.wardley?.annotationStroke ?? "#000",
410
+ annotationTextColor: themeVariables.wardley?.annotationTextColor ?? themeVariables.primaryTextColor ?? "#222",
411
+ annotationFill: themeVariables.wardley?.annotationFill ?? themeVariables.background ?? "#fff"
412
+ };
413
+ }, "getTheme");
414
+ var getConfigValues = /* @__PURE__ */ __name(() => {
415
+ const wardleyConfig = getConfig2()["wardley-beta"];
416
+ return {
417
+ width: wardleyConfig?.width ?? 900,
418
+ height: wardleyConfig?.height ?? 600,
419
+ padding: wardleyConfig?.padding ?? 48,
420
+ nodeRadius: wardleyConfig?.nodeRadius ?? 6,
421
+ nodeLabelOffset: wardleyConfig?.nodeLabelOffset ?? 8,
422
+ axisFontSize: wardleyConfig?.axisFontSize ?? 12,
423
+ labelFontSize: wardleyConfig?.labelFontSize ?? 10,
424
+ showGrid: wardleyConfig?.showGrid ?? false,
425
+ useMaxWidth: wardleyConfig?.useMaxWidth ?? true
426
+ };
427
+ }, "getConfigValues");
428
+ var diagram = {
429
+ parser,
430
+ db: wardleyDb_default,
431
+ renderer: { draw: /* @__PURE__ */ __name((text, id, _version, diagObj) => {
432
+ log.debug("Rendering Wardley map\n" + text);
433
+ const configValues = getConfigValues();
434
+ const theme = getTheme();
435
+ const squareSize = configValues.nodeRadius * 1.6;
436
+ const db = diagObj.db;
437
+ const data = db.getWardleyData();
438
+ const title = db.getDiagramTitle();
439
+ const width = data.size?.width ?? configValues.width;
440
+ const height = data.size?.height ?? configValues.height;
441
+ const svg = selectSvgElement(id);
442
+ svg.selectAll("*").remove();
443
+ configureSvgSize(svg, height, width, configValues.useMaxWidth);
444
+ svg.attr("viewBox", `0 0 ${width} ${height}`);
445
+ const root = svg.append("g").attr("class", "wardley-map");
446
+ const defs = svg.append("defs");
447
+ defs.append("marker").attr("id", `arrow-${id}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", theme.evolutionStroke).attr("stroke", "none");
448
+ defs.append("marker").attr("id", `link-arrow-end-${id}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", theme.linkStroke).attr("stroke", "none");
449
+ defs.append("marker").attr("id", `link-arrow-start-${id}`).attr("viewBox", "0 0 10 10").attr("refX", 1).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z").attr("fill", theme.linkStroke).attr("stroke", "none");
450
+ root.append("rect").attr("class", "wardley-background").attr("width", width).attr("height", height).attr("fill", theme.backgroundColor);
451
+ const chartWidth = width - configValues.padding * 2;
452
+ const chartHeight = height - configValues.padding * 2;
453
+ if (title) root.append("text").attr("class", "wardley-title").attr("x", width / 2).attr("y", configValues.padding / 2).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize * 1.05).attr("font-weight", "bold").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title);
454
+ const projectX = /* @__PURE__ */ __name((value) => configValues.padding + value / 100 * chartWidth, "projectX");
455
+ const projectY = /* @__PURE__ */ __name((value) => height - configValues.padding - value / 100 * chartHeight, "projectY");
456
+ const axisGroup = root.append("g").attr("class", "wardley-axes");
457
+ axisGroup.append("line").attr("x1", configValues.padding).attr("x2", width - configValues.padding).attr("y1", height - configValues.padding).attr("y2", height - configValues.padding).attr("stroke", theme.axisColor).attr("stroke-width", 1);
458
+ axisGroup.append("line").attr("x1", configValues.padding).attr("x2", configValues.padding).attr("y1", configValues.padding).attr("y2", height - configValues.padding).attr("stroke", theme.axisColor).attr("stroke-width", 1);
459
+ const xLabel = data.axes.xLabel ?? "Evolution";
460
+ const yLabel = data.axes.yLabel ?? "Visibility";
461
+ axisGroup.append("text").attr("class", "wardley-axis-label wardley-axis-label-x").attr("x", configValues.padding + chartWidth / 2).attr("y", height - configValues.padding / 4).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").text(xLabel);
462
+ axisGroup.append("text").attr("class", "wardley-axis-label wardley-axis-label-y").attr("x", configValues.padding / 3).attr("y", configValues.padding + chartHeight / 2).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").attr("transform", `rotate(-90 ${configValues.padding / 3} ${configValues.padding + chartHeight / 2})`).text(yLabel);
463
+ const stages = data.axes.stages && data.axes.stages.length > 0 ? data.axes.stages : DEFAULT_STAGES;
464
+ if (stages.length > 0) {
465
+ const stageGroup = root.append("g").attr("class", "wardley-stages");
466
+ const boundaries = data.axes.stageBoundaries;
467
+ const stagePositions = [];
468
+ if (boundaries && boundaries.length === stages.length) {
469
+ let prevBoundary = 0;
470
+ boundaries.forEach((boundary) => {
471
+ stagePositions.push({
472
+ start: prevBoundary,
473
+ end: boundary
474
+ });
475
+ prevBoundary = boundary;
476
+ });
477
+ } else {
478
+ const stageWidth = 1 / stages.length;
479
+ stages.forEach((_, index) => {
480
+ stagePositions.push({
481
+ start: index * stageWidth,
482
+ end: (index + 1) * stageWidth
483
+ });
484
+ });
485
+ }
486
+ stages.forEach((stage, index) => {
487
+ const pos = stagePositions[index];
488
+ const startX = configValues.padding + pos.start * chartWidth;
489
+ const centerX = (startX + (configValues.padding + pos.end * chartWidth)) / 2;
490
+ if (index > 0) stageGroup.append("line").attr("x1", startX).attr("x2", startX).attr("y1", configValues.padding).attr("y2", height - configValues.padding).attr("stroke", "#000").attr("stroke-width", 1).attr("stroke-dasharray", "5 5").attr("opacity", .8);
491
+ stageGroup.append("text").attr("class", "wardley-stage-label").attr("x", centerX).attr("y", height - configValues.padding / 1.5).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize - 2).attr("text-anchor", "middle").text(stage);
492
+ });
493
+ }
494
+ if (configValues.showGrid) {
495
+ const gridGroup = root.append("g").attr("class", "wardley-grid");
496
+ for (let i = 1; i < 4; i++) {
497
+ const ratio = i / 4;
498
+ const x = configValues.padding + chartWidth * ratio;
499
+ gridGroup.append("line").attr("x1", x).attr("x2", x).attr("y1", configValues.padding).attr("y2", height - configValues.padding).attr("stroke", theme.gridColor).attr("stroke-dasharray", "2 6");
500
+ gridGroup.append("line").attr("x1", configValues.padding).attr("x2", width - configValues.padding).attr("y1", height - configValues.padding - chartHeight * ratio).attr("y2", height - configValues.padding - chartHeight * ratio).attr("stroke", theme.gridColor).attr("stroke-dasharray", "2 6");
501
+ }
502
+ }
503
+ const positions = /* @__PURE__ */ new Map();
504
+ data.nodes.forEach((node) => {
505
+ positions.set(node.id, {
506
+ x: projectX(node.x),
507
+ y: projectY(node.y),
508
+ node
509
+ });
510
+ });
511
+ if (data.pipelines.length > 0) {
512
+ const pipelineGroup = root.append("g").attr("class", "wardley-pipelines");
513
+ const pipelineLinksGroup = root.append("g").attr("class", "wardley-pipeline-links");
514
+ data.pipelines.forEach((pipeline) => {
515
+ if (pipeline.componentIds.length === 0) return;
516
+ const sortedComponents = pipeline.componentIds.map((id2) => ({
517
+ id: id2,
518
+ pos: positions.get(id2),
519
+ node: data.nodes.find((n) => n.id === id2)
520
+ })).filter((c) => c.pos && c.node).sort((a, b) => a.node.x - b.node.x);
521
+ for (let i = 0; i < sortedComponents.length - 1; i++) {
522
+ const current = sortedComponents[i];
523
+ const next = sortedComponents[i + 1];
524
+ pipelineLinksGroup.append("line").attr("class", "wardley-pipeline-evolution-link").attr("x1", current.pos.x).attr("y1", current.pos.y).attr("x2", next.pos.x).attr("y2", next.pos.y).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4");
525
+ }
526
+ let minX = Infinity;
527
+ let maxX = -Infinity;
528
+ let y = 0;
529
+ pipeline.componentIds.forEach((componentId) => {
530
+ const pos = positions.get(componentId);
531
+ if (pos) {
532
+ minX = Math.min(minX, pos.x);
533
+ maxX = Math.max(maxX, pos.x);
534
+ y = pos.y;
535
+ }
536
+ });
537
+ if (minX !== Infinity && maxX !== -Infinity) {
538
+ const padding = 15;
539
+ const height2 = configValues.nodeRadius * 4;
540
+ const boxTop = y - height2 / 2;
541
+ const parentPos = positions.get(pipeline.nodeId);
542
+ if (parentPos) {
543
+ parentPos.x = (minX + maxX) / 2;
544
+ parentPos.y = boxTop - squareSize / 6;
545
+ }
546
+ pipelineGroup.append("rect").attr("class", "wardley-pipeline-box").attr("x", minX - padding).attr("y", boxTop).attr("width", maxX - minX + padding * 2).attr("height", height2).attr("fill", "none").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
547
+ }
548
+ });
549
+ }
550
+ const linksGroup = root.append("g").attr("class", "wardley-links");
551
+ const pipelineMap = /* @__PURE__ */ new Map();
552
+ data.pipelines.forEach((pipeline) => {
553
+ pipelineMap.set(pipeline.nodeId, new Set(pipeline.componentIds));
554
+ });
555
+ const validLinks = data.links.filter((link) => {
556
+ if (!positions.has(link.source) || !positions.has(link.target)) return false;
557
+ if (pipelineMap.get(link.target)?.has(link.source)) return false;
558
+ return true;
559
+ });
560
+ linksGroup.selectAll("line").data(validLinks).enter().append("line").attr("class", (link) => `wardley-link${link.dashed ? " wardley-link--dashed" : ""}`).attr("x1", (link) => {
561
+ const sourcePos = positions.get(link.source);
562
+ const targetPos = positions.get(link.target);
563
+ const radius = data.nodes.find((n) => n.id === link.source).isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
564
+ const dx = targetPos.x - sourcePos.x;
565
+ const dy = targetPos.y - sourcePos.y;
566
+ const distance = Math.sqrt(dx * dx + dy * dy);
567
+ return sourcePos.x + dx / distance * radius;
568
+ }).attr("y1", (link) => {
569
+ const sourcePos = positions.get(link.source);
570
+ const targetPos = positions.get(link.target);
571
+ const radius = data.nodes.find((n) => n.id === link.source).isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
572
+ const dx = targetPos.x - sourcePos.x;
573
+ const dy = targetPos.y - sourcePos.y;
574
+ const distance = Math.sqrt(dx * dx + dy * dy);
575
+ return sourcePos.y + dy / distance * radius;
576
+ }).attr("x2", (link) => {
577
+ const sourcePos = positions.get(link.source);
578
+ const targetPos = positions.get(link.target);
579
+ const radius = data.nodes.find((n) => n.id === link.target).isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
580
+ const dx = sourcePos.x - targetPos.x;
581
+ const dy = sourcePos.y - targetPos.y;
582
+ const distance = Math.sqrt(dx * dx + dy * dy);
583
+ return targetPos.x + dx / distance * radius;
584
+ }).attr("y2", (link) => {
585
+ const sourcePos = positions.get(link.source);
586
+ const targetPos = positions.get(link.target);
587
+ const radius = data.nodes.find((n) => n.id === link.target).isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
588
+ const dx = sourcePos.x - targetPos.x;
589
+ const dy = sourcePos.y - targetPos.y;
590
+ const distance = Math.sqrt(dx * dx + dy * dy);
591
+ return targetPos.y + dy / distance * radius;
592
+ }).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", (link) => link.dashed ? "6 6" : null).attr("marker-end", (link) => {
593
+ if (link.flow === "forward" || link.flow === "bidirectional") return `url(#link-arrow-end-${id})`;
594
+ return null;
595
+ }).attr("marker-start", (link) => {
596
+ if (link.flow === "backward" || link.flow === "bidirectional") return `url(#link-arrow-start-${id})`;
597
+ return null;
598
+ });
599
+ linksGroup.selectAll("text").data(validLinks.filter((link) => link.label)).enter().append("text").attr("class", "wardley-link-label").attr("x", (link) => {
600
+ const sourcePos = positions.get(link.source);
601
+ const targetPos = positions.get(link.target);
602
+ const midX = (sourcePos.x + targetPos.x) / 2;
603
+ const dy = targetPos.y - sourcePos.y;
604
+ const dx = targetPos.x - sourcePos.x;
605
+ return midX + dy / Math.sqrt(dx * dx + dy * dy) * 8;
606
+ }).attr("y", (link) => {
607
+ const sourcePos = positions.get(link.source);
608
+ const targetPos = positions.get(link.target);
609
+ const midY = (sourcePos.y + targetPos.y) / 2;
610
+ const dx = targetPos.x - sourcePos.x;
611
+ const dy = targetPos.y - sourcePos.y;
612
+ const distance = Math.sqrt(dx * dx + dy * dy);
613
+ return midY + -dx / distance * 8;
614
+ }).attr("fill", theme.axisTextColor).attr("font-size", configValues.labelFontSize).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("transform", (link) => {
615
+ const sourcePos = positions.get(link.source);
616
+ const targetPos = positions.get(link.target);
617
+ const midX = (sourcePos.x + targetPos.x) / 2;
618
+ const midY = (sourcePos.y + targetPos.y) / 2;
619
+ const dx = targetPos.x - sourcePos.x;
620
+ const dy = targetPos.y - sourcePos.y;
621
+ const distance = Math.sqrt(dx * dx + dy * dy);
622
+ const offset = 8;
623
+ const perpX = dy / distance;
624
+ const perpY = -dx / distance;
625
+ const labelX = midX + perpX * offset;
626
+ const labelY = midY + perpY * offset;
627
+ let angle = Math.atan2(dy, dx) * 180 / Math.PI;
628
+ if (angle > 90 || angle < -90) angle += 180;
629
+ return `rotate(${angle} ${labelX} ${labelY})`;
630
+ }).text((link) => link.label);
631
+ const trendGroup = root.append("g").attr("class", "wardley-trends");
632
+ const trendsWithPositions = data.trends.map((trend) => {
633
+ const origin = positions.get(trend.nodeId);
634
+ if (!origin) return null;
635
+ const targetX = projectX(trend.targetX);
636
+ const targetY = projectY(trend.targetY);
637
+ const dx = targetX - origin.x;
638
+ const dy = targetY - origin.y;
639
+ const distance = Math.sqrt(dx * dx + dy * dy);
640
+ const shortenBy = configValues.nodeRadius + 2;
641
+ return {
642
+ origin,
643
+ targetX,
644
+ targetY,
645
+ adjustedX2: distance > shortenBy ? targetX - dx / distance * shortenBy : targetX,
646
+ adjustedY2: distance > shortenBy ? targetY - dy / distance * shortenBy : targetY
647
+ };
648
+ }).filter((trend) => trend !== null);
649
+ trendGroup.selectAll("line").data(trendsWithPositions).enter().append("line").attr("class", "wardley-trend").attr("x1", (trend) => trend.origin.x).attr("y1", (trend) => trend.origin.y).attr("x2", (trend) => trend.adjustedX2).attr("y2", (trend) => trend.adjustedY2).attr("stroke", theme.evolutionStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("marker-end", `url(#arrow-${id})`);
650
+ const nodeEnter = root.append("g").attr("class", "wardley-nodes").selectAll("g").data(data.nodes).enter().append("g").attr("class", (node) => ["wardley-node", node.className ? `wardley-node--${node.className}` : ""].filter(Boolean).join(" "));
651
+ nodeEnter.filter((node) => node.sourceStrategy === "outsource").append("circle").attr("class", "wardley-outsource-overlay").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#666").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
652
+ nodeEnter.filter((node) => node.sourceStrategy === "buy").append("circle").attr("class", "wardley-buy-overlay").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#ccc").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
653
+ nodeEnter.filter((node) => node.sourceStrategy === "build").append("circle").attr("class", "wardley-build-overlay").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#eee").attr("stroke", "#000").attr("stroke-width", 1);
654
+ const marketNodes = nodeEnter.filter((node) => node.sourceStrategy === "market");
655
+ marketNodes.append("circle").attr("class", "wardley-market-overlay").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
656
+ nodeEnter.filter((node) => !node.isPipelineParent && node.sourceStrategy !== "market" && node.className !== "anchor").append("circle").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius).attr("fill", theme.componentFill).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
657
+ const smallCircleRadius = configValues.nodeRadius * .7;
658
+ const triangleRadius = configValues.nodeRadius * 1.2;
659
+ marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node) => positions.get(node.id).x).attr("y1", (node) => positions.get(node.id).y - triangleRadius).attr("x2", (node) => positions.get(node.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("y2", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
660
+ marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node) => positions.get(node.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("y1", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("x2", (node) => positions.get(node.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("y2", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
661
+ marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node) => positions.get(node.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("y1", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("x2", (node) => positions.get(node.id).x).attr("y2", (node) => positions.get(node.id).y - triangleRadius).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
662
+ marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y - triangleRadius).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
663
+ marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node) => positions.get(node.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("cy", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
664
+ marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node) => positions.get(node.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("cy", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
665
+ nodeEnter.filter((node) => node.isPipelineParent === true).append("rect").attr("x", (node) => positions.get(node.id).x - squareSize / 2).attr("y", (node) => positions.get(node.id).y - squareSize / 2).attr("width", squareSize).attr("height", squareSize).attr("fill", theme.componentFill).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
666
+ nodeEnter.filter((node) => node.inertia === true).append("line").attr("class", "wardley-inertia").attr("x1", (node) => {
667
+ const pos = positions.get(node.id);
668
+ let offset = node.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15;
669
+ if (node.sourceStrategy) offset += configValues.nodeRadius + 10;
670
+ return pos.x + offset;
671
+ }).attr("y1", (node) => {
672
+ const pos = positions.get(node.id);
673
+ const lineHeight = node.isPipelineParent ? squareSize : configValues.nodeRadius * 2;
674
+ return pos.y - lineHeight / 2;
675
+ }).attr("x2", (node) => {
676
+ const pos = positions.get(node.id);
677
+ let offset = node.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15;
678
+ if (node.sourceStrategy) offset += configValues.nodeRadius + 10;
679
+ return pos.x + offset;
680
+ }).attr("y2", (node) => {
681
+ const pos = positions.get(node.id);
682
+ const lineHeight = node.isPipelineParent ? squareSize : configValues.nodeRadius * 2;
683
+ return pos.y + lineHeight / 2;
684
+ }).attr("stroke", theme.componentStroke).attr("stroke-width", 6);
685
+ nodeEnter.append("text").attr("x", (node) => {
686
+ const pos = positions.get(node.id);
687
+ if (node.className === "anchor") return node.labelOffsetX !== void 0 ? pos.x + node.labelOffsetX : pos.x;
688
+ let defaultOffset = configValues.nodeLabelOffset;
689
+ if (node.sourceStrategy && node.labelOffsetX === void 0) defaultOffset += 10;
690
+ const customOffset = node.labelOffsetX ?? defaultOffset;
691
+ return pos.x + customOffset;
692
+ }).attr("y", (node) => {
693
+ const pos = positions.get(node.id);
694
+ if (node.className === "anchor") return node.labelOffsetY !== void 0 ? pos.y + node.labelOffsetY : pos.y - 3;
695
+ let defaultOffset = -configValues.nodeLabelOffset;
696
+ if (node.sourceStrategy && node.labelOffsetY === void 0) defaultOffset -= 10;
697
+ const customOffset = node.labelOffsetY ?? defaultOffset;
698
+ return pos.y + customOffset;
699
+ }).attr("class", "wardley-node-label").attr("fill", (node) => {
700
+ if (node.className === "evolved") return theme.evolutionStroke;
701
+ if (node.className === "anchor") return "#000";
702
+ return theme.componentLabelColor;
703
+ }).attr("font-size", configValues.labelFontSize).attr("font-weight", (node) => node.className === "anchor" ? "bold" : "normal").attr("text-anchor", (node) => node.className === "anchor" ? "middle" : "start").attr("dominant-baseline", (node) => node.className === "anchor" ? "middle" : "auto").text((node) => node.label);
704
+ if (data.annotations.length > 0) {
705
+ const annotationsGroup = root.append("g").attr("class", "wardley-annotations");
706
+ data.annotations.forEach((annotation) => {
707
+ const projectedCoords = annotation.coordinates.map((coord) => ({
708
+ x: projectX(coord.x),
709
+ y: projectY(coord.y)
710
+ }));
711
+ if (projectedCoords.length > 1) for (let i = 0; i < projectedCoords.length - 1; i++) annotationsGroup.append("line").attr("class", "wardley-annotation-line").attr("x1", projectedCoords[i].x).attr("y1", projectedCoords[i].y).attr("x2", projectedCoords[i + 1].x).attr("y2", projectedCoords[i + 1].y).attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4");
712
+ projectedCoords.forEach((coord) => {
713
+ const annotationNode = annotationsGroup.append("g").attr("class", "wardley-annotation");
714
+ annotationNode.append("circle").attr("cx", coord.x).attr("cy", coord.y).attr("r", 10).attr("fill", "white").attr("stroke", theme.axisColor).attr("stroke-width", 1.5);
715
+ annotationNode.append("text").attr("x", coord.x).attr("y", coord.y).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(annotation.number);
716
+ });
717
+ });
718
+ if (data.annotationsBox) {
719
+ let boxX = projectX(data.annotationsBox.x);
720
+ let boxY = projectY(data.annotationsBox.y);
721
+ const padding = 10;
722
+ const lineHeight = 16;
723
+ const fontSize = 11;
724
+ const textBoxGroup = annotationsGroup.append("g").attr("class", "wardley-annotations-box");
725
+ const sortedAnnotations = [...data.annotations].filter((a) => a.text).sort((a, b) => a.number - b.number);
726
+ const textElements = [];
727
+ sortedAnnotations.forEach((annotation, idx) => {
728
+ const text2 = textBoxGroup.append("text").attr("x", boxX + padding).attr("y", boxY + padding + (idx + 1) * lineHeight).attr("font-size", fontSize).attr("fill", theme.axisTextColor).attr("text-anchor", "start").attr("dominant-baseline", "middle").text(`${annotation.number}. ${annotation.text}`);
729
+ textElements.push(text2);
730
+ });
731
+ if (textElements.length > 0) {
732
+ let maxWidth = 0;
733
+ let maxHeight = 0;
734
+ textElements.forEach((text2) => {
735
+ const textNode = text2.node();
736
+ const textWidth = textNode.getComputedTextLength();
737
+ maxWidth = Math.max(maxWidth, textWidth);
738
+ const bbox = textNode.getBBox();
739
+ maxHeight = Math.max(maxHeight, bbox.height);
740
+ });
741
+ const boxWidth = maxWidth + padding * 2 + 105;
742
+ const boxHeight = sortedAnnotations.length * lineHeight + padding * 2 + maxHeight / 2;
743
+ const minX = configValues.padding;
744
+ const maxX = width - configValues.padding - boxWidth;
745
+ const minY = configValues.padding;
746
+ const maxY = height - configValues.padding - boxHeight;
747
+ boxX = Math.max(minX, Math.min(boxX, maxX));
748
+ boxY = Math.max(minY, Math.min(boxY, maxY));
749
+ textElements.forEach((text2, idx) => {
750
+ text2.attr("x", boxX + padding).attr("y", boxY + padding + (idx + 1) * lineHeight);
751
+ });
752
+ textBoxGroup.insert("rect", "text").attr("x", boxX).attr("y", boxY).attr("width", boxWidth).attr("height", boxHeight).attr("fill", "white").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
753
+ }
754
+ }
755
+ }
756
+ if (data.notes.length > 0) {
757
+ const notesGroup = root.append("g").attr("class", "wardley-notes");
758
+ data.notes.forEach((note) => {
759
+ const noteX = projectX(note.x);
760
+ const noteY = projectY(note.y);
761
+ notesGroup.append("text").attr("x", noteX).attr("y", noteY).attr("text-anchor", "start").attr("font-size", 11).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(note.text);
762
+ });
763
+ }
764
+ if (data.accelerators.length > 0) {
765
+ const acceleratorsGroup = root.append("g").attr("class", "wardley-accelerators");
766
+ data.accelerators.forEach((accelerator) => {
767
+ const accX = projectX(accelerator.x);
768
+ const accY = projectY(accelerator.y);
769
+ const arrowWidth = 60;
770
+ const arrowHeight = 30;
771
+ const arrowHeadWidth = 20;
772
+ const arrowPath = `
773
+ M ${accX} ${accY - arrowHeight / 2}
774
+ L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2}
775
+ L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2 - 8}
776
+ L ${accX + arrowWidth} ${accY}
777
+ L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2 + 8}
778
+ L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2}
779
+ L ${accX} ${accY + arrowHeight / 2}
780
+ Z
781
+ `;
782
+ acceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
783
+ acceleratorsGroup.append("text").attr("x", accX + arrowWidth / 2).attr("y", accY + arrowHeight / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(accelerator.name);
784
+ });
785
+ }
786
+ if (data.deaccelerators.length > 0) {
787
+ const deacceleratorsGroup = root.append("g").attr("class", "wardley-deaccelerators");
788
+ data.deaccelerators.forEach((deaccelerator) => {
789
+ const decX = projectX(deaccelerator.x);
790
+ const decY = projectY(deaccelerator.y);
791
+ const arrowWidth = 60;
792
+ const arrowHeight = 30;
793
+ const arrowHeadWidth = 20;
794
+ const arrowPath = `
795
+ M ${decX + arrowWidth} ${decY - arrowHeight / 2}
796
+ L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2}
797
+ L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2 - 8}
798
+ L ${decX} ${decY}
799
+ L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2 + 8}
800
+ L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2}
801
+ L ${decX + arrowWidth} ${decY + arrowHeight / 2}
802
+ Z
803
+ `;
804
+ deacceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
805
+ deacceleratorsGroup.append("text").attr("x", decX + arrowWidth / 2).attr("y", decY + arrowHeight / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(deaccelerator.name);
806
+ });
807
+ }
808
+ }, "draw") },
809
+ styles: /* @__PURE__ */ __name(({ wardley } = {}) => {
810
+ const w = cleanAndMerge(cleanAndMerge(getThemeVariables3(), getConfig().themeVariables).wardley, wardley);
811
+ return `
812
+ .wardley-background {
813
+ fill: ${w.backgroundColor};
814
+ }
815
+ .wardley-axes line, .wardley-axes path {
816
+ stroke: ${w.axisColor};
817
+ }
818
+ .wardley-axis-label {
819
+ fill: ${w.axisTextColor};
820
+ }
821
+ .wardley-stage-label {
822
+ fill: ${w.axisTextColor};
823
+ }
824
+ .wardley-grid line {
825
+ stroke: ${w.gridColor};
826
+ }
827
+ .wardley-node circle {
828
+ fill: ${w.componentFill};
829
+ stroke: ${w.componentStroke};
830
+ }
831
+ .wardley-node-label {
832
+ fill: ${w.componentLabelColor};
833
+ }
834
+ .wardley-link {
835
+ stroke: ${w.linkStroke};
836
+ }
837
+ .wardley-link--dashed {
838
+ stroke-dasharray: 4 4;
839
+ }
840
+ .wardley-link-label {
841
+ fill: ${w.axisTextColor};
842
+ }
843
+ .wardley-trend line {
844
+ stroke: ${w.evolutionStroke};
845
+ }
846
+ .wardley-annotation-line {
847
+ stroke: ${w.annotationStroke};
848
+ }
849
+ .wardley-annotation circle {
850
+ fill: ${w.annotationFill};
851
+ stroke: ${w.annotationStroke};
852
+ }
853
+ .wardley-annotation text {
854
+ fill: ${w.annotationTextColor};
855
+ }
856
+ .wardley-annotations-box rect {
857
+ fill: ${w.annotationFill};
858
+ stroke: ${w.annotationStroke};
859
+ }
860
+ .wardley-annotations-box text {
861
+ fill: ${w.annotationTextColor};
862
+ }
863
+ .wardley-pipeline-box {
864
+ stroke: ${w.componentStroke};
865
+ }
866
+ .wardley-notes text {
867
+ fill: ${w.axisTextColor};
868
+ }
869
+ `;
870
+ }, "styles")
871
+ };
872
+
873
+ //#endregion
874
+ export { diagram };