@aiderdesk/aiderdesk 0.62.0 → 0.66.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 (65) hide show
  1. package/out/cli.js +1 -0
  2. package/out/{open-telemetry-CcefKvbB.js → open-telemetry-baOvr6sK.js} +1 -1
  3. package/out/renderer/assets/{arc-TuVjX2tH.js → arc-BXuUWHai.js} +1 -1
  4. package/out/renderer/assets/{architectureDiagram-Q4EWVU46-CnAcyRvO.js → architectureDiagram-3BPJPVTR-Bm9oFTP_.js} +11 -9
  5. package/out/renderer/assets/{blockDiagram-DXYQGD6D-DBoJhGAM.js → blockDiagram-GPEHLZMM-DQ2DevZl.js} +218 -30
  6. package/out/renderer/assets/{c4Diagram-AHTNJAMY-BzW0gKwX.js → c4Diagram-AAUBKEIU-BdR46VbA.js} +2 -2
  7. package/out/renderer/assets/{channel-CqR4FAVX.js → channel-DUdp1NJ7.js} +1 -1
  8. package/out/renderer/assets/{chunk-EDXVE4YY-DRk838hn.js → chunk-2J33WTMH-Dzi-idRV.js} +1 -1
  9. package/out/renderer/assets/{chunk-4BX2VUAB-DQjg_Naa.js → chunk-4BX2VUAB-DEyFpixF.js} +1 -1
  10. package/out/renderer/assets/{chunk-55IACEB6-pFPEMTmI.js → chunk-55IACEB6-DyyQMIZa.js} +1 -1
  11. package/out/renderer/assets/{chunk-4TB4RGXK-DkcI1yaW.js → chunk-727SXJPM-vXEiesCP.js} +245 -149
  12. package/out/renderer/assets/{chunk-OYMX7WX6-DOGJ-XHp.js → chunk-AQP2D5EJ-B0SWmbrS.js} +92 -78
  13. package/out/renderer/assets/{chunk-FMBD7UC4-BagQdd5u.js → chunk-FMBD7UC4-CoPwvBCa.js} +1 -1
  14. package/out/renderer/assets/{chunk-YZCP3GAM-BKZRTlUj.js → chunk-ND2GUHAM-ku5t5SwP.js} +1 -1
  15. package/out/renderer/assets/{chunk-QZHKN3VN-CdzjbbBk.js → chunk-QZHKN3VN-DBGBAqit.js} +1 -1
  16. package/out/renderer/assets/{classDiagram-6PBFFD2Q-CjVhmlxb.js → classDiagram-4FO5ZUOK-DTyjsHX9.js} +6 -6
  17. package/out/renderer/assets/{classDiagram-v2-HSJHXN6E-CjVhmlxb.js → classDiagram-v2-Q7XG4LA2-DTyjsHX9.js} +6 -6
  18. package/out/renderer/assets/{cose-bilkent-S5V4N54A-CZLRecVB.js → cose-bilkent-S5V4N54A-wGfE9wIx.js} +1 -1
  19. package/out/renderer/assets/{dagre-KV5264BT-BUAzC7Um.js → dagre-BM42HDAG-cwyj1-l0.js} +17 -6
  20. package/out/renderer/assets/{diagram-MMDJMWI5-B5H49OVD.js → diagram-2AECGRRQ-BYvCxkOs.js} +3 -5
  21. package/out/renderer/assets/{diagram-5BDNPKRD-DNQEDszc.js → diagram-5GNKFQAL--ZlqvgmY.js} +4 -6
  22. package/out/renderer/assets/diagram-KO2AKTUF-CoPNrPhx.js +632 -0
  23. package/out/renderer/assets/{diagram-TYMM5635-Bw7r467p.js → diagram-LMA3HP47-wjhxYTWf.js} +3 -5
  24. package/out/renderer/assets/{diagram-G4DWMVQ6-D9YY6W2O.js → diagram-OG6HWLK6-DhYpewbd.js} +4 -6
  25. package/out/renderer/assets/{erDiagram-SMLLAGMA-Bz4ALNLp.js → erDiagram-TEJ5UH35-DolRLBng.js} +4 -4
  26. package/out/renderer/assets/{flowDiagram-DWJPFMVM-Uqg1ZeN2.js → flowDiagram-I6XJVG4X-DjAbl_XC.js} +6 -6
  27. package/out/renderer/assets/{ganttDiagram-T4ZO3ILL-Dm0tRLCH.js → ganttDiagram-6RSMTGT7-AF7-XgtX.js} +7 -1
  28. package/out/renderer/assets/{gitGraphDiagram-UUTBAWPF-R8imfIrj.js → gitGraphDiagram-PVQCEYII-BMZLakzH.js} +4 -6
  29. package/out/renderer/assets/{graph-B5YWEnt0.js → graph-B_ifajWk.js} +490 -135
  30. package/out/renderer/assets/{index-D7Xi0GX5.js → index-3bI-dJm8.js} +12818 -8179
  31. package/out/renderer/assets/{index-B6Zj03wk.css → index-B62bIfbt.css} +234 -11
  32. package/out/renderer/assets/{infoDiagram-42DDH7IO-CWPYNP1k.js → infoDiagram-5YYISTIA-0f7Qxxvp.js} +3 -5
  33. package/out/renderer/assets/{ishikawaDiagram-UXIWVN3A-CFTrc-S6.js → ishikawaDiagram-YF4QCWOH-BX_EIAMn.js} +1 -1
  34. package/out/renderer/assets/{journeyDiagram-VCZTEJTY-Dfd-piIf.js → journeyDiagram-JHISSGLW-Dmitv8wD.js} +4 -4
  35. package/out/renderer/assets/{kanban-definition-6JOO6SKY-BocrfAtb.js → kanban-definition-UN3LZRKU-By2GFUNB.js} +2 -2
  36. package/out/renderer/assets/{layout-DHzrXVin.js → layout-DAkKffy1.js} +459 -32
  37. package/out/renderer/assets/{mindmap-definition-QFDTVHPH-D9cyK1Gb.js → mindmap-definition-RKZ34NQL-yIrV1m0y.js} +3 -3
  38. package/out/renderer/assets/{pieDiagram-DEJITSTG-LUWwVJA5.js → pieDiagram-4H26LBE5-PV9y5rw_.js} +4 -6
  39. package/out/renderer/assets/{quadrantDiagram-34T5L4WZ-DdWTi9yW.js → quadrantDiagram-W4KKPZXB-DeX0zTCp.js} +22 -20
  40. package/out/renderer/assets/{requirementDiagram-MS252O5E-BoLT3tay.js → requirementDiagram-4Y6WPE33-Bzfk_KE-.js} +3 -3
  41. package/out/renderer/assets/{sankeyDiagram-XADWPNL6-B4gY_QI-.js → sankeyDiagram-5OEKKPKP-BuCv8QIY.js} +80 -11
  42. package/out/renderer/assets/{sequenceDiagram-FGHM5R23-B-JJvxQW.js → sequenceDiagram-3UESZ5HK-Zg7Ukud8.js} +21 -9
  43. package/out/renderer/assets/{stateDiagram-FHFEXIEX-BntwOBUs.js → stateDiagram-AJRCARHV-CLaqfYR8.js} +6 -8
  44. package/out/renderer/assets/{stateDiagram-v2-QKLJ7IA2-C__eWVIe.js → stateDiagram-v2-BHNVJYJU-Cmm1ljQ4.js} +4 -4
  45. package/out/renderer/assets/{timeline-definition-GMOUNBTQ-C7ch2INk.js → timeline-definition-PNZ67QCA-DQBaAVcC.js} +2 -2
  46. package/out/renderer/assets/{vennDiagram-DHZGUBPP-CQ__NSue.js → vennDiagram-CIIHVFJN-CuplbU_R.js} +1 -1
  47. package/out/renderer/assets/{wardley-RL74JXVD-Kh6mNiRV.js → wardley-L42UT6IY-BiqfHMim.js} +25605 -19118
  48. package/out/renderer/assets/{wardleyDiagram-NUSXRM2D-CfRYzJMU.js → wardleyDiagram-YWT4CUSO-BaV0FnUu.js} +112 -38
  49. package/out/renderer/assets/worker-CfJUABHG.js +12626 -0
  50. package/out/renderer/assets/{xychartDiagram-5P7HB3ND-BFq2zIne.js → xychartDiagram-2RQKCTM6-DA_Miw-n.js} +1 -1
  51. package/out/renderer/index.html +2 -2
  52. package/out/renderer/progress.html +4 -48
  53. package/out/resources/connector/connector.py +14 -6
  54. package/out/resources/mcp-server/aider-desk-mcp-server.js +1051 -501
  55. package/out/resources/skills/extension-creator/references/config-components.md +6 -6
  56. package/out/runner.js +2815 -537
  57. package/package.json +29 -21
  58. package/patches/@ai-sdk+deepseek+1.0.37.patch +150 -0
  59. package/scripts/generate-package.mjs +10 -2
  60. package/out/renderer/assets/_baseUniq-B7TxjYgy.js +0 -381
  61. package/out/renderer/assets/clone-B-kqpcr4.js +0 -8
  62. package/out/renderer/assets/min-D6g96v7R.js +0 -41
  63. package/out/resources/linux/probe +0 -0
  64. package/out/resources/linux-x64/probe +0 -0
  65. /package/patches/{ai+5.0.172.patch → ai+5.0.179.patch} +0 -0
