@goplasmatic/dataflow-ui 2.0.6 → 2.0.8

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.
package/dist/index.js CHANGED
@@ -205,6 +205,17 @@ const CircleCheckBig = createLucideIcon("CircleCheckBig", [
205
205
  ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
206
206
  ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
207
207
  ]);
208
+ /**
209
+ * @license lucide-react v0.462.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */
214
+ const CircleX = createLucideIcon("CircleX", [
215
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
216
+ ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
217
+ ["path", { d: "m9 9 6 6", key: "z0biqf" }]
218
+ ]);
208
219
  /**
209
220
  * @license lucide-react v0.462.0 - ISC
210
221
  *
@@ -311,6 +322,15 @@ const ListTree = createLucideIcon("ListTree", [
311
322
  ["path", { d: "M3 6v4c0 1.1.9 2 2 2h3", key: "1ywdgy" }],
312
323
  ["path", { d: "M3 10v6c0 1.1.9 2 2 2h3", key: "2wc746" }]
313
324
  ]);
325
+ /**
326
+ * @license lucide-react v0.462.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */
331
+ const LoaderCircle = createLucideIcon("LoaderCircle", [
332
+ ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
333
+ ]);
314
334
  /**
315
335
  * @license lucide-react v0.462.0 - ISC
316
336
  *
@@ -11068,7 +11088,7 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
11068
11088
  }
11069
11089
  ]
11070
11090
  ];
11071
- const CircleX = createLucideIcon2("circle-x", __iconNode$l);
11091
+ const CircleX2 = createLucideIcon2("circle-x", __iconNode$l);
11072
11092
  const __iconNode$k = [
11073
11093
  [
11074
11094
  "path",
@@ -11696,7 +11716,7 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
11696
11716
  "database": Database,
11697
11717
  "boxes": Boxes,
11698
11718
  "circle-help": CircleQuestionMark,
11699
- "circle-x": CircleX,
11719
+ "circle-x": CircleX2,
11700
11720
  "git-commit-horizontal": GitCommitHorizontal,
11701
11721
  "search": Search2,
11702
11722
  "divide": Divide,
@@ -19753,7 +19773,7 @@ function WorkflowFlowView({
19753
19773
  }
19754
19774
  function DataLogicView({ value }) {
19755
19775
  const { resolvedTheme } = useTheme();
19756
- return /* @__PURE__ */ jsx("div", { className: "df-details-content", children: /* @__PURE__ */ jsx("div", { className: "df-details-logic-editor", children: /* @__PURE__ */ jsx(
19776
+ return /* @__PURE__ */ jsx("div", { className: "df-details-content", children: /* @__PURE__ */ jsx("div", { className: "df-details-logic-editor", "data-theme": resolvedTheme, children: /* @__PURE__ */ jsx(
19757
19777
  DataLogicEditor,
19758
19778
  {
19759
19779
  value,
@@ -20423,1854 +20443,2124 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
20423
20443
  }
20424
20444
  ) });
20425
20445
  }
20426
- function SearchInput({
20427
- value,
20428
- onChange,
20429
- onClear,
20430
- placeholder = "Search...",
20431
- className = ""
20432
- }) {
20433
- return /* @__PURE__ */ jsxs("div", { className: `df-search-input ${className}`, children: [
20434
- /* @__PURE__ */ jsx(Search, { className: "df-search-icon", size: 16 }),
20435
- /* @__PURE__ */ jsx(
20436
- "input",
20437
- {
20438
- type: "text",
20439
- value,
20440
- onChange: (e) => onChange(e.target.value),
20441
- placeholder,
20442
- className: "df-search-field"
20446
+ function DebuggerControls({ compact = false, className = "" }) {
20447
+ const {
20448
+ state,
20449
+ play,
20450
+ pause,
20451
+ stop,
20452
+ reset,
20453
+ stepForward,
20454
+ stepBackward,
20455
+ setSpeed,
20456
+ isAtStart,
20457
+ isAtEnd,
20458
+ hasTrace,
20459
+ progress,
20460
+ totalSteps
20461
+ } = useDebugger();
20462
+ const { playbackState, playbackSpeed, currentStepIndex, isExecuting } = state;
20463
+ const handleKeyDown = useCallback(
20464
+ (e) => {
20465
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
20466
+ return;
20443
20467
  }
20444
- ),
20445
- value && onClear && /* @__PURE__ */ jsx(
20446
- "button",
20447
- {
20448
- onClick: onClear,
20449
- className: "df-search-clear",
20450
- "aria-label": "Clear search",
20451
- children: /* @__PURE__ */ jsx(X, { size: 14 })
20468
+ switch (e.key) {
20469
+ case " ":
20470
+ e.preventDefault();
20471
+ if (playbackState === "playing") {
20472
+ pause();
20473
+ } else if (hasTrace) {
20474
+ play();
20475
+ }
20476
+ break;
20477
+ case "ArrowRight":
20478
+ e.preventDefault();
20479
+ if (hasTrace && !isAtEnd) {
20480
+ stepForward();
20481
+ }
20482
+ break;
20483
+ case "ArrowLeft":
20484
+ e.preventDefault();
20485
+ if (hasTrace && !isAtStart) {
20486
+ stepBackward();
20487
+ }
20488
+ break;
20489
+ case "Escape":
20490
+ e.preventDefault();
20491
+ stop();
20492
+ break;
20493
+ case "r":
20494
+ if (e.metaKey || e.ctrlKey) {
20495
+ e.preventDefault();
20496
+ reset();
20497
+ }
20498
+ break;
20452
20499
  }
20453
- )
20500
+ },
20501
+ [playbackState, hasTrace, isAtEnd, isAtStart, play, pause, stop, stepForward, stepBackward, reset]
20502
+ );
20503
+ useEffect(() => {
20504
+ window.addEventListener("keydown", handleKeyDown);
20505
+ return () => window.removeEventListener("keydown", handleKeyDown);
20506
+ }, [handleKeyDown]);
20507
+ const handleSpeedChange = (e) => {
20508
+ setSpeed(Number(e.target.value));
20509
+ };
20510
+ if (compact) {
20511
+ return /* @__PURE__ */ jsxs("div", { className: `df-debug-controls df-debug-controls-compact ${className}`, children: [
20512
+ /* @__PURE__ */ jsx(
20513
+ "button",
20514
+ {
20515
+ className: "df-debug-btn",
20516
+ onClick: stepBackward,
20517
+ disabled: !hasTrace || isAtStart || isExecuting,
20518
+ title: "Previous step (Left Arrow)",
20519
+ children: /* @__PURE__ */ jsx(SkipBack, { size: 16 })
20520
+ }
20521
+ ),
20522
+ playbackState === "playing" ? /* @__PURE__ */ jsx(
20523
+ "button",
20524
+ {
20525
+ className: "df-debug-btn df-debug-btn-primary",
20526
+ onClick: pause,
20527
+ disabled: !hasTrace || isExecuting,
20528
+ title: "Pause (Space)",
20529
+ children: /* @__PURE__ */ jsx(Pause, { size: 18 })
20530
+ }
20531
+ ) : /* @__PURE__ */ jsx(
20532
+ "button",
20533
+ {
20534
+ className: "df-debug-btn df-debug-btn-primary",
20535
+ onClick: play,
20536
+ disabled: !hasTrace || isAtEnd || isExecuting,
20537
+ title: "Play (Space)",
20538
+ children: /* @__PURE__ */ jsx(Play, { size: 18 })
20539
+ }
20540
+ ),
20541
+ /* @__PURE__ */ jsx(
20542
+ "button",
20543
+ {
20544
+ className: "df-debug-btn",
20545
+ onClick: stepForward,
20546
+ disabled: !hasTrace || isAtEnd || isExecuting,
20547
+ title: "Next step (Right Arrow)",
20548
+ children: /* @__PURE__ */ jsx(SkipForward, { size: 16 })
20549
+ }
20550
+ ),
20551
+ /* @__PURE__ */ jsxs("span", { className: "df-debug-step-counter", children: [
20552
+ currentStepIndex + 1,
20553
+ " / ",
20554
+ totalSteps
20555
+ ] })
20556
+ ] });
20557
+ }
20558
+ return /* @__PURE__ */ jsxs("div", { className: `df-debug-controls ${className}`, children: [
20559
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-controls-main", children: [
20560
+ /* @__PURE__ */ jsx(
20561
+ "button",
20562
+ {
20563
+ className: "df-debug-btn",
20564
+ onClick: stop,
20565
+ disabled: !hasTrace || isExecuting,
20566
+ title: "Stop (Escape)",
20567
+ children: /* @__PURE__ */ jsx(Square, { size: 20 })
20568
+ }
20569
+ ),
20570
+ /* @__PURE__ */ jsx(
20571
+ "button",
20572
+ {
20573
+ className: "df-debug-btn",
20574
+ onClick: stepBackward,
20575
+ disabled: !hasTrace || isAtStart || isExecuting,
20576
+ title: "Previous step (Left Arrow)",
20577
+ children: /* @__PURE__ */ jsx(SkipBack, { size: 20 })
20578
+ }
20579
+ ),
20580
+ playbackState === "playing" ? /* @__PURE__ */ jsx(
20581
+ "button",
20582
+ {
20583
+ className: "df-debug-btn df-debug-btn-primary",
20584
+ onClick: pause,
20585
+ disabled: !hasTrace || isExecuting,
20586
+ title: "Pause (Space)",
20587
+ children: /* @__PURE__ */ jsx(Pause, { size: 24 })
20588
+ }
20589
+ ) : /* @__PURE__ */ jsx(
20590
+ "button",
20591
+ {
20592
+ className: "df-debug-btn df-debug-btn-primary",
20593
+ onClick: play,
20594
+ disabled: !hasTrace || isAtEnd || isExecuting,
20595
+ title: "Play (Space)",
20596
+ children: /* @__PURE__ */ jsx(Play, { size: 24 })
20597
+ }
20598
+ ),
20599
+ /* @__PURE__ */ jsx(
20600
+ "button",
20601
+ {
20602
+ className: "df-debug-btn",
20603
+ onClick: stepForward,
20604
+ disabled: !hasTrace || isAtEnd || isExecuting,
20605
+ title: "Next step (Right Arrow)",
20606
+ children: /* @__PURE__ */ jsx(SkipForward, { size: 20 })
20607
+ }
20608
+ ),
20609
+ /* @__PURE__ */ jsx(
20610
+ "button",
20611
+ {
20612
+ className: "df-debug-btn",
20613
+ onClick: reset,
20614
+ disabled: !hasTrace || isExecuting,
20615
+ title: "Reset (Ctrl+R)",
20616
+ children: /* @__PURE__ */ jsx(RotateCcw, { size: 20 })
20617
+ }
20618
+ )
20619
+ ] }),
20620
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-progress", children: [
20621
+ /* @__PURE__ */ jsx("div", { className: "df-debug-progress-bar", children: /* @__PURE__ */ jsx(
20622
+ "div",
20623
+ {
20624
+ className: "df-debug-progress-fill",
20625
+ style: { width: `${progress * 100}%` }
20626
+ }
20627
+ ) }),
20628
+ /* @__PURE__ */ jsxs("span", { className: "df-debug-step-counter", children: [
20629
+ "Step ",
20630
+ currentStepIndex + 1,
20631
+ " of ",
20632
+ totalSteps
20633
+ ] })
20634
+ ] }),
20635
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-speed", children: [
20636
+ /* @__PURE__ */ jsx(Gauge, { size: 14 }),
20637
+ /* @__PURE__ */ jsx(
20638
+ "input",
20639
+ {
20640
+ type: "range",
20641
+ min: "100",
20642
+ max: "2000",
20643
+ step: "100",
20644
+ value: playbackSpeed,
20645
+ onChange: handleSpeedChange,
20646
+ className: "df-debug-speed-slider",
20647
+ title: `Playback speed: ${playbackSpeed}ms`
20648
+ }
20649
+ ),
20650
+ /* @__PURE__ */ jsxs("span", { className: "df-debug-speed-label", children: [
20651
+ playbackSpeed,
20652
+ "ms"
20653
+ ] })
20654
+ ] })
20454
20655
  ] });
20455
20656
  }
20456
- function JsonViewer({
20457
- data,
20458
- initialExpanded = false,
20459
- maxStringLength = 50,
20657
+ function MessageInputPanel({
20658
+ onExecute,
20659
+ isExecuting = false,
20460
20660
  className = ""
20461
20661
  }) {
20462
- return /* @__PURE__ */ jsx("div", { className: `df-json-viewer ${className}`, children: /* @__PURE__ */ jsx(
20463
- JsonNode,
20464
- {
20465
- data,
20466
- initialExpanded,
20467
- maxStringLength
20468
- }
20469
- ) });
20470
- }
20471
- function JsonNode({
20472
- data,
20473
- initialExpanded,
20474
- maxStringLength,
20475
- keyName,
20476
- isLast = true
20477
- }) {
20478
- const [expanded, setExpanded] = useState(initialExpanded);
20479
- const renderValue = () => {
20480
- if (data === null) {
20481
- return /* @__PURE__ */ jsx("span", { className: "df-json-null", children: "null" });
20482
- }
20483
- if (data === void 0) {
20484
- return /* @__PURE__ */ jsx("span", { className: "df-json-undefined", children: "undefined" });
20485
- }
20486
- if (typeof data === "boolean") {
20487
- return /* @__PURE__ */ jsx("span", { className: "df-json-boolean", children: data.toString() });
20488
- }
20489
- if (typeof data === "number") {
20490
- return /* @__PURE__ */ jsx("span", { className: "df-json-number", children: data });
20662
+ const { setInputPayload, state } = useDebugger();
20663
+ const { inputPayload } = state;
20664
+ const [expandedSections, setExpandedSections] = useState(
20665
+ /* @__PURE__ */ new Set(["payload"])
20666
+ );
20667
+ const [editingSection, setEditingSection] = useState(null);
20668
+ const [editText, setEditText] = useState("");
20669
+ const [parseError, setParseError] = useState(null);
20670
+ const payload = inputPayload || {};
20671
+ const toggleSection = (section) => {
20672
+ setExpandedSections((prev) => {
20673
+ const next = new Set(prev);
20674
+ if (next.has(section)) {
20675
+ next.delete(section);
20676
+ } else {
20677
+ next.add(section);
20678
+ }
20679
+ return next;
20680
+ });
20681
+ };
20682
+ const startEditing = () => {
20683
+ setEditingSection("payload");
20684
+ setEditText(JSON.stringify(payload, null, 2));
20685
+ setParseError(null);
20686
+ };
20687
+ const cancelEditing = () => {
20688
+ setEditingSection(null);
20689
+ setEditText("");
20690
+ setParseError(null);
20691
+ };
20692
+ const saveEditing = useCallback(() => {
20693
+ if (!editingSection) return;
20694
+ try {
20695
+ const parsed = JSON.parse(editText);
20696
+ setInputPayload(parsed);
20697
+ setEditingSection(null);
20698
+ setEditText("");
20699
+ setParseError(null);
20700
+ } catch (err) {
20701
+ setParseError(err instanceof Error ? err.message : "Invalid JSON");
20491
20702
  }
20492
- if (typeof data === "string") {
20493
- const display = data.length > maxStringLength ? `${data.slice(0, maxStringLength)}...` : data;
20494
- return /* @__PURE__ */ jsxs("span", { className: "df-json-string", children: [
20495
- '"',
20496
- display,
20497
- '"'
20498
- ] });
20703
+ }, [editingSection, editText, setInputPayload]);
20704
+ const handleLoadSample = () => {
20705
+ setInputPayload({
20706
+ id: "123",
20707
+ name: "John Doe",
20708
+ email: "john@example.com",
20709
+ amount: 100
20710
+ });
20711
+ };
20712
+ const handleClear = () => {
20713
+ setInputPayload({});
20714
+ };
20715
+ const formatValue2 = (value) => {
20716
+ if (Object.keys(value).length === 0) {
20717
+ return "(empty)";
20499
20718
  }
20500
- if (Array.isArray(data)) {
20501
- if (data.length === 0) {
20502
- return /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "[]" });
20503
- }
20504
- return /* @__PURE__ */ jsxs("span", { className: "df-json-array", children: [
20505
- /* @__PURE__ */ jsx(
20719
+ return JSON.stringify(value, null, 2);
20720
+ };
20721
+ const isEmptyPayload = Object.keys(payload).length === 0;
20722
+ const isExpanded = expandedSections.has("payload");
20723
+ const isEditing = editingSection === "payload";
20724
+ return /* @__PURE__ */ jsxs("div", { className: `df-debug-input-panel ${className}`, children: [
20725
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-input-header", children: [
20726
+ /* @__PURE__ */ jsx("span", { className: "df-debug-input-title", children: "Test Payload" }),
20727
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-input-actions", children: [
20728
+ /* @__PURE__ */ jsxs(
20506
20729
  "button",
20507
20730
  {
20508
- onClick: () => setExpanded(!expanded),
20509
- className: "df-json-toggle",
20510
- children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 12 })
20731
+ className: "df-debug-btn-sm",
20732
+ onClick: handleLoadSample,
20733
+ title: "Load sample data",
20734
+ children: [
20735
+ /* @__PURE__ */ jsx(FileJson, { size: 12 }),
20736
+ "Sample"
20737
+ ]
20511
20738
  }
20512
20739
  ),
20513
- /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "[" }),
20514
- !expanded && /* @__PURE__ */ jsxs("span", { className: "df-json-preview", children: [
20515
- data.length,
20516
- " item",
20517
- data.length !== 1 ? "s" : ""
20518
- ] }),
20519
- expanded && /* @__PURE__ */ jsx("div", { className: "df-json-children", children: data.map((item, index2) => /* @__PURE__ */ jsx(
20520
- JsonNode,
20740
+ /* @__PURE__ */ jsxs(
20741
+ "button",
20521
20742
  {
20522
- data: item,
20523
- initialExpanded: false,
20524
- maxStringLength,
20525
- isLast: index2 === data.length - 1
20526
- },
20527
- index2
20528
- )) }),
20529
- /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "]" })
20530
- ] });
20531
- }
20532
- if (typeof data === "object") {
20533
- const entries = Object.entries(data);
20534
- if (entries.length === 0) {
20535
- return /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "{}" });
20536
- }
20537
- return /* @__PURE__ */ jsxs("span", { className: "df-json-object", children: [
20743
+ className: "df-debug-btn-sm",
20744
+ onClick: handleClear,
20745
+ title: "Clear all data",
20746
+ children: [
20747
+ /* @__PURE__ */ jsx(RefreshCw, { size: 12 }),
20748
+ "Clear"
20749
+ ]
20750
+ }
20751
+ )
20752
+ ] })
20753
+ ] }),
20754
+ /* @__PURE__ */ jsx("div", { className: "df-debug-input-sections", children: /* @__PURE__ */ jsxs("div", { className: "df-debug-input-section", children: [
20755
+ /* @__PURE__ */ jsxs(
20756
+ "div",
20757
+ {
20758
+ className: "df-debug-input-section-header",
20759
+ onClick: () => !isEditing && toggleSection("payload"),
20760
+ children: [
20761
+ /* @__PURE__ */ jsx("span", { className: "df-debug-section-toggle", children: isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 14 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14 }) }),
20762
+ /* @__PURE__ */ jsx("span", { className: "df-debug-section-label", children: "Payload" }),
20763
+ isEmptyPayload && /* @__PURE__ */ jsx("span", { className: "df-debug-section-empty", children: "(empty)" }),
20764
+ !isEditing && /* @__PURE__ */ jsx(
20765
+ "button",
20766
+ {
20767
+ className: "df-debug-section-edit",
20768
+ onClick: (e) => {
20769
+ e.stopPropagation();
20770
+ startEditing();
20771
+ },
20772
+ title: "Edit Payload",
20773
+ children: "Edit"
20774
+ }
20775
+ )
20776
+ ]
20777
+ }
20778
+ ),
20779
+ isExpanded && /* @__PURE__ */ jsx("div", { className: "df-debug-input-section-content", children: isEditing ? /* @__PURE__ */ jsxs("div", { className: "df-debug-input-editor", children: [
20538
20780
  /* @__PURE__ */ jsx(
20539
- "button",
20781
+ "textarea",
20540
20782
  {
20541
- onClick: () => setExpanded(!expanded),
20542
- className: "df-json-toggle",
20543
- children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 12 })
20783
+ className: "df-debug-input-textarea",
20784
+ value: editText,
20785
+ onChange: (e) => setEditText(e.target.value),
20786
+ placeholder: "Enter payload as JSON...",
20787
+ spellCheck: false
20544
20788
  }
20545
20789
  ),
20546
- /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "{" }),
20547
- !expanded && /* @__PURE__ */ jsxs("span", { className: "df-json-preview", children: [
20548
- entries.length,
20549
- " key",
20550
- entries.length !== 1 ? "s" : ""
20551
- ] }),
20552
- expanded && /* @__PURE__ */ jsx("div", { className: "df-json-children", children: entries.map(([key, value], index2) => /* @__PURE__ */ jsx(
20553
- JsonNode,
20554
- {
20555
- keyName: key,
20556
- data: value,
20557
- initialExpanded: false,
20558
- maxStringLength,
20559
- isLast: index2 === entries.length - 1
20560
- },
20561
- key
20562
- )) }),
20563
- /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "}" })
20564
- ] });
20565
- }
20566
- return /* @__PURE__ */ jsx("span", { children: String(data) });
20567
- };
20568
- return /* @__PURE__ */ jsxs("div", { className: "df-json-node", children: [
20569
- keyName !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
20570
- /* @__PURE__ */ jsxs("span", { className: "df-json-key", children: [
20571
- '"',
20572
- keyName,
20573
- '"'
20574
- ] }),
20575
- /* @__PURE__ */ jsx("span", { className: "df-json-colon", children: ": " })
20576
- ] }),
20577
- renderValue(),
20578
- !isLast && /* @__PURE__ */ jsx("span", { className: "df-json-comma", children: "," })
20579
- ] });
20580
- }
20581
- function _arrayLikeToArray(r, a) {
20582
- (null == a || a > r.length) && (a = r.length);
20583
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
20584
- return n;
20585
- }
20586
- function _arrayWithHoles(r) {
20587
- if (Array.isArray(r)) return r;
20588
- }
20589
- function _defineProperty$1(e, r, t) {
20590
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
20591
- value: t,
20592
- enumerable: true,
20593
- configurable: true,
20594
- writable: true
20595
- }) : e[r] = t, e;
20596
- }
20597
- function _iterableToArrayLimit(r, l2) {
20598
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
20599
- if (null != t) {
20600
- var e, n, i, u, a = [], f = true, o = false;
20601
- try {
20602
- if (i = (t = t.call(r)).next, 0 === l2) ;
20603
- else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f = true) ;
20604
- } catch (r2) {
20605
- o = true, n = r2;
20606
- } finally {
20607
- try {
20608
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
20609
- } finally {
20610
- if (o) throw n;
20611
- }
20612
- }
20613
- return a;
20614
- }
20615
- }
20616
- function _nonIterableRest() {
20617
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20618
- }
20619
- function ownKeys$1(e, r) {
20620
- var t = Object.keys(e);
20621
- if (Object.getOwnPropertySymbols) {
20622
- var o = Object.getOwnPropertySymbols(e);
20623
- r && (o = o.filter(function(r2) {
20624
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
20625
- })), t.push.apply(t, o);
20626
- }
20627
- return t;
20628
- }
20629
- function _objectSpread2$1(e) {
20630
- for (var r = 1; r < arguments.length; r++) {
20631
- var t = null != arguments[r] ? arguments[r] : {};
20632
- r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) {
20633
- _defineProperty$1(e, r2, t[r2]);
20634
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) {
20635
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
20636
- });
20637
- }
20638
- return e;
20639
- }
20640
- function _objectWithoutProperties(e, t) {
20641
- if (null == e) return {};
20642
- var o, r, i = _objectWithoutPropertiesLoose(e, t);
20643
- if (Object.getOwnPropertySymbols) {
20644
- var n = Object.getOwnPropertySymbols(e);
20645
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
20646
- }
20647
- return i;
20648
- }
20649
- function _objectWithoutPropertiesLoose(r, e) {
20650
- if (null == r) return {};
20651
- var t = {};
20652
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
20653
- if (-1 !== e.indexOf(n)) continue;
20654
- t[n] = r[n];
20655
- }
20656
- return t;
20657
- }
20658
- function _slicedToArray(r, e) {
20659
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
20660
- }
20661
- function _toPrimitive(t, r) {
20662
- if ("object" != typeof t || !t) return t;
20663
- var e = t[Symbol.toPrimitive];
20664
- if (void 0 !== e) {
20665
- var i = e.call(t, r);
20666
- if ("object" != typeof i) return i;
20667
- throw new TypeError("@@toPrimitive must return a primitive value.");
20668
- }
20669
- return ("string" === r ? String : Number)(t);
20670
- }
20671
- function _toPropertyKey(t) {
20672
- var i = _toPrimitive(t, "string");
20673
- return "symbol" == typeof i ? i : i + "";
20674
- }
20675
- function _unsupportedIterableToArray(r, a) {
20676
- if (r) {
20677
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
20678
- var t = {}.toString.call(r).slice(8, -1);
20679
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
20680
- }
20790
+ parseError && /* @__PURE__ */ jsx("div", { className: "df-debug-input-error", children: parseError }),
20791
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-input-editor-actions", children: [
20792
+ /* @__PURE__ */ jsx(
20793
+ "button",
20794
+ {
20795
+ className: "df-debug-btn-sm df-debug-btn-cancel",
20796
+ onClick: cancelEditing,
20797
+ children: "Cancel"
20798
+ }
20799
+ ),
20800
+ /* @__PURE__ */ jsx(
20801
+ "button",
20802
+ {
20803
+ className: "df-debug-btn-sm df-debug-btn-save",
20804
+ onClick: saveEditing,
20805
+ children: "Save"
20806
+ }
20807
+ )
20808
+ ] })
20809
+ ] }) : /* @__PURE__ */ jsx("pre", { className: "df-debug-input-preview", children: formatValue2(payload) }) })
20810
+ ] }) }),
20811
+ /* @__PURE__ */ jsx("div", { className: "df-debug-input-footer", children: /* @__PURE__ */ jsx(
20812
+ "button",
20813
+ {
20814
+ className: "df-debug-run-btn",
20815
+ onClick: onExecute,
20816
+ disabled: isExecuting,
20817
+ children: isExecuting ? /* @__PURE__ */ jsxs(Fragment, { children: [
20818
+ /* @__PURE__ */ jsx(RefreshCw, { size: 14, className: "df-debug-spin" }),
20819
+ "Executing..."
20820
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
20821
+ /* @__PURE__ */ jsx(Play, { size: 14 }),
20822
+ "Run Debug"
20823
+ ] })
20824
+ }
20825
+ ) })
20826
+ ] });
20681
20827
  }
