@workflow/web 5.0.0-beta.2 → 5.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/build/client/assets/{highlighted-body-B3W2YXNL-DPWdt39H.js → highlighted-body-B3W2YXNL-B7T9pqeb.js} +1 -1
  2. package/build/client/assets/{home-OcN-ARTU.js → home-BIQJMe_Q.js} +16 -8
  3. package/build/client/assets/{manifest-62352cd9.js → manifest-77894282.js} +1 -1
  4. package/build/client/assets/{mermaid-3ZIDBTTL-B9v3aKRl.js → mermaid-3ZIDBTTL-w46Kr90n.js} +705 -745
  5. package/build/client/assets/root-C0Tu5TVN.css +1 -0
  6. package/build/client/assets/{root-ClRrWHkX.js → root-sXuXrryl.js} +1 -1
  7. package/build/client/assets/{run-detail-BdYMODbi.js → run-detail-7Pj2mQLs.js} +2074 -3250
  8. package/build/client/assets/server-build-DqaxIrF0.css +1 -0
  9. package/build/client/assets/{workflow-graph-viewer-BdFIMYrh.js → workflow-graph-viewer-De9JQkZc.js} +42 -51
  10. package/build/client/assets/{workflow-graph-viewer-yls6qlc0.css → workflow-graph-viewer-DnlNuQQH.css} +1 -1
  11. package/build/server/assets/{app-coxrYAYu.js → app-CtOg8_v5.js} +1 -1
  12. package/build/server/assets/{highlighted-body-B3W2YXNL-DhGWas67.js → highlighted-body-B3W2YXNL-uaucauLI.js} +3 -3
  13. package/build/server/assets/{index-DJ8Yt9MV.js → index-D02biwxV.js} +4 -4
  14. package/build/server/assets/{mermaid-3ZIDBTTL-DJkW_cc4.js → mermaid-3ZIDBTTL-DrZ5V6uv.js} +3 -3
  15. package/build/server/assets/{server-build-dCNkWo2d.js → server-build-DT0Hg0Yf.js} +2547 -3679
  16. package/build/server/assets/{token-Bi1ru9oe.js → token-D7_Lld85.js} +2 -2
  17. package/build/server/assets/{token-util-Bwj_Mj31.js → token-util-CfY4anoc.js} +2 -2
  18. package/build/server/index.js +1 -1
  19. package/package.json +4 -4
  20. package/build/client/assets/root-BrnNveEi.css +0 -1
  21. package/build/client/assets/server-build-DKWv59Tp.css +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-B3W2YXNL-DPWdt39H.js","assets/index-DQa-BExo.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-B3W2YXNL-B7T9pqeb.js","assets/index-DQa-BExo.js"])))=>i.map(i=>d[i]);
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -6673,6 +6673,28 @@ const createLucideIcon = (iconName, iconNode) => {
6673
6673
  Component.displayName = toPascalCase(iconName);
6674
6674
  return Component;
6675
6675
  };