@@ -0,0 +1,632 @@
1
+ import { p as populateCommonDb } from "./chunk-4BX2VUAB-DEyFpixF.js";
2
+ import { q as getDiagramTitle, p as setDiagramTitle, s as setAccDescription, g as getAccDescription, a as getAccTitle, b as setAccTitle, _ as __name, l as log, c as getConfig2, d as select, E as setupGraphViewbox2, z as clear, F as cleanAndMerge, D as getConfig, G as defaultConfig_default, i as sanitizeText, w as wrapLabel, ap as calculateTextDimensions } from "./index-3bI-dJm8.js";
3
+ import { p as parse, i as isEmResetFrame } from "./wardley-L42UT6IY-BiqfHMim.js";
4
+ var PositionFrameKind = "position frame";
5
+ var FramePositionedKind = "frame positioned";
6
+ var PositionRelationKind = "position relation";
7
+ var RelationPositionedKind = "relation positioned";
8
+ var setOptions = /* @__PURE__ */ __name(function(_rawOptString) {
9
+ log.debug("options str", _rawOptString);
10
+ }, "setOptions");
11
+ var getOptions = /* @__PURE__ */ __name(function() {
12
+ return {};
13
+ }, "getOptions");
14
+ var clear2 = /* @__PURE__ */ __name(function() {
15
+ reset();
16
+ clear();
17
+ }, "clear");
18
+ function reset() {
19
+ store = {};
20
+ }
21
+ __name(reset, "reset");
22
+ var DEFAULT_EVENTMODELING_CONFIG = defaultConfig_default.eventmodeling;
23
+ var getConfig3 = /* @__PURE__ */ __name(() => {
24
+ const config = cleanAndMerge({
25
+ ...DEFAULT_EVENTMODELING_CONFIG,
26
+ ...getConfig().eventmodeling
27
+ });
28
+ return config;
29
+ }, "getConfig");
30
+ var store = {};
31
+ function getState() {
32
+ let state = initial;
33
+ const { ast } = store;
34
+ const diagramProps2 = getDiagramProps();
35
+ if (!ast) {
36
+ throw new Error("No data for EventModel");
37
+ }
38
+ ast.frames.forEach((frame, index) => {
39
+ const textProps = calculateTextProps(frame, ast.dataEntities, diagramProps2);
40
+ state = dispatch(state, {
41
+ $kind: PositionFrameKind,
42
+ index,
43
+ frame,
44
+ textProps
45
+ });
46
+ let sourceFrames = void 0;
47
+ if (hasSourceFrame(frame)) {
48
+ log.debug(`source frame`, frame.sourceFrames);
49
+ sourceFrames = ast.frames.filter((currentFrame) => {
50
+ return frame.sourceFrames.some((sf) => sf.$refText === currentFrame.name);
51
+ });
52
+ sourceFrames.forEach((sourceFrame) => {
53
+ state = dispatch(state, {
54
+ $kind: PositionRelationKind,
55
+ index,
56
+ frame,
57
+ sourceFrame
58
+ });
59
+ });
60
+ } else {
61
+ state = dispatch(state, {
62
+ $kind: PositionRelationKind,
63
+ index,
64
+ frame
65
+ });
66
+ }
67
+ });
68
+ state = {
69
+ ...state,
70
+ sortedSwimlanesArray: sortedSwimlanesArray(state.swimlanes)
71
+ };
72
+ return state;
73
+ }
74
+ __name(getState, "getState");
75
+ function setAst(ast) {
76
+ store.ast = ast;
77
+ }
78
+ __name(setAst, "setAst");
79
+ var diagramProps = {
80
+ swimlaneMinHeight: 70,
81
+ swimlanePadding: 15,
82
+ swimlaneGap: 10,
83
+ boxPadding: 10,
84
+ boxOverlap: 90,
85
+ boxDefaultY: 0,
86
+ boxMinWidth: 80,
87
+ boxMaxWidth: 450,
88
+ boxMinHeight: 80,
89
+ boxMaxHeight: 750,
90
+ contentStartX: 250,
91
+ textMaxWidth: 450 - 2 * 10,
92
+ boxTextFontWeight: "bold",
93
+ boxTextPadding: 10,
94
+ swimlaneTextFontWeight: "bold",
95
+ labelUiAutomation: "UI/Automation",
96
+ labelUiAutomationPrefix: "UI/A: ",
97
+ labelCommandReadModel: "Command/Read Model",
98
+ labelCommandReadModelPrefix: "C/RM: ",
99
+ labelEvents: "Events",
100
+ labelEventsPrefix: "Stream: "
101
+ };
102
+ function getDiagramProps() {
103
+ return diagramProps;
104
+ }
105
+ __name(getDiagramProps, "getDiagramProps");
106
+ var initial = {
107
+ boxes: [],
108
+ swimlanes: {},
109
+ relations: [],
110
+ maxR: 0,
111
+ sortedSwimlanesArray: []
112
+ };
113
+ function extractNamespace(entityIdentifier) {
114
+ const spl = entityIdentifier.split(".");
115
+ if (spl.length === 2) {
116
+ return spl[0];
117
+ }
118
+ return void 0;
119
+ }
120
+ __name(extractNamespace, "extractNamespace");
121
+ function extractName(entityIdentifier) {
122
+ const spl = entityIdentifier.split(".");
123
+ if (spl.length === 2) {
124
+ return spl[1];
125
+ }
126
+ return entityIdentifier;
127
+ }
128
+ __name(extractName, "extractName");
129
+ function findSwimlaneByNamespace(swimlanes, namespace) {
130
+ if (!namespace || namespace.length === 0) {
131
+ return void 0;
132
+ }
133
+ return Object.values(swimlanes).find((swimlane) => swimlane.namespace === namespace);
134
+ }
135
+ __name(findSwimlaneByNamespace, "findSwimlaneByNamespace");
136
+ function findNextAvailableIndex(swimlanes, boundaryMin, boundaryMax) {
137
+ return Math.max(
138
+ boundaryMin,
139
+ ...Object.keys(swimlanes).filter((key) => {
140
+ const index = Number.parseInt(key);
141
+ return index > boundaryMin && index < boundaryMax;
142
+ }).map((key) => Number.parseInt(key))
143
+ ) + 1;
144
+ }
145
+ __name(findNextAvailableIndex, "findNextAvailableIndex");
146
+ function calculateSwimlaneProps(frame, swimlanes) {
147
+ const namespace = extractNamespace(frame.entityIdentifier);
148
+ const sw = findSwimlaneByNamespace(swimlanes, namespace);
149
+ switch (frame.modelEntityType) {
150
+ case "ui":
151
+ case "pcr":
152
+ case "processor":
153
+ if (sw) {
154
+ return {
155
+ index: sw.index,
156
+ label: sw.namespace || diagramProps.labelUiAutomation
157
+ };
158
+ } else if (namespace) {
159
+ return {
160
+ index: findNextAvailableIndex(swimlanes, 0, 100),
161
+ label: diagramProps.labelUiAutomationPrefix + namespace
162
+ };
163
+ }
164
+ return { index: 0, label: diagramProps.labelUiAutomation };
165
+ case "rmo":
166
+ case "readmodel":
167
+ case "cmd":
168
+ case "command":
169
+ if (sw) {
170
+ return {
171
+ index: sw.index,
172
+ label: sw.namespace || diagramProps.labelCommandReadModel
173
+ };
174
+ } else if (namespace) {
175
+ return {
176
+ index: findNextAvailableIndex(swimlanes, 100, 200),
177
+ label: diagramProps.labelCommandReadModelPrefix + namespace
178
+ };
179
+ }
180
+ return { index: 100, label: diagramProps.labelCommandReadModel };
181
+ case "evt":
182
+ case "event":
183
+ default:
184
+ if (sw) {
185
+ return {
186
+ index: sw.index,
187
+ label: sw.namespace || diagramProps.labelEvents
188
+ };
189
+ } else if (namespace) {
190
+ return {
191
+ index: findNextAvailableIndex(swimlanes, 200, 300),
192
+ label: diagramProps.labelEventsPrefix + namespace
193
+ };
194
+ }
195
+ return { index: 200, label: diagramProps.labelEvents };
196
+ }
197
+ }
198
+ __name(calculateSwimlaneProps, "calculateSwimlaneProps");
199
+ function calculateEntityVisualProps(frame) {
200
+ const { themeVariables } = getConfig();
201
+ switch (frame.modelEntityType) {
202
+ case "ui":
203
+ return {
204
+ fill: themeVariables.emUiFill ?? "white",
205
+ stroke: themeVariables.emUiStroke ?? "#dbdada"
206
+ };
207
+ case "pcr":
208
+ case "processor":
209
+ return {
210
+ fill: themeVariables.emProcessorFill ?? "#edb3f6",
211
+ stroke: themeVariables.emProcessorStroke ?? "#b88cbf"
212
+ };
213
+ case "rmo":
214
+ case "readmodel":
215
+ return {
216
+ fill: themeVariables.emReadModelFill ?? "#d3f1a2",
217
+ stroke: themeVariables.emReadModelStroke ?? "#a3b732"
218
+ };
219
+ case "cmd":
220
+ case "command":
221
+ return {
222
+ fill: themeVariables.emCommandFill ?? "#bcd6fe",
223
+ stroke: themeVariables.emCommandStroke ?? "#679ac3"
224
+ };
225
+ case "evt":
226
+ case "event":
227
+ return {
228
+ fill: themeVariables.emEventFill ?? "#ffb778",
229
+ stroke: themeVariables.emEventStroke ?? "#c19a0f"
230
+ };
231
+ default:
232
+ return {
233
+ fill: "red",
234
+ stroke: "black"
235
+ };
236
+ }
237
+ }
238
+ __name(calculateEntityVisualProps, "calculateEntityVisualProps");
239
+ function calculateTextProps(frame, dataEntities, diagramProps2) {
240
+ const config = getConfig();
241
+ const name = sanitizeText(extractName(frame.entityIdentifier) ?? "", config);
242
+ let toHtml;
243
+ const wrapLabelConfig = {
244
+ fontSize: 16,
245
+ fontWeight: 700,
246
+ fontFamily: '"trebuchet ms", verdana, arial, sans-serif',
247
+ joinWith: "<br/>"
248
+ };
249
+ const wrappedName = wrapLabel(name, diagramProps2.textMaxWidth, wrapLabelConfig);
250
+ let content = `<b>${wrappedName}</b>`;
251
+ if (frame.dataInlineValue) {
252
+ toHtml = frame.dataInlineValue;
253
+ toHtml = toHtml.substring(toHtml.indexOf("{") + 1);
254
+ toHtml = toHtml.substring(0, toHtml.lastIndexOf("}") - 1);
255
+ toHtml = sanitizeText(toHtml, config);
256
+ toHtml = wrapLabel(toHtml, diagramProps2.textMaxWidth, wrapLabelConfig);
257
+ toHtml = toHtml.replaceAll(" ", "&nbsp;");
258
+ }
259
+ if (frame.dataReference) {
260
+ const dataEntity = dataEntities.find(
261
+ (dataEntity2) => dataEntity2.name === frame.dataReference?.$refText
262
+ );
263
+ if (dataEntity) {
264
+ toHtml = dataEntity.dataBlockValue;
265
+ toHtml = toHtml.substring(toHtml.indexOf("{\n") + 2);
266
+ toHtml = toHtml.substring(0, toHtml.lastIndexOf("}") - 1);
267
+ toHtml = sanitizeText(toHtml, config);
268
+ toHtml = wrapLabel(toHtml, diagramProps2.textMaxWidth, wrapLabelConfig);
269
+ toHtml = toHtml.replaceAll(" ", "&nbsp;");
270
+ toHtml += `<br/>`;
271
+ }
272
+ }
273
+ const hasRenderedData = toHtml !== void 0;
274
+ if (hasRenderedData) {
275
+ content += `<br/><br/><code style="text-align: left; display: block;max-width:${diagramProps2.textMaxWidth}px">${toHtml}</code>`;
276
+ }
277
+ const textDimensionConfig = {
278
+ fontSize: wrapLabelConfig.fontSize,
279
+ fontWeight: wrapLabelConfig.fontWeight,
280
+ fontFamily: wrapLabelConfig.fontFamily
281
+ };
282
+ const dimensions = calculateTextDimensions(content, textDimensionConfig);
283
+ const calculatedWidthFix = hasRenderedData ? dimensions.width / 3 : dimensions.width;
284
+ const props = {
285
+ content,
286
+ width: calculatedWidthFix,
287
+ height: dimensions.height
288
+ };
289
+ log.debug(`[${frame.name}] ${frame.entityIdentifier} text`, props);
290
+ return props;
291
+ }
292
+ __name(calculateTextProps, "calculateTextProps");
293
+ function decidePositionFrame(state, _command) {
294
+ const command = _command;
295
+ const visual = calculateEntityVisualProps(command.frame);
296
+ const dimension = {
297
+ width: command.textProps.width + 2 * diagramProps.boxTextPadding,
298
+ height: command.textProps.height + 2 * diagramProps.boxTextPadding
299
+ };
300
+ const event = {
301
+ $kind: FramePositionedKind,
302
+ frame: command.frame,
303
+ index: command.index,
304
+ visual,
305
+ dimension,
306
+ textProps: command.textProps
307
+ };
308
+ return [event];
309
+ }
310
+ __name(decidePositionFrame, "decidePositionFrame");
311
+ function calculateX(swimlane, previousSwimlane, lastBox) {
312
+ if (previousSwimlane === void 0) {
313
+ return diagramProps.contentStartX;
314
+ }
315
+ if (previousSwimlane.index === swimlane.index && swimlane.r) {
316
+ return swimlane.r + diagramProps.boxPadding;
317
+ }
318
+ if (lastBox === void 0) {
319
+ return diagramProps.contentStartX;
320
+ }
321
+ return lastBox.r - diagramProps.boxOverlap + diagramProps.boxPadding;
322
+ }
323
+ __name(calculateX, "calculateX");
324
+ function calculateMaxRight(swimlanes, swimlaneR) {
325
+ const rs = [...swimlanes.map((s) => s.r), swimlaneR];
326
+ return Math.max(...rs);
327
+ }
328
+ __name(calculateMaxRight, "calculateMaxRight");
329
+ function sortedSwimlanesArray(swimlanes) {
330
+ return Object.values(swimlanes).sort((a, b) => a.index - b.index);
331
+ }
332
+ __name(sortedSwimlanesArray, "sortedSwimlanesArray");
333
+ function evolveFramePositioned(state, _event) {
334
+ const event = _event;
335
+ const swimlaneProps = calculateSwimlaneProps(event.frame, state.swimlanes);
336
+ let swimlane;
337
+ if (swimlaneProps.index in state.swimlanes) {
338
+ swimlane = state.swimlanes[swimlaneProps.index];
339
+ } else {
340
+ swimlane = {
341
+ index: swimlaneProps.index,
342
+ label: swimlaneProps.label,
343
+ r: 0,
344
+ y: swimlaneProps.index * diagramProps.swimlaneMinHeight + diagramProps.swimlaneGap,
345
+ height: diagramProps.swimlaneMinHeight,
346
+ maxHeight: diagramProps.swimlaneMinHeight
347
+ };
348
+ }
349
+ const lastBox = state.boxes.length > 0 ? state.boxes[state.boxes.length - 1] : void 0;
350
+ const previousSwimlane = state.previousSwimlaneNumber !== void 0 ? state.swimlanes[state.previousSwimlaneNumber] : void 0;
351
+ const dimension = {
352
+ width: Math.max(
353
+ diagramProps.boxMinWidth,
354
+ Math.min(diagramProps.boxMaxWidth, event.dimension.width)
355
+ ) + 2 * diagramProps.boxPadding,
356
+ height: Math.max(
357
+ diagramProps.boxMinHeight,
358
+ Math.min(diagramProps.boxMaxHeight, event.dimension.height)
359
+ ) + 2 * diagramProps.boxPadding
360
+ };
361
+ const x = calculateX(swimlane, previousSwimlane, lastBox);
362
+ const r = x + dimension.width + diagramProps.boxPadding;
363
+ const maxR = calculateMaxRight(Object.values(state.swimlanes), r);
364
+ swimlane.r = x + dimension.width;
365
+ swimlane.maxHeight = Math.max(swimlane.maxHeight, dimension.height);
366
+ swimlane.height = Math.max(diagramProps.swimlaneMinHeight, swimlane.maxHeight) + 2 * diagramProps.swimlanePadding;
367
+ const box = {
368
+ x,
369
+ y: diagramProps.swimlanePadding + swimlane.y,
370
+ // y: diagramProps.swimlanePadding + (swimlane.y || diagramProps.boxDefaultY),
371
+ r,
372
+ dimension,
373
+ leftSibling: false,
374
+ swimlane,
375
+ visual: event.visual,
376
+ text: event.textProps.content,
377
+ frame: event.frame,
378
+ index: event.index
379
+ };
380
+ const newState = {
381
+ ...state,
382
+ boxes: [...state.boxes, box],
383
+ swimlanes: {
384
+ ...state.swimlanes,
385
+ [`${swimlane.index}`]: swimlane
386
+ },
387
+ previousSwimlaneNumber: swimlaneProps.index,
388
+ previousFrame: event.frame,
389
+ maxR
390
+ };
391
+ const swimlanes = sortedSwimlanesArray(newState.swimlanes);
392
+ if (swimlanes.length > 0) {
393
+ swimlanes[0].y = 0;
394
+ }
395
+ for (let i = 1; i < swimlanes.length; i++) {
396
+ const sw = swimlanes[i];
397
+ const prevSw = swimlanes[i - 1];
398
+ sw.y = prevSw.y + prevSw.height + diagramProps.swimlaneGap;
399
+ }
400
+ return newState;
401
+ }
402
+ __name(evolveFramePositioned, "evolveFramePositioned");
403
+ function isFirstFrame(index, frame) {
404
+ if (index === 0 && frame.sourceFrames.length === 0) {
405
+ return true;
406
+ }
407
+ return false;
408
+ }
409
+ __name(isFirstFrame, "isFirstFrame");
410
+ function hasSourceFrame(frame) {
411
+ return frame.sourceFrames !== void 0 && frame.sourceFrames !== null && frame.sourceFrames.length > 0;
412
+ }
413
+ __name(hasSourceFrame, "hasSourceFrame");
414
+ function findBoxByFrame(boxes, frame) {
415
+ if (frame === void 0 || frame === null) {
416
+ return void 0;
417
+ }
418
+ return boxes.find((box) => box.frame.name === frame.name);
419
+ }
420
+ __name(findBoxByFrame, "findBoxByFrame");
421
+ function findBoxByLineIndex(boxes, targetSwimlane, lineIndex) {
422
+ if (lineIndex < 0) {
423
+ return void 0;
424
+ }
425
+ for (let i = lineIndex; i >= 0; i--) {
426
+ const box = boxes[i];
427
+ if (box.swimlane.index !== targetSwimlane) {
428
+ return box;
429
+ }
430
+ }
431
+ return void 0;
432
+ }
433
+ __name(findBoxByLineIndex, "findBoxByLineIndex");
434
+ function decidePositionRelation(state, _command) {
435
+ const command = _command;
436
+ if (isEmResetFrame(command.frame) || isFirstFrame(command.index, command.frame)) {
437
+ return [];
438
+ }
439
+ const targetBox = findBoxByFrame(state.boxes, command.frame);
440
+ if (targetBox === void 0) {
441
+ throw new Error(`Target box not found for frame ${command.frame.name}`);
442
+ }
443
+ let sourceBox;
444
+ if (command.sourceFrame) {
445
+ sourceBox = findBoxByFrame(state.boxes, command.sourceFrame);
446
+ } else {
447
+ sourceBox = findBoxByLineIndex(state.boxes, targetBox.swimlane.index, command.index - 1);
448
+ }
449
+ if (sourceBox === void 0) {
450
+ return [];
451
+ }
452
+ const event = {
453
+ $kind: RelationPositionedKind,
454
+ frame: command.frame,
455
+ index: command.index,
456
+ sourceBox,
457
+ targetBox
458
+ };
459
+ return [event];
460
+ }
461
+ __name(decidePositionRelation, "decidePositionRelation");
462
+ function evolveRelationPositioned(state, _event) {
463
+ const event = _event;
464
+ const relation = {
465
+ visual: {
466
+ fill: "none",
467
+ stroke: "#000"
468
+ },
469
+ source: {
470
+ x: event.sourceBox.x,
471
+ y: event.sourceBox.y
472
+ },
473
+ target: {
474
+ x: event.targetBox.x,
475
+ y: event.targetBox.y
476
+ },
477
+ sourceBox: event.sourceBox,
478
+ targetBox: event.targetBox
479
+ };
480
+ const newState = {
481
+ ...state,
482
+ relations: [...state.relations, relation]
483
+ };
484
+ return newState;
485
+ }
486
+ __name(evolveRelationPositioned, "evolveRelationPositioned");
487
+ var deciders = {
488
+ [PositionFrameKind]: decidePositionFrame,
489
+ [PositionRelationKind]: decidePositionRelation
490
+ };
491
+ var evolvers = {
492
+ [FramePositionedKind]: evolveFramePositioned,
493
+ [RelationPositionedKind]: evolveRelationPositioned
494
+ };
495
+ function decide(state, command) {
496
+ const fn = deciders[command.$kind];
497
+ if (fn === void 0 || fn === null) {
498
+ return [];
499
+ }
500
+ const events = fn(state, command);
501
+ log.debug(`decided events`, events);
502
+ return events;
503
+ }
504
+ __name(decide, "decide");
505
+ function evolve(state, events) {
506
+ const newState = events.reduce((previousState, event) => {
507
+ const fn = evolvers[event.$kind];
508
+ if (fn === void 0 || fn === null) {
509
+ return previousState;
510
+ }
511
+ return fn(previousState, event);
512
+ }, state);
513
+ log.debug(`evolve events`, { state, newState, events });
514
+ return newState;
515
+ }
516
+ __name(evolve, "evolve");
517
+ function dispatch(state, command) {
518
+ const events = decide(state, command);
519
+ const newState = evolve(state, events);
520
+ return newState;
521
+ }
522
+ __name(dispatch, "dispatch");
523
+ var db = {
524
+ getConfig: getConfig3,
525
+ setOptions,
526
+ getOptions,
527
+ clear: clear2,
528
+ setAccTitle,
529
+ getAccTitle,
530
+ getAccDescription,
531
+ setAccDescription,
532
+ setDiagramTitle,
533
+ getDiagramTitle,
534
+ setAst,
535
+ getDiagramProps,
536
+ getState
537
+ };
538
+ var parser = {
539
+ parse: /* @__PURE__ */ __name(async (input) => {
540
+ const ast = await parse("eventmodeling", input);
541
+ log.debug(ast);
542
+ db.setAst(ast);
543
+ populateCommonDb(ast, db);
544
+ }, "parse")
545
+ };
546
+ var DEFAULT_CONFIG = getConfig2();
547
+ var DEFAULT_EVENTMODELING_CONFIG2 = DEFAULT_CONFIG?.eventmodeling;
548
+ function renderD3Box(diagram2, diagramProps2) {
549
+ return (box) => {
550
+ const y = box.swimlane.y + diagramProps2.swimlanePadding;
551
+ const g = diagram2.append("g").attr("class", "em-box");
552
+ g.append("rect").attr("x", box.x).attr("y", y).attr("rx", "3").attr("width", box.dimension.width).attr("height", box.dimension.height).attr("stroke", box.visual.stroke).attr("fill", box.visual.fill);
553
+ const f = g.append("foreignObject").attr("x", box.x + diagramProps2.boxPadding).attr("y", y + 10).attr("width", box.dimension.width - 2 * diagramProps2.boxPadding).attr("height", box.dimension.height - 2 * diagramProps2.boxPadding);
554
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
555
+ text.append("span").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").html(box.text);
556
+ };
557
+ }
558
+ __name(renderD3Box, "renderD3Box");
559
+ function dirUpwards(sourceY, targetY) {
560
+ return sourceY > targetY;
561
+ }
562
+ __name(dirUpwards, "dirUpwards");
563
+ function renderD3Relation(diagram2, diagramProps2, arrowheadId, themeVariables) {
564
+ return (relation) => {
565
+ const sourceBoxY = relation.sourceBox.swimlane.y + diagramProps2.swimlanePadding;
566
+ const targetBoxY = relation.targetBox.swimlane.y + diagramProps2.swimlanePadding;
567
+ const upwards = dirUpwards(sourceBoxY, targetBoxY);
568
+ const sourceX = relation.sourceBox.x + relation.sourceBox.dimension.width * 2 / 3;
569
+ const targetX = relation.targetBox.x + relation.targetBox.dimension.width / 3;
570
+ let sourceY;
571
+ let targetY;
572
+ log.debug(`rendering relation up=${upwards} for `, {
573
+ sourceBox: relation.sourceBox,
574
+ targetBox: relation.targetBox
575
+ });
576
+ if (upwards) {
577
+ sourceY = sourceBoxY;
578
+ targetY = targetBoxY + relation.targetBox.dimension.height;
579
+ } else {
580
+ sourceY = sourceBoxY + relation.sourceBox.dimension.height;
581
+ targetY = targetBoxY;
582
+ }
583
+ const relationStroke = themeVariables.emRelationStroke ?? relation.visual.stroke;
584
+ diagram2.append("path").attr("class", "em-relation").attr("fill", relation.visual.fill).attr("stroke", relationStroke).attr("stroke-width", "1").attr("marker-end", `url(#${arrowheadId})`).attr("d", `M${sourceX} ${sourceY} L${targetX} ${targetY}`);
585
+ };
586
+ }
587
+ __name(renderD3Relation, "renderD3Relation");
588
+ function renderD3Swimlane(diagram2, maxR, diagramProps2, themeVariables) {
589
+ return (swimlane) => {
590
+ const g = diagram2.append("g").attr("class", "em-swimlane");
591
+ const oddBackground = themeVariables.emSwimlaneBackgroundOdd ?? "rgb(250,250,250)";
592
+ const backgroundStroke = themeVariables.emSwimlaneBackgroundStroke ?? "rgb(240,240,240)";
593
+ g.append("rect").attr("x", 0).attr("y", swimlane.y).attr("rx", "3").attr("width", maxR + diagramProps2.swimlanePadding).attr("height", swimlane.height).attr("fill", oddBackground).attr("stroke", backgroundStroke);
594
+ g.append("text").attr("font-weight", diagramProps2.swimlaneTextFontWeight).attr("x", 30).attr("y", swimlane.y + 30).text(swimlane.label);
595
+ };
596
+ }
597
+ __name(renderD3Swimlane, "renderD3Swimlane");
598
+ var draw = /* @__PURE__ */ __name(function(txt, id, ver, diagObj) {
599
+ log.debug("in eventmodeling renderer", txt + "\n", "id:", id, ver);
600
+ if (!DEFAULT_EVENTMODELING_CONFIG2) {
601
+ throw new Error("EventModeling config not found");
602
+ }
603
+ const db2 = diagObj.db;
604
+ const { themeVariables, eventmodeling: config } = getConfig2();
605
+ const diagram2 = select(`[id="${id}"]`);
606
+ const diagramProps2 = db2.getDiagramProps();
607
+ const state = db2.getState();
608
+ const arrowheadId = `em-arrowhead-${id}`;
609
+ const arrowheadColor = themeVariables.emArrowhead ?? "#000000";
610
+ state.sortedSwimlanesArray.forEach(
611
+ renderD3Swimlane(diagram2, state.maxR, diagramProps2, themeVariables)
612
+ );
613
+ state.boxes.forEach(renderD3Box(diagram2, diagramProps2));
614
+ state.relations.forEach(renderD3Relation(diagram2, diagramProps2, arrowheadId, themeVariables));
615
+ const marker = diagram2.append("defs").append("marker").attr("id", arrowheadId).attr("markerWidth", "10").attr("markerHeight", "7").attr("refX", "10").attr("refY", "3.5").attr("orient", "auto");
616
+ marker.append("polygon").attr("points", "0 0, 10 3.5, 0 7").attr("fill", arrowheadColor);
617
+ setupGraphViewbox2(void 0, diagram2, config?.padding ?? 30, config?.useMaxWidth);
618
+ }, "draw");
619
+ var renderer_default = {
620
+ draw
621
+ };
622
+ var getStyles = /* @__PURE__ */ __name((_options) => ``, "getStyles");
623
+ var styles_default = getStyles;
624
+ var diagram = {
625
+ parser,
626
+ db,
627
+ renderer: renderer_default,
628
+ styles: styles_default
629
+ };
630
+ export {
631
+ diagram
632
+ };
@@ -1,8 +1,6 @@
1
- import { _ as __name, F as cleanAndMerge, I as selectSvgElement, e as configureSvgSize, l as log, b as setAccTitle, a as getAccTitle, p as setDiagramTitle, q as getDiagramTitle, g as getAccDescription, s as setAccDescription, G as defaultConfig_default, D as getConfig, z as clear } from "./index-D7Xi0GX5.js";
2
- import { p as populateCommonDb } from "./chunk-4BX2VUAB-DQjg_Naa.js";
3
- import { p as parse } from "./wardley-RL74JXVD-Kh6mNiRV.js";
4
- import "./min-D6g96v7R.js";
5
- import "./_baseUniq-B7TxjYgy.js";
1
+ import { _ as __name, F as cleanAndMerge, I as selectSvgElement, e as configureSvgSize, l as log, b as setAccTitle, a as getAccTitle, p as setDiagramTitle, q as getDiagramTitle, g as getAccDescription, s as setAccDescription, D as getConfig, G as defaultConfig_default, z as clear } from "./index-3bI-dJm8.js";
2
+ import { p as populateCommonDb } from "./chunk-4BX2VUAB-DEyFpixF.js";
3
+ import { p as parse } from "./wardley-L42UT6IY-BiqfHMim.js";
6
4
  var DEFAULT_PACKET_CONFIG = defaultConfig_default.packet;