20682
- function _defineProperty(obj, key, value) {
20683
- if (key in obj) {
20684
- Object.defineProperty(obj, key, {
20685
- value,
20686
- enumerable: true,
20687
- configurable: true,
20688
- writable: true
20689
- });
20690
- } else {
20691
- obj[key] = value;
20828
+ function MessageStatePanel({ className = "" }) {
20829
+ const { currentStep, currentMessage, currentChanges } = useDebugger();
20830
+ const [activeTab, setActiveTab] = useState("message");
20831
+ if (!currentStep || !currentMessage) {
20832
+ return /* @__PURE__ */ jsx("div", { className: `df-debug-state-panel df-debug-state-empty ${className}`, children: /* @__PURE__ */ jsx("p", { children: "No step selected. Run debug to see message state changes." }) });
20692
20833
  }
20693
- return obj;
20834
+ const { workflow_id, task_id, result } = currentStep;
20835
+ const tabs = [
20836
+ { key: "message", label: "Message" },
20837
+ { key: "changes", label: `Changes (${currentChanges.length})` }
20838
+ ];
20839
+ return /* @__PURE__ */ jsxs("div", { className: `df-debug-state-panel ${className}`, children: [
20840
+ /* @__PURE__ */ jsx("div", { className: "df-debug-state-header", children: /* @__PURE__ */ jsx("div", { className: "df-debug-state-tabs", children: tabs.map(({ key, label }) => /* @__PURE__ */ jsx(
20841
+ "button",
20842
+ {
20843
+ className: `df-debug-state-tab ${activeTab === key ? "df-debug-state-tab-active" : ""}`,
20844
+ onClick: () => setActiveTab(key),
20845
+ children: label
20846
+ },
20847
+ key
20848
+ )) }) }),
20849
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-state-content", children: [
20850
+ activeTab === "message" && /* @__PURE__ */ jsx(MessageView, { message: currentMessage }),
20851
+ activeTab === "changes" && /* @__PURE__ */ jsx(ChangesView, { changes: currentChanges })
20852
+ ] }),
20853
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-state-footer", children: [
20854
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-state-step-type", children: [
20855
+ /* @__PURE__ */ jsx("span", { className: `df-debug-state-badge df-debug-state-badge-${result}`, children: result }),
20856
+ /* @__PURE__ */ jsxs("span", { className: "df-debug-state-type-label", children: [
20857
+ workflow_id,
20858
+ task_id ? ` / ${task_id}` : ""
20859
+ ] })
20860
+ ] }),
20861
+ currentMessage.errors.length > 0 && /* @__PURE__ */ jsxs("div", { className: "df-debug-state-error", children: [
20862
+ "Errors: ",
20863
+ currentMessage.errors.length
20864
+ ] })
20865
+ ] })
20866
+ ] });
20694
20867
  }
20695
- function ownKeys(object2, enumerableOnly) {
20696
- var keys = Object.keys(object2);
20697
- if (Object.getOwnPropertySymbols) {
20698
- var symbols = Object.getOwnPropertySymbols(object2);
20699
- if (enumerableOnly) symbols = symbols.filter(function(sym) {
20700
- return Object.getOwnPropertyDescriptor(object2, sym).enumerable;
20868
+ function MessageView({ message }) {
20869
+ const [expandedSections, setExpandedSections] = useState(
20870
+ /* @__PURE__ */ new Set(["context"])
20871
+ );
20872
+ const toggleSection = (section) => {
20873
+ setExpandedSections((prev) => {
20874
+ const next = new Set(prev);
20875
+ if (next.has(section)) {
20876
+ next.delete(section);
20877
+ } else {
20878
+ next.add(section);
20879
+ }
20880
+ return next;
20701
20881
  });
20702
- keys.push.apply(keys, symbols);
20703
- }
20704
- return keys;
20882
+ };
20883
+ const sections = [
20884
+ { key: "context", value: message.context },
20885
+ { key: "payload", value: message.payload },
20886
+ { key: "errors", value: message.errors },
20887
+ { key: "audit_trail", value: message.audit_trail }
20888
+ ];
20889
+ return /* @__PURE__ */ jsx("div", { className: "df-debug-message-view", children: sections.map(({ key, value }) => {
20890
+ const isExpanded = expandedSections.has(key);
20891
+ const isEmpty2 = Array.isArray(value) ? value.length === 0 : typeof value === "object" && value !== null ? Object.keys(value).length === 0 : !value;
20892
+ return /* @__PURE__ */ jsxs("div", { className: "df-debug-message-section", children: [
20893
+ /* @__PURE__ */ jsxs(
20894
+ "div",
20895
+ {
20896
+ className: "df-debug-message-section-header",
20897
+ onClick: () => toggleSection(key),
20898
+ children: [
20899
+ /* @__PURE__ */ jsx("span", { className: "df-debug-section-arrow", children: isExpanded ? "▼" : "▶" }),
20900
+ /* @__PURE__ */ jsx("span", { className: "df-debug-section-key", children: key }),
20901
+ isEmpty2 && /* @__PURE__ */ jsx("span", { className: "df-debug-section-empty", children: "(empty)" })
20902
+ ]
20903
+ }
20904
+ ),
20905
+ isExpanded && /* @__PURE__ */ jsx("pre", { className: "df-debug-message-section-content", children: JSON.stringify(value, null, 2) })
20906
+ ] }, key);
20907
+ }) });
20705
20908
  }
20706
- function _objectSpread2(target) {
20707
- for (var i = 1; i < arguments.length; i++) {
20708
- var source = arguments[i] != null ? arguments[i] : {};
20709
- if (i % 2) {
20710
- ownKeys(Object(source), true).forEach(function(key) {
20711
- _defineProperty(target, key, source[key]);
20712
- });
20713
- } else if (Object.getOwnPropertyDescriptors) {
20714
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
20715
- } else {
20716
- ownKeys(Object(source)).forEach(function(key) {
20717
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
20718
- });
20719
- }
20909
+ function ChangesView({ changes }) {
20910
+ if (changes.length === 0) {
20911
+ return /* @__PURE__ */ jsx("div", { className: "df-debug-changes-empty", children: "No changes recorded in this step" });
20720
20912
  }
20721
- return target;
20913
+ return /* @__PURE__ */ jsx("div", { className: "df-debug-changes-view", children: changes.map((change, index2) => {
20914
+ const isModified = change.old_value !== void 0 && change.new_value !== void 0;
20915
+ const isAdded = change.old_value === void 0 && change.new_value !== void 0;
20916
+ const isRemoved = change.old_value !== void 0 && change.new_value === void 0;
20917
+ const changeType = isAdded ? "added" : isRemoved ? "removed" : "modified";
20918
+ return /* @__PURE__ */ jsxs("div", { className: `df-debug-change-item df-debug-change-${changeType}`, children: [
20919
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-change-header", children: [
20920
+ /* @__PURE__ */ jsx("span", { className: `df-debug-change-op df-debug-change-op-${changeType}`, children: changeType }),
20921
+ /* @__PURE__ */ jsx("span", { className: "df-debug-change-path", children: change.path })
20922
+ ] }),
20923
+ isModified && /* @__PURE__ */ jsxs("div", { className: "df-debug-change-values", children: [
20924
+ /* @__PURE__ */ jsx("span", { className: "df-debug-change-old", children: formatValue(change.old_value) }),
20925
+ /* @__PURE__ */ jsx("span", { className: "df-debug-change-arrow", children: "→" }),
20926
+ /* @__PURE__ */ jsx("span", { className: "df-debug-change-new", children: formatValue(change.new_value) })
20927
+ ] }),
20928
+ isAdded && /* @__PURE__ */ jsx("div", { className: "df-debug-change-values", children: /* @__PURE__ */ jsx("span", { className: "df-debug-change-new", children: formatValue(change.new_value) }) }),
20929
+ isRemoved && /* @__PURE__ */ jsx("div", { className: "df-debug-change-values", children: /* @__PURE__ */ jsx("span", { className: "df-debug-change-old", children: formatValue(change.old_value) }) })
20930
+ ] }, index2);
20931
+ }) });
20722
20932
  }
20723
- function compose$1() {
20724
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
20725
- fns[_key] = arguments[_key];
20726
- }
20727
- return function(x) {
20728
- return fns.reduceRight(function(y, f) {
20729
- return f(y);
20730
- }, x);
20731
- };
20933
+ function formatValue(value) {
20934
+ if (value === void 0) return "undefined";
20935
+ if (value === null) return "null";
20936
+ if (typeof value === "string") return `"${value}"`;
20937
+ if (typeof value === "object") return JSON.stringify(value);
20938
+ return String(value);
20732
20939
  }
20733
- function curry$1(fn) {
20734
- return function curried() {
20735
- var _this = this;
20736
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
20737
- args[_key2] = arguments[_key2];
20738
- }
20739
- return args.length >= fn.length ? fn.apply(this, args) : function() {
20740
- for (var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
20741
- nextArgs[_key3] = arguments[_key3];
20940
+ function DebugInfoBubble({
20941
+ step,
20942
+ targetRef,
20943
+ visible,
20944
+ onClose
20945
+ }) {
20946
+ var _a;
20947
+ const [position, setPosition] = useState({ top: 0, left: 0 });
20948
+ const bubbleRef = useRef(null);
20949
+ useEffect(() => {
20950
+ if (!visible || !targetRef.current) return;
20951
+ const updatePosition = () => {
20952
+ var _a2, _b;
20953
+ const targetRect = (_a2 = targetRef.current) == null ? void 0 : _a2.getBoundingClientRect();
20954
+ const bubbleRect = (_b = bubbleRef.current) == null ? void 0 : _b.getBoundingClientRect();
20955
+ if (!targetRect) return;
20956
+ let top = targetRect.bottom + 8;
20957
+ let left = targetRect.left;
20958
+ if (bubbleRect) {
20959
+ if (left + bubbleRect.width > window.innerWidth - 16) {
20960
+ left = window.innerWidth - bubbleRect.width - 16;
20961
+ }
20962
+ if (top + bubbleRect.height > window.innerHeight - 16) {
20963
+ top = targetRect.top - bubbleRect.height - 8;
20964
+ }
20742
20965
  }
20743
- return curried.apply(_this, [].concat(args, nextArgs));
20966
+ setPosition({ top, left });
20744
20967
  };
20745
- };
20746
- }
20747
- function isObject$1(value) {
20748
- return {}.toString.call(value).includes("Object");
20749
- }
20750
- function isEmpty(obj) {
20751
- return !Object.keys(obj).length;
20752
- }
20753
- function isFunction(value) {
20754
- return typeof value === "function";
20755
- }
20756
- function hasOwnProperty(object2, property) {
20757
- return Object.prototype.hasOwnProperty.call(object2, property);
20758
- }
20759
- function validateChanges(initial, changes) {
20760
- if (!isObject$1(changes)) errorHandler$1("changeType");
20761
- if (Object.keys(changes).some(function(field) {
20762
- return !hasOwnProperty(initial, field);
20763
- })) errorHandler$1("changeField");
20764
- return changes;
20765
- }
20766
- function validateSelector(selector2) {
20767
- if (!isFunction(selector2)) errorHandler$1("selectorType");
20768
- }
20769
- function validateHandler(handler) {
20770
- if (!(isFunction(handler) || isObject$1(handler))) errorHandler$1("handlerType");
20771
- if (isObject$1(handler) && Object.values(handler).some(function(_handler) {
20772
- return !isFunction(_handler);
20773
- })) errorHandler$1("handlersType");
20774
- }
20775
- function validateInitial(initial) {
20776
- if (!initial) errorHandler$1("initialIsRequired");
20777
- if (!isObject$1(initial)) errorHandler$1("initialType");
20778
- if (isEmpty(initial)) errorHandler$1("initialContent");
20779
- }
20780
- function throwError$1(errorMessages2, type) {
20781
- throw new Error(errorMessages2[type] || errorMessages2["default"]);
20782
- }
20783
- var errorMessages$1 = {
20784
- initialIsRequired: "initial state is required",
20785
- initialType: "initial state should be an object",
20786
- initialContent: "initial state shouldn't be an empty object",
20787
- handlerType: "handler should be an object or a function",
20788
- handlersType: "all handlers should be a functions",
20789
- selectorType: "selector should be a function",
20790
- changeType: "provided value of changes should be an object",
20791
- changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
20792
- "default": "an unknown error accured in `state-local` package"
20793
- };
20794
- var errorHandler$1 = curry$1(throwError$1)(errorMessages$1);
20795
- var validators$1 = {
20796
- changes: validateChanges,
20797
- selector: validateSelector,
20798
- handler: validateHandler,
20799
- initial: validateInitial
20800
- };
20801
- function create(initial) {
20802
- var handler = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
20803
- validators$1.initial(initial);
20804
- validators$1.handler(handler);
20805
- var state = {
20806
- current: initial
20807
- };
20808
- var didUpdate = curry$1(didStateUpdate)(state, handler);
20809
- var update = curry$1(updateState)(state);
20810
- var validate = curry$1(validators$1.changes)(initial);
20811
- var getChanges = curry$1(extractChanges)(state);
20812
- function getState2() {
20813
- var selector2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(state2) {
20814
- return state2;
20968
+ updatePosition();
20969
+ window.addEventListener("scroll", updatePosition, true);
20970
+ window.addEventListener("resize", updatePosition);
20971
+ return () => {
20972
+ window.removeEventListener("scroll", updatePosition, true);
20973
+ window.removeEventListener("resize", updatePosition);
20815
20974
  };
20816
- validators$1.selector(selector2);
20817
- return selector2(state.current);
20818
- }
20819
- function setState2(causedChanges) {
20820
- compose$1(didUpdate, update, validate, getChanges)(causedChanges);
20821
- }
20822
- return [getState2, setState2];
20823
- }
20824
- function extractChanges(state, causedChanges) {
20825
- return isFunction(causedChanges) ? causedChanges(state.current) : causedChanges;
20826
- }
20827
- function updateState(state, changes) {
20828
- state.current = _objectSpread2(_objectSpread2({}, state.current), changes);
20829
- return changes;
20830
- }
20831
- function didStateUpdate(state, handler, changes) {
20832
- isFunction(handler) ? handler(state.current) : Object.keys(changes).forEach(function(field) {
20833
- var _handler$field;
20834
- return (_handler$field = handler[field]) === null || _handler$field === void 0 ? void 0 : _handler$field.call(handler, state.current[field]);
20835
- });
20836
- return changes;
20837
- }
20838
- var index = {
20839
- create
20840
- };
20841
- var config$1 = {
20842
- paths: {
20843
- vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"
20844
- }
20845
- };
20846
- function curry(fn) {
20847
- return function curried() {
20848
- var _this = this;
20849
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20850
- args[_key] = arguments[_key];
20851
- }
20852
- return args.length >= fn.length ? fn.apply(this, args) : function() {
20853
- for (var _len2 = arguments.length, nextArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
20854
- nextArgs[_key2] = arguments[_key2];
20975
+ }, [visible, targetRef]);
20976
+ if (!visible) return null;
20977
+ const { workflow_id, task_id, result, message } = step;
20978
+ const state = result === "executed" ? "executed" : "skipped";
20979
+ const hasError = message && message.errors && message.errors.length > 0;
20980
+ const displayState = hasError ? "error" : state;
20981
+ return createPortal(
20982
+ /* @__PURE__ */ jsxs(
20983
+ "div",
20984
+ {
20985
+ ref: bubbleRef,
20986
+ className: "df-debug-bubble",
20987
+ style: {
20988
+ position: "fixed",
20989
+ top: position.top,
20990
+ left: position.left
20991
+ },
20992
+ children: [
20993
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-header", children: [
20994
+ /* @__PURE__ */ jsx(StateIcon, { state: displayState }),
20995
+ /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-title", children: task_id ? "Task Step" : "Workflow Skipped" }),
20996
+ onClose && /* @__PURE__ */ jsx("button", { className: "df-debug-bubble-close", onClick: onClose, children: /* @__PURE__ */ jsx(X, { size: 14 }) })
20997
+ ] }),
20998
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-content", children: [
20999
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-row", children: [
21000
+ /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-label", children: "Workflow:" }),
21001
+ /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-value", children: workflow_id })
21002
+ ] }),
21003
+ task_id && /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-row", children: [
21004
+ /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-label", children: "Task:" }),
21005
+ /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-value", children: task_id })
21006
+ ] }),
21007
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-row", children: [
21008
+ /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-label", children: "Result:" }),
21009
+ /* @__PURE__ */ jsx("span", { className: `df-debug-bubble-state df-debug-bubble-state-${displayState}`, children: result })
21010
+ ] }),
21011
+ hasError && (message == null ? void 0 : message.errors) && /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-error", children: [
21012
+ /* @__PURE__ */ jsx(CircleAlert, { size: 14 }),
21013
+ /* @__PURE__ */ jsx("span", { children: ((_a = message.errors[0]) == null ? void 0 : _a.message) || "Unknown error" })
21014
+ ] })
21015
+ ] })
21016
+ ]
20855
21017
  }
20856
- return curried.apply(_this, [].concat(args, nextArgs));
20857
- };
20858
- };
20859
- }
20860
- function isObject(value) {
20861
- return {}.toString.call(value).includes("Object");
21018
+ ),
21019
+ document.body
21020
+ );
20862
21021
  }
