@loopstack/loopstack-studio 0.29.4 → 0.30.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 (114) hide show
  1. package/dist/_virtual/rolldown_runtime.js +3 -1
  2. package/dist/api/config.js +5 -4
  3. package/dist/api/environments.js +5 -1
  4. package/dist/api/processor.js +4 -1
  5. package/dist/app/EnvironmentEmbedRoot.js +22 -30
  6. package/dist/components/ai-elements/code-block.js +4 -4
  7. package/dist/components/dynamic-form/CodeContent.js +1 -1
  8. package/dist/components/dynamic-form/Form.js +31 -51
  9. package/dist/components/dynamic-form/FormBody.js +1 -1
  10. package/dist/components/motion/FadeIn.js +72 -0
  11. package/dist/components/motion/StreamingText.js +49 -0
  12. package/dist/components/ui/accordion.js +2 -2
  13. package/dist/components/ui-widgets/UiWidget.js +11 -10
  14. package/dist/components/ui-widgets/widgets/AiPromptInput.js +31 -28
  15. package/dist/events/sse-client-events.js +7 -1
  16. package/dist/features/code-explorer/components/FileContentViewer.js +2 -2
  17. package/dist/features/debug/components/WorkflowFlowViewer.js +49 -51
  18. package/dist/features/documents/DocumentRenderer.js +18 -17
  19. package/dist/features/documents/components/DocumentItem.js +42 -20
  20. package/dist/features/documents/components/DocumentList.js +34 -36
  21. package/dist/features/documents/components/DocumentMetadataPills.js +102 -49
  22. package/dist/features/documents/document-details/DocumentDetails.js +577 -377
  23. package/dist/features/documents/document-details/PromptDetails.js +118 -130
  24. package/dist/features/documents/document-details/document-debug-utils.js +100 -0
  25. package/dist/features/documents/renderers/ChoicesRenderer.js +41 -38
  26. package/dist/features/documents/renderers/ConfirmPromptRenderer.js +31 -28
  27. package/dist/features/documents/renderers/DocumentFormRenderer.js +62 -70
  28. package/dist/features/documents/renderers/LlmMessage.js +52 -47
  29. package/dist/features/documents/renderers/TextPromptRenderer.js +32 -29
  30. package/dist/features/documents/renderers/useDocumentTransition.js +4 -4
  31. package/dist/features/feature-registry/FeatureRegistryProvider.js +32 -10
  32. package/dist/features/feature-registry/available-features.js +12 -0
  33. package/dist/features/feature-registry/index.js +2 -1
  34. package/dist/features/file-explorer/components/FileExplorerPanel.js +55 -51
  35. package/dist/features/git/components/GitBranchBadge.js +31 -0
  36. package/dist/features/git/components/GitCommitList.js +46 -0
  37. package/dist/features/git/components/GitRemoteStatus.js +84 -0
  38. package/dist/features/git/components/WorkbenchGitPanel.js +81 -0
  39. package/dist/features/git/git-feature.js +12 -0
  40. package/dist/features/git/hooks/useGit.js +78 -0
  41. package/dist/features/git/index.js +1 -0
  42. package/dist/features/oauth/OAuthPromptRenderer.js +137 -142
  43. package/dist/features/runs/Runs.js +4 -4
  44. package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
  45. package/dist/features/secrets/renderers/SecretInputRenderer.js +30 -29
  46. package/dist/features/workbench/Workbench.js +25 -33
  47. package/dist/features/workbench/WorkflowItem.js +9 -9
  48. package/dist/features/workbench/WorkflowList.js +61 -62
  49. package/dist/features/workbench/components/NewRunDialog.js +237 -209
  50. package/dist/features/workbench/components/RecentRunItem.js +3 -3
  51. package/dist/features/workbench/components/WorkbenchEnvironmentPanel.js +8 -8
  52. package/dist/features/workbench/components/WorkbenchIconSidebar.js +1 -1
  53. package/dist/features/workbench/components/WorkbenchSidebarShell.js +3 -3
  54. package/dist/features/workbench/components/WorkflowForms.js +11 -10
  55. package/dist/features/workbench/components/WorkflowHistoryItem.js +16 -36
  56. package/dist/features/workbench/components/WorkflowHistoryList.js +19 -17
  57. package/dist/features/workbench/components/buttons/WorkflowButtons.js +3 -3
  58. package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +159 -0
  59. package/dist/features/workbench/hooks/useWorkflowData.js +58 -31
  60. package/dist/features/workbench/index.js +2 -2
  61. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +53 -53
  62. package/dist/features/workspaces/Workspaces.js +134 -125
  63. package/dist/features/workspaces/components/CreateWorkspace.js +115 -107
  64. package/dist/features/workspaces/components/ExecutionTimeline.js +2 -2
  65. package/dist/features/workspaces/components/WorkflowRunForm.js +127 -104
  66. package/dist/features/workspaces/components/WorkspaceHomePage.js +6 -89
  67. package/dist/features/workspaces/components/workflow-form/ArgumentsView.js +1 -1
  68. package/dist/features/workspaces/components/workflow-form/SelectionView.js +15 -15
  69. package/dist/hooks/index.js +3 -2
  70. package/dist/hooks/query-keys.js +43 -30
  71. package/dist/hooks/useConfig.js +28 -22
  72. package/dist/hooks/useEnvironments.js +27 -2
  73. package/dist/hooks/useProcessor.js +14 -1
  74. package/dist/hooks/useWorkflows.js +4 -4
  75. package/dist/index.d.ts +116 -15
  76. package/dist/index.js +9 -8
  77. package/dist/node_modules/d3/src/index.js +13 -13
  78. package/dist/node_modules/d3-scale/src/continuous.js +16 -16
  79. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-3BPJPVTR.js +43 -43
  80. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/blockDiagram-GPEHLZMM.js +270 -270
  81. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAUBKEIU.js +90 -90
  82. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-3OPIFGDE.js +458 -458
  83. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-55IACEB6.js +3 -3
  84. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5ZQYHXKU.js +37 -37
  85. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-727SXJPM.js +208 -208
  86. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-KSCS5N6A.js +145 -145
  87. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ND2GUHAM.js +7 -7
  88. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-O5CBEL6O.js +41 -41
  89. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-WU5MYG2G.js +3 -3
  90. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/cose-bilkent-S5V4N54A.js +6 -6
  91. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-KO2AKTUF.js +30 -30
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-OG6HWLK6.js +82 -82
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/erDiagram-TEJ5UH35.js +65 -65
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-I6XJVG4X.js +227 -227
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-6RSMTGT7.js +104 -104
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-PVQCEYII.js +104 -104
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/journeyDiagram-JHISSGLW.js +49 -49
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/quadrantDiagram-W4KKPZXB.js +101 -101
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sankeyDiagram-5OEKKPKP.js +20 -20
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-3UESZ5HK.js +354 -354
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-AJRCARHV.js +53 -53
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-PNZ67QCA.js +113 -113
  103. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-CIIHVFJN.js +90 -90
  104. package/dist/node_modules/mermaid/dist/mermaid.core.js +156 -156
  105. package/dist/node_modules/motion/dist/es/react.js +9 -2
  106. package/dist/pages/DebugWorkflowDetailsPage.js +2 -2
  107. package/dist/pages/DebugWorkflowsPage.js +76 -106
  108. package/dist/pages/EmbedWorkbenchPage.js +1 -1
  109. package/dist/pages/PreviewWorkbenchPage.js +6 -6
  110. package/dist/pages/WorkbenchPage.js +43 -47
  111. package/dist/pages/WorkflowDebugPage.js +6 -12
  112. package/dist/pages/WorkspacePage.js +40 -66
  113. package/dist/pages/WorkspaceRunsPage.js +24 -31
  114. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