6676
+ /**
6677
+ * @license lucide-react v0.575.0 - ISC
6678
+ *
6679
+ * This source code is licensed under the ISC license.
6680
+ * See the LICENSE file in the root directory of this source tree.
6681
+ */
6682
+ const __iconNode$3 = [
6683
+ ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
6684
+ ["path", { d: "M19 12H5", key: "x3x0zl" }]
6685
+ ];
6686
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$3);
6687
+ /**
6688
+ * @license lucide-react v0.575.0 - ISC
6689
+ *
6690
+ * This source code is licensed under the ISC license.
6691
+ * See the LICENSE file in the root directory of this source tree.
6692
+ */
6693
+ const __iconNode$2 = [
6694
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
6695
+ ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
6696
+ ];
6697
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$2);
6676
6698
  /**
6677
6699
  * @license lucide-react v0.575.0 - ISC
6678
6700
  *
@@ -6695,37 +6717,36 @@ const Lock = createLucideIcon("lock", __iconNode);
6695
6717
  function cn$4(...inputs) {
6696
6718
  return twMerge(clsx(inputs));
6697
6719
  }
6698
- const durationFormatter = new Intl.NumberFormat(void 0, {
6699
- maximumFractionDigits: 2
6700
- });
6701
6720
  const MS_IN_SECOND = 1e3;
6702
6721
  const MS_IN_MINUTE = 60 * MS_IN_SECOND;
6703
6722
  const MS_IN_HOUR = 60 * MS_IN_MINUTE;
6704
6723
  const MS_IN_DAY = 24 * MS_IN_HOUR;
6705
6724
  function formatDuration(ms, compact = false) {
6706
6725
  if (ms === 0) {
6707
- return "0";
6726
+ return "0s";
6708
6727
  }
6709
6728
  if (ms < MS_IN_SECOND) {
6710
- return `${durationFormatter.format(ms)}ms`;
6729
+ const roundedMs2 = Math.round(ms);
6730
+ return roundedMs2 < MS_IN_SECOND ? `${roundedMs2}ms` : "1s";
6711
6731
  }
6712
- if (ms < MS_IN_MINUTE) {
6713
- return `${durationFormatter.format(ms / MS_IN_SECOND)}s`;
6732
+ const roundedMs = Math.round(ms / MS_IN_SECOND) * MS_IN_SECOND;
6733
+ if (roundedMs < MS_IN_MINUTE) {
6734
+ return `${Math.floor(roundedMs / MS_IN_SECOND)}s`;
6714
6735
  }
6715
6736
  if (compact) {
6716
- if (ms < MS_IN_HOUR) {
6717
- const m3 = Math.floor(ms / MS_IN_MINUTE);
6718
- const s2 = Math.floor(ms % MS_IN_MINUTE / MS_IN_SECOND);
6737
+ if (roundedMs < MS_IN_HOUR) {
6738
+ const m3 = Math.floor(roundedMs / MS_IN_MINUTE);
6739
+ const s2 = Math.floor(roundedMs % MS_IN_MINUTE / MS_IN_SECOND);
6719
6740
  return s2 > 0 ? `${m3}m ${s2}s` : `${m3}m`;
6720
6741
  }
6721
- const h2 = Math.floor(ms / MS_IN_HOUR);
6722
- const m2 = Math.floor(ms % MS_IN_HOUR / MS_IN_MINUTE);
6742
+ const h2 = Math.floor(roundedMs / MS_IN_HOUR);
6743
+ const m2 = Math.floor(roundedMs % MS_IN_HOUR / MS_IN_MINUTE);
6723
6744
  return m2 > 0 ? `${h2}h ${m2}m` : `${h2}h`;
6724
6745
  }
6725
- const days = Math.floor(ms / MS_IN_DAY);
6726
- const hours = Math.floor(ms % MS_IN_DAY / MS_IN_HOUR);
6727
- const minutes = Math.floor(ms % MS_IN_HOUR / MS_IN_MINUTE);
6728
- const seconds = Math.floor(ms % MS_IN_MINUTE / MS_IN_SECOND);
6746
+ const days = Math.floor(roundedMs / MS_IN_DAY);
6747
+ const hours = Math.floor(roundedMs % MS_IN_DAY / MS_IN_HOUR);
6748
+ const minutes = Math.floor(roundedMs % MS_IN_HOUR / MS_IN_MINUTE);
6749
+ const seconds = Math.floor(roundedMs % MS_IN_MINUTE / MS_IN_SECOND);
6729
6750
  const parts = [];
6730
6751
  if (days > 0) {
6731
6752
  parts.push(`${days}d`);
@@ -6736,9 +6757,7 @@ function formatDuration(ms, compact = false) {
6736
6757
  if (minutes > 0) {
6737
6758
  parts.push(`${minutes}m`);
6738
6759
  }
6739
- if (hours <= 1 && (seconds > 0 || parts.length === 0)) {
6740
- parts.push(`${seconds}s`);
6741
- }
6760
+ parts.push(`${seconds}s`);
6742
6761
  return parts.join(" ");
6743
6762
  }
6744
6763
  function isDoStreamStep(stepName) {
@@ -16707,13 +16726,33 @@ const useDarkMode = () => {
16707
16726
  }, []);
16708
16727
  return isDark;
16709
16728
  };
16729
+ function summarizeArrayBufferView(value) {
16730
+ const ta = value;
16731
+ const name2 = ta.constructor.name;
16732
+ const preview = Array.from({ length: Math.min(ta.length, 8) }, (_2, i) => ta[i]);
16733
+ const suffix = ta.length > 8 ? ", …" : "";
16734
+ return `${name2}(${ta.length}) [${preview.join(", ")}${suffix}]`;
16735
+ }
16736
+ function formatArrayBufferViewForDisplay(value) {
16737
+ try {
16738
+ const text2 = new TextDecoder("utf-8", { fatal: true }).decode(value);
16739
+ return {
16740
+ text: text2,
16741
+ decodedFrom: {
16742
+ type: value.constructor.name,
16743
+ encoding: "utf-8",
16744
+ rawSummary: summarizeArrayBufferView(value)
16745
+ }
16746
+ };
16747
+ } catch {
16748
+ return { text: summarizeArrayBufferView(value) };
16749
+ }
16750
+ }
16710
16751
  const inspectorThemeExtendedLight = {
16711
- OBJECT_VALUE_DATE_COLOR: "#a21caf"
16712
- // fuchsia-700
16752
+ OBJECT_VALUE_DATE_COLOR: "var(--ds-pink-900)"
16713
16753
  };
16714
16754
  const inspectorThemeExtendedDark = {
16715
- OBJECT_VALUE_DATE_COLOR: "#e879f9"
16716
- // fuchsia-400
16755
+ OBJECT_VALUE_DATE_COLOR: "var(--ds-pink-900)"
16717
16756
  };
16718
16757
  const shared = {
16719
16758
  BASE_FONT_SIZE: "11px",
@@ -16731,85 +16770,64 @@ const shared = {
16731
16770
  TABLE_DATA_BACKGROUND_IMAGE: "none",
16732
16771
  TABLE_DATA_BACKGROUND_SIZE: "0"
16733
16772
  };
16734
- const inspectorThemeLight = {
16773
+ const geistTheme = {
16735
16774
  ...shared,
16736
16775
  // Base text
16737
16776
  BASE_COLOR: "var(--ds-gray-1000)",
16738
- // Property names — unstyled, same as base foreground (Node: no style)
16739
- OBJECT_NAME_COLOR: "var(--ds-gray-900)",
16740
- // Strings & symbols — green (Node: 'green')
16741
- OBJECT_VALUE_STRING_COLOR: "#16a34a",
16742
- // green-600
16743
- OBJECT_VALUE_SYMBOL_COLOR: "#16a34a",
16744
- // Numbers & booleans — yellow/amber (Node: 'yellow')
16745
- OBJECT_VALUE_NUMBER_COLOR: "#b45309",
16746
- // amber-700 (readable on white)
16747
- OBJECT_VALUE_BOOLEAN_COLOR: "#b45309",
16748
- // null — bold foreground (Node: 'bold')
16777
+ // Property names — default foreground (matches JSON key color in Geist Shiki)
16778
+ OBJECT_NAME_COLOR: "var(--ds-gray-1000)",
16779
+ // Strings & symbols — green
16780
+ OBJECT_VALUE_STRING_COLOR: "var(--ds-green-900)",
16781
+ OBJECT_VALUE_SYMBOL_COLOR: "var(--ds-green-900)",
16782
+ // Numbers & booleans — green (Geist JSON tokens)
16783
+ OBJECT_VALUE_NUMBER_COLOR: "var(--ds-green-900)",
16784
+ OBJECT_VALUE_BOOLEAN_COLOR: "var(--ds-green-900)",
16785
+ // null muted foreground
16749
16786
  OBJECT_VALUE_NULL_COLOR: "var(--ds-gray-900)",
16750
- // undefined — grey (Node: 'grey')
16751
- OBJECT_VALUE_UNDEFINED_COLOR: "var(--ds-gray-500)",
16752
- // RegExp — red (Node regexp base uses green/red/yellow palette)
16753
- OBJECT_VALUE_REGEXP_COLOR: "#dc2626",
16754
- // red-600
16755
- // Functions — cyan (Node: 'special' → 'cyan')
16756
- OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "#0891b2",
16757
- // cyan-600
16758
- // HTML (less relevant for data inspection, but reasonable defaults)
16759
- HTML_TAG_COLOR: "var(--ds-gray-500)",
16760
- HTML_TAGNAME_COLOR: "#0891b2",
16761
- HTML_ATTRIBUTE_NAME_COLOR: "#b45309",
16762
- HTML_ATTRIBUTE_VALUE_COLOR: "#16a34a",
16763
- HTML_COMMENT_COLOR: "var(--ds-gray-400)",
16764
- HTML_DOCTYPE_COLOR: "var(--ds-gray-400)",
16765
- // Structural
16766
- ARROW_COLOR: "var(--ds-gray-500)",
16767
- TABLE_BORDER_COLOR: "var(--ds-gray-300)",
16768
- TABLE_TH_BACKGROUND_COLOR: "var(--ds-gray-100)",
16769
- TABLE_TH_HOVER_COLOR: "var(--ds-gray-200)",
16770
- TABLE_SORT_ICON_COLOR: "var(--ds-gray-500)"
16771
- };
16772
- const inspectorThemeDark = {
16773
- ...shared,
16774
- // Base text
16775
- BASE_COLOR: "var(--ds-gray-1000)",
16776
- // Property names — white/light foreground (Node: unstyled = white in dark terminal)
16777
- OBJECT_NAME_COLOR: "var(--ds-gray-900)",
16778
- // Strings & symbols — green (Node: 'green')
16779
- OBJECT_VALUE_STRING_COLOR: "#4ade80",
16780
- // green-400
16781
- OBJECT_VALUE_SYMBOL_COLOR: "#4ade80",
16782
- // Numbers & booleans — yellow (Node: 'yellow')
16783
- OBJECT_VALUE_NUMBER_COLOR: "#facc15",
16784
- // yellow-400
16785
- OBJECT_VALUE_BOOLEAN_COLOR: "#facc15",
16786
- // null — bold foreground / white (Node: 'bold')
16787
- OBJECT_VALUE_NULL_COLOR: "var(--ds-gray-1000)",
16788
- // undefined — grey (Node: 'grey')
16789
- OBJECT_VALUE_UNDEFINED_COLOR: "var(--ds-gray-500)",
16790
- // RegExp — red (Node regexp palette)
16791
- OBJECT_VALUE_REGEXP_COLOR: "#f87171",
16792
- // red-400
16793
- // Functions — cyan (Node: 'special' → 'cyan')
16794
- OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "#22d3ee",
16795
- // cyan-400
16796
- // HTML
16797
- HTML_TAG_COLOR: "var(--ds-gray-500)",
16798
- HTML_TAGNAME_COLOR: "#22d3ee",
16799
- HTML_ATTRIBUTE_NAME_COLOR: "#facc15",
16800
- HTML_ATTRIBUTE_VALUE_COLOR: "#4ade80",
16801
- HTML_COMMENT_COLOR: "var(--ds-gray-500)",
16802
- HTML_DOCTYPE_COLOR: "var(--ds-gray-500)",
16787
+ // undefined — muted foreground
16788
+ OBJECT_VALUE_UNDEFINED_COLOR: "var(--ds-gray-900)",
16789
+ // RegExp — purple
16790
+ OBJECT_VALUE_REGEXP_COLOR: "var(--ds-purple-900)",
16791
+ // Functions — purple
16792
+ OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "var(--ds-purple-900)",
16793
+ // HTML (rarely used here, kept consistent with the palette)
16794
+ HTML_TAG_COLOR: "var(--ds-gray-900)",
16795
+ HTML_TAGNAME_COLOR: "var(--ds-blue-900)",
16796
+ HTML_ATTRIBUTE_NAME_COLOR: "var(--ds-amber-900)",
16797
+ HTML_ATTRIBUTE_VALUE_COLOR: "var(--ds-green-900)",
16798
+ HTML_COMMENT_COLOR: "var(--ds-gray-700)",
16799
+ HTML_DOCTYPE_COLOR: "var(--ds-gray-700)",
16803
16800
  // Structural
16804
- ARROW_COLOR: "var(--ds-gray-500)",
16801
+ ARROW_COLOR: "var(--ds-gray-700)",
16805
16802
  TABLE_BORDER_COLOR: "var(--ds-gray-300)",
16806
16803
  TABLE_TH_BACKGROUND_COLOR: "var(--ds-gray-100)",
16807
16804
  TABLE_TH_HOVER_COLOR: "var(--ds-gray-200)",
16808
- TABLE_SORT_ICON_COLOR: "var(--ds-gray-500)"
16805
+ TABLE_SORT_ICON_COLOR: "var(--ds-gray-700)"
16809
16806
  };
16807
+ const inspectorThemeLight = geistTheme;
16808
+ const inspectorThemeDark = geistTheme;
16810
16809
  const STREAM_REF_TYPE = "__workflow_stream_ref__";
16811
16810
  const CLASS_INSTANCE_REF_TYPE = "__workflow_class_instance_ref__";
16812
16811
  const RUN_REF_TYPE = "__workflow_run_ref__";
16812
+ const BYTES_DISPLAY_TYPE = "__workflow_bytes_display__";
16813
+ function deserializeChunkText(text2) {
16814
+ try {
16815
+ const parsed = JSON.parse(text2);
16816
+ if (typeof parsed === "string") {
16817
+ return parsed;
16818
+ }
16819
+ return JSON.stringify(parsed, null, 2);
16820
+ } catch {
16821
+ return text2;
16822
+ }
16823
+ }
16824
+ function parseChunkData(text2) {
16825
+ try {
16826
+ return JSON.parse(text2);
16827
+ } catch {
16828
+ return text2;
16829
+ }
16830
+ }
16813
16831
  function isStreamRef(value) {
16814
16832
  if (value === null || typeof value !== "object")
16815
16833
  return false;
@@ -16822,6 +16840,12 @@ function isRunRef(value) {
16822
16840
  const desc = Object.getOwnPropertyDescriptor(value, "__type");
16823
16841
  return (desc == null ? void 0 : desc.value) === RUN_REF_TYPE;
16824
16842
  }
16843
+ function isBytesDisplay(value) {
16844
+ if (value === null || typeof value !== "object")
16845
+ return false;
16846
+ const desc = Object.getOwnPropertyDescriptor(value, "__type");
16847
+ return (desc == null ? void 0 : desc.value) === BYTES_DISPLAY_TYPE;
16848
+ }
16825
16849
  function isClassInstanceRef(value) {
16826
16850
  return value !== null && typeof value === "object" && "__type" in value && value.__type === CLASS_INSTANCE_REF_TYPE;
16827
16851
  }
@@ -16874,9 +16898,31 @@ function RunRefInline({ runRef }) {
16874
16898
  }, title: `View run: ${runRef.runId}`, children: jsxRuntimeExports.jsx("span", { children: runRef.runId }) });
16875
16899
  }
16876
16900
  const ExtendedThemeContext = reactExports.createContext(inspectorThemeExtendedLight);
16901
+ function DecodedBytesChunk({ decodedText, source }) {
16902
+ const [selectedView, setSelectedView] = reactExports.useState("decoded");
16903
+ const parsed = parseChunkData(decodedText);
16904
+ return jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [selectedView === "decoded" ? jsxRuntimeExports.jsx("div", { className: "min-w-0", children: typeof parsed === "string" ? jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words", style: { color: "var(--ds-gray-1000)" }, children: deserializeChunkText(parsed) }) : jsxRuntimeExports.jsx(DataInspector, { data: parsed, expandLevel: 1 }) }) : jsxRuntimeExports.jsx(DecodedBytesInspector, { decodedText, source }), jsxRuntimeExports.jsx("div", { className: "mt-2 flex", children: jsxRuntimeExports.jsxs("div", { className: "inline-flex overflow-hidden rounded border", style: { borderColor: "var(--ds-gray-400)" }, title: `${source.type} decoded as ${source.encoding.toUpperCase()} text. Switch to Bytes to inspect the summarized raw value.`, children: [jsxRuntimeExports.jsx("button", { type: "button", className: "h-5 px-1.5 text-[10px] font-medium", style: {
16905
+ backgroundColor: selectedView === "decoded" ? "var(--ds-gray-200)" : "var(--ds-gray-100)",
16906
+ color: "var(--ds-gray-900)"
16907
+ }, onClick: () => setSelectedView("decoded"), "aria-pressed": selectedView === "decoded", "aria-label": "Show decoded text", children: "Decoded" }), jsxRuntimeExports.jsx("button", { type: "button", className: "h-5 border-l px-1.5 text-[10px] font-medium", style: {
16908
+ borderColor: "var(--ds-gray-400)",
16909
+ backgroundColor: selectedView === "bytes" ? "var(--ds-gray-200)" : "var(--ds-gray-100)",
16910
+ color: "var(--ds-gray-900)"
16911
+ }, onClick: () => setSelectedView("bytes"), "aria-pressed": selectedView === "bytes", "aria-label": "Show raw bytes summary", children: "Bytes" })] }) })] });
16912
+ }
16913
+ function DecodedBytesInspector({ decodedText, source }) {
16914
+ const [expanded2, setExpanded] = reactExports.useState(false);
16915
+ return jsxRuntimeExports.jsxs("div", { className: "font-mono", children: [jsxRuntimeExports.jsxs("button", { type: "button", className: "flex max-w-full items-start gap-1 text-left", style: { color: "var(--ds-gray-1000)" }, onClick: () => setExpanded((value) => !value), title: `${source.type} decoded as ${source.encoding.toUpperCase()} text`, children: [jsxRuntimeExports.jsx("span", { className: "select-none", style: { color: "var(--ds-gray-700)" }, children: expanded2 ? "▼" : "▶" }), jsxRuntimeExports.jsx("span", { className: "min-w-0 break-words", children: source.rawSummary })] }), expanded2 && jsxRuntimeExports.jsxs("div", { className: "mt-1 pl-5", children: [jsxRuntimeExports.jsx("span", { style: { color: "var(--ds-gray-700)" }, children: "decoded: " }), jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words", style: { color: "var(--ds-green-900)" }, children: JSON.stringify(decodedText) })] })] });
16916
+ }
16917
+ function BytesDisplayLabel({ name: name2, display }) {
16918
+ return jsxRuntimeExports.jsxs("div", { className: "inline-block min-w-0 align-top", children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), display.decodedFrom ? jsxRuntimeExports.jsx(DecodedBytesChunk, { decodedText: display.text, source: display.decodedFrom }) : jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words", style: { color: "var(--ds-gray-1000)" }, children: display.text })] });
16919
+ }
16877
16920
  function NodeRenderer({ depth, name: name2, data, isNonenumerable }) {
16878
16921
  var _a3;
16879
16922
  const extendedTheme = reactExports.useContext(ExtendedThemeContext);
16923
+ if (isBytesDisplay(data)) {
16924
+ return jsxRuntimeExports.jsx(BytesDisplayLabel, { name: name2, display: data });
16925
+ }
16880
16926
  if (data !== null && typeof data === "object" && ((_a3 = data.constructor) == null ? void 0 : _a3.name) === ENCRYPTED_DISPLAY_NAME) {
16881
16927
  const label = jsxRuntimeExports.jsx(EncryptedInlineLabel, {});
16882
16928
  if (depth === 0) {
@@ -16915,13 +16961,41 @@ function makeOpaqueRef(ref) {
16915
16961
  }
16916
16962
  return opaque;
16917
16963
  }
16964
+ function makeBytesDisplay(display) {
16965
+ const opaque = /* @__PURE__ */ Object.create(null);
16966
+ Object.defineProperty(opaque, "__type", {
16967
+ value: BYTES_DISPLAY_TYPE,
16968
+ enumerable: false
16969
+ });
16970
+ Object.defineProperty(opaque, "text", {
16971
+ value: display.text,
16972
+ enumerable: false
16973
+ });
16974
+ Object.defineProperty(opaque, "decodedFrom", {
16975
+ value: display.decodedFrom,
16976
+ enumerable: false
16977
+ });
16978
+ return opaque;
16979
+ }
16918
16980
  function collapseRefs(data) {
16919
16981
  if (data === null || typeof data !== "object")
16920
16982
  return data;
16983
+ if (ArrayBuffer.isView(data) && !(data instanceof DataView)) {
16984
+ return makeBytesDisplay(formatArrayBufferViewForDisplay(data));
16985
+ }
16921
16986
  if (isRunRef(data) || isStreamRef(data))
16922
16987
  return makeOpaqueRef(data);
16923
16988
  if (Array.isArray(data))
16924
16989
  return data.map(collapseRefs);
16990
+ if (data instanceof Map) {
16991
+ return new Map(Array.from(data.entries(), ([key, value]) => [
16992
+ collapseRefs(key),
16993
+ collapseRefs(value)
16994
+ ]));
16995
+ }
16996
+ if (data instanceof Set) {
16997
+ return new Set(Array.from(data.values(), collapseRefs));
16998
+ }
16925
16999
  const proto2 = Object.getPrototypeOf(data);
16926
17000
  if (proto2 !== Object.prototype && proto2 !== null)
16927
17001
  return data;
@@ -16971,9 +17045,16 @@ function useStableInspectorData(next2) {
16971
17045
  function isObjectLike(value) {
16972
17046
  return typeof value === "object" && value !== null;
16973
17047
  }
17048
+ function isSameBytesDisplay(a2, b2) {
17049
+ var _a3, _b, _c, _d, _e2, _f;
17050
+ return a2.text === b2.text && ((_a3 = a2.decodedFrom) == null ? void 0 : _a3.type) === ((_b = b2.decodedFrom) == null ? void 0 : _b.type) && ((_c = a2.decodedFrom) == null ? void 0 : _c.encoding) === ((_d = b2.decodedFrom) == null ? void 0 : _d.encoding) && ((_e2 = a2.decodedFrom) == null ? void 0 : _e2.rawSummary) === ((_f = b2.decodedFrom) == null ? void 0 : _f.rawSummary);
17051
+ }
16974
17052
  function isDeepEqual(a2, b2, seen2 = /* @__PURE__ */ new WeakMap()) {
16975
17053
  if (Object.is(a2, b2))
16976
17054
  return true;
17055
+ if (isBytesDisplay(a2) || isBytesDisplay(b2)) {
17056
+ return isBytesDisplay(a2) && isBytesDisplay(b2) && isSameBytesDisplay(a2, b2);
17057
+ }
16977
17058
  if (a2 instanceof Date && b2 instanceof Date) {
16978
17059
  return a2.getTime() === b2.getTime();
16979
17060
  }
@@ -42883,7 +42964,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
42883
42964
  var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
42884
42965
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
42885
42966
  var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
42886
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => __vitePreload(() => import("./highlighted-body-B3W2YXNL-DPWdt39H.js"), true ? __vite__mapDeps([0,1]) : void 0).then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
42967
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => __vitePreload(() => import("./highlighted-body-B3W2YXNL-B7T9pqeb.js"), true ? __vite__mapDeps([0,1]) : void 0).then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
42887
42968
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
42888
42969
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
42889
42970
  return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur", "data-streamdown": "code-block-actions", children: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
@@ -43647,27 +43728,11 @@ var Nt = ({ chart: e, className: t, config: o, fullscreen: n = false, showContro
43647
43728
  let T2 = l || d2;
43648
43729
  return jsxRuntimeExports.jsx("div", { className: f("size-full", t), "data-streamdown": "mermaid", ref: w2, children: jsxRuntimeExports.jsx(So, { className: f(n ? "size-full overflow-hidden" : "overflow-hidden", t), fullscreen: n, maxZoom: 3, minZoom: 0.5, showControls: s2, zoomStep: 0.1, children: jsxRuntimeExports.jsx("div", { "aria-label": "Mermaid chart", className: f("flex justify-center", n ? "size-full items-center" : null), dangerouslySetInnerHTML: { __html: T2 }, role: "img" }) }) });
43649
43730
  };
43650
- const SEARCH_HEIGHT = 40;
43651
- const SEARCH_GAP = 8;
43652
43731
  const MAP_HEIGHT = 56;
43653
43732
  const TIMELINE_PADDING = 8;
43654
43733
  const ROW_PADDING = 2;
43655
- const ROW_HEIGHT = 24;
43734
+ const ROW_HEIGHT$1 = 24;
43656
43735
  const MARKER_HEIGHT = 24;
43657
- const MARKER_NOTCH_HEIGHT = 8;
43658
- const detectScrollbarWidth = () => {
43659
- if (!("document" in globalThis))
43660
- return 0;
43661
- const size2 = 400;
43662
- const container = document.createElement("div");
43663
- container.style.width = `${size2}px`;
43664
- container.style.height = `${size2}px`;
43665
- container.style.overflow = "scroll";
43666
- document.body.appendChild(container);
43667
- const scrollbarWidth = size2 - container.scrollWidth;
43668
- container.remove();
43669
- return scrollbarWidth;
43670
- };
43671
43736
  const initialState = {
43672
43737
  root: {
43673
43738
  startTime: 0,
@@ -43697,301 +43762,14 @@ const initialState = {
43697
43762
  withPanel: false,
43698
43763
  isMobile: false
43699
43764
  };
43700
- const getMinScale = (state) => {
43701
- return (state.timelineWidth - state.scrollbarWidth) / state.root.duration;
43702
- };
43703
43765
  const TraceViewerContext = reactExports.createContext({
43704
43766
  state: initialState,
43705
43767
  dispatch: () => {
43706
43768
  }
43707
43769
  });
43708
43770
  TraceViewerContext.displayName = "TraceViewerContext";
43709
- const reducer = (state, action) => {
43710
- var _a3;
43711
- switch (action.type) {
43712
- case "setRoot":
43713
- state.scrollSnapshotRef.current = void 0;
43714
- state.memoCacheRef.current.clear();
43715
- return reducer({
43716
- ...state,
43717
- root: action.root,
43718
- spanMap: action.spanMap,
43719
- resourceMap: Object.fromEntries(action.resources.map(({ name: name2, attributes }) => [name2, attributes]))
43720
- }, {
43721
- type: "detectBaseScale"
43722
- });
43723
- case "setSize": {
43724
- const lowerHeight = action.height - MAP_HEIGHT - SEARCH_HEIGHT - 3 * SEARCH_GAP;
43725
- const isMobile = state.withPanel && action.width <= 768;
43726
- let newState = {
43727
- ...state,
43728
- width: action.width,
43729
- height: action.height,
43730
- timelineWidth: action.width - Number(Boolean(state.selected && state.withPanel && !isMobile)) * state.panelWidth,
43731
- timelineHeight: lowerHeight,
43732
- panelHeight: lowerHeight,
43733
- isMobile
43734
- };
43735
- if (newState.width !== state.width) {
43736
- newState = reducer(newState, {
43737
- type: "detectBaseScale"
43738
- });
43739
- }
43740
- return newState;
43741
- }
43742
- case "setPanelWidth": {
43743
- const panelWidth = Math.max(240, Math.min(action.width, state.width - 240));
43744
- const timelineWidth = state.withPanel && state.selected && !state.isMobile ? state.width - panelWidth : state.width;
43745
- return reducer({
43746
- ...state,
43747
- timelineWidth,
43748
- panelWidth
43749
- }, {
43750
- type: "detectBaseScale"
43751
- });
43752
- }
43753
- case "setFilter":
43754
- return {
43755
- ...state,
43756
- filter: action.filter
43757
- };
43758
- case "deselect":
43759
- return reducer({
43760
- ...state,
43761
- selected: null,
43762
- timelineWidth: state.width
43763
- }, {
43764
- type: "detectBaseScale"
43765
- });
43766
- case "select": {
43767
- const node2 = state.spanMap[action.id];
43768
- if (!node2) {
43769
- return state;
43770
- }
43771
- return reducer({
43772
- ...state,
43773
- selected: node2,
43774
- timelineWidth: state.width - (state.withPanel && !state.isMobile ? state.panelWidth : 0)
43775
- }, {
43776
- type: "detectBaseScale"
43777
- });
43778
- }
43779
- case "escape": {
43780
- if (state.selected) {
43781
- return reducer(state, {
43782
- type: "deselect"
43783
- });
43784
- }
43785
- return reducer(state, {
43786
- type: "resetScale"
43787
- });
43788
- }
43789
- case "toggleSelection": {
43790
- let newState = state;
43791
- if (state.selected) {
43792
- newState = reducer(newState, {
43793
- type: "deselect"
43794
- });
43795
- }
43796
- if (((_a3 = state.selected) == null ? void 0 : _a3.span.spanId) === action.id) {
43797
- return newState;
43798
- }
43799
- return reducer(newState, {
43800
- type: "select",
43801
- id: action.id
43802
- });
43803
- }
43804
- case "detectBaseScale": {
43805
- const baseScale = (state.timelineWidth - state.scrollbarWidth) / state.root.duration;
43806
- return reducer({
43807
- ...state,
43808
- baseScale,
43809
- scale: baseScale * state.scaleRatio
43810
- }, {
43811
- type: "minScale"
43812
- });
43813
- }
43814
- case "setScale":
43815
- return {
43816
- ...state,
43817
- scaleRatio: action.scale,
43818
- scale: state.baseScale * action.scale
43819
- };
43820
- case "resetScale":
43821
- return reducer(state, {
43822
- type: "scaleToRange",
43823
- t1: state.root.startTime,
43824
- t2: state.root.endTime
43825
- });
43826
- case "scaleToNode": {
43827
- const node2 = state.spanMap[action.id];
43828
- if (!node2) {
43829
- return state;
43830
- }
43831
- return reducer(reducer(state, {
43832
- type: "setScale",
43833
- scale: (state.width - state.scrollbarWidth - (state.withPanel && !state.isMobile ? state.panelWidth : 0)) / node2.duration / state.baseScale
43834
- }), {
43835
- type: "setScrollSnapshot",
43836
- anchorT: node2.startTime - state.root.startTime,
43837
- anchorX: 0
43838
- });
43839
- }
43840
- case "scaleToRange": {
43841
- const duration2 = Math.abs(action.t1 - action.t2);
43842
- return reducer(reducer(state, {
43843
- type: "setScale",
43844
- scale: (state.width - state.scrollbarWidth - (state.selected && state.withPanel ? state.panelWidth : 0)) / duration2 / state.baseScale
43845
- }), {
43846
- type: "setScrollSnapshot",
43847
- anchorT: Math.min(action.t1, action.t2) - state.root.startTime,
43848
- anchorX: 0
43849
- });
43850
- }
43851
- case "adjustScaleRatio": {
43852
- let { scaleRatio } = state;
43853
- switch (action.direction) {
43854
- case -1:
43855
- scaleRatio *= 0.8;
43856
- break;
43857
- case 1:
43858
- scaleRatio *= 1.25;
43859
- break;
43860
- default:
43861
- scaleRatio = 1;
43862
- break;
43863
- }
43864
- const $timeline = state.timelineRef.current;
43865
- if (!$timeline) {
43866
- console.warn("timelineRef is null");
43867
- return state;
43868
- }
43869
- const { clientWidth, scrollLeft } = $timeline;
43870
- return reducer(reducer({
43871
- ...state,
43872
- scaleRatio,
43873
- scale: state.baseScale * scaleRatio
43874
- }, {
43875
- type: "minScale"
43876
- }), {
43877
- type: "setScrollSnapshot",
43878
- anchorT: (scrollLeft + clientWidth * 0.5) / state.scale,
43879
- anchorX: clientWidth * 0.5
43880
- });
43881
- }
43882
- case "trackpadScale": {
43883
- const minScaleRatio = getMinScale(state) / state.baseScale;
43884
- const scaleRatio = Math.max(minScaleRatio, state.scaleRatio * (1 + 0.2 * Math.sign(action.delta) * Math.sqrt(Math.abs(action.delta))));
43885
- return reducer({
43886
- ...state,
43887
- scaleRatio,
43888
- scale: state.baseScale * scaleRatio
43889
- }, {
43890
- type: "setScrollSnapshot",
43891
- anchorT: action.anchorT,
43892
- anchorX: action.anchorX
43893
- });
43894
- }
43895
- case "minScale": {
43896
- const minScale = getMinScale(state);
43897
- if (state.scale >= minScale)
43898
- return state;
43899
- return {
43900
- ...state,
43901
- scale: minScale,
43902
- scaleRatio: minScale / state.baseScale
43903
- };
43904
- }
43905
- case "setScrollSnapshot": {
43906
- const $timeline = state.timelineRef.current;
43907
- if (!$timeline)
43908
- return state;
43909
- const { anchorT, anchorX } = action;
43910
- const scrollLeft = anchorT * state.scale - anchorX;
43911
- const { scrollTop } = $timeline;
43912
- const startRow = (scrollTop - MARKER_HEIGHT - TIMELINE_PADDING) / (ROW_HEIGHT + ROW_PADDING);
43913
- const endRow = startRow + Math.ceil(state.timelineHeight / (ROW_HEIGHT + ROW_PADDING));
43914
- state.scrollSnapshotRef.current = {
43915
- anchorT,
43916
- anchorX,
43917
- scrollLeft,
43918
- scrollTop,
43919
- startTime: state.root.startTime + scrollLeft / state.scale,
43920
- endTime: state.root.startTime + (scrollLeft + state.timelineWidth) / state.scale,
43921
- startRow,
43922
- endRow,
43923
- scale: state.scale
43924
- };
43925
- return state;
43926
- }
43927
- case "setWithPanel": {
43928
- if (state.withPanel === action.withPanel)
43929
- return state;
43930
- const timelineWidth = action.withPanel && state.selected && !state.isMobile ? state.width - state.panelWidth : state.width;
43931
- return reducer({
43932
- ...state,
43933
- withPanel: action.withPanel,
43934
- timelineWidth
43935
- }, {
43936
- type: "detectBaseScale"
43937
- });
43938
- }
43939
- case "forceRender":
43940
- state.memoCacheRef.current.set("", {});
43941
- return {
43942
- ...state
43943
- };
43944
- case "updateRoot":
43945
- state.memoCacheRef.current.set("", {});
43946
- return reducer({
43947
- ...state,
43948
- root: action.root,
43949
- spanMap: action.spanMap,
43950
- resourceMap: Object.fromEntries(action.resources.map(({ name: name2, attributes }) => [name2, attributes]))
43951
- }, {
43952
- type: "detectBaseScale"
43953
- });
43954
- }
43955
- };
43956
- function TraceViewerContextProvider({ getQuickLinks, withPanel = false, children: children2, customSpanClassNameFunc, customSpanEventClassNameFunc, customPanelComponent = null }) {
43957
- const timelineRef = reactExports.useRef(null);
43958
- const scrollSnapshotRef = reactExports.useRef(void 0);
43959
- const getQuickLinksRef = reactExports.useRef(getQuickLinks);
43960
- getQuickLinksRef.current = getQuickLinks;
43961
- const memoCacheRef = reactExports.useRef(/* @__PURE__ */ new Map());
43962
- const quickLinksCache = reactExports.useRef(/* @__PURE__ */ new Map());
43963
- const [state, dispatch] = reactExports.useReducer(reducer, initialState, (initial) => {
43964
- return {
43965
- ...initial,
43966
- scrollbarWidth: detectScrollbarWidth(),
43967
- timelineRef,
43968
- scrollSnapshotRef,
43969
- customSpanClassNameFunc,
43970
- customSpanEventClassNameFunc,
43971
- memoCacheRef,
43972
- withPanel,
43973
- getQuickLinks: (span) => {
43974
- var _a3;
43975
- const cacheKey = span.spanId;
43976
- const existing = quickLinksCache.current.get(cacheKey);
43977
- if (existing)
43978
- return existing;
43979
- const value2 = ((_a3 = getQuickLinksRef.current) == null ? void 0 : _a3.call(getQuickLinksRef, span)) || [];
43980
- quickLinksCache.current.set(cacheKey, value2);
43981
- return value2;
43982
- }
43983
- };
43984
- });
43985
- reactExports.useEffect(() => dispatch({
43986
- type: "setWithPanel",
43987
- withPanel
43988
- }), [withPanel]);
43989
- const value = reactExports.useMemo(() => ({ state, dispatch }), [state, dispatch]);
43990
- return jsxRuntimeExports.jsx(CustomPanelContext.Provider, { value: customPanelComponent, children: jsxRuntimeExports.jsx(TraceViewerContext.Provider, { value, children: children2 }) });
43991
- }
43992
43771
  const useTraceViewer = () => reactExports.useContext(TraceViewerContext);
43993
- const CustomPanelContext = reactExports.createContext(null);
43994
- const useCustomPanelComponent = () => reactExports.useContext(CustomPanelContext);
43772
+ reactExports.createContext(null);
43995
43773
  const traceNode = "_traceNode_1fmf2_1";
43996
43774
  const childRow = "_childRow_1fmf2_5";
43997
43775
  const spanNode = "_spanNode_1fmf2_11";
@@ -44241,27 +44019,6 @@ const styles = {
44241
44019
  function getHighResInMs([seconds, nanoseconds]) {
44242
44020
  return seconds * 1e3 + nanoseconds / 1e6;
44243
44021
  }
44244
- function getMsInHighRes(ms) {
44245
- return [Math.floor(ms / 1e3), ms % 1e3 * 1e3];
44246
- }
44247
- const formatDurationForTimeline = (ms) => formatDuration(ms, true);
44248
- const timeSelectionFormatter = new Intl.NumberFormat(void 0, {
44249
- minimumFractionDigits: 2,
44250
- maximumFractionDigits: 2
44251
- });
44252
- function formatTimeSelection(ms) {
44253
- if (ms >= 1e3) {
44254
- return `${timeSelectionFormatter.format(ms / 1e3)}s`;
44255
- }
44256
- return `${timeSelectionFormatter.format(ms)}ms`;
44257
- }
44258
- function formatWallClockTime(epochMs) {
44259
- const d2 = new Date(epochMs);
44260
- const h2 = String(d2.getHours()).padStart(2, "0");
44261
- const m2 = String(d2.getMinutes()).padStart(2, "0");
44262
- const s2 = String(d2.getSeconds()).padStart(2, "0");
44263
- return `${h2}:${m2}:${s2}`;
44264
- }
44265
44022
  const SEGMENT_CLASS_MAP = {
44266
44023
  queued: "segQueued",
44267
44024
  running: "segRunning",
@@ -44272,13 +44029,13 @@ const SEGMENT_CLASS_MAP = {
44272
44029
  sleeping: "segSleeping",
44273
44030
  received: "segReceived"
44274
44031
  };
44275
- function clampFraction(value) {
44032
+ function clampFraction$1(value) {
44276
44033
  return Math.max(0, Math.min(1, value));
44277
44034
  }
44278
- function timeToFraction(time2, spanStart, spanDuration2) {
44035
+ function timeToFraction$1(time2, spanStart, spanDuration2) {
44279
44036
  if (spanDuration2 <= 0)
44280
44037
  return 0;
44281
- return clampFraction((time2 - spanStart) / spanDuration2);
44038
+ return clampFraction$1((time2 - spanStart) / spanDuration2);
44282
44039
  }
44283
44040
  function sortedEvents(events) {
44284
44041
  return [...events].sort((a2, b2) => a2.timestamp - b2.timestamp);
@@ -44300,7 +44057,7 @@ function computeStepSegments(node2) {
44300
44057
  return segments;
44301
44058
  }
44302
44059
  const firstMark = marks[0];
44303
- const firstFraction = timeToFraction(firstMark.time, startTime, duration2);
44060
+ const firstFraction = timeToFraction$1(firstMark.time, startTime, duration2);
44304
44061
  if (firstFraction > 1e-3) {
44305
44062
  segments.push({
44306
44063
  startFraction: 0,
@@ -44310,9 +44067,9 @@ function computeStepSegments(node2) {
44310
44067
  }
44311
44068
  for (let i = 0; i < marks.length; i++) {
44312
44069
  const mark2 = marks[i];
44313
- const markFraction = timeToFraction(mark2.time, startTime, duration2);
44070
+ const markFraction = timeToFraction$1(mark2.time, startTime, duration2);
44314
44071
  const nextMark = marks[i + 1];
44315
- const nextFraction = nextMark ? timeToFraction(nextMark.time, startTime, duration2) : 1;
44072
+ const nextFraction = nextMark ? timeToFraction$1(nextMark.time, startTime, duration2) : 1;
44316
44073
  if (mark2.type === "step_started") {
44317
44074
  const isLastMark = i === marks.length - 1;
44318
44075
  if (isLastMark) {
@@ -44360,8 +44117,8 @@ function computeHookSegments(node2) {
44360
44117
  segments.push({ startFraction: 0, endFraction: 1, status: "waiting" });
44361
44118
  return segments;
44362
44119
  }
44363
- const receivedFraction = receivedEvent ? timeToFraction(receivedEvent.timestamp, startTime, duration2) : null;
44364
- const disposedFraction = disposedEvent ? timeToFraction(disposedEvent.timestamp, startTime, duration2) : null;
44120
+ const receivedFraction = receivedEvent ? timeToFraction$1(receivedEvent.timestamp, startTime, duration2) : null;
44121
+ const disposedFraction = disposedEvent ? timeToFraction$1(disposedEvent.timestamp, startTime, duration2) : null;
44365
44122
  if (receivedFraction !== null && receivedFraction > 1e-3) {
44366
44123
  segments.push({
44367
44124
  startFraction: 0,
@@ -44403,7 +44160,7 @@ function computeSleepSegments(node2) {
44403
44160
  segments.push({ startFraction: 0, endFraction: 1, status: "sleeping" });
44404
44161
  return segments;
44405
44162
  }
44406
- const completedFraction = timeToFraction(completedEvent.timestamp, startTime, duration2);
44163
+ const completedFraction = timeToFraction$1(completedEvent.timestamp, startTime, duration2);
44407
44164
  if (completedFraction > 1e-3) {
44408
44165
  segments.push({
44409
44166
  startFraction: 0,
@@ -44429,13 +44186,13 @@ function computeRunSegments(node2) {
44429
44186
  if (!hasRunCreated) {
44430
44187
  const runData = (_a3 = node2.span.attributes) == null ? void 0 : _a3.data;
44431
44188
  const runStatus = runData == null ? void 0 : runData.status;
44432
- return computeV1RunSegments(startTime, duration2, activeStartTime, runStatus);
44189
+ return computeV1RunSegments$1(startTime, duration2, activeStartTime, runStatus);
44433
44190
  }
44434
44191
  const failedEvent = events.find((e) => e.event.name === "run_failed");
44435
44192
  const completedEvent = events.find((e) => e.event.name === "run_completed");
44436
44193
  let cursor = 0;
44437
44194
  if (activeStartTime && activeStartTime > startTime) {
44438
- const queuedFraction = timeToFraction(activeStartTime, startTime, duration2);
44195
+ const queuedFraction = timeToFraction$1(activeStartTime, startTime, duration2);
44439
44196
  if (queuedFraction > 1e-3) {
44440
44197
  segments.push({
44441
44198
  startFraction: 0,
@@ -44446,7 +44203,7 @@ function computeRunSegments(node2) {
44446
44203
  }
44447
44204
  }
44448
44205
  if (failedEvent) {
44449
- const failedFraction = timeToFraction(failedEvent.timestamp, startTime, duration2);
44206
+ const failedFraction = timeToFraction$1(failedEvent.timestamp, startTime, duration2);
44450
44207
  if (failedFraction > cursor + 1e-3) {
44451
44208
  segments.push({
44452
44209
  startFraction: cursor,
@@ -44460,7 +44217,7 @@ function computeRunSegments(node2) {
44460
44217
  status: "failed"
44461
44218
  });
44462
44219
  } else if (completedEvent) {
44463
- const completedFraction = timeToFraction(completedEvent.timestamp, startTime, duration2);
44220
+ const completedFraction = timeToFraction$1(completedEvent.timestamp, startTime, duration2);
44464
44221
  if (completedFraction > cursor + 1e-3) {
44465
44222
  segments.push({
44466
44223
  startFraction: cursor,
@@ -44482,11 +44239,11 @@ function computeRunSegments(node2) {
44482
44239
  }
44483
44240
  return segments;
44484
44241
  }
44485
- function computeV1RunSegments(startTime, duration2, activeStartTime, runStatus) {
44242
+ function computeV1RunSegments$1(startTime, duration2, activeStartTime, runStatus) {
44486
44243
  const segments = [];
44487
44244
  let cursor = 0;
44488
44245
  if (activeStartTime && activeStartTime > startTime) {
44489
- const queuedFraction = timeToFraction(activeStartTime, startTime, duration2);
44246
+ const queuedFraction = timeToFraction$1(activeStartTime, startTime, duration2);
44490
44247
  if (queuedFraction > 1e-3) {
44491
44248
  segments.push({
44492
44249
  startFraction: 0,
@@ -44539,7 +44296,7 @@ function computeBoundaries(node2, relevantEventNames) {
44539
44296
  for (const e of events) {
44540
44297
  if (!relevantEventNames.includes(e.event.name))
44541
44298
  continue;
44542
- const fraction = timeToFraction(e.timestamp, startTime, duration2);
44299
+ const fraction = timeToFraction$1(e.timestamp, startTime, duration2);
44543
44300
  if (fraction < 0.01 || fraction > 0.99)
44544
44301
  continue;
44545
44302
  boundaries.push({
@@ -44710,17 +44467,17 @@ function computeIsNearRightSide(node2, root2, scrollSnapshotRef, isHovered) {
44710
44467
  }
44711
44468
  function computeDefaultLayout(node2, root2, scale, scrollSnapshotRef) {
44712
44469
  const left = (node2.startTime - root2.startTime) * scale;
44713
- let top = MARKER_HEIGHT + (ROW_HEIGHT + ROW_PADDING) * node2.row;
44470
+ let top = MARKER_HEIGHT + (ROW_HEIGHT$1 + ROW_PADDING) * node2.row;
44714
44471
  const actualWidth = node2.duration * scale;
44715
44472
  const width = Math.max(actualWidth, MIN_SPAN_WIDTH);
44716
- let height = ROW_HEIGHT;
44473
+ let height = ROW_HEIGHT$1;
44717
44474
  const isHuge = computeIsHuge(actualWidth);
44718
44475
  const isSmall = computeIsSmall(actualWidth);
44719
44476
  const isHovered = computeIsHovered(node2, isHuge);
44720
44477
  const isExpanded = isHovered || Boolean(node2.isSelected);
44721
44478
  if (isSmall && !isExpanded) {
44722
44479
  height *= 0.4;
44723
- top += (ROW_HEIGHT - height) * 0.5;
44480
+ top += (ROW_HEIGHT$1 - height) * 0.5;
44724
44481
  }
44725
44482
  const isNearRightSide = computeIsNearRightSide(node2, root2, scrollSnapshotRef, isExpanded);
44726
44483
  return {
@@ -44809,7 +44566,7 @@ function getTerminalTimestamp(resourceType, node2) {
44809
44566
  return void 0;
44810
44567
  }
44811
44568
  }
44812
- const SpanNodes = reactExports.memo(function SpanNodes2({ root: root2, scale, spans, isLive = false, scrollSnapshotRef, cache, customSpanClassNameFunc, customSpanEventClassNameFunc }) {
44569
+ reactExports.memo(function SpanNodes({ root: root2, scale, spans, isLive = false, scrollSnapshotRef, cache, customSpanClassNameFunc, customSpanEventClassNameFunc }) {
44813
44570
  return spans.map((x2) => jsxRuntimeExports.jsx(SpanComponent, { cacheKey: cache.get(x2.span.spanId), customSpanEventClassNameFunc, customSpanClassNameFunc, node: x2, root: root2, scale, traceIsLive: isLive, scrollSnapshotRef }, x2.span.spanId));
44814
44571
  });
44815
44572
  function getSpanStyle(layout, node2, root2, scale) {
@@ -44886,8 +44643,8 @@ const SpanComponent = reactExports.memo(function SpanComponent2({ node: node2, r
44886
44643
  layout.isSmall = liveActualWidth < 64;
44887
44644
  layout.isHuge = liveActualWidth >= 500;
44888
44645
  if (!layout.isSmall) {
44889
- layout.height = ROW_HEIGHT;
44890
- layout.top = MARKER_HEIGHT + (ROW_HEIGHT + ROW_PADDING) * segmentNode.row;
44646
+ layout.height = ROW_HEIGHT$1;
44647
+ layout.top = MARKER_HEIGHT + (ROW_HEIGHT$1 + ROW_PADDING) * segmentNode.row;
44891
44648
  }
44892
44649
  }
44893
44650
  reactExports.useEffect(() => {
@@ -44962,7 +44719,7 @@ const SpanEventComponent = reactExports.memo(function SpanEventComponent2({ even
44962
44719
  }
44963
44720
  }
44964
44721
  const left = (event.timestamp - root2.startTime) * scale;
44965
- const top = MARKER_HEIGHT + (ROW_HEIGHT + ROW_PADDING) * node2.row;
44722
+ const top = MARKER_HEIGHT + (ROW_HEIGHT$1 + ROW_PADDING) * node2.row;
44966
44723
  const isLeftAligned = node2.duration <= 0 || (event.timestamp - node2.startTime) / node2.duration < 0.5;
44967
44724
  const customClassName = customSpanEventClassNameFunc ? customSpanEventClassNameFunc(event) : "";
44968
44725
  return jsxRuntimeExports.jsxs("div", { title: phaseDuration ? `${displayLabel} ${timestamp}
@@ -44975,10 +44732,6 @@ const colorTokenMap = {
44975
44732
  "gray-700": "var(--ds-gray-700)",
44976
44733
  "gray-900": "var(--ds-gray-900)"
44977
44734
  };
44978
- function IconCross({ size: size2 = 16, color: color5 = "gray-700" }) {
44979
- const style2 = { color: colorTokenMap[color5] || color5 };
44980
- return jsxRuntimeExports.jsxs("svg", { width: size2, height: size2, viewBox: "0 0 24 24", fill: "none", style: style2, "aria-hidden": true, children: [jsxRuntimeExports.jsx("title", { children: "Cross" }), jsxRuntimeExports.jsx("path", { d: "M6 6l12 12M18 6L6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })] });
44981
- }
44982
44735
  function IconChevronDown({ size: size2 = 16 }) {
44983
44736
  return jsxRuntimeExports.jsxs("svg", { width: size2, height: size2, viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, className: styles.detailHeadingIcon, children: [jsxRuntimeExports.jsx("title", { children: "Chevron Down" }), jsxRuntimeExports.jsx("path", { d: "M6 9l6 6 6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] });
44984
44737
  }
@@ -44994,102 +44747,9 @@ function Link(props) {
44994
44747
  }
44995
44748
  return jsxRuntimeExports.jsx("a", { className, href, ...rest, children: children2 });
44996
44749
  }
44997
- function ButtonLink(props) {
44998
- const { className, children: children2, size: _size, ...rest } = props;
44999
- return jsxRuntimeExports.jsx("a", { ...rest, className: clsx(styles.buttonLink, className), children: children2 });
45000
- }
45001
- function Note({ children: children2, className }) {
45002
- return jsxRuntimeExports.jsx("div", { className: clsx(styles.note, className), children: children2 });
45003
- }
45004
44750
  function Skeleton({ width, height, rounded }) {
45005
44751
  return jsxRuntimeExports.jsx("span", { className: clsx(styles.skeleton, rounded && styles.skeletonRounded), style: { width, height }, "aria-hidden": true });
45006
44752
  }
45007
- const percentage = (n) => `${(100 * n).toFixed(3)}%`;
45008
- const sortWord = (a2, b2) => {
45009
- if (a2 < b2) {
45010
- return -1;
45011
- } else if (a2 > b2) {
45012
- return 1;
45013
- }
45014
- return 0;
45015
- };
45016
- const getGroupedAttributes = (attributes) => {
45017
- const groups = {};
45018
- for (const [key, value] of Object.entries(attributes)) {
45019
- const dotIndex = key.indexOf(".");
45020
- let prefix = "";
45021
- let suffix = "";
45022
- if (dotIndex !== -1) {
45023
- prefix = key.substring(0, dotIndex);
45024
- suffix = key.substring(dotIndex + 1);
45025
- } else {
45026
- suffix = key;
45027
- }
45028
- let group = groups[prefix];
45029
- if (!group) {
45030
- group = {
45031
- prefix,
45032
- attributes: []
45033
- };
45034
- groups[prefix] = group;
45035
- }
45036
- group.attributes.push({
45037
- key,
45038
- suffix,
45039
- value: String(value)
45040
- });
45041
- }
45042
- const result = Array.from(Object.values(groups)).sort((a2, b2) => sortWord(a2.prefix, b2.prefix));
45043
- for (const group of result) {
45044
- group.attributes.sort((a2, b2) => sortWord(a2.suffix, b2.suffix));
45045
- }
45046
- return result;
45047
- };
45048
- const getAncestors = (_root, start) => {
45049
- const result = [];
45050
- if (!start)
45051
- return result;
45052
- for (let node2 = start; "parent" in node2; node2 = node2.parent) {
45053
- result.unshift(node2);
45054
- }
45055
- return result;
45056
- };
45057
- const SpanDetailPanelBody = () => {
45058
- var _a3;
45059
- const { state: { root: root2, selected, resourceMap, getQuickLinks }, dispatch } = useTraceViewer();
45060
- const ancestors = reactExports.useMemo(() => getAncestors(root2, selected), [root2, selected]);
45061
- const attributeGroups = reactExports.useMemo(() => getGroupedAttributes((selected == null ? void 0 : selected.span.attributes) ?? {}), [selected]);
45062
- const resourceAttributeGroups = reactExports.useMemo(() => {
45063
- const resourceName = selected == null ? void 0 : selected.span.resource;
45064
- if (!resourceName)
45065
- return [];
45066
- const resourceAttributes = resourceMap[resourceName];
45067
- if (!resourceAttributes)
45068
- return [];
45069
- return getGroupedAttributes(resourceAttributes);
45070
- }, [resourceMap, selected]);
45071
- if (!selected)
45072
- return null;
45073
- const { span } = selected;
45074
- const isEntrySpan = detectIsEntrySpan(selected);
45075
- return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [selected.isVercel ? jsxRuntimeExports.jsx(InfraSpanDescription, { node: selected }) : null, selected.isInstrumentationHint ? jsxRuntimeExports.jsx(InstrumentationHint, {}) : null, !selected.isInstrumentationHint && ancestors.length ? jsxRuntimeExports.jsx(DetailGroup, { className: styles.ancestorGroup, name: "Location", children: ancestors.map((node2) => jsxRuntimeExports.jsxs("button", { className: styles.ancestorNode, onClick: () => dispatch({
45076
- type: "select",
45077
- id: node2.span.spanId
45078
- }), type: "button", children: [jsxRuntimeExports.jsxs("div", { className: styles.ancestorText, children: [jsxRuntimeExports.jsx("span", { className: styles.ancestorName, children: node2.label || node2.span.name }), jsxRuntimeExports.jsx("span", { className: styles.ancestorDuration, children: formatDuration(node2.duration) })] }), jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: styles.ancestorLineContainer, children: jsxRuntimeExports.jsx("span", { className: clsx(styles.ancestorLine, getSpanColorClassName(node2)), style: {
45079
- left: percentage((node2.startTime - root2.startTime) / root2.duration),
45080
- width: percentage(node2.duration / root2.duration)
45081
- } }) })] }, `${selected.span.spanId}.${node2.span.spanId}`)) }) : null, isEntrySpan ? jsxRuntimeExports.jsx(EntrySpanLinks, { getQuickLinks, span: selected.span }) : null, ((_a3 = selected.events) == null ? void 0 : _a3.length) ? jsxRuntimeExports.jsx(DetailGroup, { name: "Events", children: selected.events.map((event) => jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [jsxRuntimeExports.jsxs("dl", { className: styles.spanDetailPanelAttribute, children: [jsxRuntimeExports.jsx("dt", { className: styles.spanDetailPanelAttributeKey, children: event.event.name }), jsxRuntimeExports.jsx("dd", { className: styles.spanDetailPanelAttributeValue, children: formatDuration(event.timestamp - root2.startTime) })] }), Object.entries(event.event.attributes).map(([key, value]) => jsxRuntimeExports.jsx(DetailLine, { name: `${event.event.name}.${key}`, value }, key))] }, event.key)) }) : null, attributeGroups.length ? jsxRuntimeExports.jsx(DetailGroup, { name: "Attributes", children: attributeGroups.map((group) => jsxRuntimeExports.jsx(reactExports.Fragment, { children: group.attributes.map(({ key, value }) => jsxRuntimeExports.jsx(DetailLine, { name: key, value }, key)) }, group.prefix)) }) : null, resourceAttributeGroups.length ? jsxRuntimeExports.jsx(DetailGroup, { name: "Resource", children: resourceAttributeGroups.map((group) => jsxRuntimeExports.jsx(reactExports.Fragment, { children: group.attributes.map(({ key, value }) => jsxRuntimeExports.jsx(DetailLine, { name: key, value }, key)) }, group.prefix)) }) : null, selected.isInstrumentationHint ? null : jsxRuntimeExports.jsxs(DetailGroup, { name: "Library", children: [jsxRuntimeExports.jsx(DetailLine, { name: "name", value: span.library.name }), span.library.version ? jsxRuntimeExports.jsx(DetailLine, { name: "version", value: span.library.version }) : null] })] });
45082
- };
45083
- function SpanDetailPanel({ attached = false }) {
45084
- const { state: { selected, isMobile }, dispatch } = useTraceViewer();
45085
- const customPanelComponent = useCustomPanelComponent();
45086
- if (!selected)
45087
- return null;
45088
- const { span } = selected;
45089
- return jsxRuntimeExports.jsxs("div", { className: clsx(styles.spanDetailPanel, isMobile && styles.mobile), children: [attached && !isMobile ? jsxRuntimeExports.jsx(PanelResizer, {}) : null, jsxRuntimeExports.jsx("div", { className: styles.spanDetailPanelTop, children: jsxRuntimeExports.jsxs("div", { className: styles.spanDetailPanelTopInfo, children: [jsxRuntimeExports.jsx("span", { className: styles.spanDetailPanelName, title: span.name, children: span.name }), jsxRuntimeExports.jsxs("div", { className: styles.spanDetailPanelCorner, children: [selected.isInstrumentationHint ? null : jsxRuntimeExports.jsx("span", { className: styles.spanDetailPanelDuration, children: formatDuration(selected.duration) }), jsxRuntimeExports.jsx("div", { className: styles.spanDetailPanelCloseVerticalRule }), jsxRuntimeExports.jsx("button", { "aria-label": "Close Span Details", className: styles.spanDetailPanelClose, onClick: () => dispatch({
45090
- type: "deselect"
45091
- }), type: "button", children: jsxRuntimeExports.jsx(IconCross, { color: "gray-700", size: 20 }) })] })] }) }), jsxRuntimeExports.jsx("div", { className: clsx("flex gap-3", styles.spanDetailPanelBody), children: customPanelComponent || jsxRuntimeExports.jsx(SpanDetailPanelBody, {}) })] });
45092
- }
45093
44753
  const EXPANDED_STORAGE_KEY_PREFIX = "vc-trace-span-exp:";
45094
44754
  function DetailGroup({ name: name2, className = "", children: children2 }) {
45095
44755
  const [isExpanded, setIsExpanded] = reactExports.useState(() => {
@@ -45106,77 +44766,7 @@ function DetailGroup({ name: name2, className = "", children: children2 }) {
45106
44766
  }, [name2]);
45107
44767
  return jsxRuntimeExports.jsxs("div", { className: clsx(styles.detailGroup, isExpanded ? styles.expanded : styles.collapsed, className), children: [jsxRuntimeExports.jsxs("button", { className: styles.detailHeading, onClick: toggleExpanded, type: "button", children: [jsxRuntimeExports.jsx("span", { children: name2 }), jsxRuntimeExports.jsx(IconChevronDown, {})] }), isExpanded ? children2 : null] });
45108
44768
  }
45109
- const CommonHttpVerbs = /* @__PURE__ */ new Set([
45110
- "OPTIONS",
45111
- "HEAD",
45112
- "GET",
45113
- "PUT",
45114
- "POST",
45115
- "DELETE"
45116
- ]);
45117
- const KnownSpans = {
45118
- "Resolve Deployment": `How long it took Vercel's routing layer to retrieve details for the deployment.`,
45119
- "Resolve Cache": `How long it took Vercel's routing layer to check for a cached function invocation.`,
45120
- "Resolve Route": `How long it took Vercel's routing layer to resolve routing rules, including redirects and rewrites.`,
45121
- "Invoke Middleware": `How long it took this middleware to start and run user code.`,
45122
- "Invoke Function": `How long it took this Vercel Function to start and run user code.`,
45123
- waitUntil: `How long it took to run user code inside of waitUntil.`,
45124
- "Start VM": `How long it took to start the Virtual Machine which contains the Vercel Function.`,
45125
- "Spawn Node.js": `How long it took the Virtual Machine to start the Node.js runtime.`,
45126
- "Spawn Python": `How long it took the Virtual Machine to start the Python runtime.`,
45127
- "Init User Code": `How long it took to import the user code and run any globally-scoped code.`
45128
- };
45129
- const ColdStartSpanNames = /* @__PURE__ */ new Set([
45130
- "Start VM",
45131
- "Spawn Node.js",
45132
- "Spawn Python",
45133
- "Init User Code"
45134
- ]);
45135
- const getRegion = (node2) => {
45136
- if (!node2 || !("span" in node2)) {
45137
- return null;
45138
- }
45139
- const attr = node2.span.attributes;
45140
- const region = attr["vercel.region"] || attr["vercel.function.region"];
45141
- if (region)
45142
- return String(region);
45143
- return null;
45144
- };
45145
- const getNote = (node2) => {
45146
- const { name: name2 } = node2.span;
45147
- const region = getRegion(node2);
45148
- const parentRegion = getRegion(node2.parent);
45149
- if (node2.span.attributes["vercel.middleware.internal"] === "true") {
45150
- return "The Vercel Toolbar created this middleware.";
45151
- } else if (ColdStartSpanNames.has(name2) || name2 === "Invoke Function" && node2.children.some((x2) => ColdStartSpanNames.has(x2.span.name))) {
45152
- return "This function encountered a cold start.";
45153
- } else if (region && parentRegion && region !== parentRegion) {
45154
- return "This request was routed across regions.";
45155
- }
45156
- return null;
45157
- };
45158
- const detectIsEntrySpan = (node2) => {
45159
- if (!node2.isVercel)
45160
- return false;
45161
- const { name: name2 } = node2.span;
45162
- const spaceIndex = name2.indexOf(" ");
45163
- if (spaceIndex === -1)
45164
- return false;
45165
- const firstWord = name2.substring(0, spaceIndex);
45166
- return CommonHttpVerbs.has(firstWord);
45167
- };
45168
- function InfraSpanDescription({ node: node2 }) {
45169
- const { name: name2 } = node2.span;
45170
- let description = KnownSpans[name2];
45171
- if (!description && detectIsEntrySpan(node2)) {
45172
- description = `How long it took for Vercel to process the request and send the response.`;
45173
- }
45174
- if (!description)
45175
- return null;
45176
- const note2 = getNote(node2);
45177
- return jsxRuntimeExports.jsx(DetailGroup, { name: "What is this?", children: jsxRuntimeExports.jsxs("div", { className: styles.infraSpanDescription, children: [jsxRuntimeExports.jsx("span", { children: description }), note2 ? jsxRuntimeExports.jsx(Note, { children: note2 }) : note2] }) });
45178
- }
45179
- const EntrySpanLinks = reactExports.memo(function EntrySpanLinks2({ getQuickLinks, span }) {
44769
+ reactExports.memo(function EntrySpanLinks({ getQuickLinks, span }) {
45180
44770
  const links = getQuickLinks(span);
45181
44771
  if (!links.length)
45182
44772
  return null;
@@ -45200,70 +44790,6 @@ function EntrySpanLink({ name: name2, link: linkPromise }) {
45200
44790
  const link2 = usePromise(linkPromise);
45201
44791
  return jsxRuntimeExports.jsxs(Link, { as: link2 ? void 0 : "span", className: clsx(styles.spanDetailPanelAttribute, styles.spanDetailPanelQuickLink), href: (link2 == null ? void 0 : link2.href) || "", children: [jsxRuntimeExports.jsx("span", { className: styles.spanDetailPanelAttributeKey, children: name2 }), jsxRuntimeExports.jsx("span", { className: clsx(styles.spanDetailPanelAttributeValue, styles.spanDetailPanelQuickLinkLabel), children: link2 ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [link2.label, link2.icon || jsxRuntimeExports.jsx(IconExternalSmall, { color: "gray-900" })] }) : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Skeleton, { height: 18, width: 32 + name2.length * 8 }), jsxRuntimeExports.jsx(Skeleton, { height: 18, rounded: true, width: 18 })] }) })] });
45202
44792
  }
45203
- function InstrumentationHint() {
45204
- return jsxRuntimeExports.jsx(DetailGroup, { name: "What is this?", children: jsxRuntimeExports.jsxs("div", { className: styles.infraSpanDescription, children: [jsxRuntimeExports.jsx("span", { children: `You can visualize your application's spans alongside Vercel's spans in this viewer.` }), jsxRuntimeExports.jsx(ButtonLink, { href: "https://vercel.com/docs/session-tracing#adding-custom-spans", size: "small", target: "_blank", children: "Get Started" })] }) });
45205
- }
45206
- function DetailLine({ name: name2, value }) {
45207
- return jsxRuntimeExports.jsxs("dl", { className: styles.spanDetailPanelAttribute, children: [jsxRuntimeExports.jsx("dt", { className: styles.spanDetailPanelAttributeKey, children: name2 }), jsxRuntimeExports.jsx("dd", { className: styles.spanDetailPanelAttributeValue, title: String(value), children: String(value) })] });
45208
- }
45209
- function PanelResizer() {
45210
- const { state: { panelWidth }, dispatch } = useTraceViewer();
45211
- const gestureRef = reactExports.useRef({
45212
- start: {
45213
- x: 0,
45214
- width: panelWidth
45215
- },
45216
- x: 0,
45217
- width: panelWidth,
45218
- isHeld: false
45219
- });
45220
- gestureRef.current.width = panelWidth;
45221
- const onPointerDown = reactExports.useCallback((event) => {
45222
- if (event.pointerType !== "mouse")
45223
- return;
45224
- event.preventDefault();
45225
- const g2 = gestureRef.current;
45226
- g2.start.x = event.clientX;
45227
- g2.x = event.clientX;
45228
- g2.start.width = g2.width;
45229
- g2.isHeld = true;
45230
- }, []);
45231
- const onDoubleClick = reactExports.useCallback(() => {
45232
- dispatch({
45233
- type: "setPanelWidth",
45234
- width: initialState.panelWidth
45235
- });
45236
- }, [dispatch]);
45237
- reactExports.useEffect(() => {
45238
- let nextFrame = 0;
45239
- const onFrame = () => {
45240
- const g2 = gestureRef.current;
45241
- const width = g2.start.width + g2.start.x - g2.x;
45242
- dispatch({
45243
- type: "setPanelWidth",
45244
- width
45245
- });
45246
- };
45247
- const onPointerMove = (event) => {
45248
- if (!gestureRef.current.isHeld)
45249
- return;
45250
- event.preventDefault();
45251
- gestureRef.current.x = event.clientX;
45252
- cancelAnimationFrame(nextFrame);
45253
- nextFrame = requestAnimationFrame(onFrame);
45254
- };
45255
- const onPointerUp = () => {
45256
- gestureRef.current.isHeld = false;
45257
- };
45258
- window.addEventListener("pointermove", onPointerMove);
45259
- window.addEventListener("pointerup", onPointerUp);
45260
- return () => {
45261
- window.removeEventListener("pointermove", onPointerMove);
45262
- window.removeEventListener("pointerup", onPointerUp);
45263
- };
45264
- }, [dispatch]);
45265
- return jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: styles.spanDetailPanelResizer, onDoubleClick, onPointerDown });
45266
- }
45267
44793
  function useImmediateStyle(ref) {
45268
44794
  const styleRef = reactExports.useRef({});
45269
44795
  const setStyle = reactExports.useCallback((propertyName, value) => {
@@ -45298,7 +44824,7 @@ const useDpi = () => {
45298
44824
  return dpi;
45299
44825
  };
45300
44826
  const padding = TIMELINE_PADDING;
45301
- const MiniMap = reactExports.memo(function MiniMap2({ timelineRef, rows, scale }) {
44827
+ reactExports.memo(function MiniMap({ timelineRef, rows, scale }) {
45302
44828
  const { state: { root: root2, baseScale, timelineWidth, width: fullWidth, scrollbarWidth } } = useTraceViewer();
45303
44829
  const mapWidth = fullWidth + TIMELINE_PADDING * 2;
45304
44830
  const dpi = useDpi();
@@ -45431,30 +44957,19 @@ const MiniMap = reactExports.memo(function MiniMap2({ timelineRef, rows, scale }
45431
44957
  height: MAP_HEIGHT - 4
45432
44958
  } })] });
45433
44959
  });
45434
- function deserializeChunkText(text2) {
45435
- try {
45436
- const parsed = JSON.parse(text2);
45437
- if (typeof parsed === "string") {
45438
- return parsed;
45439
- }
45440
- return JSON.stringify(parsed, null, 2);
45441
- } catch {
45442
- return text2;
45443
- }
44960
+ const SidebarDataContext = reactExports.createContext(null);
44961
+ SidebarDataContext.displayName = "SidebarDataContext";
44962
+ function SidebarDataProvider({ value, children: children2 }) {
44963
+ return jsxRuntimeExports.jsx(SidebarDataContext.Provider, { value, children: children2 });
45444
44964
  }
45445
- function parseChunkData(text2) {
45446
- try {
45447
- return JSON.parse(text2);
45448
- } catch {
45449
- return text2;
45450
- }
44965
+ function useSidebarDataOptional() {
44966
+ return reactExports.useContext(SidebarDataContext);
45451
44967
  }
45452
44968
  const ChunkRow = ReactExports.memo(function ChunkRow2({ chunk, index: index2 }) {
45453
- const parsed = parseChunkData(chunk.text);
45454
- return jsxRuntimeExports.jsxs("div", { className: "text-[11px] rounded-md border p-3", style: {
44969
+ return jsxRuntimeExports.jsx("div", { className: "text-[11px] rounded-md border p-3", style: {
45455
44970
  borderColor: "var(--ds-gray-300)",
45456
44971
  backgroundColor: "var(--ds-gray-100)"
45457
- }, children: [jsxRuntimeExports.jsxs("span", { className: "select-none mr-2", style: { color: "var(--ds-gray-500)" }, children: ["[", index2, "]"] }), typeof parsed === "string" ? jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words", style: { color: "var(--ds-gray-1000)" }, children: deserializeChunkText(parsed) }) : jsxRuntimeExports.jsx(DataInspector, { data: parsed, expandLevel: 1 })] });
44972
+ }, children: jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [jsxRuntimeExports.jsxs("span", { className: "select-none pt-px", style: { color: "var(--ds-gray-500)" }, children: ["[", index2, "]"] }), jsxRuntimeExports.jsx("div", { className: "min-w-0 flex-1", children: typeof chunk.value === "string" ? jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words", style: { color: "var(--ds-gray-1000)" }, children: chunk.value }) : jsxRuntimeExports.jsx(DataInspector, { data: chunk.value, expandLevel: 1 }) })] }) });
45458
44973
  });
45459
44974
  function StreamSkeleton() {
45460
44975
  return jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 animate-in fade-in", children: [jsxRuntimeExports.jsx(Skeleton$1, { style: { width: 120, height: 16, borderRadius: 4 } }), [1, 2, 3, 4].map((i) => jsxRuntimeExports.jsx(Skeleton$1, { style: { height: 56, borderRadius: 6 } }, i))] });
@@ -45485,6 +45000,460 @@ function StreamViewer({ streamId: _streamId, chunks, isLive, error, isLoading, o
45485
45000
  color: "var(--ds-gray-600)"
45486
45001
  }, children: isLive ? "Waiting for stream data..." : "Stream is empty" }) : jsxRuntimeExports.jsx(Yr, { ref: virtuosoRef, totalCount: chunks.length, overscan: 10, endReached: () => onScrollEnd == null ? void 0 : onScrollEnd(), itemContent: (index2) => jsxRuntimeExports.jsx("div", { style: { paddingBottom: 8 }, children: jsxRuntimeExports.jsx(ChunkRow, { chunk: chunks[index2], index: index2 }) }), style: { flex: 1, minHeight: 0 } }) })] });
45487
45002
  }
45003
+ function computeRootBounds(spans) {
45004
+ let minStart = Number.POSITIVE_INFINITY;
45005
+ let maxEnd = Number.NEGATIVE_INFINITY;
45006
+ for (const span of spans) {
45007
+ const s2 = getHighResInMs(span.startTime);
45008
+ const e = getHighResInMs(span.endTime);
45009
+ if (s2 < minStart)
45010
+ minStart = s2;
45011
+ if (e > maxEnd)
45012
+ maxEnd = e;
45013
+ }
45014
+ if (!Number.isFinite(minStart) || !Number.isFinite(maxEnd)) {
45015
+ return { startTime: 0, endTime: 1, duration: 1 };
45016
+ }
45017
+ const duration2 = Math.max(maxEnd - minStart, 1);
45018
+ return { startTime: minStart, endTime: maxEnd, duration: duration2 };
45019
+ }
45020
+ function getSpanDurationMs(span) {
45021
+ return Math.max(0, getHighResInMs(span.endTime) - getHighResInMs(span.startTime));
45022
+ }
45023
+ const NICE_INTERVALS = [
45024
+ 1,
45025
+ 2,
45026
+ 5,
45027
+ 10,
45028
+ 20,
45029
+ 50,
45030
+ 100,
45031
+ 200,
45032
+ 500,
45033
+ 1e3,
45034
+ 2e3,
45035
+ 5e3,
45036
+ 1e4,
45037
+ 2e4,
45038
+ 5e4,
45039
+ 1e5,
45040
+ 2e5,
45041
+ 5e5,
45042
+ 1e6,
45043
+ 2e6,
45044
+ 5e6,
45045
+ 1e7,
45046
+ 2e7,
45047
+ 5e7,
45048
+ 1e8,
45049
+ 2e8,
45050
+ 5e8,
45051
+ 1e9,
45052
+ 2e9,
45053
+ 5e9
45054
+ ];
45055
+ const MAX_MARKERS = 8;
45056
+ function pickInterval(viewDuration, maxTicks) {
45057
+ for (const interval of NICE_INTERVALS) {
45058
+ if (viewDuration / interval <= maxTicks)
45059
+ return interval;
45060
+ }
45061
+ return NICE_INTERVALS[NICE_INTERVALS.length - 1];
45062
+ }
45063
+ function computeTimeMarkers(viewDuration, offset2) {
45064
+ if (viewDuration <= 0)
45065
+ return [];
45066
+ const maxTicks = 6;
45067
+ const interval = pickInterval(viewDuration, maxTicks);
45068
+ const firstTick = Math.ceil(offset2 / interval) * interval;
45069
+ const markers2 = [];
45070
+ for (let t = firstTick; t <= offset2 + viewDuration; t += interval) {
45071
+ const position2 = (t - offset2) / viewDuration;
45072
+ if (position2 < -0.01 || position2 > 1.01)
45073
+ continue;
45074
+ markers2.push({
45075
+ position: Math.min(Math.max(position2, 0), 1),
45076
+ label: formatDuration(Math.abs(t), true),
45077
+ value: t
45078
+ });
45079
+ if (markers2.length >= MAX_MARKERS)
45080
+ break;
45081
+ }
45082
+ return markers2;
45083
+ }
45084
+ function computeSpanGaps(spans, viewStart, viewEnd) {
45085
+ const range = viewEnd - viewStart;
45086
+ if (range <= 0)
45087
+ return [];
45088
+ const gaps = [];
45089
+ for (let i = 0; i < spans.length - 1; i++) {
45090
+ const endTime = getHighResInMs(spans[i].endTime);
45091
+ const startTime = getHighResInMs(spans[i + 1].startTime);
45092
+ const gapMs = startTime - endTime;
45093
+ if (gapMs <= 0)
45094
+ continue;
45095
+ const leftFrac = Math.min(Math.max((endTime - viewStart) / range, 0), 1);
45096
+ const rightFrac = Math.min(Math.max((startTime - viewStart) / range, 0), 1);
45097
+ if (rightFrac - leftFrac < 1e-3)
45098
+ continue;
45099
+ gaps.push({ gapMs, leftFrac, rightFrac, rowIndex: i });
45100
+ }
45101
+ return gaps;
45102
+ }
45103
+ const RESOURCE_COLORS = {
45104
+ run: { bar: "var(--ds-blue-700)", errorBar: "var(--ds-red-700)" },
45105
+ step: { bar: "var(--ds-green-700)", errorBar: "var(--ds-red-700)" },
45106
+ hook: { bar: "var(--ds-amber-700)", errorBar: "var(--ds-red-700)" },
45107
+ sleep: { bar: "var(--ds-purple-700)", errorBar: "var(--ds-red-700)" },
45108
+ default: { bar: "var(--ds-gray-500)", errorBar: "var(--ds-red-700)" }
45109
+ };
45110
+ function getResourceColor(resource) {
45111
+ return RESOURCE_COLORS[resource] ?? RESOURCE_COLORS.default;
45112
+ }
45113
+ function clampFraction(value) {
45114
+ return Math.max(0, Math.min(1, value));
45115
+ }
45116
+ function timeToFraction(time2, spanStart, spanDuration2) {
45117
+ if (spanDuration2 <= 0)
45118
+ return 0;
45119
+ return clampFraction((time2 - spanStart) / spanDuration2);
45120
+ }
45121
+ function sortedEventMarks(events, relevantNames) {
45122
+ return events.filter((e) => relevantNames.includes(e.name)).map((e) => ({ time: getHighResInMs(e.timestamp), type: e.name })).sort((a2, b2) => a2.time - b2.time);
45123
+ }
45124
+ function computeStepSegmentsFromSpan(startMs, duration2, events) {
45125
+ const segments = [];
45126
+ if (duration2 <= 0)
45127
+ return segments;
45128
+ const marks = sortedEventMarks(events, [
45129
+ "step_started",
45130
+ "step_retrying",
45131
+ "step_failed",
45132
+ "step_completed"
45133
+ ]);
45134
+ if (marks.length === 0) {
45135
+ segments.push({ startFraction: 0, endFraction: 1, status: "running" });
45136
+ return segments;
45137
+ }
45138
+ const firstFraction = timeToFraction(marks[0].time, startMs, duration2);
45139
+ if (firstFraction > 1e-3) {
45140
+ segments.push({
45141
+ startFraction: 0,
45142
+ endFraction: firstFraction,
45143
+ status: "queued"
45144
+ });
45145
+ }
45146
+ for (let i = 0; i < marks.length; i++) {
45147
+ const mark2 = marks[i];
45148
+ const markFrac = timeToFraction(mark2.time, startMs, duration2);
45149
+ const nextMark = marks[i + 1];
45150
+ const nextFrac = nextMark ? timeToFraction(nextMark.time, startMs, duration2) : 1;
45151
+ if (mark2.type === "step_started") {
45152
+ if (i === marks.length - 1) {
45153
+ segments.push({
45154
+ startFraction: markFrac,
45155
+ endFraction: 1,
45156
+ status: "succeeded"
45157
+ });
45158
+ } else {
45159
+ const nextType = nextMark.type;
45160
+ const attemptStatus = nextType === "step_retrying" || nextType === "step_failed" ? "failed" : nextType === "step_completed" ? "succeeded" : "running";
45161
+ segments.push({
45162
+ startFraction: markFrac,
45163
+ endFraction: nextFrac,
45164
+ status: attemptStatus
45165
+ });
45166
+ }
45167
+ } else if (mark2.type === "step_retrying") {
45168
+ segments.push({
45169
+ startFraction: markFrac,
45170
+ endFraction: nextFrac,
45171
+ status: "retrying"
45172
+ });
45173
+ } else if (mark2.type === "step_failed") {
45174
+ if (markFrac < 0.999) {
45175
+ segments.push({
45176
+ startFraction: markFrac,
45177
+ endFraction: 1,
45178
+ status: "failed"
45179
+ });
45180
+ }
45181
+ }
45182
+ }
45183
+ return segments;
45184
+ }
45185
+ function computeHookSegmentsFromSpan(startMs, duration2, events) {
45186
+ const segments = [];
45187
+ if (duration2 <= 0)
45188
+ return segments;
45189
+ const sorted = [...events].map((e) => ({ name: e.name, time: getHighResInMs(e.timestamp) })).sort((a2, b2) => a2.time - b2.time);
45190
+ const received = sorted.find((e) => e.name === "hook_received");
45191
+ const disposed = sorted.find((e) => e.name === "hook_disposed");
45192
+ if (!received && !disposed) {
45193
+ segments.push({ startFraction: 0, endFraction: 1, status: "waiting" });
45194
+ return segments;
45195
+ }
45196
+ const receivedFrac = received ? timeToFraction(received.time, startMs, duration2) : null;
45197
+ const disposedFrac = disposed ? timeToFraction(disposed.time, startMs, duration2) : null;
45198
+ if (receivedFrac !== null && receivedFrac > 1e-3) {
45199
+ segments.push({
45200
+ startFraction: 0,
45201
+ endFraction: receivedFrac,
45202
+ status: "waiting"
45203
+ });
45204
+ } else if (receivedFrac === null && disposedFrac !== null) {
45205
+ segments.push({
45206
+ startFraction: 0,
45207
+ endFraction: disposedFrac,
45208
+ status: "waiting"
45209
+ });
45210
+ }
45211
+ if (receivedFrac !== null) {
45212
+ segments.push({
45213
+ startFraction: receivedFrac,
45214
+ endFraction: disposedFrac ?? 1,
45215
+ status: "received"
45216
+ });
45217
+ }
45218
+ if (disposedFrac !== null && disposedFrac < 0.999) {
45219
+ segments.push({
45220
+ startFraction: disposedFrac,
45221
+ endFraction: 1,
45222
+ status: "succeeded"
45223
+ });
45224
+ }
45225
+ return segments;
45226
+ }
45227
+ function computeSleepSegmentsFromSpan(_startMs, duration2, _events) {
45228
+ if (duration2 <= 0)
45229
+ return [];
45230
+ return [{ startFraction: 0, endFraction: 1, status: "sleeping" }];
45231
+ }
45232
+ function computeRunSegmentsFromSpan(startMs, duration2, activeStartMs, events, attributes) {
45233
+ const segments = [];
45234
+ if (duration2 <= 0)
45235
+ return segments;
45236
+ const sorted = [...events].map((e) => ({ name: e.name, time: getHighResInMs(e.timestamp) })).sort((a2, b2) => a2.time - b2.time);
45237
+ const hasRunCreated = sorted.some((e) => e.name === "run_created");
45238
+ if (!hasRunCreated) {
45239
+ const runData = attributes == null ? void 0 : attributes.data;
45240
+ const runStatus = runData == null ? void 0 : runData.status;
45241
+ return computeV1RunSegments(startMs, duration2, activeStartMs, runStatus);
45242
+ }
45243
+ const failedEvent = sorted.find((e) => e.name === "run_failed");
45244
+ let cursor = 0;
45245
+ if (activeStartMs !== void 0 && activeStartMs > startMs) {
45246
+ const queuedFrac = timeToFraction(activeStartMs, startMs, duration2);
45247
+ if (queuedFrac > 1e-3) {
45248
+ segments.push({
45249
+ startFraction: 0,
45250
+ endFraction: queuedFrac,
45251
+ status: "queued"
45252
+ });
45253
+ cursor = queuedFrac;
45254
+ }
45255
+ }
45256
+ segments.push({
45257
+ startFraction: cursor,
45258
+ endFraction: 1,
45259
+ status: failedEvent ? "failed" : "running"
45260
+ });
45261
+ return segments;
45262
+ }
45263
+ function computeV1RunSegments(startMs, duration2, activeStartMs, runStatus) {
45264
+ const segments = [];
45265
+ let cursor = 0;
45266
+ if (activeStartMs !== void 0 && activeStartMs > startMs) {
45267
+ const queuedFrac = timeToFraction(activeStartMs, startMs, duration2);
45268
+ if (queuedFrac > 1e-3) {
45269
+ segments.push({
45270
+ startFraction: 0,
45271
+ endFraction: queuedFrac,
45272
+ status: "queued"
45273
+ });
45274
+ cursor = queuedFrac;
45275
+ }
45276
+ }
45277
+ segments.push({
45278
+ startFraction: cursor,
45279
+ endFraction: 1,
45280
+ status: runStatus === "failed" ? "failed" : "running"
45281
+ });
45282
+ return segments;
45283
+ }
45284
+ function computeSpanSegments(span) {
45285
+ const startMs = getHighResInMs(span.startTime);
45286
+ const duration2 = getSpanDurationMs(span);
45287
+ const activeStartMs = span.activeStartTime ? getHighResInMs(span.activeStartTime) : void 0;
45288
+ switch (span.resource) {
45289
+ case "step":
45290
+ return computeStepSegmentsFromSpan(startMs, duration2, span.events);
45291
+ case "hook":
45292
+ return computeHookSegmentsFromSpan(startMs, duration2, span.events);
45293
+ case "sleep":
45294
+ return computeSleepSegmentsFromSpan(startMs, duration2, span.events);
45295
+ case "run":
45296
+ return computeRunSegmentsFromSpan(startMs, duration2, activeStartMs, span.events, span.attributes);
45297
+ default:
45298
+ return [];
45299
+ }
45300
+ }
45301
+ const SEGMENT_CONFIG = {
45302
+ queued: { className: "bg-gray-500" },
45303
+ retrying: {
45304
+ className: "box-border bg-gray-500"
45305
+ },
45306
+ waiting: { className: "bg-gray-500" },
45307
+ running: { className: "bg-blue-700" },
45308
+ failed: { className: "bg-red-700" },
45309
+ succeeded: { className: "bg-green-700" },
45310
+ sleeping: { className: "bg-gray-500" },
45311
+ received: { className: "bg-blue-700" }
45312
+ };
45313
+ const BAR_HEIGHT_PX = 24;
45314
+ const TINY_BAR_BOX_SIZE_PX = 24;
45315
+ const TINY_BAR_WIDTH_PX = 4;
45316
+ const SEGMENT_GAP_PX = 1;
45317
+ const ROW_HEIGHT = 40;
45318
+ const CONTAINER_PAD_Y = 8;
45319
+ const END_CAP_HEIGHT = 8;
45320
+ const TIMELINE_PADDING_PX = 16;
45321
+ const ORIGIN_MARKER_EPSILON = 1e-6;
45322
+ const DeltaIndicator = reactExports.memo(function DeltaIndicator2({ leftFrac, rightFrac, label, rowIndex }) {
45323
+ const centerY = CONTAINER_PAD_Y + (rowIndex + 1) * ROW_HEIGHT;
45324
+ return jsxRuntimeExports.jsxs("div", { className: "absolute pointer-events-none", style: {
45325
+ left: `${leftFrac * 100}%`,
45326
+ width: `${(rightFrac - leftFrac) * 100}%`,
45327
+ top: centerY - END_CAP_HEIGHT / 2,
45328
+ height: END_CAP_HEIGHT
45329
+ }, children: [jsxRuntimeExports.jsx("div", { className: "absolute left-0 top-0 w-px h-full bg-amber-800" }), jsxRuntimeExports.jsx("div", { className: "absolute left-0 right-0 top-1/2 h-px bg-amber-800" }), jsxRuntimeExports.jsx("div", { className: "absolute right-0 top-0 w-px h-full bg-amber-800" }), jsxRuntimeExports.jsx("span", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-label-12 leading-none whitespace-nowrap rounded-xs px-1 py-0.5 text-gray-100 bg-amber-800", children: label })] });
45330
+ });
45331
+ const TimelineBar = reactExports.memo(function TimelineBar2({ span, viewStart, viewDuration, containerWidth, isSelected, onClick }) {
45332
+ var _a3;
45333
+ const startTime = getHighResInMs(span.startTime);
45334
+ const endTime = getHighResInMs(span.endTime);
45335
+ const totalDurationMs = getSpanDurationMs(span);
45336
+ const leftFracRaw = viewDuration > 0 ? (startTime - viewStart) / viewDuration : 0;
45337
+ const rightFracRaw = viewDuration > 0 ? (endTime - viewStart) / viewDuration : 0;
45338
+ const widthFrac = rightFracRaw - leftFracRaw;
45339
+ const leftPct = leftFracRaw * 100;
45340
+ const widthPct = widthFrac * 100;
45341
+ const pixelWidth = widthFrac * containerWidth;
45342
+ const visibleLeftFrac = Math.max(0, Math.min(1, leftFracRaw));
45343
+ const visibleRightFrac = Math.max(0, Math.min(1, rightFracRaw));
45344
+ const visiblePixelWidth = Math.max(0, visibleRightFrac - visibleLeftFrac) * containerWidth;
45345
+ const isTinyBar = containerWidth > 0 && visiblePixelWidth < TINY_BAR_BOX_SIZE_PX;
45346
+ const [isRowHovered, setIsRowHovered] = reactExports.useState(false);
45347
+ const segments = reactExports.useMemo(() => computeSpanSegments(span), [span]);
45348
+ const workflowStatus = (_a3 = span.attributes.data) == null ? void 0 : _a3.status;
45349
+ const isErrored = span.status.code === 2 || workflowStatus === "failed";
45350
+ const colors = getResourceColor(span.resource);
45351
+ const fallbackColor = isErrored ? colors.errorBar ?? "var(--ds-red-700)" : colors.bar;
45352
+ const renderDurationLabel = (label) => jsxRuntimeExports.jsx("span", { className: "pointer-events-none absolute inset-0 flex items-center justify-start overflow-hidden px-1 text-[10px] font-mono font-medium leading-none whitespace-nowrap text-left text-white tabular-nums", style: { textShadow: "0 1px 1px rgba(0, 0, 0, 0.45)" }, children: label });
45353
+ const getMinDurationLabelWidthPx = (label) => Math.max(40, label.length * 6 + 12);
45354
+ const totalDurationLabel = formatDuration(totalDurationMs);
45355
+ const showBarDurationLabel = isRowHovered && pixelWidth >= getMinDurationLabelWidthPx(totalDurationLabel);
45356
+ const showBoundaryArrow = isTinyBar && (leftFracRaw < 0 || rightFracRaw > 1);
45357
+ const BoundaryArrow = leftFracRaw < 0.5 ? ArrowLeft : ArrowRight;
45358
+ const barContent = showBoundaryArrow ? jsxRuntimeExports.jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-[0.25rem]", children: jsxRuntimeExports.jsx(BoundaryArrow, { className: "size-3 text-gray-900" }) }) : isTinyBar ? jsxRuntimeExports.jsx("div", { className: "h-6 rounded-[0.25rem]", style: { background: fallbackColor } }) : segments.length > 0 ? jsxRuntimeExports.jsx("div", { className: "relative h-6 w-full", children: segments.map((seg, i) => {
45359
+ const segPixelWidth = (seg.endFraction - seg.startFraction) * pixelWidth;
45360
+ const segDurationLabel = formatDuration((seg.endFraction - seg.startFraction) * totalDurationMs);
45361
+ const showSegmentDurationLabel = isRowHovered && segPixelWidth >= getMinDurationLabelWidthPx(segDurationLabel);
45362
+ const segStyle = seg.status === "queued" && segPixelWidth < 20 ? { background: "var(--ds-gray-500)" } : SEGMENT_CONFIG[seg.status].style;
45363
+ return jsxRuntimeExports.jsx("div", { className: cn$4("absolute h-full rounded-[0.25rem]", SEGMENT_CONFIG[seg.status].className), style: {
45364
+ left: `calc(${seg.startFraction * 100}% + ${SEGMENT_GAP_PX / 2}px)`,
45365
+ width: `calc(${(seg.endFraction - seg.startFraction) * 100}% - ${SEGMENT_GAP_PX}px)`,
45366
+ minWidth: 1,
45367
+ ...segStyle
45368
+ }, children: showSegmentDurationLabel ? renderDurationLabel(segDurationLabel) : null }, `${seg.status}-${i}`);
45369
+ }) }) : jsxRuntimeExports.jsx("div", { className: "relative h-6 rounded-[0.25rem]", style: {
45370
+ width: "100%",
45371
+ minWidth: 4,
45372
+ background: fallbackColor
45373
+ }, children: showBarDurationLabel ? renderDurationLabel(totalDurationLabel) : null });
45374
+ return jsxRuntimeExports.jsx("div", { role: "treeitem", "aria-selected": isSelected, "aria-expanded": isSelected, "aria-level": 1, className: cn$4("h-10 relative flex items-center hover:bg-gray-100 aria-selected:bg-gray-100 aria-selected:hover:bg-gray-200"), onMouseEnter: () => setIsRowHovered(true), onMouseLeave: () => setIsRowHovered(false), onClick, children: jsxRuntimeExports.jsx("div", { className: "absolute inset-y-0", style: {
45375
+ left: TIMELINE_PADDING_PX,
45376
+ right: TIMELINE_PADDING_PX
45377
+ }, children: jsxRuntimeExports.jsx("div", { className: "absolute top-1/2 -translate-y-1/2", style: {
45378
+ left: showBoundaryArrow ? `min(max(${leftPct}%, 0px), calc(100% - ${TINY_BAR_BOX_SIZE_PX}px))` : isTinyBar ? `min(${leftPct}%, calc(100% - ${TINY_BAR_WIDTH_PX}px))` : `${leftPct}%`,
45379
+ width: showBoundaryArrow ? `${TINY_BAR_BOX_SIZE_PX}px` : isTinyBar ? `${TINY_BAR_WIDTH_PX}px` : `max(${widthPct}%, 4px)`,
45380
+ height: BAR_HEIGHT_PX
45381
+ }, children: barContent }) }) });
45382
+ });
45383
+ function TimelineHeader({ markers: markers2, hoverInfo: hoverInfo2 }) {
45384
+ return jsxRuntimeExports.jsx("div", { className: "relative bg-background-100 border-b border-gray-alpha-400 h-10 min-h-10 flex items-end px-4 pb-1", children: jsxRuntimeExports.jsxs("div", { className: "relative h-full flex-1", children: [markers2.map((m2) => jsxRuntimeExports.jsx("span", { className: "absolute bottom-1 font-mono text-xs font-normal leading-4 text-gray-900 whitespace-nowrap", style: { left: `${m2.position * 100}%` }, children: m2.label }, `${m2.position}-${m2.label}`)), hoverInfo2 && jsxRuntimeExports.jsx("span", { className: "absolute top-1 pointer-events-none z-10 font-mono text-[11px] leading-4 text-gray-1000 whitespace-nowrap bg-background-100 border border-gray-alpha-400 rounded px-1 -translate-x-1/2", style: { left: `${hoverInfo2.fraction * 100}%` }, children: hoverInfo2.label })] }) });
45385
+ }
45386
+ function Timeline({ spans, viewStart, viewEnd, markers: markers2, selectedId, onSelect, hoverFraction, altHeld = false }) {
45387
+ const containerRef = reactExports.useRef(null);
45388
+ const [containerWidth, setContainerWidth] = reactExports.useState(0);
45389
+ const viewDuration = viewEnd - viewStart;
45390
+ const timelineWidth = Math.max(0, containerWidth - TIMELINE_PADDING_PX * 2);
45391
+ reactExports.useEffect(() => {
45392
+ const el = containerRef.current;
45393
+ if (!el)
45394
+ return;
45395
+ const ro2 = new ResizeObserver(([entry]) => {
45396
+ setContainerWidth(entry.contentRect.width);
45397
+ });
45398
+ ro2.observe(el);
45399
+ return () => ro2.disconnect();
45400
+ }, []);
45401
+ const gaps = reactExports.useMemo(() => computeSpanGaps(spans, viewStart, viewEnd), [spans, viewStart, viewEnd]);
45402
+ return jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "relative h-full overflow-hidden", children: [jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "absolute inset-y-0 pointer-events-none", style: {
45403
+ left: TIMELINE_PADDING_PX,
45404
+ right: TIMELINE_PADDING_PX
45405
+ }, children: markers2.map((marker2) => Math.abs(marker2.value) > ORIGIN_MARKER_EPSILON ? jsxRuntimeExports.jsx("div", { className: "absolute top-0 bottom-0 w-px bg-gray-alpha-300", style: { left: `${marker2.position * 100}%` } }, `${marker2.position}-${marker2.label}`) : null) }), hoverFraction != null && jsxRuntimeExports.jsx("div", { className: "absolute inset-y-0 pointer-events-none z-10", style: {
45406
+ left: TIMELINE_PADDING_PX,
45407
+ right: TIMELINE_PADDING_PX
45408
+ }, children: jsxRuntimeExports.jsx("div", { className: "absolute top-0 bottom-0 w-px bg-gray-alpha-400", style: { left: `${hoverFraction * 100}%` } }) }), spans.map((span) => jsxRuntimeExports.jsx(TimelineBar, { span, viewStart, viewDuration, containerWidth: timelineWidth, isSelected: selectedId === span.spanId, onClick: () => onSelect(span.spanId) }, span.spanId)), altHeld && jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "absolute inset-y-0 pointer-events-none", style: {
45409
+ left: TIMELINE_PADDING_PX,
45410
+ right: TIMELINE_PADDING_PX
45411
+ }, children: gaps.map((gap) => jsxRuntimeExports.jsx(DeltaIndicator, { leftFrac: gap.leftFrac, rightFrac: gap.rightFrac, label: formatDuration(gap.gapMs, true), rowIndex: gap.rowIndex }, gap.rowIndex)) })] });
45412
+ }
45413
+ const ActiveSpanContext = reactExports.createContext(null);
45414
+ ActiveSpanContext.displayName = "ActiveSpanContext";
45415
+ function ActiveSpanProvider({ spans, children: children2 }) {
45416
+ var _a3;
45417
+ const [activeSpanId, setActiveSpanId] = reactExports.useState(((_a3 = spans[0]) == null ? void 0 : _a3.spanId) ?? null);
45418
+ reactExports.useEffect(() => {
45419
+ setActiveSpanId((currentSpanId) => {
45420
+ if (!currentSpanId) {
45421
+ return null;
45422
+ }
45423
+ const hasCurrentSpan = spans.some((span) => span.spanId === currentSpanId);
45424
+ if (hasCurrentSpan) {
45425
+ return currentSpanId;
45426
+ }
45427
+ return null;
45428
+ });
45429
+ }, [spans]);
45430
+ const activeSpan = reactExports.useMemo(() => {
45431
+ if (!activeSpanId) {
45432
+ return null;
45433
+ }
45434
+ return spans.find((span) => span.spanId === activeSpanId) ?? null;
45435
+ }, [activeSpanId, spans]);
45436
+ const setActiveSpan = reactExports.useCallback((spanId) => {
45437
+ setActiveSpanId(spanId);
45438
+ }, []);
45439
+ const clearActiveSpan = reactExports.useCallback(() => {
45440
+ setActiveSpanId(null);
45441
+ }, []);
45442
+ const value = reactExports.useMemo(() => ({
45443
+ activeSpanId,
45444
+ activeSpan,
45445
+ setActiveSpan,
45446
+ clearActiveSpan
45447
+ }), [activeSpanId, activeSpan, setActiveSpan, clearActiveSpan]);
45448
+ return jsxRuntimeExports.jsx(ActiveSpanContext.Provider, { value, children: children2 });
45449
+ }
45450
+ const useActiveSpan = () => {
45451
+ const context = reactExports.useContext(ActiveSpanContext);
45452
+ if (!context) {
45453
+ throw new Error("useActiveSpan must be used within ActiveSpanProvider");
45454
+ }
45455
+ return context;
45456
+ };
45488
45457
  const DEFAULT_PAGE_SIZE = 10;
45489
45458
  function cn(...inputs) {
45490
45459
  return twMerge(clsx(inputs));
@@ -48061,58 +48030,49 @@ export {
48061
48030
  Lock as a3,
48062
48031
  EVENT_DATA_REF_FIELDS as a4,
48063
48032
  clsx as a5,
48064
- useTraceViewer as a6,
48065
- styles as a7,
48066
- formatDurationForTimeline as a8,
48067
- formatWallClockTime as a9,
48068
- hydrateData as aA,
48069
- getWebRevivers as aB,
48070
- LIVE_UPDATE_INTERVAL_MS as aC,
48071
- fetchEvent as aD,
48072
- getEncryptionKeyForRun as aE,
48073
- StreamViewer as aF,
48074
- cn$4 as aG,
48075
- composeRefs as aH,
48076
- useFloating as aI,
48077
- offset as aJ,
48078
- shift as aK,
48079
- limitShift as aL,
48080
- flip as aM,
48081
- size as aN,
48082
- arrow as aO,
48083
- hide as aP,
48084
- autoUpdate as aQ,
48085
- cancelRun as aR,
48086
- reenqueueRun as aS,
48087
- wakeUpRun as aT,
48088
- resumeHook as aU,
48089
- recreateRun as aV,
48090
- useImmediateStyle as aa,
48091
- TIMELINE_PADDING as ab,
48092
- formatTimeSelection as ac,
48093
- MARKER_HEIGHT as ad,
48094
- ROW_HEIGHT as ae,
48095
- ROW_PADDING as af,
48096
- SEARCH_HEIGHT as ag,
48097
- getHighResInMs as ah,
48098
- getMsInHighRes as ai,
48099
- MARKER_NOTCH_HEIGHT as aj,
48100
- MAP_HEIGHT as ak,
48101
- SEARCH_GAP as al,
48102
- MiniMap as am,
48103
- SpanNodes as an,
48104
- SpanDetailPanel as ao,
48105
- TraceViewerContextProvider as ap,
48106
- hydrateResourceIOWithKey as aq,
48107
- hydrateResourceIO as ar,
48108
- fetchHook as as,
48109
- fetchStep as at,
48110
- hasEncryptedFields as au,
48111
- fetchStreams as av,
48112
- Slot as aw,
48113
- Slottable as ax,
48114
- buttonVariants as ay,
48115
- isEncryptedData as az,
48033
+ cn$4 as a6,
48034
+ getSpanDurationMs as a7,
48035
+ getHighResInMs as a8,
48036
+ ActiveSpanProvider as a9,
48037
+ offset as aA,
48038
+ shift as aB,
48039
+ limitShift as aC,
48040
+ flip as aD,
48041
+ size as aE,
48042
+ arrow as aF,
48043
+ hide as aG,
48044
+ autoUpdate as aH,
48045
+ cancelRun as aI,
48046
+ reenqueueRun as aJ,
48047
+ wakeUpRun as aK,
48048
+ resumeHook as aL,
48049
+ recreateRun as aM,
48050
+ useActiveSpan as aa,
48051
+ useSidebarDataOptional as ab,
48052
+ computeRootBounds as ac,
48053
+ computeTimeMarkers as ad,
48054
+ TIMELINE_PADDING_PX as ae,
48055
+ Timeline as af,
48056
+ TimelineHeader as ag,
48057
+ SidebarDataProvider as ah,
48058
+ hydrateResourceIOWithKey as ai,
48059
+ hydrateResourceIO as aj,
48060
+ fetchHook as ak,
48061
+ fetchStep as al,
48062
+ hasEncryptedFields as am,
48063
+ fetchStreams as an,
48064
+ Slot as ao,
48065
+ Slottable as ap,
48066
+ buttonVariants as aq,
48067
+ isEncryptedData as ar,
48068
+ hydrateData as as,
48069
+ getWebRevivers as at,
48070
+ LIVE_UPDATE_INTERVAL_MS as au,
48071
+ fetchEvent as av,
48072
+ getEncryptionKeyForRun as aw,
48073
+ StreamViewer as ax,
48074
+ composeRefs as ay,
48075
+ useFloating as az,
48116
48076
  TooltipContent as b,
48117
48077
  createLucideIcon as c,
48118
48078
  cn as d,