20863
- function validateConfig(config2) {
20864
- if (!config2) errorHandler("configIsRequired");
20865
- if (!isObject(config2)) errorHandler("configType");
20866
- if (config2.urls) {
20867
- informAboutDeprecation();
20868
- return {
20869
- paths: {
20870
- vs: config2.urls.monacoBase
20871
- }
20872
- };
21022
+ function StateIcon({ state }) {
21023
+ switch (state) {
21024
+ case "executed":
21025
+ return /* @__PURE__ */ jsx(Check, { size: 16, className: "df-debug-icon-executed" });
21026
+ case "skipped":
21027
+ return /* @__PURE__ */ jsx(SkipForward, { size: 16, className: "df-debug-icon-skipped" });
21028
+ case "error":
21029
+ return /* @__PURE__ */ jsx(CircleAlert, { size: 16, className: "df-debug-icon-error" });
21030
+ case "current":
21031
+ return /* @__PURE__ */ jsx(Clock, { size: 16, className: "df-debug-icon-current" });
21032
+ case "pending":
21033
+ default:
21034
+ return /* @__PURE__ */ jsx(Clock, { size: 16, className: "df-debug-icon-pending" });
20873
21035
  }
20874
- return config2;
20875
- }
20876
- function informAboutDeprecation() {
20877
- console.warn(errorMessages.deprecation);
20878
21036
  }
20879
- function throwError(errorMessages2, type) {
20880
- throw new Error(errorMessages2[type] || errorMessages2["default"]);
21037
+ function DebugStateBadge({
21038
+ state,
21039
+ conditionResult,
21040
+ size = "sm"
21041
+ }) {
21042
+ const iconSize = size === "sm" ? 12 : 14;
21043
+ return /* @__PURE__ */ jsxs("span", { className: `df-debug-badge df-debug-badge-${state} df-debug-badge-${size}`, children: [
21044
+ /* @__PURE__ */ jsx(StateIcon, { state }),
21045
+ conditionResult !== void 0 && /* @__PURE__ */ jsx("span", { className: `df-debug-badge-condition ${conditionResult ? "df-debug-badge-condition-pass" : "df-debug-badge-condition-fail"}`, children: conditionResult ? /* @__PURE__ */ jsx(Check, { size: iconSize }) : /* @__PURE__ */ jsx(X, { size: iconSize }) })
21046
+ ] });
20881
21047
  }
20882
- var errorMessages = {
20883
- configIsRequired: "the configuration object is required",
20884
- configType: "the configuration object should be an object",
20885
- "default": "an unknown error accured in `@monaco-editor/loader` package",
20886
- deprecation: "Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "
20887
- };
20888
- var errorHandler = curry(throwError)(errorMessages);
20889
- var validators = {
20890
- config: validateConfig
20891
- };
20892
- var compose = function compose2() {
20893
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
20894
- fns[_key] = arguments[_key];
20895
- }
20896
- return function(x) {
20897
- return fns.reduceRight(function(y, f) {
20898
- return f(y);
20899
- }, x);
20900
- };
20901
- };
20902
- function merge(target, source) {
20903
- Object.keys(source).forEach(function(key) {
20904
- if (source[key] instanceof Object) {
20905
- if (target[key]) {
20906
- Object.assign(source[key], merge(target[key], source[key]));
21048
+ function IntegratedDebugToolbar({
21049
+ workflows,
21050
+ payload,
21051
+ autoExecute = false,
21052
+ onExecutionComplete,
21053
+ onExecutionError,
21054
+ className = ""
21055
+ }) {
21056
+ const {
21057
+ state,
21058
+ play,
21059
+ pause,
21060
+ stop,
21061
+ reset,
21062
+ stepForward,
21063
+ stepBackward,
21064
+ startExecution,
21065
+ executeTrace,
21066
+ setExecutionError,
21067
+ runExecution,
21068
+ isAtStart,
21069
+ isAtEnd,
21070
+ hasTrace,
21071
+ totalSteps,
21072
+ isEngineReady
21073
+ } = useDebugger();
21074
+ const { playbackState, currentStepIndex, isExecuting, executionError, trace } = state;
21075
+ const lastExecutionRef = useRef(null);
21076
+ const handleExecute = useCallback(async () => {
21077
+ var _a, _b;
21078
+ if (!isEngineReady || workflows.length === 0) return;
21079
+ const workflowsJson = JSON.stringify(workflows);
21080
+ const payloadJson = JSON.stringify(payload || {});
21081
+ const current = { workflows: workflowsJson, payload: payloadJson };
21082
+ if (((_a = lastExecutionRef.current) == null ? void 0 : _a.workflows) === current.workflows && ((_b = lastExecutionRef.current) == null ? void 0 : _b.payload) === current.payload) {
21083
+ return;
21084
+ }
21085
+ startExecution();
21086
+ try {
21087
+ const result = await runExecution(workflows, payload || {});
21088
+ if (result) {
21089
+ executeTrace(result);
21090
+ lastExecutionRef.current = current;
21091
+ onExecutionComplete == null ? void 0 : onExecutionComplete(result);
20907
21092
  }
21093
+ } catch (err) {
21094
+ const errorMessage = err instanceof Error ? err.message : "Execution failed";
21095
+ setExecutionError(errorMessage);
21096
+ onExecutionError == null ? void 0 : onExecutionError(errorMessage);
20908
21097
  }
20909
- });
20910
- return _objectSpread2$1(_objectSpread2$1({}, target), source);
20911
- }
20912
- var CANCELATION_MESSAGE = {
20913
- type: "cancelation",
20914
- msg: "operation is manually canceled"
20915
- };
20916
- function makeCancelable(promise) {
20917
- var hasCanceled_ = false;
20918
- var wrappedPromise = new Promise(function(resolve, reject) {
20919
- promise.then(function(val) {
20920
- return hasCanceled_ ? reject(CANCELATION_MESSAGE) : resolve(val);
20921
- });
20922
- promise["catch"](reject);
20923
- });
20924
- return wrappedPromise.cancel = function() {
20925
- return hasCanceled_ = true;
20926
- }, wrappedPromise;
20927
- }
20928
- var _excluded = ["monaco"];
20929
- var _state$create = index.create({
20930
- config: config$1,
20931
- isInitialized: false,
20932
- resolve: null,
20933
- reject: null,
20934
- monaco: null
20935
- }), _state$create2 = _slicedToArray(_state$create, 2), getState = _state$create2[0], setState = _state$create2[1];
20936
- function config(globalConfig) {
20937
- var _validators$config = validators.config(globalConfig), monaco = _validators$config.monaco, config2 = _objectWithoutProperties(_validators$config, _excluded);
20938
- setState(function(state) {
20939
- return {
20940
- config: merge(state.config, config2),
20941
- monaco
20942
- };
20943
- });
20944
- }
20945
- function init() {
20946
- var state = getState(function(_ref) {
20947
- var monaco = _ref.monaco, isInitialized = _ref.isInitialized, resolve = _ref.resolve;
20948
- return {
20949
- monaco,
20950
- isInitialized,
20951
- resolve
20952
- };
20953
- });
20954
- if (!state.isInitialized) {
20955
- setState({
20956
- isInitialized: true
20957
- });
20958
- if (state.monaco) {
20959
- state.resolve(state.monaco);
20960
- return makeCancelable(wrapperPromise);
21098
+ }, [
21099
+ isEngineReady,
21100
+ workflows,
21101
+ payload,
21102
+ startExecution,
21103
+ runExecution,
21104
+ executeTrace,
21105
+ setExecutionError,
21106
+ onExecutionComplete,
21107
+ onExecutionError
21108
+ ]);
21109
+ const handleReset = useCallback(() => {
21110
+ reset();
21111
+ lastExecutionRef.current = null;
21112
+ }, [reset]);
21113
+ useEffect(() => {
21114
+ if (!autoExecute || !isEngineReady || workflows.length === 0) return;
21115
+ const timeoutId = setTimeout(() => {
21116
+ handleExecute();
21117
+ }, 500);
21118
+ return () => clearTimeout(timeoutId);
21119
+ }, [autoExecute, isEngineReady, workflows, payload]);
21120
+ const handleKeyDown = useCallback(
21121
+ (e) => {
21122
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
21123
+ return;
21124
+ }
21125
+ switch (e.key) {
21126
+ case " ":
21127
+ e.preventDefault();
21128
+ if (playbackState === "playing") {
21129
+ pause();
21130
+ } else if (hasTrace) {
21131
+ play();
21132
+ }
21133
+ break;
21134
+ case "ArrowRight":
21135
+ e.preventDefault();
21136
+ if (hasTrace && !isAtEnd) {
21137
+ stepForward();
21138
+ }
21139
+ break;
21140
+ case "ArrowLeft":
21141
+ e.preventDefault();
21142
+ if (hasTrace && !isAtStart) {
21143
+ stepBackward();
21144
+ }
21145
+ break;
21146
+ case "Escape":
21147
+ e.preventDefault();
21148
+ stop();
21149
+ break;
21150
+ case "r":
21151
+ if (e.metaKey || e.ctrlKey) {
21152
+ e.preventDefault();
21153
+ handleReset();
21154
+ }
21155
+ break;
21156
+ }
21157
+ },
21158
+ [playbackState, hasTrace, isAtEnd, isAtStart, play, pause, stop, stepForward, stepBackward, handleReset]
21159
+ );
21160
+ useEffect(() => {
21161
+ window.addEventListener("keydown", handleKeyDown);
21162
+ return () => window.removeEventListener("keydown", handleKeyDown);
21163
+ }, [handleKeyDown]);
21164
+ const getStatusIcon = () => {
21165
+ var _a;
21166
+ if (isExecuting) {
21167
+ return /* @__PURE__ */ jsx(LoaderCircle, { size: 14, className: "df-debug-spin" });
20961
21168
  }
20962
- if (window.monaco && window.monaco.editor) {
20963
- storeMonacoInstance(window.monaco);
20964
- state.resolve(window.monaco);
20965
- return makeCancelable(wrapperPromise);
21169
+ if (executionError) {
21170
+ return /* @__PURE__ */ jsx(CircleX, { size: 14, className: "df-debug-toolbar-status-error" });
20966
21171
  }
20967
- compose(injectScripts, getMonacoLoaderScript)(configureLoader);
20968
- }
20969
- return makeCancelable(wrapperPromise);
21172
+ if (hasTrace) {
21173
+ const finalStep = trace == null ? void 0 : trace.steps[trace.steps.length - 1];
21174
+ const hasErrors = ((_a = finalStep == null ? void 0 : finalStep.message) == null ? void 0 : _a.errors) && finalStep.message.errors.length > 0;
21175
+ if (hasErrors) {
21176
+ return /* @__PURE__ */ jsx(CircleAlert, { size: 14, className: "df-debug-toolbar-status-warning" });
21177
+ }
21178
+ return /* @__PURE__ */ jsx(CircleCheckBig, { size: 14, className: "df-debug-toolbar-status-success" });
21179
+ }
21180
+ return null;
21181
+ };
21182
+ const getStepText = () => {
21183
+ if (isExecuting) {
21184
+ return "Executing...";
21185
+ }
21186
+ if (!hasTrace) {
21187
+ return "Ready";
21188
+ }
21189
+ if (currentStepIndex < 0) {
21190
+ return "Ready";
21191
+ }
21192
+ return `Step ${currentStepIndex + 1} / ${totalSteps}`;
21193
+ };
21194
+ return /* @__PURE__ */ jsxs("div", { className: `df-debug-toolbar-integrated ${className}`, children: [
21195
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-toolbar-status", children: [
21196
+ getStatusIcon(),
21197
+ /* @__PURE__ */ jsx("span", { className: "df-debug-toolbar-step-text", children: getStepText() })
21198
+ ] }),
21199
+ /* @__PURE__ */ jsxs("div", { className: "df-debug-toolbar-controls", children: [
21200
+ /* @__PURE__ */ jsx(
21201
+ "button",
21202
+ {
21203
+ className: "df-debug-toolbar-btn",
21204
+ onClick: stepBackward,
21205
+ disabled: !hasTrace || isAtStart || isExecuting,
21206
+ title: "Previous step (Left Arrow)",
21207
+ children: /* @__PURE__ */ jsx(SkipBack, { size: 14 })
21208
+ }
21209
+ ),
21210
+ playbackState === "playing" ? /* @__PURE__ */ jsx(
21211
+ "button",
21212
+ {
21213
+ className: "df-debug-toolbar-btn df-debug-toolbar-btn-primary",
21214
+ onClick: pause,
21215
+ disabled: !hasTrace || isExecuting,
21216
+ title: "Pause (Space)",
21217
+ children: /* @__PURE__ */ jsx(Pause, { size: 14 })
21218
+ }
21219
+ ) : /* @__PURE__ */ jsx(
21220
+ "button",
21221
+ {
21222
+ className: "df-debug-toolbar-btn df-debug-toolbar-btn-primary",
21223
+ onClick: play,
21224
+ disabled: !hasTrace || isAtEnd || isExecuting,
21225
+ title: "Play (Space)",
21226
+ children: /* @__PURE__ */ jsx(Play, { size: 14 })
21227
+ }
21228
+ ),
21229
+ /* @__PURE__ */ jsx(
21230
+ "button",
21231
+ {
21232
+ className: "df-debug-toolbar-btn",
21233
+ onClick: stepForward,
21234
+ disabled: !hasTrace || isAtEnd || isExecuting,
21235
+ title: "Next step (Right Arrow)",
21236
+ children: /* @__PURE__ */ jsx(SkipForward, { size: 14 })
21237
+ }
21238
+ ),
21239
+ /* @__PURE__ */ jsx(
21240
+ "button",
21241
+ {
21242
+ className: "df-debug-toolbar-btn",
21243
+ onClick: stop,
21244
+ disabled: !hasTrace || isExecuting,
21245
+ title: "Stop (Escape)",
21246
+ children: /* @__PURE__ */ jsx(Square, { size: 14 })
21247
+ }
21248
+ )
21249
+ ] }),
21250
+ /* @__PURE__ */ jsx("div", { className: "df-debug-toolbar-actions", children: hasTrace ? /* @__PURE__ */ jsxs(
21251
+ "button",
21252
+ {
21253
+ className: "df-debug-toolbar-btn-action df-debug-toolbar-btn-reset",
21254
+ onClick: handleReset,
21255
+ disabled: isExecuting,
21256
+ title: "Reset (Ctrl+R)",
21257
+ children: [
21258
+ /* @__PURE__ */ jsx(RotateCcw, { size: 12 }),
21259
+ /* @__PURE__ */ jsx("span", { children: "Reset" })
21260
+ ]
21261
+ }
21262
+ ) : /* @__PURE__ */ jsxs(
21263
+ "button",
21264
+ {
21265
+ className: "df-debug-toolbar-btn-action df-debug-toolbar-btn-run",
21266
+ onClick: handleExecute,
21267
+ disabled: !isEngineReady || isExecuting || workflows.length === 0,
21268
+ title: "Run workflow",
21269
+ children: [
21270
+ isExecuting ? /* @__PURE__ */ jsx(LoaderCircle, { size: 12, className: "df-debug-spin" }) : /* @__PURE__ */ jsx(Play, { size: 12 }),
21271
+ /* @__PURE__ */ jsx("span", { children: isExecuting ? "Running..." : "Run" })
21272
+ ]
21273
+ }
21274
+ ) })
21275
+ ] });
20970
21276
  }
20971
- function injectScripts(script) {
20972
- return document.body.appendChild(script);
21277
+ function SearchInput({
21278
+ value,
21279
+ onChange,
21280
+ onClear,
21281
+ placeholder = "Search...",
21282
+ className = ""
21283
+ }) {
21284
+ return /* @__PURE__ */ jsxs("div", { className: `df-search-input ${className}`, children: [
21285
+ /* @__PURE__ */ jsx(Search, { className: "df-search-icon", size: 16 }),
21286
+ /* @__PURE__ */ jsx(
21287
+ "input",
21288
+ {
21289
+ type: "text",
21290
+ value,
21291
+ onChange: (e) => onChange(e.target.value),
21292
+ placeholder,
21293
+ className: "df-search-field"
21294
+ }
21295
+ ),
21296
+ value && onClear && /* @__PURE__ */ jsx(
21297
+ "button",
21298
+ {
21299
+ onClick: onClear,
21300
+ className: "df-search-clear",
21301
+ "aria-label": "Clear search",
21302
+ children: /* @__PURE__ */ jsx(X, { size: 14 })
21303
+ }
21304
+ )
21305
+ ] });
20973
21306
  }
20974
- function createScript(src) {
20975
- var script = document.createElement("script");
20976
- return src && (script.src = src), script;
21307
+ function JsonViewer({
21308
+ data,
21309
+ initialExpanded = false,
21310
+ maxStringLength = 50,
21311
+ className = ""
21312
+ }) {
21313
+ return /* @__PURE__ */ jsx("div", { className: `df-json-viewer ${className}`, children: /* @__PURE__ */ jsx(
21314
+ JsonNode,
21315
+ {
21316
+ data,
21317
+ initialExpanded,
21318
+ maxStringLength
21319
+ }
21320
+ ) });
20977
21321
  }
20978
- function getMonacoLoaderScript(configureLoader2) {
20979
- var state = getState(function(_ref2) {
20980
- var config2 = _ref2.config, reject = _ref2.reject;
20981
- return {
20982
- config: config2,
20983
- reject
20984
- };
20985
- });
20986
- var loaderScript = createScript("".concat(state.config.paths.vs, "/loader.js"));
20987
- loaderScript.onload = function() {
20988
- return configureLoader2();
21322
+ function JsonNode({
21323
+ data,
21324
+ initialExpanded,
21325
+ maxStringLength,
21326
+ keyName,
21327
+ isLast = true
21328
+ }) {
21329
+ const [expanded, setExpanded] = useState(initialExpanded);
21330
+ const renderValue = () => {
21331
+ if (data === null) {
21332
+ return /* @__PURE__ */ jsx("span", { className: "df-json-null", children: "null" });
21333
+ }
21334
+ if (data === void 0) {
21335
+ return /* @__PURE__ */ jsx("span", { className: "df-json-undefined", children: "undefined" });
21336
+ }
21337
+ if (typeof data === "boolean") {
21338
+ return /* @__PURE__ */ jsx("span", { className: "df-json-boolean", children: data.toString() });
21339
+ }
21340
+ if (typeof data === "number") {
21341
+ return /* @__PURE__ */ jsx("span", { className: "df-json-number", children: data });
21342
+ }
21343
+ if (typeof data === "string") {
21344
+ const display = data.length > maxStringLength ? `${data.slice(0, maxStringLength)}...` : data;
21345
+ return /* @__PURE__ */ jsxs("span", { className: "df-json-string", children: [
21346
+ '"',
21347
+ display,
21348
+ '"'
21349
+ ] });
21350
+ }
21351
+ if (Array.isArray(data)) {
21352
+ if (data.length === 0) {
21353
+ return /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "[]" });
21354
+ }
21355
+ return /* @__PURE__ */ jsxs("span", { className: "df-json-array", children: [
21356
+ /* @__PURE__ */ jsx(
21357
+ "button",
21358
+ {
21359
+ onClick: () => setExpanded(!expanded),
21360
+ className: "df-json-toggle",
21361
+ children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 12 })
21362
+ }
21363
+ ),
21364
+ /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "[" }),
21365
+ !expanded && /* @__PURE__ */ jsxs("span", { className: "df-json-preview", children: [
21366
+ data.length,
21367
+ " item",
21368
+ data.length !== 1 ? "s" : ""
21369
+ ] }),
21370
+ expanded && /* @__PURE__ */ jsx("div", { className: "df-json-children", children: data.map((item, index2) => /* @__PURE__ */ jsx(
21371
+ JsonNode,
21372
+ {
21373
+ data: item,
21374
+ initialExpanded: false,
21375
+ maxStringLength,
21376
+ isLast: index2 === data.length - 1
21377
+ },
21378
+ index2
21379
+ )) }),
21380
+ /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "]" })
21381
+ ] });
21382
+ }
21383
+ if (typeof data === "object") {
21384
+ const entries = Object.entries(data);
21385
+ if (entries.length === 0) {
21386
+ return /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "{}" });
21387
+ }
21388
+ return /* @__PURE__ */ jsxs("span", { className: "df-json-object", children: [
21389
+ /* @__PURE__ */ jsx(
21390
+ "button",
21391
+ {
21392
+ onClick: () => setExpanded(!expanded),
21393
+ className: "df-json-toggle",
21394
+ children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 12 })
21395
+ }
21396
+ ),
21397
+ /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "{" }),
21398
+ !expanded && /* @__PURE__ */ jsxs("span", { className: "df-json-preview", children: [
21399
+ entries.length,
21400
+ " key",
21401
+ entries.length !== 1 ? "s" : ""
21402
+ ] }),
21403
+ expanded && /* @__PURE__ */ jsx("div", { className: "df-json-children", children: entries.map(([key, value], index2) => /* @__PURE__ */ jsx(
21404
+ JsonNode,
21405
+ {
21406
+ keyName: key,
21407
+ data: value,
21408
+ initialExpanded: false,
21409
+ maxStringLength,
21410
+ isLast: index2 === entries.length - 1
21411
+ },
21412
+ key
21413
+ )) }),
21414
+ /* @__PURE__ */ jsx("span", { className: "df-json-bracket", children: "}" })
21415
+ ] });
21416
+ }
21417
+ return /* @__PURE__ */ jsx("span", { children: String(data) });
20989
21418
  };
20990
- loaderScript.onerror = state.reject;
20991
- return loaderScript;
21419
+ return /* @__PURE__ */ jsxs("div", { className: "df-json-node", children: [
21420
+ keyName !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
21421
+ /* @__PURE__ */ jsxs("span", { className: "df-json-key", children: [
21422
+ '"',
21423
+ keyName,
21424
+ '"'
21425
+ ] }),
21426
+ /* @__PURE__ */ jsx("span", { className: "df-json-colon", children: ": " })
21427
+ ] }),
21428
+ renderValue(),
21429
+ !isLast && /* @__PURE__ */ jsx("span", { className: "df-json-comma", children: "," })
21430
+ ] });
20992
21431
  }