7
5
  var PacketDB = class {
8
6
  constructor() {
@@ -1,9 +1,7 @@
1
- import { _ as __name, L as getThemeVariables3, D as getConfig, F as cleanAndMerge, I as selectSvgElement, e as configureSvgSize, bH as format, l as log, aJ as ordinal, bI as styles2String, d as select, b as setAccTitle, a as getAccTitle, p as setDiagramTitle, q as getDiagramTitle, g as getAccDescription, s as setAccDescription, G as defaultConfig_default, bJ as isLabelStyle, z as clear } from "./index-D7Xi0GX5.js";
2
- import { s as setupViewPortForSVG } from "./chunk-EDXVE4YY-DRk838hn.js";
3
- import { p as populateCommonDb } from "./chunk-4BX2VUAB-DQjg_Naa.js";
4
- import { p as parse } from "./wardley-RL74JXVD-Kh6mNiRV.js";
5
- import "./min-D6g96v7R.js";
6
- import "./_baseUniq-B7TxjYgy.js";
1
+ import { _ as __name, L as getThemeVariables3, D as getConfig, F as cleanAndMerge, I as selectSvgElement, e as configureSvgSize, bB as format, l as log, b7 as ordinal, bC as styles2String, d as select, b as setAccTitle, a as getAccTitle, p as setDiagramTitle, q as getDiagramTitle, g as getAccDescription, s as setAccDescription, G as defaultConfig_default, bD as isLabelStyle, z as clear } from "./index-3bI-dJm8.js";
2
+ import { s as setupViewPortForSVG } from "./chunk-2J33WTMH-Dzi-idRV.js";
3
+ import { p as populateCommonDb } from "./chunk-4BX2VUAB-DEyFpixF.js";
4
+ import { p as parse } from "./wardley-L42UT6IY-BiqfHMim.js";
7
5
  function count(node) {
8
6
  var sum = 0, children = node.children, i = children && children.length;
9
7
  if (!i) sum = 1;
@@ -1,7 +1,7 @@
1
- import { g as getDiagramElement } from "./chunk-55IACEB6-pFPEMTmI.js";
2
- import { s as setupViewPortForSVG } from "./chunk-EDXVE4YY-DRk838hn.js";
3
- import { _ as __name, b as setAccTitle, a as getAccTitle, s as setAccDescription, g as getAccDescription, p as setDiagramTitle, q as getDiagramTitle, c as getConfig2, l as log, z as clear, x as getEdgeId, B as rgba, C as __export, o as getRegisteredLayoutAlgorithm, r as render, d as select, u as utils_default } from "./index-D7Xi0GX5.js";
4
- import { c as channel } from "./channel-CqR4FAVX.js";
1
+ import { g as getDiagramElement } from "./chunk-55IACEB6-DyyQMIZa.js";
2
+ import { s as setupViewPortForSVG } from "./chunk-2J33WTMH-Dzi-idRV.js";
3
+ import { _ as __name, b as setAccTitle, a as getAccTitle, s as setAccDescription, g as getAccDescription, p as setDiagramTitle, q as getDiagramTitle, c as getConfig2, l as log, z as clear, x as getEdgeId, B as rgba, C as __export, o as getRegisteredLayoutAlgorithm, r as render, d as select, u as utils_default } from "./index-3bI-dJm8.js";
4
+ import { c as channel } from "./channel-DUdp1NJ7.js";
5
5
  var parser = (function() {
6
6
  var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
7
7
  for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
@@ -1,9 +1,9 @@
1
- import { g as getIconStyles } from "./chunk-FMBD7UC4-BagQdd5u.js";
2
- import { _ as __name, n as setConfig2, l as log, c as getConfig2, o as getRegisteredLayoutAlgorithm, r as render, u as utils_default, b as setAccTitle, s as setAccDescription, p as setDiagramTitle, a as getAccTitle, g as getAccDescription, q as getDiagramTitle, k as common_default, t as load, J as JSON_SCHEMA, v as isValidShape, x as getEdgeId, d as select, y as purify, z as clear, A as defaultConfig2, B as rgba } from "./index-D7Xi0GX5.js";
3
- import { c as createTooltip } from "./chunk-YZCP3GAM-BKZRTlUj.js";
4
- import { g as getDiagramElement } from "./chunk-55IACEB6-pFPEMTmI.js";
5
- import { s as setupViewPortForSVG } from "./chunk-EDXVE4YY-DRk838hn.js";
6
- import { c as channel } from "./channel-CqR4FAVX.js";
1
+ import { g as getIconStyles } from "./chunk-FMBD7UC4-CoPwvBCa.js";
2
+ import { _ as __name, n as setConfig2, l as log, c as getConfig2, o as getRegisteredLayoutAlgorithm, r as render, u as utils_default, b as setAccTitle, s as setAccDescription, p as setDiagramTitle, a as getAccTitle, g as getAccDescription, q as getDiagramTitle, k as common_default, t as load, J as JSON_SCHEMA, v as isValidShape, x as getEdgeId, d as select, y as purify, z as clear, A as defaultConfig2, B as rgba } from "./index-3bI-dJm8.js";
3
+ import { c as createTooltip } from "./chunk-ND2GUHAM-ku5t5SwP.js";
4
+ import { g as getDiagramElement } from "./chunk-55IACEB6-DyyQMIZa.js";
5
+ import { s as setupViewPortForSVG } from "./chunk-2J33WTMH-Dzi-idRV.js";
6
+ import { c as channel } from "./channel-DUdp1NJ7.js";
7
7
  var MERMAID_DOM_ID_PREFIX = "flowchart-";
8
8
  var FlowDB = class {
9
9
  // cspell:ignore funs