+ import select_default from "../../../../d3-selection/src/select.js";
1
2
  import { __name, log } from "./chunk-AGHRB4JF.js";
2
3
  import { common_default, getConfig, hasKatex, renderKatexSanitized, sanitizeText } from "./chunk-CSCIHK7Q.js";
3
- import select_default from "../../../../d3-selection/src/select.js";
4
4
  import "../../../../d3/src/index.js";
5
5
  import { decodeEntities } from "./chunk-5ZQYHXKU.js";
6
6
  import { stringToIcon } from "../../../../@iconify/utils/lib/icon/name.js";
@@ -15,16 +15,16 @@ var unknownIcon = {
15
15
  height: 80,
16
16
  width: 80
17
17
  }, iconsStore = /* @__PURE__ */ new Map(), loaderStore = /* @__PURE__ */ new Map(), registerIconPacks = /* @__PURE__ */ __name((a) => {
18
- for (let A of a) {
19
- if (!A.name) throw Error("Invalid icon loader. Must have a \"name\" property with non-empty string value.");
20
- if (log.debug("Registering icon pack:", A.name), "loader" in A) loaderStore.set(A.name, A.loader);
21
- else if ("icons" in A) iconsStore.set(A.name, A.icons);
22
- else throw log.error("Invalid icon loader:", A), Error("Invalid icon loader. Must have either \"icons\" or \"loader\" property.");
18
+ for (let O of a) {
19
+ if (!O.name) throw Error("Invalid icon loader. Must have a \"name\" property with non-empty string value.");
20
+ if (log.debug("Registering icon pack:", O.name), "loader" in O) loaderStore.set(O.name, O.loader);
21
+ else if ("icons" in O) iconsStore.set(O.name, O.icons);
22
+ else throw log.error("Invalid icon loader:", O), Error("Invalid icon loader. Must have either \"icons\" or \"loader\" property.");
23
23
  }
24
- }, "registerIconPacks"), getRegisteredIconData = /* @__PURE__ */ __name(async (a, A) => {
25
- let j = stringToIcon(a, !0, A !== void 0);
24
+ }, "registerIconPacks"), getRegisteredIconData = /* @__PURE__ */ __name(async (a, O) => {
25
+ let j = stringToIcon(a, !0, O !== void 0);
26
26
  if (!j) throw Error(`Invalid icon name: ${a}`);
27
- let M = j.prefix || A;
27
+ let M = j.prefix || O;
28
28
  if (!M) throw Error(`Icon name must contain a prefix: ${a}`);
29
29
  let N = iconsStore.get(M);
30
30
  if (!N) {
@@ -48,17 +48,17 @@ var unknownIcon = {
48
48
  } catch {
49
49
  return !1;
50
50
  }
51
- }, "isIconAvailable"), getIconSVG = /* @__PURE__ */ __name(async (a, A, M) => {
51
+ }, "isIconAvailable"), getIconSVG = /* @__PURE__ */ __name(async (a, O, j) => {
52
52
  let N;
53
53
  try {
54
- N = await getRegisteredIconData(a, A?.fallbackPrefix);
54
+ N = await getRegisteredIconData(a, O?.fallbackPrefix);
55
55
  } catch (a) {
56
56
  log.error(a), N = unknownIcon;
57
57
  }
58
- let F = iconToSVG(N, A);
59
- return sanitizeText(iconToHTML(replaceIDs(F.body), {
60
- ...F.attributes,
61
- ...M
58
+ let P = iconToSVG(N, O);
59
+ return sanitizeText(iconToHTML(replaceIDs(P.body), {
60
+ ...P.attributes,
61
+ ...j
62
62
  }), getConfig());
63
63
  }, "getIconSVG");
64
64
  function preprocessMarkdown(a, { markdownAutoWrap: O }) {
@@ -72,8 +72,8 @@ function nonMarkdownToLines(a) {
72
72
  })) ?? []);
73
73
  }
74
74
  __name(nonMarkdownToLines, "nonMarkdownToLines");
75
- function markdownToLines(O, A = {}) {
76
- let j = preprocessMarkdown(O, A), M = k.lexer(j), N = [[]], P = 0;
75
+ function markdownToLines(a, A = {}) {
76
+ let j = preprocessMarkdown(a, A), M = k.lexer(j), N = [[]], P = 0;
77
77
  function F(a, O = "normal") {
78
78
  a.type === "text" ? a.text.split("\n").forEach((a, A) => {
79
79
  A !== 0 && (P++, N.push([])), a.split(" ").forEach((a) => {
@@ -106,8 +106,8 @@ function nonMarkdownToHTML(a) {
106
106
  return a ? `<p>${a.replace(/\\n|\n/g, "<br />")}</p>` : "";
107
107
  }
108
108
  __name(nonMarkdownToHTML, "nonMarkdownToHTML");
109
- function markdownToHTML(A, { markdownAutoWrap: j } = {}) {
110
- let M = k.lexer(A);
109
+ function markdownToHTML(a, { markdownAutoWrap: j } = {}) {
110
+ let M = k.lexer(a);
111
111
  function N(a) {
112
112
  return a.type === "text" ? j === !1 ? a.text.replace(/\n */g, "<br/>").replace(/ /g, "&nbsp;") : a.text.replace(/\n */g, "<br/>") : a.type === "strong" ? `<strong>${a.tokens?.map(N).join("")}</strong>` : a.type === "em" ? `<em>${a.tokens?.map(N).join("")}</em>` : a.type === "paragraph" ? `<p>${a.tokens?.map(N).join("")}</p>` : a.type === "space" ? "" : a.type === "html" ? `${a.text}` : a.type === "escape" ? a.text : (log.warn(`Unsupported markdown: ${a.type}`), a.raw);
113
113
  }
@@ -173,13 +173,13 @@ function applyStyle(a, O) {
173
173
  }
174
174
  __name(applyStyle, "applyStyle");
175
175
  var maxSafeSizeForWidth = 16384;
176
- async function addHtmlSpan(a, O, F, I, L = !1, R = getConfig()) {
176
+ async function addHtmlSpan(a, O, A, I, L = !1, R = getConfig()) {
177
177
  let z = a.append("foreignObject");
178
- z.attr("width", `${Math.min(10 * F, maxSafeSizeForWidth)}px`), z.attr("height", `${Math.min(10 * F, maxSafeSizeForWidth)}px`);
178
+ z.attr("width", `${Math.min(10 * A, maxSafeSizeForWidth)}px`), z.attr("height", `${Math.min(10 * A, maxSafeSizeForWidth)}px`);
179
179
  let B = z.append("xhtml:div"), V = hasKatex(O.label) ? await renderKatexSanitized(O.label.replace(common_default.lineBreakRegex, "\n"), R) : sanitizeText(O.label, R), H = O.isNode ? "nodeLabel" : "edgeLabel", U = B.append("span");
180
- U.html(V), applyStyle(U, O.labelStyle), U.attr("class", `${H} ${I}`), applyStyle(B, O.labelStyle), B.style("display", "table-cell"), B.style("white-space", "nowrap"), B.style("line-height", "1.5"), F !== Infinity && (B.style("max-width", F + "px"), B.style("text-align", "center")), B.attr("xmlns", "http://www.w3.org/1999/xhtml"), L && B.attr("class", "labelBkg");
180
+ U.html(V), applyStyle(U, O.labelStyle), U.attr("class", `${H} ${I}`), applyStyle(B, O.labelStyle), B.style("display", "table-cell"), B.style("white-space", "nowrap"), B.style("line-height", "1.5"), A !== Infinity && (B.style("max-width", A + "px"), B.style("text-align", "center")), B.attr("xmlns", "http://www.w3.org/1999/xhtml"), L && B.attr("class", "labelBkg");
181
181
  let W = B.node().getBoundingClientRect();
182
- return W.width === F && (B.style("display", "table"), B.style("white-space", "break-spaces"), B.style("width", F + "px"), W = B.node().getBoundingClientRect()), z.node();
182
+ return W.width === A && (B.style("display", "table"), B.style("white-space", "break-spaces"), B.style("width", A + "px"), W = B.node().getBoundingClientRect()), z.node();
183
183
  }
184
184
  __name(addHtmlSpan, "addHtmlSpan");
185
185
  function createTspan(a, O, A, j = !1) {
@@ -204,12 +204,12 @@ function computeDimensionOfText(a, O, A) {
204
204
  return N && j.remove(), N;
205
205
  }
206
206
  __name(computeDimensionOfText, "computeDimensionOfText");
207
- function createFormattedText(O, A, j, M = !1, N = !1) {
207
+ function createFormattedText(a, A, j, M = !1, N = !1) {
208
208
  let P = 1.1, F = A.append("g"), I = F.insert("rect").attr("class", "background").attr("style", "stroke: none"), L = F.append("text").attr("y", "-10.1");
209
209
  N && L.attr("text-anchor", "middle");
210
210
  let R = 0;
211
211
  for (let A of j) {
212
- let j = /* @__PURE__ */ __name((a) => computeWidthOfText(F, P, a) <= O, "checkWidth"), M = j(A) ? [A] : splitLineToFitWidth(A, j);
212
+ let j = /* @__PURE__ */ __name((O) => computeWidthOfText(F, P, O) <= a, "checkWidth"), M = j(A) ? [A] : splitLineToFitWidth(A, j);
213
213
  for (let a of M) updateTextContentAndStyles(createTspan(L, R, P, N), a), R++;
214
214
  }
215
215
  if (M) {
@@ -246,27 +246,27 @@ async function replaceIconSubstring(a, O = {}) {
246
246
  return a.replace(/(fa[bklrs]?):fa-([\w-]+)/g, () => j.shift() ?? "");
247
247
  }
248
248
  __name(replaceIconSubstring, "replaceIconSubstring");
249
- var createText = /* @__PURE__ */ __name(async (a, A = "", { style: j = "", isTitle: N = !1, classes: P = "", useHtmlLabels: L = !0, markdown: R = !0, isNode: z = !0, width: B = 200, addSvgBackground: V = !1 } = {}, H) => {
250
- if (log.debug("XYZ createText", A, j, N, P, L, z, "addSvgBackground: ", V), L) {
251
- let O = await replaceIconSubstring(decodeEntities(R ? markdownToHTML(A, H) : nonMarkdownToHTML(A)), H), N = A.replace(/\\\\/g, "\\");
252
- return await addHtmlSpan(a, {
249
+ var createText = /* @__PURE__ */ __name(async (O, j = "", { style: M = "", isTitle: P = !1, classes: F = "", useHtmlLabels: L = !0, markdown: R = !0, isNode: z = !0, width: B = 200, addSvgBackground: V = !1 } = {}, H) => {
250
+ if (log.debug("XYZ createText", j, M, P, F, L, z, "addSvgBackground: ", V), L) {
251
+ let a = await replaceIconSubstring(decodeEntities(R ? markdownToHTML(j, H) : nonMarkdownToHTML(j)), H), A = j.replace(/\\\\/g, "\\");
252
+ return await addHtmlSpan(O, {
253
253
  isNode: z,
254
- label: hasKatex(A) ? N : O,
255
- labelStyle: j.replace("fill:", "color:")
256
- }, B, P, V, H);
254
+ label: hasKatex(j) ? A : a,
255
+ labelStyle: M.replace("fill:", "color:")
256
+ }, B, F, V, H);
257
257
  } else {
258
- let O = decodeEntities(A.replace(/<br\s*\/?>/g, "<br/>")), M = createFormattedText(B, a, R ? markdownToLines(O.replace("<br>", "<br/>"), H) : nonMarkdownToLines(O), A ? V : !1, !z);
258
+ let A = decodeEntities(j.replace(/<br\s*\/?>/g, "<br/>")), N = createFormattedText(B, O, R ? markdownToLines(A.replace("<br>", "<br/>"), H) : nonMarkdownToLines(A), j ? V : !1, !z);
259
259
  if (z) {
260
- /stroke:/.exec(j) && (j = j.replace("stroke:", "lineColor:"));
261
- let a = j.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
262
- select_default(M).attr("style", a);
260
+ /stroke:/.exec(M) && (M = M.replace("stroke:", "lineColor:"));
261
+ let O = M.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
262
+ select_default(N).attr("style", O);
263
263
  } else {
264
- let a = j.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:");
265
- select_default(M).select("rect").attr("style", a.replace(/background:/g, "fill:"));
266
- let O = j.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
267
- select_default(M).select("text").attr("style", O);
264
+ let O = M.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:");
265
+ select_default(N).select("rect").attr("style", O.replace(/background:/g, "fill:"));
266
+ let A = M.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
267
+ select_default(N).select("text").attr("style", A);
268
268
  }
269
- return N ? select_default(M).selectAll("tspan.text-outer-tspan").classed("title-row", !0) : select_default(M).selectAll("tspan.text-outer-tspan").classed("row", !0), M;
269
+ return P ? select_default(N).selectAll("tspan.text-outer-tspan").classed("title-row", !0) : select_default(N).selectAll("tspan.text-outer-tspan").classed("row", !0), N;
270
270
  }
271
271
  }, "createText");
272
272
  export { computeDimensionOfText, createText, getIconSVG, registerIconPacks, unknownIcon };
@@ -1,9 +1,9 @@
1
+ import select_default from "../../../../d3-selection/src/select.js";
1
2
  import { __name } from "./chunk-AGHRB4JF.js";
2
3
  import { getConfig2 } from "./chunk-CSCIHK7Q.js";
3
- import select_default from "../../../../d3-selection/src/select.js";
4
4
  import "../../../../d3/src/index.js";
5
- var selectSvgElement = /* @__PURE__ */ __name((e) => {
5
+ var selectSvgElement = /* @__PURE__ */ __name((n) => {
6
6
  let { securityLevel: r } = getConfig2(), i = select_default("body");
7
- return r === "sandbox" && (i = select_default((select_default(`#i${e}`).node()?.contentDocument ?? document).body)), i.select(`#${e}`);
7
+ return r === "sandbox" && (i = select_default((select_default(`#i${n}`).node()?.contentDocument ?? document).body)), i.select(`#${n}`);
8
8
  }, "selectSvgElement");
9
9
  export { selectSvgElement };
@@ -1,6 +1,6 @@
1
1
  import { __toESM } from "../../../../../_virtual/rolldown_runtime.js";
2
- import { __name, log } from "./chunk-AGHRB4JF.js";
3
2
  import select_default from "../../../../d3-selection/src/select.js";
3
+ import { __name, log } from "./chunk-AGHRB4JF.js";
4
4
  import "../../../../d3/src/index.js";
5
5
  import { cytoscape } from "../../../../cytoscape/dist/cytoscape.esm.js";
6
6
  import { require_cytoscape_cose_bilkent } from "../../../../cytoscape-cose-bilkent/cytoscape-cose-bilkent.js";
@@ -57,7 +57,7 @@ function addEdges(e, n) {
57
57
  }
58
58
  __name(addEdges, "addEdges");
59
59
  function createCytoscapeInstance(e) {
60
- return new Promise((n) => {
60
+ return new Promise((r) => {
61
61
  let o = select_default("body").append("div").attr("id", "cy").attr("style", "display:none"), s = cytoscape({
62
62
  container: document.getElementById("cy"),
63
63
  style: [{
@@ -79,7 +79,7 @@ function createCytoscapeInstance(e) {
79
79
  styleEnabled: !1,
80
80
  animate: !1
81
81
  }).run(), s.ready((e) => {
82
- log.info("Cytoscape ready", e), n(s);
82
+ log.info("Cytoscape ready", e), r(s);
83
83
  });
84
84
  });
85
85
  }
@@ -124,9 +124,9 @@ async function executeCoseBilkentLayout(e, n) {
124
124
  log.debug("Starting cose-bilkent layout algorithm");
125
125
  try {
126
126
  validateLayoutData(e);
127
- let n = await createCytoscapeInstance(e), i = extractPositionedNodes(n), a = extractPositionedEdges(n);
128
- return log.debug(`Layout completed: ${i.length} nodes, ${a.length} edges`), {
129
- nodes: i,
127
+ let n = await createCytoscapeInstance(e), r = extractPositionedNodes(n), a = extractPositionedEdges(n);
128
+ return log.debug(`Layout completed: ${r.length} nodes, ${a.length} edges`), {
129
+ nodes: r,
130
130
  edges: a
131
131
  };
132
132
  } catch (e) {
@@ -1,6 +1,6 @@
1
+ import select_default from "../../../../d3-selection/src/select.js";
1
2
  import { __name, log } from "./chunk-AGHRB4JF.js";
2
3
  import { clear, defaultConfig_default, getAccDescription, getAccTitle, getConfig, getConfig2, getDiagramTitle, sanitizeText, setAccDescription, setAccTitle, setDiagramTitle, setupGraphViewbox2 } from "./chunk-CSCIHK7Q.js";
3
- import select_default from "../../../../d3-selection/src/select.js";
4
4
  import "../../../../d3/src/index.js";
5
5
  import { calculateTextDimensions, cleanAndMerge, wrapLabel } from "./chunk-5ZQYHXKU.js";
6
6
  import { isEmResetFrame } from "../../../../@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-NNHCCRGN.js";
@@ -22,10 +22,10 @@ var DEFAULT_EVENTMODELING_CONFIG = defaultConfig_default.eventmodeling, getConfi
22
22
  ...getConfig().eventmodeling
23
23
  }), "getConfig"), store = {};
24
24
  function getState() {
25
- let l = initial, { ast: z } = store, B = getDiagramProps();
26
- if (!z) throw Error("No data for EventModel");
27
- return z.frames.forEach((V, H) => {
28
- let U = calculateTextProps(V, z.dataEntities, B);
25
+ let l = initial, { ast: R } = store, B = getDiagramProps();
26
+ if (!R) throw Error("No data for EventModel");
27
+ return R.frames.forEach((V, H) => {
28
+ let U = calculateTextProps(V, R.dataEntities, B);
29
29
  l = dispatch(l, {
30
30
  $kind: PositionFrameKind,
31
31
  index: H,
@@ -33,7 +33,7 @@ function getState() {
33
33
  textProps: U
34
34
  });
35
35
  let W;
36
- hasSourceFrame(V) ? (log.debug("source frame", V.sourceFrames), W = z.frames.filter((l) => V.sourceFrames.some((R) => R.$refText === l.name)), W.forEach((R) => {
36
+ hasSourceFrame(V) ? (log.debug("source frame", V.sourceFrames), W = R.frames.filter((l) => V.sourceFrames.some((R) => R.$refText === l.name)), W.forEach((R) => {
37
37
  l = dispatch(l, {
38
38
  $kind: PositionRelationKind,
39
39
  index: H,
@@ -187,25 +187,25 @@ function calculateEntityVisualProps(l) {
187
187
  }
188
188
  }
189
189
  __name(calculateEntityVisualProps, "calculateEntityVisualProps");
190
- function calculateTextProps(l, z, B) {
191
- let V = getConfig(), H = sanitizeText(extractName(l.entityIdentifier) ?? "", V), W, G = {
190
+ function calculateTextProps(l, R, B) {
191
+ let V = getConfig(), H = sanitizeText(extractName(l.entityIdentifier) ?? "", V), U, G = {
192
192
  fontSize: 16,
193
193
  fontWeight: 700,
194
194
  fontFamily: "\"trebuchet ms\", verdana, arial, sans-serif",
195
195
  joinWith: "<br/>"
196
- }, q = `<b>${wrapLabel(H, B.textMaxWidth, G)}</b>`;
197
- if (l.dataInlineValue && (W = l.dataInlineValue, W = W.substring(W.indexOf("{") + 1), W = W.substring(0, W.lastIndexOf("}") - 1), W = sanitizeText(W, V), W = wrapLabel(W, B.textMaxWidth, G), W = W.replaceAll(" ", "&nbsp;")), l.dataReference) {
198
- let R = z.find((R) => R.name === l.dataReference?.$refText);
199
- R && (W = R.dataBlockValue, W = W.substring(W.indexOf("{\n") + 2), W = W.substring(0, W.lastIndexOf("}") - 1), W = sanitizeText(W, V), W = wrapLabel(W, B.textMaxWidth, G), W = W.replaceAll(" ", "&nbsp;"), W += "<br/>");
196
+ }, K = `<b>${wrapLabel(H, B.textMaxWidth, G)}</b>`;
197
+ if (l.dataInlineValue && (U = l.dataInlineValue, U = U.substring(U.indexOf("{") + 1), U = U.substring(0, U.lastIndexOf("}") - 1), U = sanitizeText(U, V), U = wrapLabel(U, B.textMaxWidth, G), U = U.replaceAll(" ", "&nbsp;")), l.dataReference) {
198
+ let z = R.find((R) => R.name === l.dataReference?.$refText);
199
+ z && (U = z.dataBlockValue, U = U.substring(U.indexOf("{\n") + 2), U = U.substring(0, U.lastIndexOf("}") - 1), U = sanitizeText(U, V), U = wrapLabel(U, B.textMaxWidth, G), U = U.replaceAll(" ", "&nbsp;"), U += "<br/>");
200
200
  }
201
- let J = W !== void 0;
202
- J && (q += `<br/><br/><code style="text-align: left; display: block;max-width:${B.textMaxWidth}px">${W}</code>`);
201
+ let J = U !== void 0;
202
+ J && (K += `<br/><br/><code style="text-align: left; display: block;max-width:${B.textMaxWidth}px">${U}</code>`);
203
203
  let Y = {
204
204
  fontSize: G.fontSize,
205
205
  fontWeight: G.fontWeight,
206
206
  fontFamily: G.fontFamily
207
- }, X = calculateTextDimensions(q, Y), Z = J ? X.width / 3 : X.width, $ = {
208
- content: q,
207
+ }, X = calculateTextDimensions(K, Y), Z = J ? X.width / 3 : X.width, $ = {
208
+ content: K,
209
209
  width: Z,
210
210
  height: X.height
211
211
  };
@@ -349,22 +349,22 @@ var deciders = {
349
349
  [FramePositionedKind]: evolveFramePositioned,
350
350
  [RelationPositionedKind]: evolveRelationPositioned
351
351
  };
352
- function decide(l, z) {
353
- let B = deciders[z.$kind];
352
+ function decide(l, R) {
353
+ let B = deciders[R.$kind];
354
354
  if (B == null) return [];
355
- let V = B(l, z);
355
+ let V = B(l, R);
356
356
  return log.debug("decided events", V), V;
357
357
  }
358
358
  __name(decide, "decide");
359
- function evolve(l, z) {
360
- let B = z.reduce((l, R) => {
359
+ function evolve(l, R) {
360
+ let B = R.reduce((l, R) => {
361
361
  let z = evolvers[R.$kind];
362
362
  return z == null ? l : z(l, R);
363
363
  }, l);
364
364
  return log.debug("evolve events", {
365
365
  state: l,
366
366
  newState: B,
367
- events: z
367
+ events: R
368
368
  }), B;
369
369
  }
370
370
  __name(evolve, "evolve");
@@ -387,8 +387,8 @@ var db = {
387
387
  getDiagramProps,
388
388
  getState
389
389
  }, parser = { parse: /* @__PURE__ */ __name(async (l) => {
390
- let z = await parse("eventmodeling", l);
391
- log.debug(z), db.setAst(z), populateCommonDb(z, db);
390
+ let R = await parse("eventmodeling", l);
391
+ log.debug(R), db.setAst(R), populateCommonDb(R, db);
392
392
  }, "parse") }, DEFAULT_EVENTMODELING_CONFIG2 = getConfig2()?.eventmodeling;
393
393
  function renderD3Box(l, R) {
394
394
  return (z) => {
@@ -401,9 +401,9 @@ function dirUpwards(l, R) {
401
401
  return l > R;
402
402
  }
403
403
  __name(dirUpwards, "dirUpwards");
404
- function renderD3Relation(l, z, B, V) {
404
+ function renderD3Relation(l, R, B, V) {
405
405
  return (H) => {
406
- let U = H.sourceBox.swimlane.y + z.swimlanePadding, W = H.targetBox.swimlane.y + z.swimlanePadding, G = dirUpwards(U, W), K = H.sourceBox.x + H.sourceBox.dimension.width * 2 / 3, q = H.targetBox.x + H.targetBox.dimension.width / 3, J, Y;
406
+ let U = H.sourceBox.swimlane.y + R.swimlanePadding, W = H.targetBox.swimlane.y + R.swimlanePadding, G = dirUpwards(U, W), K = H.sourceBox.x + H.sourceBox.dimension.width * 2 / 3, q = H.targetBox.x + H.targetBox.dimension.width / 3, J, Y;
407
407
  log.debug(`rendering relation up=${G} for `, {
408
408
  sourceBox: H.sourceBox,
409
409
  targetBox: H.targetBox
@@ -423,10 +423,10 @@ __name(renderD3Swimlane, "renderD3Swimlane");
423
423
  var diagram = {
424
424
  parser,
425
425
  db,
426
- renderer: { draw: /* @__PURE__ */ __name(function(l, z, B, V) {
427
- if (log.debug("in eventmodeling renderer", l + "\n", "id:", z, B), !DEFAULT_EVENTMODELING_CONFIG2) throw Error("EventModeling config not found");
428
- let H = V.db, { themeVariables: U, eventmodeling: G } = getConfig2(), K = select_default(`[id="${z}"]`), q = H.getDiagramProps(), J = H.getState(), Y = `em-arrowhead-${z}`, Q = U.emArrowhead ?? "#000000";
429
- J.sortedSwimlanesArray.forEach(renderD3Swimlane(K, J.maxR, q, U)), J.boxes.forEach(renderD3Box(K, q)), J.relations.forEach(renderD3Relation(K, q, Y, U)), K.append("defs").append("marker").attr("id", Y).attr("markerWidth", "10").attr("markerHeight", "7").attr("refX", "10").attr("refY", "3.5").attr("orient", "auto").append("polygon").attr("points", "0 0, 10 3.5, 0 7").attr("fill", Q), setupGraphViewbox2(void 0, K, G?.padding ?? 30, G?.useMaxWidth);
426
+ renderer: { draw: /* @__PURE__ */ __name(function(R, B, V, H) {
427
+ if (log.debug("in eventmodeling renderer", R + "\n", "id:", B, V), !DEFAULT_EVENTMODELING_CONFIG2) throw Error("EventModeling config not found");
428
+ let U = H.db, { themeVariables: W, eventmodeling: K } = getConfig2(), q = select_default(`[id="${B}"]`), J = U.getDiagramProps(), Y = U.getState(), X = `em-arrowhead-${B}`, Q = W.emArrowhead ?? "#000000";
429
+ Y.sortedSwimlanesArray.forEach(renderD3Swimlane(q, Y.maxR, J, W)), Y.boxes.forEach(renderD3Box(q, J)), Y.relations.forEach(renderD3Relation(q, J, X, W)), q.append("defs").append("marker").attr("id", X).attr("markerWidth", "10").attr("markerHeight", "7").attr("refX", "10").attr("refY", "3.5").attr("orient", "auto").append("polygon").attr("points", "0 0, 10 3.5, 0 7").attr("fill", Q), setupGraphViewbox2(void 0, q, K?.padding ?? 30, K?.useMaxWidth);
430
430
  }, "draw") },
431
431
  styles: /* @__PURE__ */ __name((l) => "", "getStyles")
432
432
  };