20993
- function configureLoader() {
20994
- var state = getState(function(_ref3) {
20995
- var config2 = _ref3.config, resolve = _ref3.resolve, reject = _ref3.reject;
20996
- return {
20997
- config: config2,
20998
- resolve,
20999
- reject
21000
- };
21001
- });
21002
- var require2 = window.require;
21003
- require2.config(state.config);
21004
- require2(["vs/editor/editor.main"], function(loaded) {
21005
- var monaco = loaded.m || loaded;
21006
- storeMonacoInstance(monaco);
21007
- state.resolve(monaco);
21008
- }, function(error) {
21009
- state.reject(error);
21010
- });
21432
+ function _arrayLikeToArray(r, a) {
21433
+ (null == a || a > r.length) && (a = r.length);
21434
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
21435
+ return n;
21011
21436
  }
21012
- function storeMonacoInstance(monaco) {
21013
- if (!getState().monaco) {
21014
- setState({
21015
- monaco
21016
- });
21017
- }
21437
+ function _arrayWithHoles(r) {
21438
+ if (Array.isArray(r)) return r;
21018
21439
  }
21019
- function __getMonacoInstance() {
21020
- return getState(function(_ref4) {
21021
- var monaco = _ref4.monaco;
21022
- return monaco;
21023
- });
21440
+ function _defineProperty$1(e, r, t) {
21441
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
21442
+ value: t,
21443
+ enumerable: true,
21444
+ configurable: true,
21445
+ writable: true
21446
+ }) : e[r] = t, e;
21024
21447
  }
21025
- var wrapperPromise = new Promise(function(resolve, reject) {
21026
- return setState({
21027
- resolve,
21028
- reject
21029
- });
21030
- });
21031
- var loader = {
21032
- config,
21033
- init,
21034
- __getMonacoInstance
21035
- };
21036
- var le = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, v = le;
21037
- var ae = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, Y = ae;
21038
- function Me({ children: e }) {
21039
- return require$$0.createElement("div", { style: Y.container }, e);
21448
+ function _iterableToArrayLimit(r, l2) {
21449
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
21450
+ if (null != t) {
21451
+ var e, n, i, u, a = [], f = true, o = false;
21452
+ try {
21453
+ if (i = (t = t.call(r)).next, 0 === l2) ;
21454
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f = true) ;
21455
+ } catch (r2) {
21456
+ o = true, n = r2;
21457
+ } finally {
21458
+ try {
21459
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
21460
+ } finally {
21461
+ if (o) throw n;
21462
+ }
21463
+ }
21464
+ return a;
21465
+ }
21040
21466
  }
21041
- var Z = Me;
21042
- var $ = Z;
21043
- function Ee({ width: e, height: r, isEditorReady: n, loading: t, _ref: a, className: m, wrapperProps: E }) {
21044
- return require$$0.createElement("section", { style: { ...v.wrapper, width: e, height: r }, ...E }, !n && require$$0.createElement($, null, t), require$$0.createElement("div", { ref: a, style: { ...v.fullWidth, ...!n && v.hide }, className: m }));
21467
+ function _nonIterableRest() {
21468
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
21045
21469
  }
21046
- var ee = Ee;
21047
- var H = memo(ee);
21048
- function Ce(e) {
21049
- useEffect(e, []);
21470
+ function ownKeys$1(e, r) {
21471
+ var t = Object.keys(e);
21472
+ if (Object.getOwnPropertySymbols) {
21473
+ var o = Object.getOwnPropertySymbols(e);
21474
+ r && (o = o.filter(function(r2) {
21475
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
21476
+ })), t.push.apply(t, o);
21477
+ }
21478
+ return t;
21050
21479
  }
21051
- var k = Ce;
21052
- function he(e, r, n = true) {
21053
- let t = useRef(true);
21054
- useEffect(t.current || !n ? () => {
21055
- t.current = false;
21056
- } : e, r);
21480
+ function _objectSpread2$1(e) {
21481
+ for (var r = 1; r < arguments.length; r++) {
21482
+ var t = null != arguments[r] ? arguments[r] : {};
21483
+ r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) {
21484
+ _defineProperty$1(e, r2, t[r2]);
21485
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) {
21486
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
21487
+ });
21488
+ }
21489
+ return e;
21057
21490
  }
21058
- var l = he;
21059
- function D() {
21491
+ function _objectWithoutProperties(e, t) {
21492
+ if (null == e) return {};
21493
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
21494
+ if (Object.getOwnPropertySymbols) {
21495
+ var n = Object.getOwnPropertySymbols(e);
21496
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
21497
+ }
21498
+ return i;
21060
21499
  }
21061
- function h(e, r, n, t) {
21062
- return De(e, t) || be(e, r, n, t);
21500
+ function _objectWithoutPropertiesLoose(r, e) {
21501
+ if (null == r) return {};
21502
+ var t = {};
21503
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
21504
+ if (-1 !== e.indexOf(n)) continue;
21505
+ t[n] = r[n];
21506
+ }
21507
+ return t;
21063
21508
  }
21064
- function De(e, r) {
21065
- return e.editor.getModel(te(e, r));
21509
+ function _slicedToArray(r, e) {
21510
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
21066
21511
  }
21067
- function be(e, r, n, t) {
21068
- return e.editor.createModel(r, n, t ? te(e, t) : void 0);
21512
+ function _toPrimitive(t, r) {
21513
+ if ("object" != typeof t || !t) return t;
21514
+ var e = t[Symbol.toPrimitive];
21515
+ if (void 0 !== e) {
21516
+ var i = e.call(t, r);
21517
+ if ("object" != typeof i) return i;
21518
+ throw new TypeError("@@toPrimitive must return a primitive value.");
21519
+ }
21520
+ return ("string" === r ? String : Number)(t);
21069
21521
  }
21070
- function te(e, r) {
21071
- return e.Uri.parse(r);
21522
+ function _toPropertyKey(t) {
21523
+ var i = _toPrimitive(t, "string");
21524
+ return "symbol" == typeof i ? i : i + "";
21072
21525
  }
21073
- function Oe({ original: e, modified: r, language: n, originalLanguage: t, modifiedLanguage: a, originalModelPath: m, modifiedModelPath: E, keepCurrentOriginalModel: g = false, keepCurrentModifiedModel: N = false, theme: x = "light", loading: P = "Loading...", options: y = {}, height: V = "100%", width: z = "100%", className: F, wrapperProps: j = {}, beforeMount: A = D, onMount: q = D }) {
21074
- let [M, O] = useState(false), [T, s] = useState(true), u = useRef(null), c = useRef(null), w = useRef(null), d = useRef(q), o = useRef(A), b = useRef(false);
21075
- k(() => {
21076
- let i = loader.init();
21077
- return i.then((f) => (c.current = f) && s(false)).catch((f) => (f == null ? void 0 : f.type) !== "cancelation" && console.error("Monaco initialization: error:", f)), () => u.current ? I() : i.cancel();
21078
- }), l(() => {
21079
- if (u.current && c.current) {
21080
- let i = u.current.getOriginalEditor(), f = h(c.current, e || "", t || n || "text", m || "");
21081
- f !== i.getModel() && i.setModel(f);
21082
- }
21083
- }, [m], M), l(() => {
21084
- if (u.current && c.current) {
21085
- let i = u.current.getModifiedEditor(), f = h(c.current, r || "", a || n || "text", E || "");
21086
- f !== i.getModel() && i.setModel(f);
21087
- }
21088
- }, [E], M), l(() => {
21089
- let i = u.current.getModifiedEditor();
21090
- i.getOption(c.current.editor.EditorOption.readOnly) ? i.setValue(r || "") : r !== i.getValue() && (i.executeEdits("", [{ range: i.getModel().getFullModelRange(), text: r || "", forceMoveMarkers: true }]), i.pushUndoStop());
21091
- }, [r], M), l(() => {
21092
- var _a, _b;
21093
- (_b = (_a = u.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.original.setValue(e || "");
21094
- }, [e], M), l(() => {
21095
- let { original: i, modified: f } = u.current.getModel();
21096
- c.current.editor.setModelLanguage(i, t || n || "text"), c.current.editor.setModelLanguage(f, a || n || "text");
21097
- }, [n, t, a], M), l(() => {
21098
- var _a;
21099
- (_a = c.current) == null ? void 0 : _a.editor.setTheme(x);
21100
- }, [x], M), l(() => {
21101
- var _a;
21102
- (_a = u.current) == null ? void 0 : _a.updateOptions(y);
21103
- }, [y], M);
21104
- let L = useCallback(() => {
21105
- var _a;
21106
- if (!c.current) return;
21107
- o.current(c.current);
21108
- let i = h(c.current, e || "", t || n || "text", m || ""), f = h(c.current, r || "", a || n || "text", E || "");
21109
- (_a = u.current) == null ? void 0 : _a.setModel({ original: i, modified: f });
21110
- }, [n, r, a, e, t, m, E]), U = useCallback(() => {
21111
- var _a;
21112
- !b.current && w.current && (u.current = c.current.editor.createDiffEditor(w.current, { automaticLayout: true, ...y }), L(), (_a = c.current) == null ? void 0 : _a.editor.setTheme(x), O(true), b.current = true);
21113
- }, [y, x, L]);
21114
- useEffect(() => {
21115
- M && d.current(u.current, c.current);
21116
- }, [M]), useEffect(() => {
21117
- !T && !M && U();
21118
- }, [T, M, U]);
21119
- function I() {
21120
- var _a, _b, _c, _d;
21121
- let i = (_a = u.current) == null ? void 0 : _a.getModel();
21122
- g || ((_b = i == null ? void 0 : i.original) == null ? void 0 : _b.dispose()), N || ((_c = i == null ? void 0 : i.modified) == null ? void 0 : _c.dispose()), (_d = u.current) == null ? void 0 : _d.dispose();
21526
+ function _unsupportedIterableToArray(r, a) {
21527
+ if (r) {
21528
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
21529
+ var t = {}.toString.call(r).slice(8, -1);
21530
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
21123
21531
  }
21124
- return require$$0.createElement(H, { width: z, height: V, isEditorReady: M, loading: P, _ref: w, className: F, wrapperProps: j });
21125
21532
  }
21126
- var ie = Oe;
21127
- memo(ie);
21128
- function He(e) {
21129
- let r = useRef();
21130
- return useEffect(() => {
21131
- r.current = e;
21132
- }, [e]), r.current;
21533
+ function _defineProperty(obj, key, value) {
21534
+ if (key in obj) {
21535
+ Object.defineProperty(obj, key, {
21536
+ value,
21537
+ enumerable: true,
21538
+ configurable: true,
21539
+ writable: true
21540
+ });
21541
+ } else {
21542
+ obj[key] = value;
21543
+ }
21544
+ return obj;
21133
21545
  }
21134
- var se = He;
21135
- var _ = /* @__PURE__ */ new Map();
21136
- function Ve({ defaultValue: e, defaultLanguage: r, defaultPath: n, value: t, language: a, path: m, theme: E = "light", line: g, loading: N = "Loading...", options: x = {}, overrideServices: P = {}, saveViewState: y = true, keepCurrentModel: V = false, width: z = "100%", height: F = "100%", className: j, wrapperProps: A = {}, beforeMount: q = D, onMount: M = D, onChange: O, onValidate: T = D }) {
21137
- let [s, u] = useState(false), [c, w] = useState(true), d = useRef(null), o = useRef(null), b = useRef(null), L = useRef(M), U = useRef(q), I = useRef(), i = useRef(t), f = se(m), Q = useRef(false), B = useRef(false);
21138
- k(() => {
21139
- let p = loader.init();
21140
- return p.then((R) => (d.current = R) && w(false)).catch((R) => (R == null ? void 0 : R.type) !== "cancelation" && console.error("Monaco initialization: error:", R)), () => o.current ? pe() : p.cancel();
21141
- }), l(() => {
21142
- var _a, _b, _c, _d;
21143
- let p = h(d.current, e || t || "", r || a || "", m || n || "");
21144
- p !== ((_a = o.current) == null ? void 0 : _a.getModel()) && (y && _.set(f, (_b = o.current) == null ? void 0 : _b.saveViewState()), (_c = o.current) == null ? void 0 : _c.setModel(p), y && ((_d = o.current) == null ? void 0 : _d.restoreViewState(_.get(m))));
21145
- }, [m], s), l(() => {
21146
- var _a;
21147
- (_a = o.current) == null ? void 0 : _a.updateOptions(x);
21148
- }, [x], s), l(() => {
21149
- !o.current || t === void 0 || (o.current.getOption(d.current.editor.EditorOption.readOnly) ? o.current.setValue(t) : t !== o.current.getValue() && (B.current = true, o.current.executeEdits("", [{ range: o.current.getModel().getFullModelRange(), text: t, forceMoveMarkers: true }]), o.current.pushUndoStop(), B.current = false));
21150
- }, [t], s), l(() => {
21151
- var _a, _b;
21152
- let p = (_a = o.current) == null ? void 0 : _a.getModel();
21153
- p && a && ((_b = d.current) == null ? void 0 : _b.editor.setModelLanguage(p, a));
21154
- }, [a], s), l(() => {
21155
- var _a;
21156
- g !== void 0 && ((_a = o.current) == null ? void 0 : _a.revealLine(g));
21157
- }, [g], s), l(() => {
21158
- var _a;
21159
- (_a = d.current) == null ? void 0 : _a.editor.setTheme(E);
21160
- }, [E], s);
21161
- let X2 = useCallback(() => {
21162
- var _a;
21163
- if (!(!b.current || !d.current) && !Q.current) {
21164
- U.current(d.current);
21165
- let p = m || n, R = h(d.current, t || e || "", r || a || "", p || "");
21166
- o.current = (_a = d.current) == null ? void 0 : _a.editor.create(b.current, { model: R, automaticLayout: true, ...x }, P), y && o.current.restoreViewState(_.get(p)), d.current.editor.setTheme(E), g !== void 0 && o.current.revealLine(g), u(true), Q.current = true;
21167
- }
21168
- }, [e, r, n, t, a, m, x, P, y, E, g]);
21169
- useEffect(() => {
21170
- s && L.current(o.current, d.current);
21171
- }, [s]), useEffect(() => {
21172
- !c && !s && X2();
21173
- }, [c, s, X2]), i.current = t, useEffect(() => {
21174
- var _a, _b;
21175
- s && O && ((_a = I.current) == null ? void 0 : _a.dispose(), I.current = (_b = o.current) == null ? void 0 : _b.onDidChangeModelContent((p) => {
21176
- B.current || O(o.current.getValue(), p);
21177
- }));
21178
- }, [s, O]), useEffect(() => {
21179
- if (s) {
21180
- let p = d.current.editor.onDidChangeMarkers((R) => {
21181
- var _a;
21182
- let G = (_a = o.current.getModel()) == null ? void 0 : _a.uri;
21183
- if (G && R.find((J) => J.path === G.path)) {
21184
- let J = d.current.editor.getModelMarkers({ resource: G });
21185
- T == null ? void 0 : T(J);
21186
- }
21546
+ function ownKeys(object2, enumerableOnly) {
21547
+ var keys = Object.keys(object2);
21548
+ if (Object.getOwnPropertySymbols) {
21549
+ var symbols = Object.getOwnPropertySymbols(object2);
21550
+ if (enumerableOnly) symbols = symbols.filter(function(sym) {
21551
+ return Object.getOwnPropertyDescriptor(object2, sym).enumerable;
21552
+ });
21553
+ keys.push.apply(keys, symbols);
21554
+ }
21555
+ return keys;
21556
+ }
21557
+ function _objectSpread2(target) {
21558
+ for (var i = 1; i < arguments.length; i++) {
21559
+ var source = arguments[i] != null ? arguments[i] : {};
21560
+ if (i % 2) {
21561
+ ownKeys(Object(source), true).forEach(function(key) {
21562
+ _defineProperty(target, key, source[key]);
21563
+ });
21564
+ } else if (Object.getOwnPropertyDescriptors) {
21565
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
21566
+ } else {
21567
+ ownKeys(Object(source)).forEach(function(key) {
21568
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
21187
21569
  });
21188
- return () => {
21189
- p == null ? void 0 : p.dispose();
21190
- };
21191
21570
  }
21192
- return () => {
21193
- };
21194
- }, [s, T]);
21195
- function pe() {
21196
- var _a, _b;
21197
- (_a = I.current) == null ? void 0 : _a.dispose(), V ? y && _.set(m, o.current.saveViewState()) : (_b = o.current.getModel()) == null ? void 0 : _b.dispose(), o.current.dispose();
21198
21571
  }
21199
- return require$$0.createElement(H, { width: z, height: F, isEditorReady: s, loading: N, _ref: b, className: j, wrapperProps: A });
21572
+ return target;
21200
21573
  }
21201
- var fe = Ve;
21202
- var de = memo(fe);
21203
- var Ft = de;
21204
- function findPathLineNumbers(jsonString, paths) {
21205
- if (!paths || paths.length === 0) return [];
21206
- const lines = jsonString.split("\n");
21207
- const lineNumbers = [];
21208
- for (const path of paths) {
21209
- const pathParts = path.split(".");
21210
- const lastKey = pathParts[pathParts.length - 1];
21211
- const keyPattern = new RegExp(`^\\s*"${lastKey}"\\s*:`);
21212
- for (let i = 0; i < lines.length; i++) {
21213
- if (keyPattern.test(lines[i])) {
21214
- if (pathParts.length === 1) {
21215
- lineNumbers.push(i + 1);
21216
- } else {
21217
- let matchedParents = 0;
21218
- for (let j = i - 1; j >= 0 && matchedParents < pathParts.length - 1; j--) {
21219
- const parentKey = pathParts[pathParts.length - 2 - matchedParents];
21220
- const parentPattern = new RegExp(`^\\s*"${parentKey}"\\s*:`);
21221
- if (parentPattern.test(lines[j])) {
21222
- matchedParents++;
21223
- }
21224
- }
21225
- if (matchedParents >= Math.min(pathParts.length - 1, 2)) {
21226
- lineNumbers.push(i + 1);
21227
- }
21228
- }
21229
- }
21230
- }
21574
+ function compose$1() {
21575
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
21576
+ fns[_key] = arguments[_key];
21231
21577
  }
21232
- return [...new Set(lineNumbers)];
21578
+ return function(x) {
21579
+ return fns.reduceRight(function(y, f) {
21580
+ return f(y);
21581
+ }, x);
21582
+ };
21233
21583
  }
21234
- const defineThemes = (monaco) => {
21235
- monaco.editor.defineTheme("vscode-dark", {
21236
- base: "vs-dark",
21237
- inherit: true,
21238
- rules: [
21239
- { token: "string.key.json", foreground: "9CDCFE" },
21240
- { token: "string.value.json", foreground: "CE9178" },
21241
- { token: "number", foreground: "B5CEA8" },
21242
- { token: "keyword", foreground: "569CD6" },
21243
- { token: "delimiter", foreground: "D4D4D4" }
21244
- ],
21245
- colors: {
21246
- "editor.background": "#1e1e1e",
21247
- "editor.foreground": "#d4d4d4",
21248
- "editor.lineHighlightBackground": "#2d2d2d",
21249
- "editor.selectionBackground": "#264f78",
21250
- "editorCursor.foreground": "#aeafad",
21251
- "editorLineNumber.foreground": "#858585",
21252
- "editorLineNumber.activeForeground": "#c6c6c6",
21253
- "editorIndentGuide.background": "#404040",
21254
- "editorIndentGuide.activeBackground": "#707070",
21255
- "editor.selectionHighlightBackground": "#3a3d41",
21256
- "editorBracketMatch.background": "#0064001a",
21257
- "editorBracketMatch.border": "#888888",
21258
- "editorGutter.background": "#1e1e1e",
21259
- "scrollbarSlider.background": "#79797966",
21260
- "scrollbarSlider.hoverBackground": "#646464b3",
21261
- "scrollbarSlider.activeBackground": "#bfbfbf66",
21262
- "minimap.background": "#1e1e1e"
21263
- }
21264
- });
21265
- monaco.editor.defineTheme("vscode-light", {
21266
- base: "vs",
21267
- inherit: true,
21268
- rules: [
21269
- { token: "string.key.json", foreground: "0451A5" },
21270
- { token: "string.value.json", foreground: "A31515" },
21271
- { token: "number", foreground: "098658" },
21272
- { token: "keyword", foreground: "0000FF" },
21273
- { token: "delimiter", foreground: "000000" }
21274
- ],
21275
- colors: {
21276
- "editor.background": "#ffffff",
21277
- "editor.foreground": "#000000",
21278
- "editor.lineHighlightBackground": "#f5f5f5",
21279
- "editor.selectionBackground": "#add6ff",
21280
- "editorCursor.foreground": "#000000",
21281
- "editorLineNumber.foreground": "#999999",
21282
- "editorLineNumber.activeForeground": "#000000",
21283
- "editorIndentGuide.background": "#d3d3d3",
21284
- "editorIndentGuide.activeBackground": "#939393",
21285
- "editor.selectionHighlightBackground": "#add6ff4d",
21286
- "editorBracketMatch.background": "#0064001a",
21287
- "editorBracketMatch.border": "#b9b9b9",
21288
- "editorGutter.background": "#ffffff",
21289
- "scrollbarSlider.background": "#64646466",
21290
- "scrollbarSlider.hoverBackground": "#646464b3",
21291
- "scrollbarSlider.activeBackground": "#00000099",
21292
- "minimap.background": "#ffffff"
21584
+ function curry$1(fn) {
21585
+ return function curried() {
21586
+ var _this = this;
21587
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
21588
+ args[_key2] = arguments[_key2];
21293
21589
  }
21590
+ return args.length >= fn.length ? fn.apply(this, args) : function() {
21591
+ for (var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
21592
+ nextArgs[_key3] = arguments[_key3];
21593
+ }
21594
+ return curried.apply(_this, [].concat(args, nextArgs));
21595
+ };
21596
+ };
21597
+ }
21598
+ function isObject$1(value) {
21599
+ return {}.toString.call(value).includes("Object");
21600
+ }
21601
+ function isEmpty(obj) {
21602
+ return !Object.keys(obj).length;
21603
+ }
21604
+ function isFunction(value) {
21605
+ return typeof value === "function";
21606
+ }
21607
+ function hasOwnProperty(object2, property) {
21608
+ return Object.prototype.hasOwnProperty.call(object2, property);
21609
+ }
21610
+ function validateChanges(initial, changes) {
21611
+ if (!isObject$1(changes)) errorHandler$1("changeType");
21612
+ if (Object.keys(changes).some(function(field) {
21613
+ return !hasOwnProperty(initial, field);
21614
+ })) errorHandler$1("changeField");
21615
+ return changes;
21616
+ }
21617
+ function validateSelector(selector2) {
21618
+ if (!isFunction(selector2)) errorHandler$1("selectorType");
21619
+ }
21620
+ function validateHandler(handler) {
21621
+ if (!(isFunction(handler) || isObject$1(handler))) errorHandler$1("handlerType");
21622
+ if (isObject$1(handler) && Object.values(handler).some(function(_handler) {
21623
+ return !isFunction(_handler);
21624
+ })) errorHandler$1("handlersType");
21625
+ }
21626
+ function validateInitial(initial) {
21627
+ if (!initial) errorHandler$1("initialIsRequired");
21628
+ if (!isObject$1(initial)) errorHandler$1("initialType");
21629
+ if (isEmpty(initial)) errorHandler$1("initialContent");
21630
+ }
21631
+ function throwError$1(errorMessages2, type) {
21632
+ throw new Error(errorMessages2[type] || errorMessages2["default"]);
21633
+ }
21634
+ var errorMessages$1 = {
21635
+ initialIsRequired: "initial state is required",
21636
+ initialType: "initial state should be an object",
21637
+ initialContent: "initial state shouldn't be an empty object",
21638
+ handlerType: "handler should be an object or a function",
21639
+ handlersType: "all handlers should be a functions",
21640
+ selectorType: "selector should be a function",
21641
+ changeType: "provided value of changes should be an object",
21642
+ changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
21643
+ "default": "an unknown error accured in `state-local` package"
21644
+ };
21645
+ var errorHandler$1 = curry$1(throwError$1)(errorMessages$1);
21646
+ var validators$1 = {
21647
+ changes: validateChanges,
21648
+ selector: validateSelector,
21649
+ handler: validateHandler,
21650
+ initial: validateInitial
21651
+ };
21652
+ function create(initial) {
21653
+ var handler = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
21654
+ validators$1.initial(initial);
21655
+ validators$1.handler(handler);
21656
+ var state = {
21657
+ current: initial
21658
+ };
21659
+ var didUpdate = curry$1(didStateUpdate)(state, handler);
21660
+ var update = curry$1(updateState)(state);
21661
+ var validate = curry$1(validators$1.changes)(initial);
21662
+ var getChanges = curry$1(extractChanges)(state);
21663
+ function getState2() {
21664
+ var selector2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(state2) {
21665
+ return state2;
21666
+ };
21667
+ validators$1.selector(selector2);
21668
+ return selector2(state.current);
21669
+ }
21670
+ function setState2(causedChanges) {
21671
+ compose$1(didUpdate, update, validate, getChanges)(causedChanges);
21672
+ }
21673
+ return [getState2, setState2];
21674
+ }
21675
+ function extractChanges(state, causedChanges) {
21676
+ return isFunction(causedChanges) ? causedChanges(state.current) : causedChanges;
21677
+ }
21678
+ function updateState(state, changes) {
21679
+ state.current = _objectSpread2(_objectSpread2({}, state.current), changes);
21680
+ return changes;
21681
+ }
21682
+ function didStateUpdate(state, handler, changes) {
21683
+ isFunction(handler) ? handler(state.current) : Object.keys(changes).forEach(function(field) {
21684
+ var _handler$field;
21685
+ return (_handler$field = handler[field]) === null || _handler$field === void 0 ? void 0 : _handler$field.call(handler, state.current[field]);
21294
21686
  });
21687
+ return changes;
21688
+ }
21689
+ var index = {
21690
+ create
21295
21691
  };
21296
- function JsonEditor({
21297
- value,
21298
- onChange,
21299
- readOnly = false,
21300
- className = "",
21301
- theme = "dark",
21302
- onCursorChange,
21303
- highlightedPaths
21304
- }) {
21305
- const editorRef = useRef(null);
21306
- const decorationsRef = useRef([]);
21307
- const handleEditorMount = useCallback((editor, monaco) => {
21308
- editorRef.current = editor;
21309
- monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
21310
- validate: true,
21311
- schemas: [],
21312
- allowComments: false,
21313
- trailingCommas: "error"
21314
- });
21315
- if (onCursorChange) {
21316
- editor.onDidChangeCursorPosition((e) => {
21317
- onCursorChange(e.position.lineNumber, e.position.column);
21318
- });
21319
- }
21320
- if (!readOnly) {
21321
- editor.focus();
21692
+ var config$1 = {
21693
+ paths: {
21694
+ vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"
21695
+ }
21696
+ };
21697
+ function curry(fn) {
21698
+ return function curried() {
21699
+ var _this = this;
21700
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
21701
+ args[_key] = arguments[_key];
21322
21702
  }
21323
- }, [onCursorChange, readOnly]);
21324
- useEffect(() => {
21325
- if (!editorRef.current || !highlightedPaths || highlightedPaths.length === 0) {
21326
- if (editorRef.current && decorationsRef.current.length > 0) {
21327
- decorationsRef.current = editorRef.current.deltaDecorations(decorationsRef.current, []);
21703
+ return args.length >= fn.length ? fn.apply(this, args) : function() {
21704
+ for (var _len2 = arguments.length, nextArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
21705
+ nextArgs[_key2] = arguments[_key2];
21706
+ }
21707
+ return curried.apply(_this, [].concat(args, nextArgs));
21708
+ };
21709
+ };
21710
+ }
21711
+ function isObject(value) {
21712
+ return {}.toString.call(value).includes("Object");
21713
+ }
21714
+ function validateConfig(config2) {
21715
+ if (!config2) errorHandler("configIsRequired");
21716
+ if (!isObject(config2)) errorHandler("configType");
21717
+ if (config2.urls) {
21718
+ informAboutDeprecation();
21719
+ return {
21720
+ paths: {
21721
+ vs: config2.urls.monacoBase
21722
+ }
21723
+ };
21724
+ }
21725
+ return config2;
21726
+ }
21727
+ function informAboutDeprecation() {
21728
+ console.warn(errorMessages.deprecation);
21729
+ }
21730
+ function throwError(errorMessages2, type) {
21731
+ throw new Error(errorMessages2[type] || errorMessages2["default"]);
21732
+ }
21733
+ var errorMessages = {
21734
+ configIsRequired: "the configuration object is required",
21735
+ configType: "the configuration object should be an object",
21736
+ "default": "an unknown error accured in `@monaco-editor/loader` package",
21737
+ deprecation: "Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "
21738
+ };
21739
+ var errorHandler = curry(throwError)(errorMessages);
21740
+ var validators = {
21741
+ config: validateConfig
21742
+ };
21743
+ var compose = function compose2() {
21744
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
21745
+ fns[_key] = arguments[_key];
21746
+ }
21747
+ return function(x) {
21748
+ return fns.reduceRight(function(y, f) {
21749
+ return f(y);
21750
+ }, x);
21751
+ };
21752
+ };
21753
+ function merge(target, source) {
21754
+ Object.keys(source).forEach(function(key) {
21755
+ if (source[key] instanceof Object) {
21756
+ if (target[key]) {
21757
+ Object.assign(source[key], merge(target[key], source[key]));
21328
21758
  }
21329
- return;
21330
- }
21331
- const lineNumbers = findPathLineNumbers(value, highlightedPaths);
21332
- if (lineNumbers.length > 0) {
21333
- const decorations = lineNumbers.map((lineNumber) => ({
21334
- range: {
21335
- startLineNumber: lineNumber,
21336
- startColumn: 1,
21337
- endLineNumber: lineNumber,
21338
- endColumn: 1
21339
- },
21340
- options: {
21341
- isWholeLine: true,
21342
- className: "df-highlighted-line",
21343
- glyphMarginClassName: "df-highlighted-glyph",
21344
- overviewRuler: {
21345
- color: theme === "dark" ? "#4ec9b0" : "#388a34",
21346
- position: 1
21347
- // Left
21348
- }
21349
- }
21350
- }));
21351
- decorationsRef.current = editorRef.current.deltaDecorations(
21352
- decorationsRef.current,
21353
- decorations
21354
- );
21355
- } else {
21356
- decorationsRef.current = editorRef.current.deltaDecorations(decorationsRef.current, []);
21357
21759
  }
21358
- }, [value, highlightedPaths, theme]);
21359
- const handleChange = useCallback((newValue) => {
21360
- onChange(newValue || "");
21361
- }, [onChange]);
21362
- return /* @__PURE__ */ jsx("div", { className: `df-monaco-editor-wrapper ${className}`, children: /* @__PURE__ */ jsx(
21363
- Ft,
21364
- {
21365
- height: "100%",
21366
- defaultLanguage: "json",
21367
- value,
21368
- onChange: handleChange,
21369
- onMount: handleEditorMount,
21370
- beforeMount: defineThemes,
21371
- theme: theme === "dark" ? "vscode-dark" : "vscode-light",
21372
- options: {
21373
- readOnly,
21374
- minimap: { enabled: false },
21375
- fontSize: 13,
21376
- fontFamily: "'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace",
21377
- lineHeight: 20,
21378
- tabSize: 2,
21379
- insertSpaces: true,
21380
- automaticLayout: true,
21381
- scrollBeyondLastLine: false,
21382
- wordWrap: "on",
21383
- wrappingIndent: "indent",
21384
- folding: true,
21385
- foldingStrategy: "indentation",
21386
- showFoldingControls: "mouseover",
21387
- bracketPairColorization: { enabled: true },
21388
- guides: {
21389
- bracketPairs: false,
21390
- indentation: false,
21391
- highlightActiveBracketPair: true,
21392
- highlightActiveIndentation: false
21393
- },
21394
- renderLineHighlight: readOnly ? "none" : "line",
21395
- selectOnLineNumbers: true,
21396
- roundedSelection: true,
21397
- cursorBlinking: "smooth",
21398
- cursorSmoothCaretAnimation: "on",
21399
- smoothScrolling: true,
21400
- padding: { top: 8, bottom: 8 },
21401
- scrollbar: {
21402
- vertical: "auto",
21403
- horizontal: "auto",
21404
- verticalScrollbarSize: 10,
21405
- horizontalScrollbarSize: 10
21406
- },
21407
- overviewRulerBorder: false,
21408
- hideCursorInOverviewRuler: true,
21409
- contextmenu: true,
21410
- quickSuggestions: false,
21411
- suggestOnTriggerCharacters: false,
21412
- acceptSuggestionOnEnter: "off",
21413
- formatOnPaste: true,
21414
- formatOnType: false,
21415
- glyphMargin: highlightedPaths && highlightedPaths.length > 0
21416
- }
21417
- }
21418
- ) });
21760
+ });
21761
+ return _objectSpread2$1(_objectSpread2$1({}, target), source);
21419
21762
  }
21420
- class ErrorBoundary extends Component {
21421
- constructor(props) {
21422
- super(props);
21423
- this.state = { hasError: false, error: null };
21424
- }
21425
- static getDerivedStateFromError(error) {
21426
- return { hasError: true, error };
21427
- }
21428
- componentDidCatch(error, errorInfo) {
21429
- console.error("ErrorBoundary caught an error:", error, errorInfo);
21430
- }
21431
- render() {
21432
- var _a;
21433
- if (this.state.hasError) {
21434
- if (this.props.fallback) {
21435
- return this.props.fallback;
21436
- }
21437
- return /* @__PURE__ */ jsx("div", { className: "df-error-boundary", children: /* @__PURE__ */ jsxs("div", { className: "df-error-boundary-content", children: [
21438
- /* @__PURE__ */ jsx("h3", { className: "df-error-boundary-title", children: "Something went wrong" }),
21439
- /* @__PURE__ */ jsx("p", { className: "df-error-boundary-message", children: ((_a = this.state.error) == null ? void 0 : _a.message) || "An unexpected error occurred" }),
21440
- /* @__PURE__ */ jsx(
21441
- "button",
21442
- {
21443
- className: "df-error-boundary-button",
21444
- onClick: () => this.setState({ hasError: false, error: null }),
21445
- children: "Try again"
21446
- }
21447
- )
21448
- ] }) });
21763
+ var CANCELATION_MESSAGE = {
21764
+ type: "cancelation",
21765
+ msg: "operation is manually canceled"
21766
+ };
21767
+ function makeCancelable(promise) {
21768
+ var hasCanceled_ = false;
21769
+ var wrappedPromise = new Promise(function(resolve, reject) {
21770
+ promise.then(function(val) {
21771
+ return hasCanceled_ ? reject(CANCELATION_MESSAGE) : resolve(val);
21772
+ });
21773
+ promise["catch"](reject);
21774
+ });
21775
+ return wrappedPromise.cancel = function() {
21776
+ return hasCanceled_ = true;
21777
+ }, wrappedPromise;
21778
+ }
21779
+ var _excluded = ["monaco"];
21780
+ var _state$create = index.create({
21781
+ config: config$1,
21782
+ isInitialized: false,
21783
+ resolve: null,
21784
+ reject: null,
21785
+ monaco: null
21786
+ }), _state$create2 = _slicedToArray(_state$create, 2), getState = _state$create2[0], setState = _state$create2[1];
21787
+ function config(globalConfig) {
21788
+ var _validators$config = validators.config(globalConfig), monaco = _validators$config.monaco, config2 = _objectWithoutProperties(_validators$config, _excluded);
21789
+ setState(function(state) {
21790
+ return {
21791
+ config: merge(state.config, config2),
21792
+ monaco
21793
+ };
21794
+ });
21795
+ }
21796
+ function init() {
21797
+ var state = getState(function(_ref) {
21798
+ var monaco = _ref.monaco, isInitialized = _ref.isInitialized, resolve = _ref.resolve;
21799
+ return {
21800
+ monaco,
21801
+ isInitialized,
21802
+ resolve
21803
+ };
21804
+ });
21805
+ if (!state.isInitialized) {
21806
+ setState({
21807
+ isInitialized: true
21808
+ });
21809
+ if (state.monaco) {
21810
+ state.resolve(state.monaco);
21811
+ return makeCancelable(wrapperPromise);
21449
21812
  }
21450
- return this.props.children;
21813
+ if (window.monaco && window.monaco.editor) {
21814
+ storeMonacoInstance(window.monaco);
21815
+ state.resolve(window.monaco);
21816
+ return makeCancelable(wrapperPromise);
21817
+ }
21818
+ compose(injectScripts, getMonacoLoaderScript)(configureLoader);
21451
21819
  }
21820
+ return makeCancelable(wrapperPromise);
21452
21821
  }
21453
- function getSelectionInfo(selection2) {
21454
- switch (selection2.type) {
21455
- case "workflow-condition":
21456
- return {
21457
- title: "Workflow Condition",
21458
- subtitle: selection2.workflow.name
21459
- };
21460
- case "task":
21461
- return {
21462
- title: selection2.task.name,
21463
- subtitle: `${selection2.workflow.name} / ${selection2.task.function.name}`
21464
- };
21465
- case "task-condition":
21466
- return {
21467
- title: "Task Condition",
21468
- subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
21469
- };
21470
- case "mapping":
21471
- return {
21472
- title: selection2.mapping.path,
21473
- subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
21474
- };
21475
- case "validation-rule":
21476
- return {
21477
- title: selection2.rule.message,
21478
- subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
21479
- };
21480
- default:
21481
- return null;
21822
+ function injectScripts(script) {
21823
+ return document.body.appendChild(script);
21824
+ }
21825
+ function createScript(src) {
21826
+ var script = document.createElement("script");
21827
+ return src && (script.src = src), script;
21828
+ }
21829
+ function getMonacoLoaderScript(configureLoader2) {
21830
+ var state = getState(function(_ref2) {
21831
+ var config2 = _ref2.config, reject = _ref2.reject;
21832
+ return {
21833
+ config: config2,
21834
+ reject
21835
+ };
21836
+ });
21837
+ var loaderScript = createScript("".concat(state.config.paths.vs, "/loader.js"));
21838
+ loaderScript.onload = function() {
21839
+ return configureLoader2();
21840
+ };
21841
+ loaderScript.onerror = state.reject;
21842
+ return loaderScript;
21843
+ }
21844
+ function configureLoader() {
21845
+ var state = getState(function(_ref3) {
21846
+ var config2 = _ref3.config, resolve = _ref3.resolve, reject = _ref3.reject;
21847
+ return {
21848
+ config: config2,
21849
+ resolve,
21850
+ reject
21851
+ };
21852
+ });
21853
+ var require2 = window.require;
21854
+ require2.config(state.config);
21855
+ require2(["vs/editor/editor.main"], function(loaded) {
21856
+ var monaco = loaded.m || loaded;
21857
+ storeMonacoInstance(monaco);
21858
+ state.resolve(monaco);
21859
+ }, function(error) {
21860
+ state.reject(error);
21861
+ });
21862
+ }
21863
+ function storeMonacoInstance(monaco) {
21864
+ if (!getState().monaco) {
21865
+ setState({
21866
+ monaco
21867
+ });
21868
+ }
21869
+ }
21870
+ function __getMonacoInstance() {
21871
+ return getState(function(_ref4) {
21872
+ var monaco = _ref4.monaco;
21873
+ return monaco;
21874
+ });
21875
+ }
21876
+ var wrapperPromise = new Promise(function(resolve, reject) {
21877
+ return setState({
21878
+ resolve,
21879
+ reject
21880
+ });
21881
+ });
21882
+ var loader = {
21883
+ config,
21884
+ init,
21885
+ __getMonacoInstance
21886
+ };
21887
+ var le = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, v = le;
21888
+ var ae = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, Y = ae;
21889
+ function Me({ children: e }) {
21890
+ return require$$0.createElement("div", { style: Y.container }, e);
21891
+ }
21892
+ var Z = Me;
21893
+ var $ = Z;
21894
+ function Ee({ width: e, height: r, isEditorReady: n, loading: t, _ref: a, className: m, wrapperProps: E }) {
21895
+ return require$$0.createElement("section", { style: { ...v.wrapper, width: e, height: r }, ...E }, !n && require$$0.createElement($, null, t), require$$0.createElement("div", { ref: a, style: { ...v.fullWidth, ...!n && v.hide }, className: m }));
21896
+ }
21897
+ var ee = Ee;
21898
+ var H = memo(ee);
21899
+ function Ce(e) {
21900
+ useEffect(e, []);
21901
+ }
21902
+ var k = Ce;
21903
+ function he(e, r, n = true) {
21904
+ let t = useRef(true);
21905
+ useEffect(t.current || !n ? () => {
21906
+ t.current = false;
21907
+ } : e, r);
21908
+ }
21909
+ var l = he;
21910
+ function D() {
21911
+ }
21912
+ function h(e, r, n, t) {
21913
+ return De(e, t) || be(e, r, n, t);
21914
+ }
21915
+ function De(e, r) {
21916
+ return e.editor.getModel(te(e, r));
21917
+ }
21918
+ function be(e, r, n, t) {
21919
+ return e.editor.createModel(r, n, t ? te(e, t) : void 0);
21920
+ }
21921
+ function te(e, r) {
21922
+ return e.Uri.parse(r);
21923
+ }
21924
+ function Oe({ original: e, modified: r, language: n, originalLanguage: t, modifiedLanguage: a, originalModelPath: m, modifiedModelPath: E, keepCurrentOriginalModel: g = false, keepCurrentModifiedModel: N = false, theme: x = "light", loading: P = "Loading...", options: y = {}, height: V = "100%", width: z = "100%", className: F, wrapperProps: j = {}, beforeMount: A = D, onMount: q = D }) {
21925
+ let [M, O] = useState(false), [T, s] = useState(true), u = useRef(null), c = useRef(null), w = useRef(null), d = useRef(q), o = useRef(A), b = useRef(false);
21926
+ k(() => {
21927
+ let i = loader.init();
21928
+ return i.then((f) => (c.current = f) && s(false)).catch((f) => (f == null ? void 0 : f.type) !== "cancelation" && console.error("Monaco initialization: error:", f)), () => u.current ? I() : i.cancel();
21929
+ }), l(() => {
21930
+ if (u.current && c.current) {
21931
+ let i = u.current.getOriginalEditor(), f = h(c.current, e || "", t || n || "text", m || "");
21932
+ f !== i.getModel() && i.setModel(f);
21933
+ }
21934
+ }, [m], M), l(() => {
21935
+ if (u.current && c.current) {
21936
+ let i = u.current.getModifiedEditor(), f = h(c.current, r || "", a || n || "text", E || "");
21937
+ f !== i.getModel() && i.setModel(f);
21938
+ }
21939
+ }, [E], M), l(() => {
21940
+ let i = u.current.getModifiedEditor();
21941
+ i.getOption(c.current.editor.EditorOption.readOnly) ? i.setValue(r || "") : r !== i.getValue() && (i.executeEdits("", [{ range: i.getModel().getFullModelRange(), text: r || "", forceMoveMarkers: true }]), i.pushUndoStop());
21942
+ }, [r], M), l(() => {
21943
+ var _a, _b;
21944
+ (_b = (_a = u.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.original.setValue(e || "");
21945
+ }, [e], M), l(() => {
21946
+ let { original: i, modified: f } = u.current.getModel();
21947
+ c.current.editor.setModelLanguage(i, t || n || "text"), c.current.editor.setModelLanguage(f, a || n || "text");
21948
+ }, [n, t, a], M), l(() => {
21949
+ var _a;
21950
+ (_a = c.current) == null ? void 0 : _a.editor.setTheme(x);
21951
+ }, [x], M), l(() => {
21952
+ var _a;
21953
+ (_a = u.current) == null ? void 0 : _a.updateOptions(y);
21954
+ }, [y], M);
21955
+ let L = useCallback(() => {
21956
+ var _a;
21957
+ if (!c.current) return;
21958
+ o.current(c.current);
21959
+ let i = h(c.current, e || "", t || n || "text", m || ""), f = h(c.current, r || "", a || n || "text", E || "");
21960
+ (_a = u.current) == null ? void 0 : _a.setModel({ original: i, modified: f });
21961
+ }, [n, r, a, e, t, m, E]), U = useCallback(() => {
21962
+ var _a;
21963
+ !b.current && w.current && (u.current = c.current.editor.createDiffEditor(w.current, { automaticLayout: true, ...y }), L(), (_a = c.current) == null ? void 0 : _a.editor.setTheme(x), O(true), b.current = true);
21964
+ }, [y, x, L]);
21965
+ useEffect(() => {
21966
+ M && d.current(u.current, c.current);
21967
+ }, [M]), useEffect(() => {
21968
+ !T && !M && U();
21969
+ }, [T, M, U]);
21970
+ function I() {
21971
+ var _a, _b, _c, _d;
21972
+ let i = (_a = u.current) == null ? void 0 : _a.getModel();
21973
+ g || ((_b = i == null ? void 0 : i.original) == null ? void 0 : _b.dispose()), N || ((_c = i == null ? void 0 : i.modified) == null ? void 0 : _c.dispose()), (_d = u.current) == null ? void 0 : _d.dispose();
21482
21974
  }
21975
+ return require$$0.createElement(H, { width: z, height: V, isEditorReady: M, loading: P, _ref: w, className: F, wrapperProps: j });
21483
21976
  }
21484
- function VisualizerInner({
21485
- workflows,
21486
- onTaskSelect,
21487
- onWorkflowSelect,
21488
- executionResult,
21489
- debugMode = false
21490
- }) {
21491
- const { resolvedTheme } = useTheme();
21492
- const debuggerContext = debugMode ? useDebugger() : null;
21493
- const [selection2, setSelection] = useState({ type: "none" });
21494
- const [leftPanelWidth, setLeftPanelWidth] = useState(280);
21495
- const [isDragging, setIsDragging] = useState(false);
21496
- const [treePanelHeight, setTreePanelHeight] = useState(50);
21497
- const [isVerticalDragging, setIsVerticalDragging] = useState(false);
21498
- const containerRef = useRef(null);
21499
- const leftPanelRef = useRef(null);
21500
- const handleSelection = (newSelection) => {
21501
- setSelection(newSelection);
21502
- if (newSelection.type === "workflow-condition") {
21503
- onWorkflowSelect == null ? void 0 : onWorkflowSelect(newSelection.workflow);
21504
- } else if (newSelection.type === "task" || newSelection.type === "task-condition" || newSelection.type === "mapping" || newSelection.type === "validation-rule") {
21505
- onTaskSelect == null ? void 0 : onTaskSelect(newSelection.task, newSelection.workflow);
21977
+ var ie = Oe;
21978
+ memo(ie);
21979
+ function He(e) {
21980
+ let r = useRef();
21981
+ return useEffect(() => {
21982
+ r.current = e;
21983
+ }, [e]), r.current;
21984
+ }
21985
+ var se = He;
21986
+ var _ = /* @__PURE__ */ new Map();
21987
+ function Ve({ defaultValue: e, defaultLanguage: r, defaultPath: n, value: t, language: a, path: m, theme: E = "light", line: g, loading: N = "Loading...", options: x = {}, overrideServices: P = {}, saveViewState: y = true, keepCurrentModel: V = false, width: z = "100%", height: F = "100%", className: j, wrapperProps: A = {}, beforeMount: q = D, onMount: M = D, onChange: O, onValidate: T = D }) {
21988
+ let [s, u] = useState(false), [c, w] = useState(true), d = useRef(null), o = useRef(null), b = useRef(null), L = useRef(M), U = useRef(q), I = useRef(), i = useRef(t), f = se(m), Q = useRef(false), B = useRef(false);
21989
+ k(() => {
21990
+ let p = loader.init();
21991
+ return p.then((R) => (d.current = R) && w(false)).catch((R) => (R == null ? void 0 : R.type) !== "cancelation" && console.error("Monaco initialization: error:", R)), () => o.current ? pe() : p.cancel();
21992
+ }), l(() => {
21993
+ var _a, _b, _c, _d;
21994
+ let p = h(d.current, e || t || "", r || a || "", m || n || "");
21995
+ p !== ((_a = o.current) == null ? void 0 : _a.getModel()) && (y && _.set(f, (_b = o.current) == null ? void 0 : _b.saveViewState()), (_c = o.current) == null ? void 0 : _c.setModel(p), y && ((_d = o.current) == null ? void 0 : _d.restoreViewState(_.get(m))));
21996
+ }, [m], s), l(() => {
21997
+ var _a;
21998
+ (_a = o.current) == null ? void 0 : _a.updateOptions(x);
21999
+ }, [x], s), l(() => {
22000
+ !o.current || t === void 0 || (o.current.getOption(d.current.editor.EditorOption.readOnly) ? o.current.setValue(t) : t !== o.current.getValue() && (B.current = true, o.current.executeEdits("", [{ range: o.current.getModel().getFullModelRange(), text: t, forceMoveMarkers: true }]), o.current.pushUndoStop(), B.current = false));
22001
+ }, [t], s), l(() => {
22002
+ var _a, _b;
22003
+ let p = (_a = o.current) == null ? void 0 : _a.getModel();
22004
+ p && a && ((_b = d.current) == null ? void 0 : _b.editor.setModelLanguage(p, a));
22005
+ }, [a], s), l(() => {
22006
+ var _a;
22007
+ g !== void 0 && ((_a = o.current) == null ? void 0 : _a.revealLine(g));
22008
+ }, [g], s), l(() => {
22009
+ var _a;
22010
+ (_a = d.current) == null ? void 0 : _a.editor.setTheme(E);
22011
+ }, [E], s);
22012
+ let X2 = useCallback(() => {
22013
+ var _a;
22014
+ if (!(!b.current || !d.current) && !Q.current) {
22015
+ U.current(d.current);
22016
+ let p = m || n, R = h(d.current, t || e || "", r || a || "", p || "");
22017
+ o.current = (_a = d.current) == null ? void 0 : _a.editor.create(b.current, { model: R, automaticLayout: true, ...x }, P), y && o.current.restoreViewState(_.get(p)), d.current.editor.setTheme(E), g !== void 0 && o.current.revealLine(g), u(true), Q.current = true;
21506
22018
  }
21507
- };
21508
- const handleMouseDown = useCallback((e) => {
21509
- e.preventDefault();
21510
- setIsDragging(true);
21511
- }, []);
21512
- const handleVerticalMouseDown = useCallback((e) => {
21513
- e.preventDefault();
21514
- setIsVerticalDragging(true);
21515
- }, []);
21516
- useEffect(() => {
21517
- if (!isDragging) return;
21518
- const handleMouseMove = (e) => {
21519
- if (containerRef.current) {
21520
- const rect = containerRef.current.getBoundingClientRect();
21521
- const newWidth = e.clientX - rect.left;
21522
- setLeftPanelWidth(Math.max(200, Math.min(450, newWidth)));
21523
- }
21524
- };
21525
- const handleMouseUp = () => {
21526
- setIsDragging(false);
21527
- };
21528
- document.addEventListener("mousemove", handleMouseMove);
21529
- document.addEventListener("mouseup", handleMouseUp);
21530
- return () => {
21531
- document.removeEventListener("mousemove", handleMouseMove);
21532
- document.removeEventListener("mouseup", handleMouseUp);
21533
- };
21534
- }, [isDragging]);
22019
+ }, [e, r, n, t, a, m, x, P, y, E, g]);
21535
22020
  useEffect(() => {
21536
- if (!isVerticalDragging) return;
21537
- const handleMouseMove = (e) => {
21538
- if (leftPanelRef.current) {
21539
- const rect = leftPanelRef.current.getBoundingClientRect();
21540
- const relativeY = e.clientY - rect.top;
21541
- const percentage = relativeY / rect.height * 100;
21542
- setTreePanelHeight(Math.max(20, Math.min(80, percentage)));
21543
- }
21544
- };
21545
- const handleMouseUp = () => {
21546
- setIsVerticalDragging(false);
21547
- };
21548
- document.addEventListener("mousemove", handleMouseMove);
21549
- document.addEventListener("mouseup", handleMouseUp);
22021
+ s && L.current(o.current, d.current);
22022
+ }, [s]), useEffect(() => {
22023
+ !c && !s && X2();
22024
+ }, [c, s, X2]), i.current = t, useEffect(() => {
22025
+ var _a, _b;
22026
+ s && O && ((_a = I.current) == null ? void 0 : _a.dispose(), I.current = (_b = o.current) == null ? void 0 : _b.onDidChangeModelContent((p) => {
22027
+ B.current || O(o.current.getValue(), p);
22028
+ }));
22029
+ }, [s, O]), useEffect(() => {
22030
+ if (s) {
22031
+ let p = d.current.editor.onDidChangeMarkers((R) => {
22032
+ var _a;
22033
+ let G = (_a = o.current.getModel()) == null ? void 0 : _a.uri;
22034
+ if (G && R.find((J) => J.path === G.path)) {
22035
+ let J = d.current.editor.getModelMarkers({ resource: G });
22036
+ T == null ? void 0 : T(J);
22037
+ }
22038
+ });
22039
+ return () => {
22040
+ p == null ? void 0 : p.dispose();
22041
+ };
22042
+ }
21550
22043
  return () => {
21551
- document.removeEventListener("mousemove", handleMouseMove);
21552
- document.removeEventListener("mouseup", handleMouseUp);
21553
22044
  };
21554
- }, [isVerticalDragging]);
21555
- const selectionInfo = getSelectionInfo(selection2);
21556
- const hasDebugTrace = debugMode && (debuggerContext == null ? void 0 : debuggerContext.hasTrace);
21557
- const displayMessage = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.currentMessage : executionResult;
21558
- const currentChanges = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.currentChanges : [];
21559
- const currentStepIndex = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.state.currentStepIndex : -1;
21560
- const highlightedPaths = useMemo(() => {
21561
- if (!currentChanges || currentChanges.length === 0) return void 0;
21562
- return currentChanges.map((change) => change.path);
21563
- }, [currentChanges]);
21564
- const isDraggingAny = isDragging || isVerticalDragging;
21565
- return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(
21566
- "div",
21567
- {
21568
- ref: containerRef,
21569
- className: `df-visualizer-horizontal df-theme-${resolvedTheme} ${isDraggingAny ? "df-dragging" : ""}`,
21570
- children: [
21571
- /* @__PURE__ */ jsxs(
21572
- "div",
21573
- {
21574
- ref: leftPanelRef,
21575
- className: "df-visualizer-left",
21576
- style: { width: leftPanelWidth },
21577
- children: [
21578
- /* @__PURE__ */ jsxs(
21579
- "div",
21580
- {
21581
- className: `df-visualizer-left-tree ${displayMessage ? "df-with-result" : ""}`,
21582
- style: displayMessage ? { height: `${treePanelHeight}%` } : void 0,
21583
- children: [
21584
- /* @__PURE__ */ jsx("div", { className: "df-visualizer-left-header", children: /* @__PURE__ */ jsx("span", { className: "df-visualizer-left-title", children: "Explorer" }) }),
21585
- /* @__PURE__ */ jsx("div", { className: "df-visualizer-left-content", children: workflows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "df-empty-state", children: /* @__PURE__ */ jsx("p", { children: "No workflows to display" }) }) : /* @__PURE__ */ jsx(
21586
- TreeView,
21587
- {
21588
- workflows,
21589
- selection: selection2,
21590
- onSelect: handleSelection,
21591
- debugMode
21592
- }
21593
- ) })
21594
- ]
21595
- }
21596
- ),
21597
- displayMessage && /* @__PURE__ */ jsx(
21598
- "div",
21599
- {
21600
- className: `df-visualizer-divider-horizontal ${isVerticalDragging ? "df-divider-active" : ""}`,
21601
- onMouseDown: handleVerticalMouseDown
21602
- }
21603
- ),
21604
- displayMessage && /* @__PURE__ */ jsxs(
21605
- "div",
21606
- {
21607
- className: "df-visualizer-result-panel",
21608
- style: { height: `${100 - treePanelHeight}%` },
21609
- children: [
21610
- /* @__PURE__ */ jsxs("div", { className: "df-visualizer-result-header", children: [
21611
- /* @__PURE__ */ jsx("span", { className: "df-visualizer-result-title", children: hasDebugTrace ? currentStepIndex !== void 0 && currentStepIndex >= 0 ? `Step ${currentStepIndex + 1}` : "Ready" : "Result" }),
21612
- hasDebugTrace && currentChanges && currentChanges.length > 0 && /* @__PURE__ */ jsxs("span", { className: "df-visualizer-result-changes", children: [
21613
- currentChanges.length,
21614
- " change",
21615
- currentChanges.length !== 1 ? "s" : ""
21616
- ] })
21617
- ] }),
21618
- /* @__PURE__ */ jsx("div", { className: "df-visualizer-result-content", children: /* @__PURE__ */ jsx(
21619
- JsonEditor,
21620
- {
21621
- value: JSON.stringify(displayMessage, null, 2),
21622
- onChange: () => {
21623
- },
21624
- readOnly: true,
21625
- theme: resolvedTheme === "dark" ? "dark" : "light",
21626
- highlightedPaths
21627
- }
21628
- ) })
21629
- ]
21630
- }
21631
- )
21632
- ]
21633
- }
21634
- ),
21635
- /* @__PURE__ */ jsx(
21636
- "div",
21637
- {
21638
- className: `df-visualizer-divider ${isDragging ? "df-divider-active" : ""}`,
21639
- onMouseDown: handleMouseDown
21640
- }
21641
- ),
21642
- /* @__PURE__ */ jsxs("div", { className: "df-visualizer-right", children: [
21643
- selectionInfo && /* @__PURE__ */ jsx("div", { className: "df-details-header", children: /* @__PURE__ */ jsxs("div", { className: "df-details-header-info", children: [
21644
- /* @__PURE__ */ jsx("span", { className: "df-details-header-title", children: selectionInfo.title }),
21645
- /* @__PURE__ */ jsx("span", { className: "df-details-header-subtitle", children: selectionInfo.subtitle })
21646
- ] }) }),
21647
- /* @__PURE__ */ jsx(DetailsPanel, { selection: selection2 })
21648
- ] })
21649
- ]
21650
- }
21651
- ) });
21652
- }
21653
- function WorkflowVisualizer({
21654
- workflows,
21655
- onWorkflowSelect,
21656
- onTaskSelect,
21657
- theme = "system",
21658
- className = "",
21659
- executionResult,
21660
- debugMode = false
21661
- }) {
21662
- return /* @__PURE__ */ jsx(ThemeProvider, { defaultTheme: theme, children: /* @__PURE__ */ jsx("div", { className: `df-root ${className}`, children: /* @__PURE__ */ jsx(
21663
- VisualizerInner,
21664
- {
21665
- workflows,
21666
- onTaskSelect,
21667
- onWorkflowSelect,
21668
- executionResult,
21669
- debugMode
21670
- }
21671
- ) }) });
22045
+ }, [s, T]);
22046
+ function pe() {
22047
+ var _a, _b;
22048
+ (_a = I.current) == null ? void 0 : _a.dispose(), V ? y && _.set(m, o.current.saveViewState()) : (_b = o.current.getModel()) == null ? void 0 : _b.dispose(), o.current.dispose();
22049
+ }
22050
+ return require$$0.createElement(H, { width: z, height: F, isEditorReady: s, loading: N, _ref: b, className: j, wrapperProps: A });
21672
22051
  }
21673
- function DebuggerControls({ compact = false, className = "" }) {
21674
- const {
21675
- state,
21676
- play,
21677
- pause,
21678
- stop,
21679
- reset,
21680
- stepForward,
21681
- stepBackward,
21682
- setSpeed,
21683
- isAtStart,
21684
- isAtEnd,
21685
- hasTrace,
21686
- progress,
21687
- totalSteps
21688
- } = useDebugger();
21689
- const { playbackState, playbackSpeed, currentStepIndex, isExecuting } = state;
21690
- const handleKeyDown = useCallback(
21691
- (e) => {
21692
- if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
21693
- return;
21694
- }
21695
- switch (e.key) {
21696
- case " ":
21697
- e.preventDefault();
21698
- if (playbackState === "playing") {
21699
- pause();
21700
- } else if (hasTrace) {
21701
- play();
21702
- }
21703
- break;
21704
- case "ArrowRight":
21705
- e.preventDefault();
21706
- if (hasTrace && !isAtEnd) {
21707
- stepForward();
21708
- }
21709
- break;
21710
- case "ArrowLeft":
21711
- e.preventDefault();
21712
- if (hasTrace && !isAtStart) {
21713
- stepBackward();
22052
+ var fe = Ve;
22053
+ var de = memo(fe);
22054
+ var Ft = de;
22055
+ function findPathLineNumbers(jsonString, paths) {
22056
+ if (!paths || paths.length === 0) return [];
22057
+ const lines = jsonString.split("\n");
22058
+ const lineNumbers = [];
22059
+ for (const path of paths) {
22060
+ const pathParts = path.split(".");
22061
+ const lastKey = pathParts[pathParts.length - 1];
22062
+ const keyPattern = new RegExp(`^\\s*"${lastKey}"\\s*:`);
22063
+ for (let i = 0; i < lines.length; i++) {
22064
+ if (keyPattern.test(lines[i])) {
22065
+ if (pathParts.length === 1) {
22066
+ lineNumbers.push(i + 1);
22067
+ } else {
22068
+ let matchedParents = 0;
22069
+ for (let j = i - 1; j >= 0 && matchedParents < pathParts.length - 1; j--) {
22070
+ const parentKey = pathParts[pathParts.length - 2 - matchedParents];
22071
+ const parentPattern = new RegExp(`^\\s*"${parentKey}"\\s*:`);
22072
+ if (parentPattern.test(lines[j])) {
22073
+ matchedParents++;
22074
+ }
21714
22075
  }
21715
- break;
21716
- case "Escape":
21717
- e.preventDefault();
21718
- stop();
21719
- break;
21720
- case "r":
21721
- if (e.metaKey || e.ctrlKey) {
21722
- e.preventDefault();
21723
- reset();
22076
+ if (matchedParents >= Math.min(pathParts.length - 1, 2)) {
22077
+ lineNumbers.push(i + 1);
21724
22078
  }
21725
- break;
21726
- }
21727
- },
21728
- [playbackState, hasTrace, isAtEnd, isAtStart, play, pause, stop, stepForward, stepBackward, reset]
21729
- );
21730
- useEffect(() => {
21731
- window.addEventListener("keydown", handleKeyDown);
21732
- return () => window.removeEventListener("keydown", handleKeyDown);
21733
- }, [handleKeyDown]);
21734
- const handleSpeedChange = (e) => {
21735
- setSpeed(Number(e.target.value));
21736
- };
21737
- if (compact) {
21738
- return /* @__PURE__ */ jsxs("div", { className: `df-debug-controls df-debug-controls-compact ${className}`, children: [
21739
- /* @__PURE__ */ jsx(
21740
- "button",
21741
- {
21742
- className: "df-debug-btn",
21743
- onClick: stepBackward,
21744
- disabled: !hasTrace || isAtStart || isExecuting,
21745
- title: "Previous step (Left Arrow)",
21746
- children: /* @__PURE__ */ jsx(SkipBack, { size: 16 })
21747
- }
21748
- ),
21749
- playbackState === "playing" ? /* @__PURE__ */ jsx(
21750
- "button",
21751
- {
21752
- className: "df-debug-btn df-debug-btn-primary",
21753
- onClick: pause,
21754
- disabled: !hasTrace || isExecuting,
21755
- title: "Pause (Space)",
21756
- children: /* @__PURE__ */ jsx(Pause, { size: 18 })
21757
- }
21758
- ) : /* @__PURE__ */ jsx(
21759
- "button",
21760
- {
21761
- className: "df-debug-btn df-debug-btn-primary",
21762
- onClick: play,
21763
- disabled: !hasTrace || isAtEnd || isExecuting,
21764
- title: "Play (Space)",
21765
- children: /* @__PURE__ */ jsx(Play, { size: 18 })
21766
- }
21767
- ),
21768
- /* @__PURE__ */ jsx(
21769
- "button",
21770
- {
21771
- className: "df-debug-btn",
21772
- onClick: stepForward,
21773
- disabled: !hasTrace || isAtEnd || isExecuting,
21774
- title: "Next step (Right Arrow)",
21775
- children: /* @__PURE__ */ jsx(SkipForward, { size: 16 })
21776
22079
  }
21777
- ),
21778
- /* @__PURE__ */ jsxs("span", { className: "df-debug-step-counter", children: [
21779
- currentStepIndex + 1,
21780
- " / ",
21781
- totalSteps
21782
- ] })
21783
- ] });
22080
+ }
22081
+ }
21784
22082
  }
21785
- return /* @__PURE__ */ jsxs("div", { className: `df-debug-controls ${className}`, children: [
21786
- /* @__PURE__ */ jsxs("div", { className: "df-debug-controls-main", children: [
21787
- /* @__PURE__ */ jsx(
21788
- "button",
21789
- {
21790
- className: "df-debug-btn",
21791
- onClick: stop,
21792
- disabled: !hasTrace || isExecuting,
21793
- title: "Stop (Escape)",
21794
- children: /* @__PURE__ */ jsx(Square, { size: 20 })
21795
- }
21796
- ),
21797
- /* @__PURE__ */ jsx(
21798
- "button",
21799
- {
21800
- className: "df-debug-btn",
21801
- onClick: stepBackward,
21802
- disabled: !hasTrace || isAtStart || isExecuting,
21803
- title: "Previous step (Left Arrow)",
21804
- children: /* @__PURE__ */ jsx(SkipBack, { size: 20 })
21805
- }
21806
- ),
21807
- playbackState === "playing" ? /* @__PURE__ */ jsx(
21808
- "button",
21809
- {
21810
- className: "df-debug-btn df-debug-btn-primary",
21811
- onClick: pause,
21812
- disabled: !hasTrace || isExecuting,
21813
- title: "Pause (Space)",
21814
- children: /* @__PURE__ */ jsx(Pause, { size: 24 })
21815
- }
21816
- ) : /* @__PURE__ */ jsx(
21817
- "button",
21818
- {
21819
- className: "df-debug-btn df-debug-btn-primary",
21820
- onClick: play,
21821
- disabled: !hasTrace || isAtEnd || isExecuting,
21822
- title: "Play (Space)",
21823
- children: /* @__PURE__ */ jsx(Play, { size: 24 })
21824
- }
21825
- ),
21826
- /* @__PURE__ */ jsx(
21827
- "button",
21828
- {
21829
- className: "df-debug-btn",
21830
- onClick: stepForward,
21831
- disabled: !hasTrace || isAtEnd || isExecuting,
21832
- title: "Next step (Right Arrow)",
21833
- children: /* @__PURE__ */ jsx(SkipForward, { size: 20 })
21834
- }
21835
- ),
21836
- /* @__PURE__ */ jsx(
21837
- "button",
21838
- {
21839
- className: "df-debug-btn",
21840
- onClick: reset,
21841
- disabled: !hasTrace || isExecuting,
21842
- title: "Reset (Ctrl+R)",
21843
- children: /* @__PURE__ */ jsx(RotateCcw, { size: 20 })
21844
- }
21845
- )
21846
- ] }),
21847
- /* @__PURE__ */ jsxs("div", { className: "df-debug-progress", children: [
21848
- /* @__PURE__ */ jsx("div", { className: "df-debug-progress-bar", children: /* @__PURE__ */ jsx(
21849
- "div",
21850
- {
21851
- className: "df-debug-progress-fill",
21852
- style: { width: `${progress * 100}%` }
21853
- }
21854
- ) }),
21855
- /* @__PURE__ */ jsxs("span", { className: "df-debug-step-counter", children: [
21856
- "Step ",
21857
- currentStepIndex + 1,
21858
- " of ",
21859
- totalSteps
21860
- ] })
21861
- ] }),
21862
- /* @__PURE__ */ jsxs("div", { className: "df-debug-speed", children: [
21863
- /* @__PURE__ */ jsx(Gauge, { size: 14 }),
21864
- /* @__PURE__ */ jsx(
21865
- "input",
21866
- {
21867
- type: "range",
21868
- min: "100",
21869
- max: "2000",
21870
- step: "100",
21871
- value: playbackSpeed,
21872
- onChange: handleSpeedChange,
21873
- className: "df-debug-speed-slider",
21874
- title: `Playback speed: ${playbackSpeed}ms`
21875
- }
21876
- ),
21877
- /* @__PURE__ */ jsxs("span", { className: "df-debug-speed-label", children: [
21878
- playbackSpeed,
21879
- "ms"
21880
- ] })
21881
- ] })
21882
- ] });
22083
+ return [...new Set(lineNumbers)];
21883
22084
  }
21884
- function MessageInputPanel({
21885
- onExecute,
21886
- isExecuting = false,
21887
- className = ""
22085
+ const defineThemes = (monaco) => {
22086
+ monaco.editor.defineTheme("vscode-dark", {
22087
+ base: "vs-dark",
22088
+ inherit: true,
22089
+ rules: [
22090
+ { token: "string.key.json", foreground: "9CDCFE" },
22091
+ { token: "string.value.json", foreground: "CE9178" },
22092
+ { token: "number", foreground: "B5CEA8" },
22093
+ { token: "keyword", foreground: "569CD6" },
22094
+ { token: "delimiter", foreground: "D4D4D4" }
22095
+ ],
22096
+ colors: {
22097
+ "editor.background": "#1e1e1e",
22098
+ "editor.foreground": "#d4d4d4",
22099
+ "editor.lineHighlightBackground": "#2d2d2d",
22100
+ "editor.selectionBackground": "#264f78",
22101
+ "editorCursor.foreground": "#aeafad",
22102
+ "editorLineNumber.foreground": "#858585",
22103
+ "editorLineNumber.activeForeground": "#c6c6c6",
22104
+ "editorIndentGuide.background": "#404040",
22105
+ "editorIndentGuide.activeBackground": "#707070",
22106
+ "editor.selectionHighlightBackground": "#3a3d41",
22107
+ "editorBracketMatch.background": "#0064001a",
22108
+ "editorBracketMatch.border": "#888888",
22109
+ "editorGutter.background": "#1e1e1e",
22110
+ "scrollbarSlider.background": "#79797966",
22111
+ "scrollbarSlider.hoverBackground": "#646464b3",
22112
+ "scrollbarSlider.activeBackground": "#bfbfbf66",
22113
+ "minimap.background": "#1e1e1e"
22114
+ }
22115
+ });
22116
+ monaco.editor.defineTheme("vscode-light", {
22117
+ base: "vs",
22118
+ inherit: true,
22119
+ rules: [
22120
+ { token: "string.key.json", foreground: "0451A5" },
22121
+ { token: "string.value.json", foreground: "A31515" },
22122
+ { token: "number", foreground: "098658" },
22123
+ { token: "keyword", foreground: "0000FF" },
22124
+ { token: "delimiter", foreground: "000000" }
22125
+ ],
22126
+ colors: {
22127
+ "editor.background": "#ffffff",
22128
+ "editor.foreground": "#000000",
22129
+ "editor.lineHighlightBackground": "#f5f5f5",
22130
+ "editor.selectionBackground": "#add6ff",
22131
+ "editorCursor.foreground": "#000000",
22132
+ "editorLineNumber.foreground": "#999999",
22133
+ "editorLineNumber.activeForeground": "#000000",
22134
+ "editorIndentGuide.background": "#d3d3d3",
22135
+ "editorIndentGuide.activeBackground": "#939393",
22136
+ "editor.selectionHighlightBackground": "#add6ff4d",
22137
+ "editorBracketMatch.background": "#0064001a",
22138
+ "editorBracketMatch.border": "#b9b9b9",
22139
+ "editorGutter.background": "#ffffff",
22140
+ "scrollbarSlider.background": "#64646466",
22141
+ "scrollbarSlider.hoverBackground": "#646464b3",
22142
+ "scrollbarSlider.activeBackground": "#00000099",
22143
+ "minimap.background": "#ffffff"
22144
+ }
22145
+ });
22146
+ };
22147
+ function JsonEditor({
22148
+ value,
22149
+ onChange,
22150
+ readOnly = false,
22151
+ className = "",
22152
+ theme = "dark",
22153
+ onCursorChange,
22154
+ highlightedPaths
21888
22155
  }) {
21889
- const { setInputPayload, state } = useDebugger();
21890
- const { inputPayload } = state;
21891
- const [expandedSections, setExpandedSections] = useState(
21892
- /* @__PURE__ */ new Set(["payload"])
21893
- );
21894
- const [editingSection, setEditingSection] = useState(null);
21895
- const [editText, setEditText] = useState("");
21896
- const [parseError, setParseError] = useState(null);
21897
- const payload = inputPayload || {};
21898
- const toggleSection = (section) => {
21899
- setExpandedSections((prev) => {
21900
- const next = new Set(prev);
21901
- if (next.has(section)) {
21902
- next.delete(section);
21903
- } else {
21904
- next.add(section);
21905
- }
21906
- return next;
22156
+ const editorRef = useRef(null);
22157
+ const decorationsRef = useRef([]);
22158
+ const handleEditorMount = useCallback((editor, monaco) => {
22159
+ editorRef.current = editor;
22160
+ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
22161
+ validate: true,
22162
+ schemas: [],
22163
+ allowComments: false,
22164
+ trailingCommas: "error"
21907
22165
  });
21908
- };
21909
- const startEditing = () => {
21910
- setEditingSection("payload");
21911
- setEditText(JSON.stringify(payload, null, 2));
21912
- setParseError(null);
21913
- };
21914
- const cancelEditing = () => {
21915
- setEditingSection(null);
21916
- setEditText("");
21917
- setParseError(null);
21918
- };
21919
- const saveEditing = useCallback(() => {
21920
- if (!editingSection) return;
21921
- try {
21922
- const parsed = JSON.parse(editText);
21923
- setInputPayload(parsed);
21924
- setEditingSection(null);
21925
- setEditText("");
21926
- setParseError(null);
21927
- } catch (err) {
21928
- setParseError(err instanceof Error ? err.message : "Invalid JSON");
22166
+ if (onCursorChange) {
22167
+ editor.onDidChangeCursorPosition((e) => {
22168
+ onCursorChange(e.position.lineNumber, e.position.column);
22169
+ });
21929
22170
  }
21930
- }, [editingSection, editText, setInputPayload]);
21931
- const handleLoadSample = () => {
21932
- setInputPayload({
21933
- id: "123",
21934
- name: "John Doe",
21935
- email: "john@example.com",
21936
- amount: 100
21937
- });
21938
- };
21939
- const handleClear = () => {
21940
- setInputPayload({});
21941
- };
21942
- const formatValue2 = (value) => {
21943
- if (Object.keys(value).length === 0) {
21944
- return "(empty)";
22171
+ if (!readOnly) {
22172
+ editor.focus();
21945
22173
  }
21946
- return JSON.stringify(value, null, 2);
21947
- };
21948
- const isEmptyPayload = Object.keys(payload).length === 0;
21949
- const isExpanded = expandedSections.has("payload");
21950
- const isEditing = editingSection === "payload";
21951
- return /* @__PURE__ */ jsxs("div", { className: `df-debug-input-panel ${className}`, children: [
21952
- /* @__PURE__ */ jsxs("div", { className: "df-debug-input-header", children: [
21953
- /* @__PURE__ */ jsx("span", { className: "df-debug-input-title", children: "Test Payload" }),
21954
- /* @__PURE__ */ jsxs("div", { className: "df-debug-input-actions", children: [
21955
- /* @__PURE__ */ jsxs(
21956
- "button",
21957
- {
21958
- className: "df-debug-btn-sm",
21959
- onClick: handleLoadSample,
21960
- title: "Load sample data",
21961
- children: [
21962
- /* @__PURE__ */ jsx(FileJson, { size: 12 }),
21963
- "Sample"
21964
- ]
22174
+ }, [onCursorChange, readOnly]);
22175
+ useEffect(() => {
22176
+ if (!editorRef.current || !highlightedPaths || highlightedPaths.length === 0) {
22177
+ if (editorRef.current && decorationsRef.current.length > 0) {
22178
+ decorationsRef.current = editorRef.current.deltaDecorations(decorationsRef.current, []);
22179
+ }
22180
+ return;
22181
+ }
22182
+ const lineNumbers = findPathLineNumbers(value, highlightedPaths);
22183
+ if (lineNumbers.length > 0) {
22184
+ const decorations = lineNumbers.map((lineNumber) => ({
22185
+ range: {
22186
+ startLineNumber: lineNumber,
22187
+ startColumn: 1,
22188
+ endLineNumber: lineNumber,
22189
+ endColumn: 1
22190
+ },
22191
+ options: {
22192
+ isWholeLine: true,
22193
+ className: "df-highlighted-line",
22194
+ glyphMarginClassName: "df-highlighted-glyph",
22195
+ overviewRuler: {
22196
+ color: theme === "dark" ? "#4ec9b0" : "#388a34",
22197
+ position: 1
22198
+ // Left
21965
22199
  }
21966
- ),
21967
- /* @__PURE__ */ jsxs(
22200
+ }
22201
+ }));
22202
+ decorationsRef.current = editorRef.current.deltaDecorations(
22203
+ decorationsRef.current,
22204
+ decorations
22205
+ );
22206
+ } else {
22207
+ decorationsRef.current = editorRef.current.deltaDecorations(decorationsRef.current, []);
22208
+ }
22209
+ }, [value, highlightedPaths, theme]);
22210
+ const handleChange = useCallback((newValue) => {
22211
+ onChange(newValue || "");
22212
+ }, [onChange]);
22213
+ return /* @__PURE__ */ jsx("div", { className: `df-monaco-editor-wrapper ${className}`, children: /* @__PURE__ */ jsx(
22214
+ Ft,
22215
+ {
22216
+ height: "100%",
22217
+ defaultLanguage: "json",
22218
+ value,
22219
+ onChange: handleChange,
22220
+ onMount: handleEditorMount,
22221
+ beforeMount: defineThemes,
22222
+ theme: theme === "dark" ? "vscode-dark" : "vscode-light",
22223
+ options: {
22224
+ readOnly,
22225
+ minimap: { enabled: false },
22226
+ fontSize: 13,
22227
+ fontFamily: "'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace",
22228
+ lineHeight: 20,
22229
+ tabSize: 2,
22230
+ insertSpaces: true,
22231
+ automaticLayout: true,
22232
+ scrollBeyondLastLine: false,
22233
+ wordWrap: "on",
22234
+ wrappingIndent: "indent",
22235
+ folding: true,
22236
+ foldingStrategy: "indentation",
22237
+ showFoldingControls: "mouseover",
22238
+ bracketPairColorization: { enabled: true },
22239
+ guides: {
22240
+ bracketPairs: false,
22241
+ indentation: false,
22242
+ highlightActiveBracketPair: true,
22243
+ highlightActiveIndentation: false
22244
+ },
22245
+ renderLineHighlight: readOnly ? "none" : "line",
22246
+ selectOnLineNumbers: true,
22247
+ roundedSelection: true,
22248
+ cursorBlinking: "smooth",
22249
+ cursorSmoothCaretAnimation: "on",
22250
+ smoothScrolling: true,
22251
+ padding: { top: 8, bottom: 8 },
22252
+ scrollbar: {
22253
+ vertical: "auto",
22254
+ horizontal: "auto",
22255
+ verticalScrollbarSize: 10,
22256
+ horizontalScrollbarSize: 10
22257
+ },
22258
+ overviewRulerBorder: false,
22259
+ hideCursorInOverviewRuler: true,
22260
+ contextmenu: true,
22261
+ quickSuggestions: false,
22262
+ suggestOnTriggerCharacters: false,
22263
+ acceptSuggestionOnEnter: "off",
22264
+ formatOnPaste: true,
22265
+ formatOnType: false,
22266
+ glyphMargin: highlightedPaths && highlightedPaths.length > 0
22267
+ }
22268
+ }
22269
+ ) });
22270
+ }
22271
+ class ErrorBoundary extends Component {
22272
+ constructor(props) {
22273
+ super(props);
22274
+ this.state = { hasError: false, error: null };
22275
+ }
22276
+ static getDerivedStateFromError(error) {
22277
+ return { hasError: true, error };
22278
+ }
22279
+ componentDidCatch(error, errorInfo) {
22280
+ console.error("ErrorBoundary caught an error:", error, errorInfo);
22281
+ }
22282
+ render() {
22283
+ var _a;
22284
+ if (this.state.hasError) {
22285
+ if (this.props.fallback) {
22286
+ return this.props.fallback;
22287
+ }
22288
+ return /* @__PURE__ */ jsx("div", { className: "df-error-boundary", children: /* @__PURE__ */ jsxs("div", { className: "df-error-boundary-content", children: [
22289
+ /* @__PURE__ */ jsx("h3", { className: "df-error-boundary-title", children: "Something went wrong" }),
22290
+ /* @__PURE__ */ jsx("p", { className: "df-error-boundary-message", children: ((_a = this.state.error) == null ? void 0 : _a.message) || "An unexpected error occurred" }),
22291
+ /* @__PURE__ */ jsx(
21968
22292
  "button",
21969
22293
  {
21970
- className: "df-debug-btn-sm",
21971
- onClick: handleClear,
21972
- title: "Clear all data",
21973
- children: [
21974
- /* @__PURE__ */ jsx(RefreshCw, { size: 12 }),
21975
- "Clear"
21976
- ]
22294
+ className: "df-error-boundary-button",
22295
+ onClick: () => this.setState({ hasError: false, error: null }),
22296
+ children: "Try again"
21977
22297
  }
21978
22298
  )
21979
- ] })
21980
- ] }),
21981
- /* @__PURE__ */ jsx("div", { className: "df-debug-input-sections", children: /* @__PURE__ */ jsxs("div", { className: "df-debug-input-section", children: [
21982
- /* @__PURE__ */ jsxs(
21983
- "div",
21984
- {
21985
- className: "df-debug-input-section-header",
21986
- onClick: () => !isEditing && toggleSection("payload"),
21987
- children: [
21988
- /* @__PURE__ */ jsx("span", { className: "df-debug-section-toggle", children: isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 14 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14 }) }),
21989
- /* @__PURE__ */ jsx("span", { className: "df-debug-section-label", children: "Payload" }),
21990
- isEmptyPayload && /* @__PURE__ */ jsx("span", { className: "df-debug-section-empty", children: "(empty)" }),
21991
- !isEditing && /* @__PURE__ */ jsx(
21992
- "button",
21993
- {
21994
- className: "df-debug-section-edit",
21995
- onClick: (e) => {
21996
- e.stopPropagation();
21997
- startEditing();
21998
- },
21999
- title: "Edit Payload",
22000
- children: "Edit"
22001
- }
22002
- )
22003
- ]
22004
- }
22005
- ),
22006
- isExpanded && /* @__PURE__ */ jsx("div", { className: "df-debug-input-section-content", children: isEditing ? /* @__PURE__ */ jsxs("div", { className: "df-debug-input-editor", children: [
22007
- /* @__PURE__ */ jsx(
22008
- "textarea",
22009
- {
22010
- className: "df-debug-input-textarea",
22011
- value: editText,
22012
- onChange: (e) => setEditText(e.target.value),
22013
- placeholder: "Enter payload as JSON...",
22014
- spellCheck: false
22015
- }
22016
- ),
22017
- parseError && /* @__PURE__ */ jsx("div", { className: "df-debug-input-error", children: parseError }),
22018
- /* @__PURE__ */ jsxs("div", { className: "df-debug-input-editor-actions", children: [
22019
- /* @__PURE__ */ jsx(
22020
- "button",
22021
- {
22022
- className: "df-debug-btn-sm df-debug-btn-cancel",
22023
- onClick: cancelEditing,
22024
- children: "Cancel"
22025
- }
22026
- ),
22027
- /* @__PURE__ */ jsx(
22028
- "button",
22029
- {
22030
- className: "df-debug-btn-sm df-debug-btn-save",
22031
- onClick: saveEditing,
22032
- children: "Save"
22033
- }
22034
- )
22035
- ] })
22036
- ] }) : /* @__PURE__ */ jsx("pre", { className: "df-debug-input-preview", children: formatValue2(payload) }) })
22037
- ] }) }),
22038
- /* @__PURE__ */ jsx("div", { className: "df-debug-input-footer", children: /* @__PURE__ */ jsx(
22039
- "button",
22040
- {
22041
- className: "df-debug-run-btn",
22042
- onClick: onExecute,
22043
- disabled: isExecuting,
22044
- children: isExecuting ? /* @__PURE__ */ jsxs(Fragment, { children: [
22045
- /* @__PURE__ */ jsx(RefreshCw, { size: 14, className: "df-debug-spin" }),
22046
- "Executing..."
22047
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
22048
- /* @__PURE__ */ jsx(Play, { size: 14 }),
22049
- "Run Debug"
22050
- ] })
22051
- }
22052
- ) })
22053
- ] });
22054
- }
22055
- function MessageStatePanel({ className = "" }) {
22056
- const { currentStep, currentMessage, currentChanges } = useDebugger();
22057
- const [activeTab, setActiveTab] = useState("message");
22058
- if (!currentStep || !currentMessage) {
22059
- return /* @__PURE__ */ jsx("div", { className: `df-debug-state-panel df-debug-state-empty ${className}`, children: /* @__PURE__ */ jsx("p", { children: "No step selected. Run debug to see message state changes." }) });
22299
+ ] }) });
22300
+ }
22301
+ return this.props.children;
22060
22302
  }
22061
- const { workflow_id, task_id, result } = currentStep;
22062
- const tabs = [
22063
- { key: "message", label: "Message" },
22064
- { key: "changes", label: `Changes (${currentChanges.length})` }
22065
- ];
22066
- return /* @__PURE__ */ jsxs("div", { className: `df-debug-state-panel ${className}`, children: [
22067
- /* @__PURE__ */ jsx("div", { className: "df-debug-state-header", children: /* @__PURE__ */ jsx("div", { className: "df-debug-state-tabs", children: tabs.map(({ key, label }) => /* @__PURE__ */ jsx(
22068
- "button",
22069
- {
22070
- className: `df-debug-state-tab ${activeTab === key ? "df-debug-state-tab-active" : ""}`,
22071
- onClick: () => setActiveTab(key),
22072
- children: label
22073
- },
22074
- key
22075
- )) }) }),
22076
- /* @__PURE__ */ jsxs("div", { className: "df-debug-state-content", children: [
22077
- activeTab === "message" && /* @__PURE__ */ jsx(MessageView, { message: currentMessage }),
22078
- activeTab === "changes" && /* @__PURE__ */ jsx(ChangesView, { changes: currentChanges })
22079
- ] }),
22080
- /* @__PURE__ */ jsxs("div", { className: "df-debug-state-footer", children: [
22081
- /* @__PURE__ */ jsxs("div", { className: "df-debug-state-step-type", children: [
22082
- /* @__PURE__ */ jsx("span", { className: `df-debug-state-badge df-debug-state-badge-${result}`, children: result }),
22083
- /* @__PURE__ */ jsxs("span", { className: "df-debug-state-type-label", children: [
22084
- workflow_id,
22085
- task_id ? ` / ${task_id}` : ""
22086
- ] })
22087
- ] }),
22088
- currentMessage.errors.length > 0 && /* @__PURE__ */ jsxs("div", { className: "df-debug-state-error", children: [
22089
- "Errors: ",
22090
- currentMessage.errors.length
22091
- ] })
22092
- ] })
22093
- ] });
22094
- }
22095
- function MessageView({ message }) {
22096
- const [expandedSections, setExpandedSections] = useState(
22097
- /* @__PURE__ */ new Set(["context"])
22098
- );
22099
- const toggleSection = (section) => {
22100
- setExpandedSections((prev) => {
22101
- const next = new Set(prev);
22102
- if (next.has(section)) {
22103
- next.delete(section);
22104
- } else {
22105
- next.add(section);
22106
- }
22107
- return next;
22108
- });
22109
- };
22110
- const sections = [
22111
- { key: "context", value: message.context },
22112
- { key: "payload", value: message.payload },
22113
- { key: "errors", value: message.errors },
22114
- { key: "audit_trail", value: message.audit_trail }
22115
- ];
22116
- return /* @__PURE__ */ jsx("div", { className: "df-debug-message-view", children: sections.map(({ key, value }) => {
22117
- const isExpanded = expandedSections.has(key);
22118
- const isEmpty2 = Array.isArray(value) ? value.length === 0 : typeof value === "object" && value !== null ? Object.keys(value).length === 0 : !value;
22119
- return /* @__PURE__ */ jsxs("div", { className: "df-debug-message-section", children: [
22120
- /* @__PURE__ */ jsxs(
22121
- "div",
22122
- {
22123
- className: "df-debug-message-section-header",
22124
- onClick: () => toggleSection(key),
22125
- children: [
22126
- /* @__PURE__ */ jsx("span", { className: "df-debug-section-arrow", children: isExpanded ? "▼" : "▶" }),
22127
- /* @__PURE__ */ jsx("span", { className: "df-debug-section-key", children: key }),
22128
- isEmpty2 && /* @__PURE__ */ jsx("span", { className: "df-debug-section-empty", children: "(empty)" })
22129
- ]
22130
- }
22131
- ),
22132
- isExpanded && /* @__PURE__ */ jsx("pre", { className: "df-debug-message-section-content", children: JSON.stringify(value, null, 2) })
22133
- ] }, key);
22134
- }) });
22135
22303
  }
22136
- function ChangesView({ changes }) {
22137
- if (changes.length === 0) {
22138
- return /* @__PURE__ */ jsx("div", { className: "df-debug-changes-empty", children: "No changes recorded in this step" });
22304
+ function getSelectionInfo(selection2) {
22305
+ switch (selection2.type) {
22306
+ case "workflow-condition":
22307
+ return {
22308
+ title: "Workflow Condition",
22309
+ subtitle: selection2.workflow.name
22310
+ };
22311
+ case "task":
22312
+ return {
22313
+ title: selection2.task.name,
22314
+ subtitle: `${selection2.workflow.name} / ${selection2.task.function.name}`
22315
+ };
22316
+ case "task-condition":
22317
+ return {
22318
+ title: "Task Condition",
22319
+ subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
22320
+ };
22321
+ case "mapping":
22322
+ return {
22323
+ title: selection2.mapping.path,
22324
+ subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
22325
+ };
22326
+ case "validation-rule":
22327
+ return {
22328
+ title: selection2.rule.message,
22329
+ subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
22330
+ };
22331
+ default:
22332
+ return null;
22139
22333
  }
22140
- return /* @__PURE__ */ jsx("div", { className: "df-debug-changes-view", children: changes.map((change, index2) => {
22141
- const isModified = change.old_value !== void 0 && change.new_value !== void 0;
22142
- const isAdded = change.old_value === void 0 && change.new_value !== void 0;
22143
- const isRemoved = change.old_value !== void 0 && change.new_value === void 0;
22144
- const changeType = isAdded ? "added" : isRemoved ? "removed" : "modified";
22145
- return /* @__PURE__ */ jsxs("div", { className: `df-debug-change-item df-debug-change-${changeType}`, children: [
22146
- /* @__PURE__ */ jsxs("div", { className: "df-debug-change-header", children: [
22147
- /* @__PURE__ */ jsx("span", { className: `df-debug-change-op df-debug-change-op-${changeType}`, children: changeType }),
22148
- /* @__PURE__ */ jsx("span", { className: "df-debug-change-path", children: change.path })
22149
- ] }),
22150
- isModified && /* @__PURE__ */ jsxs("div", { className: "df-debug-change-values", children: [
22151
- /* @__PURE__ */ jsx("span", { className: "df-debug-change-old", children: formatValue(change.old_value) }),
22152
- /* @__PURE__ */ jsx("span", { className: "df-debug-change-arrow", children: "→" }),
22153
- /* @__PURE__ */ jsx("span", { className: "df-debug-change-new", children: formatValue(change.new_value) })
22154
- ] }),
22155
- isAdded && /* @__PURE__ */ jsx("div", { className: "df-debug-change-values", children: /* @__PURE__ */ jsx("span", { className: "df-debug-change-new", children: formatValue(change.new_value) }) }),
22156
- isRemoved && /* @__PURE__ */ jsx("div", { className: "df-debug-change-values", children: /* @__PURE__ */ jsx("span", { className: "df-debug-change-old", children: formatValue(change.old_value) }) })
22157
- ] }, index2);
22158
- }) });
22159
- }
22160
- function formatValue(value) {
22161
- if (value === void 0) return "undefined";
22162
- if (value === null) return "null";
22163
- if (typeof value === "string") return `"${value}"`;
22164
- if (typeof value === "object") return JSON.stringify(value);
22165
- return String(value);
22166
22334
  }
22167
- function DebugInfoBubble({
22168
- step,
22169
- targetRef,
22170
- visible,
22171
- onClose
22335
+ function VisualizerInner({
22336
+ workflows,
22337
+ onTaskSelect,
22338
+ onWorkflowSelect,
22339
+ executionResult,
22340
+ debugMode = false,
22341
+ showDebugToolbar = false,
22342
+ debugConfig,
22343
+ debugPayload
22172
22344
  }) {
22173
- var _a;
22174
- const [position, setPosition] = useState({ top: 0, left: 0 });
22175
- const bubbleRef = useRef(null);
22345
+ const { resolvedTheme } = useTheme();
22346
+ const debuggerContext = debugMode ? useDebugger() : null;
22347
+ const [selection2, setSelection] = useState({ type: "none" });
22348
+ const [leftPanelWidth, setLeftPanelWidth] = useState(280);
22349
+ const [isDragging, setIsDragging] = useState(false);
22350
+ const [treePanelHeight, setTreePanelHeight] = useState(50);
22351
+ const [isVerticalDragging, setIsVerticalDragging] = useState(false);
22352
+ const containerRef = useRef(null);
22353
+ const leftPanelRef = useRef(null);
22354
+ const handleSelection = (newSelection) => {
22355
+ setSelection(newSelection);
22356
+ if (newSelection.type === "workflow-condition") {
22357
+ onWorkflowSelect == null ? void 0 : onWorkflowSelect(newSelection.workflow);
22358
+ } else if (newSelection.type === "task" || newSelection.type === "task-condition" || newSelection.type === "mapping" || newSelection.type === "validation-rule") {
22359
+ onTaskSelect == null ? void 0 : onTaskSelect(newSelection.task, newSelection.workflow);
22360
+ }
22361
+ };
22362
+ const handleMouseDown = useCallback((e) => {
22363
+ e.preventDefault();
22364
+ setIsDragging(true);
22365
+ }, []);
22366
+ const handleVerticalMouseDown = useCallback((e) => {
22367
+ e.preventDefault();
22368
+ setIsVerticalDragging(true);
22369
+ }, []);
22176
22370
  useEffect(() => {
22177
- if (!visible || !targetRef.current) return;
22178
- const updatePosition = () => {
22179
- var _a2, _b;
22180
- const targetRect = (_a2 = targetRef.current) == null ? void 0 : _a2.getBoundingClientRect();
22181
- const bubbleRect = (_b = bubbleRef.current) == null ? void 0 : _b.getBoundingClientRect();
22182
- if (!targetRect) return;
22183
- let top = targetRect.bottom + 8;
22184
- let left = targetRect.left;
22185
- if (bubbleRect) {
22186
- if (left + bubbleRect.width > window.innerWidth - 16) {
22187
- left = window.innerWidth - bubbleRect.width - 16;
22188
- }
22189
- if (top + bubbleRect.height > window.innerHeight - 16) {
22190
- top = targetRect.top - bubbleRect.height - 8;
22191
- }
22371
+ if (!isDragging) return;
22372
+ const handleMouseMove = (e) => {
22373
+ if (containerRef.current) {
22374
+ const rect = containerRef.current.getBoundingClientRect();
22375
+ const newWidth = e.clientX - rect.left;
22376
+ setLeftPanelWidth(Math.max(200, Math.min(450, newWidth)));
22192
22377
  }
22193
- setPosition({ top, left });
22194
22378
  };
22195
- updatePosition();
22196
- window.addEventListener("scroll", updatePosition, true);
22197
- window.addEventListener("resize", updatePosition);
22379
+ const handleMouseUp = () => {
22380
+ setIsDragging(false);
22381
+ };
22382
+ document.addEventListener("mousemove", handleMouseMove);
22383
+ document.addEventListener("mouseup", handleMouseUp);
22198
22384
  return () => {
22199
- window.removeEventListener("scroll", updatePosition, true);
22200
- window.removeEventListener("resize", updatePosition);
22385
+ document.removeEventListener("mousemove", handleMouseMove);
22386
+ document.removeEventListener("mouseup", handleMouseUp);
22201
22387
  };
22202
- }, [visible, targetRef]);
22203
- if (!visible) return null;
22204
- const { workflow_id, task_id, result, message } = step;
22205
- const state = result === "executed" ? "executed" : "skipped";
22206
- const hasError = message && message.errors && message.errors.length > 0;
22207
- const displayState = hasError ? "error" : state;
22208
- return createPortal(
22209
- /* @__PURE__ */ jsxs(
22210
- "div",
22211
- {
22212
- ref: bubbleRef,
22213
- className: "df-debug-bubble",
22214
- style: {
22215
- position: "fixed",
22216
- top: position.top,
22217
- left: position.left
22218
- },
22219
- children: [
22220
- /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-header", children: [
22221
- /* @__PURE__ */ jsx(StateIcon, { state: displayState }),
22222
- /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-title", children: task_id ? "Task Step" : "Workflow Skipped" }),
22223
- onClose && /* @__PURE__ */ jsx("button", { className: "df-debug-bubble-close", onClick: onClose, children: /* @__PURE__ */ jsx(X, { size: 14 }) })
22224
- ] }),
22225
- /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-content", children: [
22226
- /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-row", children: [
22227
- /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-label", children: "Workflow:" }),
22228
- /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-value", children: workflow_id })
22229
- ] }),
22230
- task_id && /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-row", children: [
22231
- /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-label", children: "Task:" }),
22232
- /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-value", children: task_id })
22233
- ] }),
22234
- /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-row", children: [
22235
- /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-label", children: "Result:" }),
22236
- /* @__PURE__ */ jsx("span", { className: `df-debug-bubble-state df-debug-bubble-state-${displayState}`, children: result })
22237
- ] }),
22238
- hasError && (message == null ? void 0 : message.errors) && /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-error", children: [
22239
- /* @__PURE__ */ jsx(CircleAlert, { size: 14 }),
22240
- /* @__PURE__ */ jsx("span", { children: ((_a = message.errors[0]) == null ? void 0 : _a.message) || "Unknown error" })
22241
- ] })
22242
- ] })
22243
- ]
22388
+ }, [isDragging]);
22389
+ useEffect(() => {
22390
+ if (!isVerticalDragging) return;
22391
+ const handleMouseMove = (e) => {
22392
+ if (leftPanelRef.current) {
22393
+ const rect = leftPanelRef.current.getBoundingClientRect();
22394
+ const relativeY = e.clientY - rect.top;
22395
+ const percentage = relativeY / rect.height * 100;
22396
+ setTreePanelHeight(Math.max(20, Math.min(80, percentage)));
22244
22397
  }
22245
- ),
22246
- document.body
22247
- );
22248
- }
22249
- function StateIcon({ state }) {
22250
- switch (state) {
22251
- case "executed":
22252
- return /* @__PURE__ */ jsx(Check, { size: 16, className: "df-debug-icon-executed" });
22253
- case "skipped":
22254
- return /* @__PURE__ */ jsx(SkipForward, { size: 16, className: "df-debug-icon-skipped" });
22255
- case "error":
22256
- return /* @__PURE__ */ jsx(CircleAlert, { size: 16, className: "df-debug-icon-error" });
22257
- case "current":
22258
- return /* @__PURE__ */ jsx(Clock, { size: 16, className: "df-debug-icon-current" });
22259
- case "pending":
22260
- default:
22261
- return /* @__PURE__ */ jsx(Clock, { size: 16, className: "df-debug-icon-pending" });
22262
- }
22398
+ };
22399
+ const handleMouseUp = () => {
22400
+ setIsVerticalDragging(false);
22401
+ };
22402
+ document.addEventListener("mousemove", handleMouseMove);
22403
+ document.addEventListener("mouseup", handleMouseUp);
22404
+ return () => {
22405
+ document.removeEventListener("mousemove", handleMouseMove);
22406
+ document.removeEventListener("mouseup", handleMouseUp);
22407
+ };
22408
+ }, [isVerticalDragging]);
22409
+ const selectionInfo = getSelectionInfo(selection2);
22410
+ const hasDebugTrace = debugMode && (debuggerContext == null ? void 0 : debuggerContext.hasTrace);
22411
+ const displayMessage = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.currentMessage : executionResult;
22412
+ const currentChanges = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.currentChanges : [];
22413
+ const currentStepIndex = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.state.currentStepIndex : -1;
22414
+ const highlightedPaths = useMemo(() => {
22415
+ if (!currentChanges || currentChanges.length === 0) return void 0;
22416
+ return currentChanges.map((change) => change.path);
22417
+ }, [currentChanges]);
22418
+ const isDraggingAny = isDragging || isVerticalDragging;
22419
+ return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(
22420
+ "div",
22421
+ {
22422
+ ref: containerRef,
22423
+ className: `df-visualizer-horizontal df-theme-${resolvedTheme} ${isDraggingAny ? "df-dragging" : ""}`,
22424
+ children: [
22425
+ /* @__PURE__ */ jsxs(
22426
+ "div",
22427
+ {
22428
+ ref: leftPanelRef,
22429
+ className: "df-visualizer-left",
22430
+ style: { width: leftPanelWidth },
22431
+ children: [
22432
+ /* @__PURE__ */ jsxs(
22433
+ "div",
22434
+ {
22435
+ className: `df-visualizer-left-tree ${displayMessage ? "df-with-result" : ""}`,
22436
+ style: displayMessage ? { height: `${treePanelHeight}%` } : void 0,
22437
+ children: [
22438
+ /* @__PURE__ */ jsxs("div", { className: `df-visualizer-left-header ${showDebugToolbar ? "df-header-with-debug" : ""}`, children: [
22439
+ /* @__PURE__ */ jsx("span", { className: "df-visualizer-left-title", children: "Explorer" }),
22440
+ showDebugToolbar && debugConfig && /* @__PURE__ */ jsx(
22441
+ IntegratedDebugToolbar,
22442
+ {
22443
+ workflows,
22444
+ payload: debugPayload ?? debugConfig.initialPayload,
22445
+ autoExecute: debugConfig.autoExecute,
22446
+ onExecutionComplete: debugConfig.onExecutionComplete,
22447
+ onExecutionError: debugConfig.onExecutionError
22448
+ }
22449
+ )
22450
+ ] }),
22451
+ /* @__PURE__ */ jsx("div", { className: "df-visualizer-left-content", children: workflows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "df-empty-state", children: /* @__PURE__ */ jsx("p", { children: "No workflows to display" }) }) : /* @__PURE__ */ jsx(
22452
+ TreeView,
22453
+ {
22454
+ workflows,
22455
+ selection: selection2,
22456
+ onSelect: handleSelection,
22457
+ debugMode
22458
+ }
22459
+ ) })
22460
+ ]
22461
+ }
22462
+ ),
22463
+ displayMessage && /* @__PURE__ */ jsx(
22464
+ "div",
22465
+ {
22466
+ className: `df-visualizer-divider-horizontal ${isVerticalDragging ? "df-divider-active" : ""}`,
22467
+ onMouseDown: handleVerticalMouseDown
22468
+ }
22469
+ ),
22470
+ displayMessage && /* @__PURE__ */ jsxs(
22471
+ "div",
22472
+ {
22473
+ className: "df-visualizer-result-panel",
22474
+ style: { height: `${100 - treePanelHeight}%` },
22475
+ children: [
22476
+ /* @__PURE__ */ jsxs("div", { className: "df-visualizer-result-header", children: [
22477
+ /* @__PURE__ */ jsx("span", { className: "df-visualizer-result-title", children: hasDebugTrace ? currentStepIndex !== void 0 && currentStepIndex >= 0 ? `Step ${currentStepIndex + 1}` : "Ready" : "Result" }),
22478
+ hasDebugTrace && currentChanges && currentChanges.length > 0 && /* @__PURE__ */ jsxs("span", { className: "df-visualizer-result-changes", children: [
22479
+ currentChanges.length,
22480
+ " change",
22481
+ currentChanges.length !== 1 ? "s" : ""
22482
+ ] })
22483
+ ] }),
22484
+ /* @__PURE__ */ jsx("div", { className: "df-visualizer-result-content", children: /* @__PURE__ */ jsx(
22485
+ JsonEditor,
22486
+ {
22487
+ value: JSON.stringify(displayMessage, null, 2),
22488
+ onChange: () => {
22489
+ },
22490
+ readOnly: true,
22491
+ theme: resolvedTheme === "dark" ? "dark" : "light",
22492
+ highlightedPaths
22493
+ }
22494
+ ) })
22495
+ ]
22496
+ }
22497
+ )
22498
+ ]
22499
+ }
22500
+ ),
22501
+ /* @__PURE__ */ jsx(
22502
+ "div",
22503
+ {
22504
+ className: `df-visualizer-divider ${isDragging ? "df-divider-active" : ""}`,
22505
+ onMouseDown: handleMouseDown
22506
+ }
22507
+ ),
22508
+ /* @__PURE__ */ jsxs("div", { className: "df-visualizer-right", children: [
22509
+ selectionInfo && /* @__PURE__ */ jsx("div", { className: "df-details-header", children: /* @__PURE__ */ jsxs("div", { className: "df-details-header-info", children: [
22510
+ /* @__PURE__ */ jsx("span", { className: "df-details-header-title", children: selectionInfo.title }),
22511
+ /* @__PURE__ */ jsx("span", { className: "df-details-header-subtitle", children: selectionInfo.subtitle })
22512
+ ] }) }),
22513
+ /* @__PURE__ */ jsx(DetailsPanel, { selection: selection2 })
22514
+ ] })
22515
+ ]
22516
+ }
22517
+ ) });
22263
22518
  }
22264
- function DebugStateBadge({
22265
- state,
22266
- conditionResult,
22267
- size = "sm"
22519
+ function WorkflowVisualizer({
22520
+ workflows,
22521
+ onWorkflowSelect,
22522
+ onTaskSelect,
22523
+ theme = "system",
22524
+ className = "",
22525
+ executionResult,
22526
+ debugMode = false,
22527
+ debugConfig,
22528
+ debugPayload
22268
22529
  }) {
22269
- const iconSize = size === "sm" ? 12 : 14;
22270
- return /* @__PURE__ */ jsxs("span", { className: `df-debug-badge df-debug-badge-${state} df-debug-badge-${size}`, children: [
22271
- /* @__PURE__ */ jsx(StateIcon, { state }),
22272
- conditionResult !== void 0 && /* @__PURE__ */ jsx("span", { className: `df-debug-badge-condition ${conditionResult ? "df-debug-badge-condition-pass" : "df-debug-badge-condition-fail"}`, children: conditionResult ? /* @__PURE__ */ jsx(Check, { size: iconSize }) : /* @__PURE__ */ jsx(X, { size: iconSize }) })
22273
- ] });
22530
+ if (debugConfig == null ? void 0 : debugConfig.enabled) {
22531
+ const showControls = debugConfig.showControls !== false;
22532
+ return /* @__PURE__ */ jsx(ThemeProvider, { defaultTheme: theme, children: /* @__PURE__ */ jsx(
22533
+ DebuggerProvider,
22534
+ {
22535
+ engineFactory: debugConfig.engineFactory,
22536
+ autoActivate: true,
22537
+ initialPayload: debugPayload ?? debugConfig.initialPayload,
22538
+ children: /* @__PURE__ */ jsx("div", { className: `df-root ${className}`, children: /* @__PURE__ */ jsx(
22539
+ VisualizerInner,
22540
+ {
22541
+ workflows,
22542
+ onTaskSelect,
22543
+ onWorkflowSelect,
22544
+ executionResult,
22545
+ debugMode: true,
22546
+ showDebugToolbar: showControls,
22547
+ debugConfig,
22548
+ debugPayload
22549
+ }
22550
+ ) })
22551
+ }
22552
+ ) });
22553
+ }
22554
+ return /* @__PURE__ */ jsx(ThemeProvider, { defaultTheme: theme, children: /* @__PURE__ */ jsx("div", { className: `df-root ${className}`, children: /* @__PURE__ */ jsx(
22555
+ VisualizerInner,
22556
+ {
22557
+ workflows,
22558
+ onTaskSelect,
22559
+ onWorkflowSelect,
22560
+ executionResult,
22561
+ debugMode
22562
+ }
22563
+ ) }) });
22274
22564
  }
22275
22565
  class WasmEngine {
22276
22566
  __destroy_into_raw() {
@@ -22497,6 +22787,7 @@ export {
22497
22787
  DebuggerProvider,
22498
22788
  ErrorBoundary,
22499
22789
  FunctionTypeBadge,
22790
+ IntegratedDebugToolbar,
22500
22791
  JsonViewer,
22501
22792
  MessageInputPanel,
22502
22793
  MessageStatePanel,