import { b as attr_class, f as clsx, s as stringify, a as attr } from './index2-BpEbpEAf.js';
import { o as onDestroy } from './index-server-BI-Ep7Rw.js';
import { I as Icon } from './Icon-SOvOgynh.js';
import { X as escape_html } from './context-B0vutJuA.js';
import './utils-KcIDVAAe.js';
import './state.svelte-DbqYHGBV.js';
import './trpc-client-Bucti7HD.js';

function createDragSelectClickGuard(options = {}) {
  const thresholdPx = options.thresholdPx ?? 4;
  const dragCursor = options.dragCursor ?? "text";
  let startX = 0;
  let startY = 0;
  let didDrag = false;
  let pointerDown = false;
  let cursorEl = null;
  let abortController = null;
  function cleanup() {
    pointerDown = false;
    didDrag = false;
    cursorEl?.style.removeProperty("cursor");
    cursorEl = null;
    abortController?.abort();
    abortController = null;
  }
  function onPointerDown(event) {
    if (typeof window === "undefined") return;
    if (event.button !== 0) return;
    abortController?.abort();
    abortController = null;
    cursorEl?.style.removeProperty("cursor");
    startX = event.clientX;
    startY = event.clientY;
    didDrag = false;
    pointerDown = true;
    cursorEl = event.currentTarget instanceof HTMLElement ? event.currentTarget : null;
    const controller = new AbortController();
    abortController = controller;
    const onMove = (moveEvent) => {
      if (!pointerDown || didDrag) return;
      const dx = Math.abs(moveEvent.clientX - startX);
      const dy = Math.abs(moveEvent.clientY - startY);
      if (dx + dy < thresholdPx) return;
      didDrag = true;
      cursorEl?.style.setProperty("cursor", dragCursor);
    };
    const onEnd = () => {
      pointerDown = false;
      cursorEl?.style.removeProperty("cursor");
      cursorEl = null;
      controller.abort();
      if (abortController === controller) abortController = null;
    };
    window.addEventListener("pointermove", onMove, { signal: controller.signal });
    window.addEventListener("pointerup", onEnd, { signal: controller.signal });
    window.addEventListener("pointercancel", onEnd, { signal: controller.signal });
  }
  function shouldSuppressClick(event) {
    return event.detail > 0 && didDrag;
  }
  return { onPointerDown, shouldSuppressClick, cleanup };
}
function ChatApiCallTrace($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let { trace } = $$props;
    const clickGuard = createDragSelectClickGuard();
    onDestroy(clickGuard.cleanup);
    function safeJson(value) {
      try {
        if (typeof value === "string") {
          const trimmed = value.trim();
          if (!trimmed) return "";
          const maybe = JSON.parse(trimmed);
          return JSON.stringify(maybe, null, 2);
        }
      } catch {
      }
      try {
        return JSON.stringify(value ?? null, null, 2);
      } catch {
        return String(value);
      }
    }
    function fmtDate(ms) {
      return new Date(ms).toISOString();
    }
    function formatHHmmss(ms) {
      if (typeof ms !== "number" || !Number.isFinite(ms)) return null;
      const d = new Date(ms);
      if (Number.isNaN(d.getTime())) return null;
      const hh = String(d.getHours()).padStart(2, "0");
      const mm = String(d.getMinutes()).padStart(2, "0");
      const ss = String(d.getSeconds()).padStart(2, "0");
      return `${hh}:${mm}:${ss}`;
    }
    const time = (() => formatHHmmss(trace.createdAt))();
    const derivedError = (() => {
      if (trace.error != null) return trace.error;
      const isFailed = trace.ok === false || typeof trace.status === "number" && trace.status >= 400;
      if (!isFailed) return void 0;
      const resp = trace.response;
      if (resp && typeof resp === "object") {
        if ("error" in resp && resp.error != null) return resp.error;
      }
      return { status: trace.status, ok: trace.ok };
    })();
    const hasError = derivedError != null;
    `API: ${trace.operationName}`;
    const oneLine = trace.operationName;
    (() => {
      if (typeof trace.createdAt !== "number") return "—";
      return fmtDate(trace.createdAt);
    })();
    safeJson({
      method: trace.method,
      path: trace.path,
      baseUrl: trace.baseUrl,
      request: trace.request
    });
    safeJson({
      status: trace.status,
      ok: trace.ok,
      response: trace.response,
      error: derivedError
    });
    derivedError != null ? safeJson(derivedError) : "";
    let $$settled = true;
    let $$inner_renderer;
    function $$render_inner($$renderer3) {
      $$renderer3.push(`<button type="button" class="flex w-full cursor-pointer select-text items-baseline gap-2 truncate rounded-md bg-transparent px-2 py-1 text-left text-sm text-rc-gray-200 hover:bg-rc-gray-800/40">`);
      Icon($$renderer3, {
        name: hasError ? "close" : "checkmark",
        width: 18,
        height: 18,
        class: hasError ? "self-center text-red-400" : "self-center text-rc-green-200"
      });
      $$renderer3.push(`<!----> `);
      if (time) {
        $$renderer3.push("<!--[-->");
        $$renderer3.push(`<span class="text-[13px] leading-none text-rc-gray-400">${escape_html(time)}</span>`);
      } else {
        $$renderer3.push("<!--[!-->");
      }
      $$renderer3.push(`<!--]--> <span${attr_class(clsx(hasError ? "text-red-200" : ""))}>${escape_html(oneLine)}</span></button> `);
      {
        $$renderer3.push("<!--[!-->");
      }
      $$renderer3.push(`<!--]-->`);
    }
    do {
      $$settled = true;
      $$inner_renderer = $$renderer2.copy();
      $$render_inner($$inner_renderer);
    } while (!$$settled);
    $$renderer2.subsume($$inner_renderer);
  });
}
function ChatConversationalTrace($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let {
      trace,
      context,
      agentId,
      analyzeDisabled = false,
      onAnalyze,
      onRegenerate,
      onRevert,
      showSeeVariants = false,
      onSeeVariants,
      variantSelectionState = "none",
      onSelectInVariantMode,
      suppressActionRow = false
    } = $$props;
    const clickGuard = createDragSelectClickGuard();
    onDestroy(clickGuard.cleanup);
    function agentName(id) {
      if (!id) return "";
      return id.split("/").at(-1) ?? id;
    }
    function getInitial(id) {
      const first = agentName(id).trim().charAt(0);
      return first ? first.toUpperCase() : "?";
    }
    const sender = (() => {
      if (trace.role === "system") return "system";
      if (trace.eventName === "finished-main-streaming-step" || trace.eventName === "sent-message") {
        return "agent";
      }
      return trace.role === "user" ? "user" : "user";
    })();
    const bubbleMaxWidthClass = (() => {
      if (sender === "agent") return "max-w-[83%]";
      if (sender === "user") return "max-w-[90%] sm:max-w-[80%] md:max-w-[70%]";
      if (sender === "system") return "max-w-[90%] sm:max-w-[85%] md:max-w-[75%]";
      return "";
    })();
    const showRevert = (() => sender === "user" && !!onRevert && // Hide for older traces that predate bosun state metadata.
    trace?.bosunPrevStateId !== void 0)();
    const hasError = (() => trace.error != null)();
    const metrics = (() => trace?.metrics)();
    const llmToAudioLatencyMs = (() => metrics?.summary?.llmToAudioLatencyMs)();
    const isHighLatency = (() => typeof llmToAudioLatencyMs === "number" && llmToAudioLatencyMs > 800)();
    const isVariantSelectable = /* @__PURE__ */ (() => variantSelectionState === "source")();
    function formatHHmmss(ms) {
      if (typeof ms !== "number" || !Number.isFinite(ms)) return null;
      const d = new Date(ms);
      if (Number.isNaN(d.getTime())) return null;
      const hh = String(d.getHours()).padStart(2, "0");
      const mm = String(d.getMinutes()).padStart(2, "0");
      const ss = String(d.getSeconds()).padStart(2, "0");
      return `${hh}:${mm}:${ss}`;
    }
    const time = (() => formatHHmmss(trace?.createdAt))();
    function isAddTestEligible() {
      return sender === "agent" && trace.eventName !== "transfer-requested" && !!(agentId && agentId.trim()) && (trace.eventName === "finished-main-streaming-step" || trace.eventName === "sent-message");
    }
    function isAnalyzeEligible() {
      return sender === "agent" && trace.eventName !== "transfer-requested" && !!(agentId && agentId.trim()) && (trace.eventName === "finished-main-streaming-step" || trace.eventName === "sent-message");
    }
    function isRegenerateEligible() {
      return isAnalyzeEligible();
    }
    let $$settled = true;
    let $$inner_renderer;
    function $$render_inner($$renderer3) {
      $$renderer3.push(`<div${attr_class("group mb-2 flex w-full items-start", void 0, { "justify-end": sender === "user" || sender === "system" })}>`);
      if (trace.eventName === "transfer-requested" || trace.eventName === "hangup-requested") {
        $$renderer3.push("<!--[-->");
        $$renderer3.push(`<div class="flex w-full justify-center"><div${attr_class(`cursor-pointer select-text rounded-full border border-rc-gray-650 bg-rc-gray-800/40 px-4 py-2 text-sm text-rc-gray-100 ${stringify(hasError ? "border-red-500 bg-red-950/30 text-red-200" : "")}`)} role="button" tabindex="0"><div class="flex flex-wrap items-baseline gap-x-2 gap-y-0">`);
        if (time) {
          $$renderer3.push("<!--[-->");
          $$renderer3.push(`<span class="text-[13px] leading-none text-rc-gray-400">${escape_html(time)}</span>`);
        } else {
          $$renderer3.push("<!--[!-->");
        }
        $$renderer3.push(`<!--]--> `);
        if (trace.eventName === "transfer-requested") {
          $$renderer3.push("<!--[-->");
          $$renderer3.push(`<div class="min-w-0 break-words">Transfer requested: ${escape_html(trace.content)}</div>`);
        } else {
          $$renderer3.push("<!--[!-->");
          $$renderer3.push(`<div class="min-w-0 break-words">Conversation hanged up.</div>`);
        }
        $$renderer3.push(`<!--]--></div></div></div>`);
      } else {
        $$renderer3.push("<!--[!-->");
        if (sender === "agent" && agentId) {
          $$renderer3.push("<!--[-->");
          $$renderer3.push(`<div class="mr-2 mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-sm bg-rc-green-700 text-sm uppercase text-rc-gray-100 backdrop-blur-md"${attr("title", agentName(agentId))}>${escape_html(getInitial(agentId))}</div>`);
        } else {
          $$renderer3.push("<!--[!-->");
        }
        $$renderer3.push(`<!--]--> `);
        if (showRevert) {
          $$renderer3.push("<!--[-->");
          $$renderer3.push(`<button type="button" title="Revert to before this message" class="mr-2 mt-1 shrink-0 self-start rounded p-1 text-rc-gray-500 opacity-80 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">`);
          Icon($$renderer3, { name: "undo", width: 16, height: 16 });
          $$renderer3.push(`<!----></button>`);
        } else {
          $$renderer3.push("<!--[!-->");
        }
        $$renderer3.push(`<!--]--> <div${attr_class(`min-w-0 ${stringify(bubbleMaxWidthClass)}`)}><div role="button" tabindex="0" class="cursor-pointer select-text"><div${attr_class(`rounded-lg ${stringify(sender === "system" ? "justify-between whitespace-pre-line break-words border border-emerald-500 text-emerald-500" : isVariantSelectable ? "w-full whitespace-pre-line break-words border border-rc-green-450 bg-transparent backdrop-blur-md hover:bg-rc-green-700" : sender !== "user" ? "w-full whitespace-pre-line break-words bg-rc-green-700 backdrop-blur-md" : "whitespace-pre-line break-words bg-rc-gray-700")} ${stringify(sender === "system" || isVariantSelectable ? "" : "border-thin border-rc-gray-110")} p-2 pt-1 text-rc-gray-100 ${stringify(hasError ? "border-red-500 bg-red-950/30 text-red-200" : "")} ${stringify(isHighLatency ? "relative pb-5 ring-1 ring-red-500/60" : "")} ${stringify(isHighLatency && !hasError ? "border-red-500" : "")}`)}><div>${escape_html(trace.content)}</div> `);
        if (time) {
          $$renderer3.push("<!--[-->");
          $$renderer3.push(`<div${attr_class(`${stringify(isHighLatency ? "absolute bottom-1 right-2" : "mt-1 text-right")} text-xs text-rc-gray-200/70`)}>${escape_html(time)}</div>`);
        } else {
          $$renderer3.push("<!--[!-->");
        }
        $$renderer3.push(`<!--]--> `);
        if (isHighLatency) {
          $$renderer3.push("<!--[-->");
          $$renderer3.push(`<div class="absolute bottom-1 left-2 rounded bg-red-950/60 px-2 py-0.5 text-[11px] text-red-200">High LLM to audio latency: ${escape_html(Math.round(llmToAudioLatencyMs))} ms</div>`);
        } else {
          $$renderer3.push("<!--[!-->");
        }
        $$renderer3.push(`<!--]--></div></div> `);
        if (!suppressActionRow && (isAnalyzeEligible() || isAddTestEligible() || isRegenerateEligible() && onRegenerate || showSeeVariants)) {
          $$renderer3.push("<!--[-->");
          $$renderer3.push(`<div class="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1">`);
          if (isAddTestEligible()) {
            $$renderer3.push("<!--[-->");
            $$renderer3.push(`<button type="button"${attr_class(`inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 transition-colors focus:outline-none focus-visible:outline-none ${stringify("cursor-pointer text-rc-gray-400 hover:bg-rc-gray-900 hover:text-rc-gray-200")}`)}>`);
            {
              $$renderer3.push("<!--[!-->");
              {
                $$renderer3.push("<!--[!-->");
                $$renderer3.push(`Add test`);
              }
              $$renderer3.push(`<!--]-->`);
            }
            $$renderer3.push(`<!--]--></button>`);
          } else {
            $$renderer3.push("<!--[!-->");
          }
          $$renderer3.push(`<!--]--> `);
          if (isAnalyzeEligible() && onAnalyze) {
            $$renderer3.push("<!--[-->");
            $$renderer3.push(`<button type="button"${attr("disabled", analyzeDisabled, true)} class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-rc-gray-400">Analyze</button>`);
          } else {
            $$renderer3.push("<!--[!-->");
          }
          $$renderer3.push(`<!--]--> `);
          if (isRegenerateEligible() && onRegenerate) {
            $$renderer3.push("<!--[-->");
            $$renderer3.push(`<button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Regenerate</button>`);
          } else {
            $$renderer3.push("<!--[!-->");
          }
          $$renderer3.push(`<!--]--> `);
          if (showSeeVariants && onSeeVariants) {
            $$renderer3.push("<!--[-->");
            $$renderer3.push(`<button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">See variants</button>`);
          } else {
            $$renderer3.push("<!--[!-->");
          }
          $$renderer3.push(`<!--]--></div>`);
        } else {
          $$renderer3.push("<!--[!-->");
        }
        $$renderer3.push(`<!--]--></div>`);
      }
      $$renderer3.push(`<!--]--></div> `);
      {
        $$renderer3.push("<!--[!-->");
      }
      $$renderer3.push(`<!--]-->`);
    }
    do {
      $$settled = true;
      $$inner_renderer = $$renderer2.copy();
      $$render_inner($$inner_renderer);
    } while (!$$settled);
    $$renderer2.subsume($$inner_renderer);
  });
}
function ChatStepTrace($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let { trace, compareTrace } = $$props;
    const clickGuard = createDragSelectClickGuard();
    onDestroy(clickGuard.cleanup);
    function getPromptForDiff(t) {
      if (!t) return null;
      if (typeof t.renderedPrompt === "string") return t.renderedPrompt;
      return null;
    }
    function commonPrefixLength(a, b) {
      if (a === b) return a.length;
      const max = Math.min(a.length, b.length);
      for (let i = 0; i < max; i++) {
        if (a.charCodeAt(i) !== b.charCodeAt(i)) return i;
      }
      return max;
    }
    function similarityPercent(current, baseline) {
      const denom = Math.max(current.length, baseline.length);
      if (denom === 0) return 100;
      const prefixLen = commonPrefixLength(current, baseline);
      return Math.floor(prefixLen / denom * 100);
    }
    function similarityDetails(current, baseline) {
      const currentLength = current.length;
      const baselineLength = baseline.length;
      const commonPrefixLen = commonPrefixLength(current, baseline);
      const denom = Math.max(currentLength, baselineLength);
      const similarityPct = denom === 0 ? 100 : Math.floor(commonPrefixLen / denom * 100);
      return {
        currentLength,
        baselineLength,
        commonPrefixLength: commonPrefixLen,
        denom,
        similarityPct
      };
    }
    function stringPreview(value, opts) {
      const headChars = 600;
      const tailChars = 600;
      const head = value.slice(0, headChars);
      const tail = value.slice(Math.max(head.length, value.length - tailChars));
      const omittedChars = Math.max(0, value.length - head.length - tail.length);
      return { length: value.length, head, tail, omittedChars };
    }
    function cachedPromptTokensPercent(trace2) {
      const usage = trace2.llmUsage;
      if (!usage) return null;
      if (typeof usage.promptTokens !== "number" || !Number.isFinite(usage.promptTokens)) return null;
      if (usage.promptTokens <= 0) return null;
      if (typeof usage.cachedPromptTokens !== "number" || !Number.isFinite(usage.cachedPromptTokens)) return null;
      if (usage.cachedPromptTokens < 0) return null;
      return Math.max(0, Math.min(100, Math.floor(usage.cachedPromptTokens / usage.promptTokens * 100)));
    }
    function safeJsonStringify(value) {
      const seen = /* @__PURE__ */ new WeakSet();
      try {
        return JSON.stringify(
          value,
          (_, v) => {
            if (typeof v === "bigint") return v.toString();
            if (v instanceof Error) {
              return { name: v.name, message: v.message, stack: v.stack };
            }
            if (typeof v === "object" && v !== null) {
              if (seen.has(v)) return "[Circular]";
              seen.add(v);
            }
            return v;
          },
          2
        ) ?? "";
      } catch {
        return String(value);
      }
    }
    function formatMaybeJson(value) {
      if (value == null) return "";
      if (typeof value === "string") {
        const trimmed = value.trim();
        if (!trimmed) return "";
        try {
          return JSON.stringify(JSON.parse(trimmed), null, 2);
        } catch {
          return value;
        }
      }
      return safeJsonStringify(value);
    }
    function formatHHmmss(ms) {
      if (typeof ms !== "number" || !Number.isFinite(ms)) return null;
      const d = new Date(ms);
      if (Number.isNaN(d.getTime())) return null;
      const hh = String(d.getHours()).padStart(2, "0");
      const mm = String(d.getMinutes()).padStart(2, "0");
      const ss = String(d.getSeconds()).padStart(2, "0");
      return `${hh}:${mm}:${ss}`;
    }
    const time = (() => formatHHmmss(trace.createdAt))();
    const hasError = trace.error != null;
    `AI: ${trace.name}`;
    const oneLine = trace.name;
    const mainPromptSimilarityPct = (() => {
      if (trace.name !== "main") return null;
      const current = getPromptForDiff(trace);
      const baseline = getPromptForDiff(compareTrace);
      if (current == null || baseline == null) return null;
      return similarityPercent(current, baseline);
    })();
    const mainCachedTokensPct = (() => {
      if (trace.name !== "main") return null;
      return cachedPromptTokensPercent(trace);
    })();
    const CACHE_OK_THRESHOLD_PCT = 90;
    const CACHE_MISS_SIMILARITY_THRESHOLD_PCT = 90;
    const mainPromptCacheLabel = (() => {
      if (trace.name !== "main") return null;
      if (mainCachedTokensPct != null) {
        const cacheMiss = mainCachedTokensPct === 0 && mainPromptSimilarityPct != null && mainPromptSimilarityPct >= CACHE_MISS_SIMILARITY_THRESHOLD_PCT;
        if (cacheMiss) {
          return {
            text: "0% tokens cached. Cache miss",
            className: "text-red-200"
          };
        }
        const ok = mainCachedTokensPct >= CACHE_OK_THRESHOLD_PCT;
        return ok ? {
          text: `${mainCachedTokensPct}% tokens cached`,
          className: "text-rc-gray-400"
        } : {
          text: `${mainCachedTokensPct}% tokens cached - move dynamic parts of prompt to the bottom`,
          className: "text-red-200"
        };
      }
      if (mainPromptSimilarityPct != null) {
        const ok = mainPromptSimilarityPct >= CACHE_OK_THRESHOLD_PCT;
        return ok ? {
          text: `${mainPromptSimilarityPct}%`,
          className: "text-rc-gray-400"
        } : {
          text: `${mainPromptSimilarityPct}% cached - move dynamic parts of prompt to the bottom`,
          className: "text-red-200"
        };
      }
      return null;
    })();
    const cacheDebugPayload = (() => {
      if (trace.name !== "main") return null;
      const currentPrompt = getPromptForDiff(trace);
      const baselinePrompt = getPromptForDiff(compareTrace);
      const promptSimilarity = currentPrompt != null && baselinePrompt != null ? similarityDetails(currentPrompt, baselinePrompt) : null;
      const usage = trace.llmUsage ?? null;
      const cachedTokensPct = mainCachedTokensPct;
      const cacheMiss = cachedTokensPct === 0 && promptSimilarity?.similarityPct != null && promptSimilarity.similarityPct >= CACHE_MISS_SIMILARITY_THRESHOLD_PCT;
      const labelSource = cachedTokensPct != null ? "llmUsage" : mainPromptSimilarityPct != null ? "promptSimilarityFallback" : "none";
      return {
        version: 1,
        labelSource,
        thresholds: {
          okPct: CACHE_OK_THRESHOLD_PCT,
          cacheMissSimilarityPct: CACHE_MISS_SIMILARITY_THRESHOLD_PCT
        },
        inputs: {
          llmUsage: usage,
          currentRenderedPrompt: currentPrompt != null ? stringPreview(currentPrompt) : null,
          baselineRenderedPrompt: baselinePrompt != null ? stringPreview(baselinePrompt) : null
        },
        computed: {
          cachedTokensPct,
          promptSimilarityPct: promptSimilarity?.similarityPct ?? null,
          promptSimilarity,
          cacheMiss
        },
        decision: { text: mainPromptCacheLabel?.text ?? null }
      };
    })();
    (() => {
      if (!cacheDebugPayload) return "{}";
      return safeJsonStringify(cacheDebugPayload);
    })();
    formatMaybeJson(trace.response);
    (() => {
      const raw = trace.response;
      if (typeof raw !== "string") return "json";
      try {
        JSON.parse(raw);
        return "json";
      } catch {
        return "text";
      }
    })();
    trace.stringifiedConversation ?? "";
    formatMaybeJson(trace.renderedPrompt);
    formatMaybeJson(trace.receivedPrompt);
    formatMaybeJson(trace.receivedContext);
    formatMaybeJson(trace.schema);
    trace.error ? safeJsonStringify(trace.error) : "";
    function toCopyablePrompt(value) {
      if (value == null) return "";
      if (typeof value === "string") return value;
      return safeJsonStringify(value);
    }
    toCopyablePrompt(trace.receivedPrompt);
    toCopyablePrompt(trace.renderedPrompt);
    let $$settled = true;
    let $$inner_renderer;
    function $$render_inner($$renderer3) {
      $$renderer3.push(`<button type="button" class="flex w-full cursor-pointer select-text items-baseline gap-2 truncate rounded-md bg-transparent px-2 py-1 text-left text-sm text-rc-gray-200 hover:bg-rc-gray-800/40">`);
      Icon($$renderer3, {
        name: hasError ? "close" : "checkmark",
        width: 18,
        height: 18,
        class: hasError ? "self-center text-red-400" : "self-center text-rc-green-200"
      });
      $$renderer3.push(`<!----> `);
      if (time) {
        $$renderer3.push("<!--[-->");
        $$renderer3.push(`<span class="text-[13px] leading-none text-rc-gray-400">${escape_html(time)}</span>`);
      } else {
        $$renderer3.push("<!--[!-->");
      }
      $$renderer3.push(`<!--]--> <span${attr_class(clsx(hasError ? "text-red-200" : ""))}>AI: ${escape_html(oneLine)}</span> `);
      if (mainPromptCacheLabel != null) {
        $$renderer3.push("<!--[-->");
        $$renderer3.push(`<span${attr_class(`shrink-0 text-xs ${mainPromptCacheLabel.className}`)}><span class="cursor-pointer" title="Show prompt-cache calc JSON">${escape_html(mainPromptCacheLabel.text)}</span></span>`);
      } else {
        $$renderer3.push("<!--[!-->");
      }
      $$renderer3.push(`<!--]--></button> `);
      {
        $$renderer3.push("<!--[!-->");
      }
      $$renderer3.push(`<!--]--> `);
      {
        $$renderer3.push("<!--[!-->");
      }
      $$renderer3.push(`<!--]-->`);
    }
    do {
      $$settled = true;
      $$inner_renderer = $$renderer2.copy();
      $$render_inner($$inner_renderer);
    } while (!$$settled);
    $$renderer2.subsume($$inner_renderer);
  });
}

export { ChatApiCallTrace as C, ChatConversationalTrace as a, ChatStepTrace as b };
//# sourceMappingURL=ChatStepTrace-Bvxmgz7y.js.map
