@hef2024/llmasaservice-ui 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1865,16 +1865,16 @@ var ChatPanel = ({
1865
1865
  return /* @__PURE__ */ React3.createElement("a", __spreadValues({ href, target: "_blank", rel: "noopener noreferrer" }, props), children);
1866
1866
  };
1867
1867
  const convertMarkdownToHTML = (markdown) => {
1868
+ const markdownContent = /* @__PURE__ */ React3.createElement(
1869
+ ReactMarkdown,
1870
+ {
1871
+ remarkPlugins: [remarkGfm],
1872
+ rehypePlugins: [rehypeRaw]
1873
+ },
1874
+ markdown
1875
+ );
1868
1876
  const html = ReactDOMServer.renderToStaticMarkup(
1869
- /* @__PURE__ */ React3.createElement(
1870
- ReactMarkdown,
1871
- {
1872
- className: markdownClass,
1873
- remarkPlugins: [remarkGfm],
1874
- rehypePlugins: [rehypeRaw]
1875
- },
1876
- markdown
1877
- )
1877
+ markdownClass ? /* @__PURE__ */ React3.createElement("div", { className: markdownClass }, markdownContent) : markdownContent
1878
1878
  );
1879
1879
  return html;
1880
1880
  };
@@ -2103,10 +2103,16 @@ var ChatPanel = ({
2103
2103
  },
2104
2104
  /* @__PURE__ */ React3.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React3.createElement("line", { x1: "18", x2: "6", y1: "6", y2: "18" }), /* @__PURE__ */ React3.createElement("line", { x1: "6", x2: "18", y1: "6", y2: "18" }))
2105
2105
  )),
2106
- /* @__PURE__ */ React3.createElement("div", { className: "responseArea", ref: responseAreaRef }, initialMessage && initialMessage !== "" ? /* @__PURE__ */ React3.createElement("div", { className: "history-entry" }, /* @__PURE__ */ React3.createElement("div", { className: "response" }, /* @__PURE__ */ React3.createElement(
2106
+ /* @__PURE__ */ React3.createElement("div", { className: "responseArea", ref: responseAreaRef }, initialMessage && initialMessage !== "" ? /* @__PURE__ */ React3.createElement("div", { className: "history-entry" }, /* @__PURE__ */ React3.createElement("div", { className: "response" }, markdownClass ? /* @__PURE__ */ React3.createElement("div", { className: markdownClass }, /* @__PURE__ */ React3.createElement(
2107
+ ReactMarkdown,
2108
+ {
2109
+ remarkPlugins: [remarkGfm],
2110
+ rehypePlugins: [rehypeRaw]
2111
+ },
2112
+ initialMessage
2113
+ )) : /* @__PURE__ */ React3.createElement(
2107
2114
  ReactMarkdown,
2108
2115
  {
2109
- className: markdownClass,
2110
2116
  remarkPlugins: [remarkGfm],
2111
2117
  rehypePlugins: [rehypeRaw]
2112
2118
  },
@@ -2131,10 +2137,9 @@ var ChatPanel = ({
2131
2137
  return null;
2132
2138
  })(), (() => {
2133
2139
  if (lastKey && history[lastKey] && history[lastKey].content) {
2134
- return /* @__PURE__ */ React3.createElement(
2140
+ const content = /* @__PURE__ */ React3.createElement(
2135
2141
  ReactMarkdown,
2136
2142
  {
2137
- className: markdownClass,
2138
2143
  remarkPlugins: [remarkGfm],
2139
2144
  rehypePlugins: [rehypeRaw],
2140
2145
  components: {
@@ -2144,27 +2149,41 @@ var ChatPanel = ({
2144
2149
  },
2145
2150
  history[lastKey].content
2146
2151
  );
2152
+ return markdownClass ? /* @__PURE__ */ React3.createElement("div", { className: markdownClass }, content) : content;
2147
2153
  }
2148
2154
  const { cleanedText } = processThinkingTags(
2149
2155
  response || ""
2150
2156
  );
2151
- return cleanedText && cleanedText.length > 0 ? /* @__PURE__ */ React3.createElement(
2152
- ReactMarkdown,
2153
- {
2154
- className: markdownClass,
2155
- remarkPlugins: [remarkGfm],
2156
- rehypePlugins: [rehypeRaw],
2157
- components: {
2158
- /*a: CustomLink,*/
2159
- code: CodeBlock
2160
- }
2161
- },
2162
- cleanedText
2163
- ) : null;
2164
- })()) : /* @__PURE__ */ React3.createElement("div", null, isLastEntry && thinkingBlocks.length > 0 && renderThinkingBlocks(), /* @__PURE__ */ React3.createElement(
2157
+ if (cleanedText && cleanedText.length > 0) {
2158
+ const content = /* @__PURE__ */ React3.createElement(
2159
+ ReactMarkdown,
2160
+ {
2161
+ remarkPlugins: [remarkGfm],
2162
+ rehypePlugins: [rehypeRaw],
2163
+ components: {
2164
+ /*a: CustomLink,*/
2165
+ code: CodeBlock
2166
+ }
2167
+ },
2168
+ cleanedText
2169
+ );
2170
+ return markdownClass ? /* @__PURE__ */ React3.createElement("div", { className: markdownClass }, content) : content;
2171
+ }
2172
+ return null;
2173
+ })()) : /* @__PURE__ */ React3.createElement("div", null, isLastEntry && thinkingBlocks.length > 0 && renderThinkingBlocks(), markdownClass ? /* @__PURE__ */ React3.createElement("div", { className: markdownClass }, /* @__PURE__ */ React3.createElement(
2174
+ ReactMarkdown,
2175
+ {
2176
+ remarkPlugins: [remarkGfm],
2177
+ rehypePlugins: [rehypeRaw],
2178
+ components: {
2179
+ /*a: CustomLink,*/
2180
+ code: CodeBlock
2181
+ }
2182
+ },
2183
+ processThinkingTags(historyEntry.content).cleanedText
2184
+ )) : /* @__PURE__ */ React3.createElement(
2165
2185
  ReactMarkdown,
2166
2186
  {
2167
- className: markdownClass,
2168
2187
  remarkPlugins: [remarkGfm],
2169
2188
  rehypePlugins: [rehypeRaw],
2170
2189
  components: {
@@ -2912,7 +2931,7 @@ var AgentPanel = ({
2912
2931
  useEffect3(() => {
2913
2932
  const fetchAgentData = () => __async(void 0, null, function* () {
2914
2933
  try {
2915
- const fetchUrl = `https://api.llmasaservice.io/agents/${agent}`;
2934
+ const fetchUrl = url.endsWith("dev") ? `https://8ftw8droff.execute-api.us-east-1.amazonaws.com/dev/agents/${agent}` : `https://api.llmasaservice.io/agents/${agent}`;
2916
2935
  const response = yield fetch(fetchUrl, {
2917
2936
  method: "GET",
2918
2937
  headers: {
@@ -3020,16 +3039,17 @@ var AgentPanel = ({
3020
3039
  var AgentPanel_default = AgentPanel;
3021
3040
 
3022
3041
  // src/AIAgentPanel.tsx
3023
- import React12, { useCallback as useCallback4, useEffect as useEffect9, useMemo as useMemo4, useRef as useRef6, useState as useState8 } from "react";
3042
+ import React13, { useCallback as useCallback4, useEffect as useEffect9, useMemo as useMemo4, useRef as useRef6, useState as useState8 } from "react";
3024
3043
 
3025
3044
  // src/AIChatPanel.tsx
3026
- import React11, {
3045
+ import React12, {
3027
3046
  useCallback as useCallback2,
3028
3047
  useEffect as useEffect7,
3029
3048
  useMemo as useMemo2,
3030
3049
  useRef as useRef5,
3031
3050
  useState as useState6
3032
3051
  } from "react";
3052
+ import ReactDOMServer2 from "react-dom/server";
3033
3053
  import { useLLM as useLLM2 } from "llmasaservice-client";
3034
3054
  import ReactMarkdown2 from "react-markdown";
3035
3055
  import remarkGfm2 from "remark-gfm";
@@ -3371,19 +3391,69 @@ var DialogFooter = ({
3371
3391
  return /* @__PURE__ */ React10.createElement("div", { className: `ai-dialog-footer ${className}` }, children);
3372
3392
  };
3373
3393
 
3394
+ // src/components/ui/ToolInfoModal.tsx
3395
+ import React11 from "react";
3396
+ var ToolInfoModal2 = ({
3397
+ isOpen,
3398
+ onClose,
3399
+ data
3400
+ }) => {
3401
+ if (!isOpen || !data) return null;
3402
+ return /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-modal-overlay", onClick: onClose }, /* @__PURE__ */ React11.createElement(
3403
+ "div",
3404
+ {
3405
+ className: "ai-chat-modal-content ai-chat-tool-info-modal",
3406
+ onClick: (e) => e.stopPropagation()
3407
+ },
3408
+ /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-modal-header" }, /* @__PURE__ */ React11.createElement("h3", null, "Tool Information"), /* @__PURE__ */ React11.createElement(
3409
+ "button",
3410
+ {
3411
+ className: "ai-chat-modal-close",
3412
+ onClick: onClose,
3413
+ "aria-label": "Close"
3414
+ },
3415
+ "\xD7"
3416
+ )),
3417
+ /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-modal-body ai-chat-tool-info-container" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-tool-info-section" }, /* @__PURE__ */ React11.createElement("h4", null, "Tool Calls"), /* @__PURE__ */ React11.createElement(
3418
+ "textarea",
3419
+ {
3420
+ className: "ai-chat-tool-info-json",
3421
+ readOnly: true,
3422
+ value: JSON.stringify(data.calls, null, 2)
3423
+ }
3424
+ )), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-tool-info-section" }, /* @__PURE__ */ React11.createElement("h4", null, "Tool Responses"), /* @__PURE__ */ React11.createElement(
3425
+ "textarea",
3426
+ {
3427
+ className: "ai-chat-tool-info-json",
3428
+ readOnly: true,
3429
+ value: JSON.stringify(data.responses, null, 2)
3430
+ }
3431
+ ))),
3432
+ /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-modal-footer" }, /* @__PURE__ */ React11.createElement(
3433
+ "button",
3434
+ {
3435
+ className: "ai-chat-modal-button ai-chat-modal-button--primary",
3436
+ onClick: onClose
3437
+ },
3438
+ "Close"
3439
+ ))
3440
+ ));
3441
+ };
3442
+ var ToolInfoModal_default2 = ToolInfoModal2;
3443
+
3374
3444
  // src/AIChatPanel.tsx
3375
- var ArrowUpIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("path", { d: "M12 19V5M5 12l7-7 7 7" }));
3376
- var StopIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "ai-chat-icon" }, /* @__PURE__ */ React11.createElement("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }));
3377
- var ChevronDownIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("path", { d: "m6 9 6 6 6-6" }));
3378
- var ChevronUpIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("path", { d: "m18 15-6-6-6 6" }));
3379
- var AgentIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("path", { d: "M12 8V4H8" }), /* @__PURE__ */ React11.createElement("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }), /* @__PURE__ */ React11.createElement("path", { d: "M2 14h2" }), /* @__PURE__ */ React11.createElement("path", { d: "M20 14h2" }), /* @__PURE__ */ React11.createElement("path", { d: "M15 13v2" }), /* @__PURE__ */ React11.createElement("path", { d: "M9 13v2" }));
3380
- var CheckIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("polyline", { points: "20 6 9 17 4 12" }));
3381
- var BrainIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("path", { d: "M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z" }), /* @__PURE__ */ React11.createElement("path", { d: "M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z" }));
3382
- var SearchIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ React11.createElement("path", { d: "m21 21-4.3-4.3" }));
3383
- var LLMAsAServiceLogo = () => /* @__PURE__ */ React11.createElement("svg", { width: "16", height: "16", viewBox: "0 0 72 72", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React11.createElement("ellipse", { cx: "14.0868", cy: "59.2146", rx: "7.8261", ry: "7.7854", fill: "#2487D8" }), /* @__PURE__ */ React11.createElement("ellipse", { cx: "24.9013", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ React11.createElement("ellipse", { cx: "45.391", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ React11.createElement("ellipse", { cx: "65.8813", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ React11.createElement("ellipse", { cx: "35.1461", cy: "26.5327", rx: "4.41103", ry: "4.3878", fill: "#2487D8" }), /* @__PURE__ */ React11.createElement("ellipse", { cx: "55.6364", cy: "26.5327", rx: "4.41103", ry: "4.3878", fill: "#2487D8" }), /* @__PURE__ */ React11.createElement("ellipse", { cx: "45.391", cy: "10.3959", rx: "2.70351", ry: "2.68919", fill: "#2487D8" }));
3384
- var AlertCircleIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ React11.createElement("line", { x1: "12", x2: "12", y1: "8", y2: "12" }), /* @__PURE__ */ React11.createElement("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" }));
3385
- var CloseIcon = () => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("line", { x1: "18", x2: "6", y1: "6", y2: "18" }), /* @__PURE__ */ React11.createElement("line", { x1: "6", x2: "18", y1: "6", y2: "18" }));
3386
- var ChatInput = React11.memo(({
3445
+ var ArrowUpIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("path", { d: "M12 19V5M5 12l7-7 7 7" }));
3446
+ var StopIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "ai-chat-icon" }, /* @__PURE__ */ React12.createElement("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }));
3447
+ var ChevronDownIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("path", { d: "m6 9 6 6 6-6" }));
3448
+ var ChevronUpIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("path", { d: "m18 15-6-6-6 6" }));
3449
+ var AgentIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("path", { d: "M12 8V4H8" }), /* @__PURE__ */ React12.createElement("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }), /* @__PURE__ */ React12.createElement("path", { d: "M2 14h2" }), /* @__PURE__ */ React12.createElement("path", { d: "M20 14h2" }), /* @__PURE__ */ React12.createElement("path", { d: "M15 13v2" }), /* @__PURE__ */ React12.createElement("path", { d: "M9 13v2" }));
3450
+ var CheckIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("polyline", { points: "20 6 9 17 4 12" }));
3451
+ var BrainIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("path", { d: "M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z" }), /* @__PURE__ */ React12.createElement("path", { d: "M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z" }));
3452
+ var SearchIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ React12.createElement("path", { d: "m21 21-4.3-4.3" }));
3453
+ var LLMAsAServiceLogo = () => /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 72 72", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("ellipse", { cx: "14.0868", cy: "59.2146", rx: "7.8261", ry: "7.7854", fill: "#2487D8" }), /* @__PURE__ */ React12.createElement("ellipse", { cx: "24.9013", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ React12.createElement("ellipse", { cx: "45.391", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ React12.createElement("ellipse", { cx: "65.8813", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ React12.createElement("ellipse", { cx: "35.1461", cy: "26.5327", rx: "4.41103", ry: "4.3878", fill: "#2487D8" }), /* @__PURE__ */ React12.createElement("ellipse", { cx: "55.6364", cy: "26.5327", rx: "4.41103", ry: "4.3878", fill: "#2487D8" }), /* @__PURE__ */ React12.createElement("ellipse", { cx: "45.391", cy: "10.3959", rx: "2.70351", ry: "2.68919", fill: "#2487D8" }));
3454
+ var AlertCircleIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ React12.createElement("line", { x1: "12", x2: "12", y1: "8", y2: "12" }), /* @__PURE__ */ React12.createElement("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" }));
3455
+ var CloseIcon = () => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("line", { x1: "18", x2: "6", y1: "6", y2: "18" }), /* @__PURE__ */ React12.createElement("line", { x1: "6", x2: "18", y1: "6", y2: "18" }));
3456
+ var ChatInput = React12.memo(({
3387
3457
  placeholder,
3388
3458
  idle,
3389
3459
  onSubmit,
@@ -3466,13 +3536,13 @@ var ChatInput = React11.memo(({
3466
3536
  if (typeof data === "string") return data;
3467
3537
  return JSON.stringify(data, null, 2);
3468
3538
  };
3469
- return /* @__PURE__ */ React11.createElement(
3539
+ return /* @__PURE__ */ React12.createElement(
3470
3540
  "div",
3471
3541
  {
3472
3542
  className: `ai-chat-panel__input-container ${dropdownOpen ? "ai-chat-panel__input-container--dropdown-open" : ""}`,
3473
3543
  ref: containerRef
3474
3544
  },
3475
- /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-panel__input" }, /* @__PURE__ */ React11.createElement(
3545
+ /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-panel__input" }, /* @__PURE__ */ React12.createElement(
3476
3546
  "textarea",
3477
3547
  {
3478
3548
  ref: textareaRef,
@@ -3492,24 +3562,24 @@ var ChatInput = React11.memo(({
3492
3562
  rows: 1
3493
3563
  }
3494
3564
  )),
3495
- /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-panel__input-footer" }, agentOptions.length > 0 ? /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-agent-selector" }, /* @__PURE__ */ React11.createElement(
3565
+ /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-panel__input-footer" }, agentOptions.length > 0 ? /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-agent-selector" }, /* @__PURE__ */ React12.createElement(
3496
3566
  "button",
3497
3567
  {
3498
3568
  className: "ai-chat-agent-selector__trigger",
3499
3569
  onClick: () => setDropdownOpen(!dropdownOpen),
3500
3570
  disabled: agentsLoading
3501
3571
  },
3502
- currentAgentAvatarUrl ? /* @__PURE__ */ React11.createElement(
3572
+ currentAgentAvatarUrl ? /* @__PURE__ */ React12.createElement(
3503
3573
  "img",
3504
3574
  {
3505
3575
  src: currentAgentAvatarUrl,
3506
3576
  alt: currentAgentLabel || "Agent",
3507
3577
  className: "ai-chat-agent-selector__avatar"
3508
3578
  }
3509
- ) : /* @__PURE__ */ React11.createElement(AgentIcon, null),
3510
- /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-selector__label" }, agentsLoading ? "Loading..." : currentAgentLabel || "Select agent"),
3511
- dropdownOpen ? /* @__PURE__ */ React11.createElement(ChevronUpIcon, null) : /* @__PURE__ */ React11.createElement(ChevronDownIcon, null)
3512
- )) : /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-panel__input-footer-spacer" }), contextSections.length > 0 && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-pill-wrapper" }, /* @__PURE__ */ React11.createElement(
3579
+ ) : /* @__PURE__ */ React12.createElement(AgentIcon, null),
3580
+ /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-selector__label" }, agentsLoading ? "Loading..." : currentAgentLabel || "Select agent"),
3581
+ dropdownOpen ? /* @__PURE__ */ React12.createElement(ChevronUpIcon, null) : /* @__PURE__ */ React12.createElement(ChevronDownIcon, null)
3582
+ )) : /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-panel__input-footer-spacer" }), contextSections.length > 0 && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-pill-wrapper" }, /* @__PURE__ */ React12.createElement(
3513
3583
  "button",
3514
3584
  {
3515
3585
  className: `ai-chat-context-pill ${contextViewerOpen ? "ai-chat-context-pill--active" : ""} ${isOverLimit ? "ai-chat-context-pill--warning" : ""}`,
@@ -3525,15 +3595,15 @@ var ChatInput = React11.memo(({
3525
3595
  type: "button",
3526
3596
  title: "View context"
3527
3597
  },
3528
- /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-pill__label" }, "context: ", contextSections.length, " ", contextSections.length === 1 ? "section" : "sections")
3529
- ), contextViewerOpen && /* @__PURE__ */ React11.createElement(
3598
+ /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-pill__label" }, "context: ", contextSections.length, " ", contextSections.length === 1 ? "section" : "sections")
3599
+ ), contextViewerOpen && /* @__PURE__ */ React12.createElement(
3530
3600
  "div",
3531
3601
  {
3532
3602
  className: `ai-chat-context-popover ${contextViewMode === "detail" ? "ai-chat-context-popover--detail" : ""}`,
3533
3603
  ref: contextPopoverRef,
3534
3604
  onClick: (e) => e.stopPropagation()
3535
3605
  },
3536
- contextViewMode === "summary" && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__summary" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__header" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__title" }, "Context"), /* @__PURE__ */ React11.createElement(
3606
+ contextViewMode === "summary" && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__summary" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__header" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__title" }, "Context"), /* @__PURE__ */ React12.createElement(
3537
3607
  "button",
3538
3608
  {
3539
3609
  className: "ai-chat-context-popover__close",
@@ -3541,13 +3611,13 @@ var ChatInput = React11.memo(({
3541
3611
  type: "button"
3542
3612
  },
3543
3613
  "\xD7"
3544
- )), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__token-bar" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__token-info" }, /* @__PURE__ */ React11.createElement("span", { className: isOverLimit ? "ai-chat-context-popover__tokens--warning" : "" }, formatTokens(totalContextTokens), " tokens"), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__token-limit" }, "/ ", formatTokens(maxContextTokens), " limit")), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__progress" }, /* @__PURE__ */ React11.createElement(
3614
+ )), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__token-bar" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__token-info" }, /* @__PURE__ */ React12.createElement("span", { className: isOverLimit ? "ai-chat-context-popover__tokens--warning" : "" }, formatTokens(totalContextTokens), " tokens"), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__token-limit" }, "/ ", formatTokens(maxContextTokens), " limit")), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__progress" }, /* @__PURE__ */ React12.createElement(
3545
3615
  "div",
3546
3616
  {
3547
3617
  className: `ai-chat-context-popover__progress-bar ${isOverLimit ? "ai-chat-context-popover__progress-bar--warning" : ""}`,
3548
3618
  style: { width: `${Math.min(tokenPercentage, 100)}%` }
3549
3619
  }
3550
- ))), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__sections" }, contextSections.map((section) => /* @__PURE__ */ React11.createElement(
3620
+ ))), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__sections" }, contextSections.map((section) => /* @__PURE__ */ React12.createElement(
3551
3621
  "div",
3552
3622
  {
3553
3623
  key: section.id,
@@ -3558,10 +3628,10 @@ var ChatInput = React11.memo(({
3558
3628
  }
3559
3629
  }
3560
3630
  },
3561
- /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__section-icon" }, "\u{1F4C4}"),
3562
- /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__section-title" }, section.title),
3563
- /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__section-tokens" }, section.tokens || Math.ceil(JSON.stringify(section.data).length / 4))
3564
- ))), enableContextDetailView && /* @__PURE__ */ React11.createElement(
3631
+ /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__section-icon" }, "\u{1F4C4}"),
3632
+ /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__section-title" }, section.title),
3633
+ /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__section-tokens" }, section.tokens || Math.ceil(JSON.stringify(section.data).length / 4))
3634
+ ))), enableContextDetailView && /* @__PURE__ */ React12.createElement(
3565
3635
  "button",
3566
3636
  {
3567
3637
  className: "ai-chat-context-popover__expand-btn",
@@ -3570,7 +3640,7 @@ var ChatInput = React11.memo(({
3570
3640
  },
3571
3641
  "View details \u2192"
3572
3642
  )),
3573
- contextViewMode === "detail" && enableContextDetailView && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__detail" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__header" }, /* @__PURE__ */ React11.createElement(
3643
+ contextViewMode === "detail" && enableContextDetailView && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__detail" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__header" }, /* @__PURE__ */ React12.createElement(
3574
3644
  "button",
3575
3645
  {
3576
3646
  className: "ai-chat-context-popover__back",
@@ -3578,7 +3648,7 @@ var ChatInput = React11.memo(({
3578
3648
  type: "button"
3579
3649
  },
3580
3650
  "\u2190 Back"
3581
- ), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__title" }, "Context Details"), /* @__PURE__ */ React11.createElement(
3651
+ ), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__title" }, "Context Details"), /* @__PURE__ */ React12.createElement(
3582
3652
  "button",
3583
3653
  {
3584
3654
  className: "ai-chat-context-popover__close",
@@ -3586,26 +3656,26 @@ var ChatInput = React11.memo(({
3586
3656
  type: "button"
3587
3657
  },
3588
3658
  "\xD7"
3589
- )), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__token-bar" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__token-info" }, /* @__PURE__ */ React11.createElement("span", { className: isOverLimit ? "ai-chat-context-popover__tokens--warning" : "" }, formatTokens(totalContextTokens), " tokens"), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__token-limit" }, "/ ", formatTokens(maxContextTokens), " limit")), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__progress" }, /* @__PURE__ */ React11.createElement(
3659
+ )), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__token-bar" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__token-info" }, /* @__PURE__ */ React12.createElement("span", { className: isOverLimit ? "ai-chat-context-popover__tokens--warning" : "" }, formatTokens(totalContextTokens), " tokens"), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__token-limit" }, "/ ", formatTokens(maxContextTokens), " limit")), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__progress" }, /* @__PURE__ */ React12.createElement(
3590
3660
  "div",
3591
3661
  {
3592
3662
  className: `ai-chat-context-popover__progress-bar ${isOverLimit ? "ai-chat-context-popover__progress-bar--warning" : ""}`,
3593
3663
  style: { width: `${Math.min(tokenPercentage, 100)}%` }
3594
3664
  }
3595
- ))), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-context-popover__detail-sections" }, contextSections.map((section) => {
3665
+ ))), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-context-popover__detail-sections" }, contextSections.map((section) => {
3596
3666
  const format = detectFormat(section.data);
3597
- return /* @__PURE__ */ React11.createElement("details", { key: section.id, className: "ai-chat-context-popover__detail-section", open: true }, /* @__PURE__ */ React11.createElement("summary", { className: "ai-chat-context-popover__detail-section-header" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__detail-section-title" }, section.title), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-context-popover__detail-section-meta" }, /* @__PURE__ */ React11.createElement("code", null, `{{${section.id}}}`), /* @__PURE__ */ React11.createElement("span", null, "~", section.tokens || Math.ceil(JSON.stringify(section.data).length / 4)))), /* @__PURE__ */ React11.createElement("pre", { className: "ai-chat-context-popover__detail-content" }, /* @__PURE__ */ React11.createElement("code", null, formatContent(section.data, format))));
3667
+ return /* @__PURE__ */ React12.createElement("details", { key: section.id, className: "ai-chat-context-popover__detail-section", open: true }, /* @__PURE__ */ React12.createElement("summary", { className: "ai-chat-context-popover__detail-section-header" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__detail-section-title" }, section.title), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-context-popover__detail-section-meta" }, /* @__PURE__ */ React12.createElement("code", null, `{{${section.id}}}`), /* @__PURE__ */ React12.createElement("span", null, "~", section.tokens || Math.ceil(JSON.stringify(section.data).length / 4)))), /* @__PURE__ */ React12.createElement("pre", { className: "ai-chat-context-popover__detail-content" }, /* @__PURE__ */ React12.createElement("code", null, formatContent(section.data, format))));
3598
3668
  })))
3599
- )), /* @__PURE__ */ React11.createElement(
3669
+ )), /* @__PURE__ */ React12.createElement(
3600
3670
  "button",
3601
3671
  {
3602
3672
  className: `ai-chat-send-button ${idle && !inputValue.trim() ? "ai-chat-send-button--disabled" : ""} ${!idle ? "ai-chat-send-button--stop" : ""}`,
3603
3673
  onClick: () => idle ? handleSubmit() : onStop(),
3604
3674
  disabled: idle && !inputValue.trim()
3605
3675
  },
3606
- idle ? /* @__PURE__ */ React11.createElement(ArrowUpIcon, null) : /* @__PURE__ */ React11.createElement(StopIcon, null)
3676
+ idle ? /* @__PURE__ */ React12.createElement(ArrowUpIcon, null) : /* @__PURE__ */ React12.createElement(StopIcon, null)
3607
3677
  )),
3608
- agentOptions.length > 0 && dropdownOpen && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-agent-selector__dropdown-inside" }, agentOptions.map((option) => /* @__PURE__ */ React11.createElement(
3678
+ agentOptions.length > 0 && dropdownOpen && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-agent-selector__dropdown-inside" }, agentOptions.map((option) => /* @__PURE__ */ React12.createElement(
3609
3679
  "button",
3610
3680
  {
3611
3681
  key: option.value,
@@ -3617,16 +3687,16 @@ var ChatInput = React11.memo(({
3617
3687
  setDropdownOpen(false);
3618
3688
  }
3619
3689
  },
3620
- option.avatarUrl ? /* @__PURE__ */ React11.createElement(
3690
+ option.avatarUrl ? /* @__PURE__ */ React12.createElement(
3621
3691
  "img",
3622
3692
  {
3623
3693
  src: option.avatarUrl,
3624
3694
  alt: option.label,
3625
3695
  className: "ai-chat-agent-selector__option-avatar"
3626
3696
  }
3627
- ) : option.icon ? /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-selector__option-icon" }, option.icon) : null,
3628
- /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-selector__option-content" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-selector__option-label" }, option.label), option.description && /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-selector__option-description" }, option.description)),
3629
- option.value === currentAgentId && /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-selector__option-check" }, /* @__PURE__ */ React11.createElement(CheckIcon, null))
3697
+ ) : option.icon ? /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-selector__option-icon" }, option.icon) : null,
3698
+ /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-selector__option-content" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-selector__option-label" }, option.label), option.description && /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-selector__option-description" }, option.description)),
3699
+ option.value === currentAgentId && /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-selector__option-check" }, /* @__PURE__ */ React12.createElement(CheckIcon, null))
3630
3700
  )))
3631
3701
  );
3632
3702
  });
@@ -3670,8 +3740,28 @@ var AIChatPanel = ({
3670
3740
  totalContextTokens = 0,
3671
3741
  maxContextTokens = 8e3,
3672
3742
  enableContextDetailView = false,
3673
- onConversationCreated
3743
+ onConversationCreated,
3744
+ // UI Customization Props
3745
+ cssUrl,
3746
+ markdownClass,
3747
+ width,
3748
+ height,
3749
+ scrollToEnd = false,
3750
+ prismStyle,
3751
+ // Email & Save Props
3752
+ showSaveButton = true,
3753
+ showEmailButton = true,
3754
+ messages = [],
3755
+ // Call-to-Action Props
3756
+ showCallToAction = false,
3757
+ callToActionButtonText = "Submit",
3758
+ callToActionEmailAddress = "",
3759
+ callToActionEmailSubject = "Agent CTA submitted",
3760
+ // Customer Email Capture Props
3761
+ customerEmailCaptureMode = "HIDE",
3762
+ customerEmailCapturePlaceholder = "Please enter your email..."
3674
3763
  }) => {
3764
+ var _a;
3675
3765
  const publicAPIUrl = "https://api.llmasaservice.io";
3676
3766
  const [lastController, setLastController] = useState6(new AbortController());
3677
3767
  const [lastMessages, setLastMessages] = useState6([]);
@@ -3688,6 +3778,27 @@ var AIChatPanel = ({
3688
3778
  const [copiedCallId, setCopiedCallId] = useState6(null);
3689
3779
  const [feedbackCallId, setFeedbackCallId] = useState6(null);
3690
3780
  const [error, setError] = useState6(null);
3781
+ const [emailSent, setEmailSent] = useState6(false);
3782
+ const [isToolInfoModalOpen, setIsToolInfoModalOpen] = useState6(false);
3783
+ const [toolInfoData, setToolInfoData] = useState6(null);
3784
+ const [callToActionSent, setCallToActionSent] = useState6(false);
3785
+ const [CTAClickedButNoEmail, setCTAClickedButNoEmail] = useState6(false);
3786
+ const [emailInput, setEmailInput] = useState6((_a = customer == null ? void 0 : customer.customer_user_email) != null ? _a : "");
3787
+ const [emailInputSet, setEmailInputSet] = useState6(false);
3788
+ const [emailValid, setEmailValid] = useState6(true);
3789
+ const [showEmailPanel, setShowEmailPanel] = useState6(customerEmailCaptureMode !== "HIDE");
3790
+ const [emailClickedButNoEmail, setEmailClickedButNoEmail] = useState6(false);
3791
+ const [pendingToolRequests, setPendingToolRequests] = useState6([]);
3792
+ const [sessionApprovedTools, setSessionApprovedTools] = useState6([]);
3793
+ const [alwaysApprovedTools, setAlwaysApprovedTools] = useState6([]);
3794
+ useEffect7(() => {
3795
+ setShowEmailPanel(customerEmailCaptureMode !== "HIDE");
3796
+ if (customerEmailCaptureMode === "REQUIRED") {
3797
+ if (!isEmailAddress(emailInput)) {
3798
+ setEmailValid(false);
3799
+ }
3800
+ }
3801
+ }, [customerEmailCaptureMode, emailInput]);
3691
3802
  const bottomRef = useRef5(null);
3692
3803
  const responseAreaRef = useRef5(null);
3693
3804
  const [userHasScrolled, setUserHasScrolled] = useState6(false);
@@ -3698,6 +3809,7 @@ var AIChatPanel = ({
3698
3809
  const hasNotifiedCompletionRef = useRef5(true);
3699
3810
  const latestHistoryRef = useRef5(initialHistory);
3700
3811
  const initialPromptSentRef = useRef5(false);
3812
+ const lastFollowOnPromptRef = useRef5("");
3701
3813
  useEffect7(() => {
3702
3814
  if (!initialHistory) return;
3703
3815
  setHistory((prev) => {
@@ -3744,9 +3856,9 @@ var AIChatPanel = ({
3744
3856
  lastKeyRef.current = lastKey;
3745
3857
  lastCallIdRef.current = lastCallId;
3746
3858
  lastPromptRef.current = lastPrompt;
3747
- const prismStyle = useMemo2(
3748
- () => theme === "light" ? materialLight3 : materialDark3,
3749
- [theme]
3859
+ const effectivePrismStyle = useMemo2(
3860
+ () => prismStyle != null ? prismStyle : theme === "light" ? materialLight3 : materialDark3,
3861
+ [prismStyle, theme]
3750
3862
  );
3751
3863
  const browserInfo = useMemo2(() => {
3752
3864
  if (typeof window === "undefined") return null;
@@ -3757,7 +3869,7 @@ var AIChatPanel = ({
3757
3869
  };
3758
3870
  }, []);
3759
3871
  const ensureConversation = useCallback2(() => {
3760
- var _a, _b;
3872
+ var _a2, _b;
3761
3873
  console.log("ensureConversation - called with:", {
3762
3874
  currentConversation,
3763
3875
  createConversationOnFirstChat,
@@ -3772,7 +3884,7 @@ var AIChatPanel = ({
3772
3884
  const requestBody = {
3773
3885
  project_id,
3774
3886
  agentId: agent,
3775
- customerId: (_a = customer == null ? void 0 : customer.customer_id) != null ? _a : null,
3887
+ customerId: (_a2 = customer == null ? void 0 : customer.customer_id) != null ? _a2 : null,
3776
3888
  customerEmail: (_b = customer == null ? void 0 : customer.customer_user_email) != null ? _b : null,
3777
3889
  timezone: browserInfo == null ? void 0 : browserInfo.userTimezone,
3778
3890
  language: browserInfo == null ? void 0 : browserInfo.userLanguage
@@ -3811,10 +3923,10 @@ var AIChatPanel = ({
3811
3923
  return Promise.resolve(currentConversation);
3812
3924
  }, [currentConversation, createConversationOnFirstChat, publicAPIUrl, project_id, agent, customer, browserInfo]);
3813
3925
  const dataWithExtras = useCallback2(() => {
3814
- var _a, _b, _c, _d, _e, _f, _g, _h;
3926
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
3815
3927
  return [
3816
3928
  ...data,
3817
- { key: "--customer_id", data: (_a = customer == null ? void 0 : customer.customer_id) != null ? _a : "" },
3929
+ { key: "--customer_id", data: (_a2 = customer == null ? void 0 : customer.customer_id) != null ? _a2 : "" },
3818
3930
  { key: "--customer_name", data: (_b = customer == null ? void 0 : customer.customer_name) != null ? _b : "" },
3819
3931
  { key: "--customer_user_id", data: (_c = customer == null ? void 0 : customer.customer_user_id) != null ? _c : "" },
3820
3932
  { key: "--customer_user_name", data: (_d = customer == null ? void 0 : customer.customer_user_name) != null ? _d : "" },
@@ -3834,6 +3946,176 @@ var AIChatPanel = ({
3834
3946
  }, [currentAgentId, agentOptions]);
3835
3947
  const currentAgentLabel = currentAgentInfo.label;
3836
3948
  const currentAgentAvatarUrl = currentAgentInfo.avatarUrl;
3949
+ const isEmailAddress = (email) => {
3950
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
3951
+ return emailRegex.test(email);
3952
+ };
3953
+ const convertMarkdownToHTML = (markdown) => {
3954
+ const html = ReactDOMServer2.renderToStaticMarkup(
3955
+ /* @__PURE__ */ React12.createElement("div", { className: markdownClass }, /* @__PURE__ */ React12.createElement(
3956
+ ReactMarkdown2,
3957
+ {
3958
+ remarkPlugins: [remarkGfm2],
3959
+ rehypePlugins: [rehypeRaw2]
3960
+ },
3961
+ markdown
3962
+ ))
3963
+ );
3964
+ return html;
3965
+ };
3966
+ const convertHistoryToHTML = (history2) => {
3967
+ const stylesheet = `
3968
+ <style>
3969
+ .conversation-history {
3970
+ font-family: Arial, sans-serif;
3971
+ line-height: 1.5;
3972
+ }
3973
+ .history-entry {
3974
+ margin-bottom: 15px;
3975
+ }
3976
+ .prompt-container, .response-container {
3977
+ margin-bottom: 10px;
3978
+ }
3979
+ .prompt, .response {
3980
+ display: block;
3981
+ margin: 5px 0;
3982
+ padding: 10px;
3983
+ border-radius: 5px;
3984
+ max-width: 80%;
3985
+ }
3986
+ .prompt {
3987
+ background-color: #efefef;
3988
+ margin-left: 0;
3989
+ }
3990
+ .response {
3991
+ background-color: #f0fcfd;
3992
+ margin-left: 25px;
3993
+ }
3994
+ </style>
3995
+ `;
3996
+ let html = `
3997
+ <html>
3998
+ <head>
3999
+ ${stylesheet}
4000
+ </head>
4001
+ <body>
4002
+ <h1>Conversation History (${(/* @__PURE__ */ new Date()).toLocaleString()})</h1>
4003
+ <div class="conversation-history">
4004
+ `;
4005
+ Object.entries(history2).forEach(([prompt, response2], index) => {
4006
+ if (hideInitialPrompt && index === 0) {
4007
+ html += `
4008
+ <div class="history-entry">
4009
+ <div class="response-container">
4010
+ <div class="response">${convertMarkdownToHTML(response2.content)}</div>
4011
+ </div>
4012
+ </div>
4013
+ `;
4014
+ } else {
4015
+ html += `
4016
+ <div class="history-entry">
4017
+ <div class="prompt-container">
4018
+ <div class="prompt">${convertMarkdownToHTML(
4019
+ formatPromptForDisplay(prompt)
4020
+ )}</div>
4021
+ </div>
4022
+ <div class="response-container">
4023
+ <div class="response">${convertMarkdownToHTML(response2.content)}</div>
4024
+ </div>
4025
+ </div>
4026
+ `;
4027
+ }
4028
+ });
4029
+ html += `
4030
+ </div>
4031
+ </body>
4032
+ </html>
4033
+ `;
4034
+ return html;
4035
+ };
4036
+ const saveHTMLToFile = (html, filename) => {
4037
+ const blob = new Blob([html], { type: "text/html" });
4038
+ const link = document.createElement("a");
4039
+ link.href = URL.createObjectURL(blob);
4040
+ link.download = filename;
4041
+ document.body.appendChild(link);
4042
+ link.click();
4043
+ document.body.removeChild(link);
4044
+ };
4045
+ const saveAsHTMLFile = useCallback2(() => {
4046
+ saveHTMLToFile(
4047
+ convertHistoryToHTML(history),
4048
+ `conversation-${(/* @__PURE__ */ new Date()).toISOString()}.html`
4049
+ );
4050
+ interactionClicked(lastCallId || "", "save");
4051
+ }, [history, lastCallId]);
4052
+ const handleSendEmail = (to, from) => {
4053
+ sendConversationsViaEmail(to, `Conversation History from ${title}`, from);
4054
+ interactionClicked(lastCallId || "", "email", to);
4055
+ setEmailSent(true);
4056
+ };
4057
+ const sendConversationsViaEmail = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (to, subject = `Conversation History from ${title}`, from = "") {
4058
+ fetch(`${publicAPIUrl}/share/email`, {
4059
+ method: "POST",
4060
+ headers: {
4061
+ "Content-Type": "application/json"
4062
+ },
4063
+ body: JSON.stringify({
4064
+ to,
4065
+ from,
4066
+ subject,
4067
+ html: convertHistoryToHTML(history),
4068
+ project_id: project_id != null ? project_id : "",
4069
+ customer,
4070
+ history,
4071
+ title
4072
+ })
4073
+ });
4074
+ yield interactionClicked(lastCallId || "", "email", from);
4075
+ });
4076
+ const sendCallToActionEmail = useCallback2((from) => __async(void 0, null, function* () {
4077
+ try {
4078
+ yield fetch(`${publicAPIUrl}/share/email`, {
4079
+ method: "POST",
4080
+ headers: {
4081
+ "Content-Type": "application/json"
4082
+ },
4083
+ body: JSON.stringify({
4084
+ to: callToActionEmailAddress,
4085
+ from,
4086
+ subject: `${callToActionEmailSubject} from ${from}`,
4087
+ html: convertHistoryToHTML(history),
4088
+ project_id: project_id != null ? project_id : "",
4089
+ customer,
4090
+ history,
4091
+ title
4092
+ })
4093
+ });
4094
+ yield interactionClicked(lastCallId || "", "cta", from);
4095
+ setCallToActionSent(true);
4096
+ } catch (err) {
4097
+ console.error("[AIChatPanel] Failed to send CTA email:", err);
4098
+ }
4099
+ }), [history, title, project_id, customer, lastCallId, publicAPIUrl, callToActionEmailAddress, callToActionEmailSubject]);
4100
+ const isDisabledDueToNoEmail = useCallback2(() => {
4101
+ if (customerEmailCaptureMode === "REQUIRED" && !emailInputSet) {
4102
+ return true;
4103
+ }
4104
+ return false;
4105
+ }, [customerEmailCaptureMode, emailInputSet]);
4106
+ const handleToolApproval = useCallback2((toolName, scope) => {
4107
+ if (scope === "session" || scope === "always") {
4108
+ setSessionApprovedTools((prev) => Array.from(/* @__PURE__ */ new Set([...prev, toolName])));
4109
+ }
4110
+ if (scope === "always") {
4111
+ setAlwaysApprovedTools((prev) => Array.from(/* @__PURE__ */ new Set([...prev, toolName])));
4112
+ }
4113
+ setPendingToolRequests((prev) => prev.filter((r) => r.toolName !== toolName));
4114
+ console.log(`[AIChatPanel] Tool "${toolName}" approved with scope: ${scope}`);
4115
+ }, []);
4116
+ const getUniqueToolNames = useCallback2(() => {
4117
+ return Array.from(new Set(pendingToolRequests.map((r) => r.toolName)));
4118
+ }, [pendingToolRequests]);
3837
4119
  const cleanContentForDisplay = useCallback2((content) => {
3838
4120
  let cleaned = content.replace(/\*\*(.*?)\*\*/g, "$1").replace(/\*(.*?)\*/g, "$1").replace(/\n+/g, " ").replace(/\s+/g, " ").trim();
3839
4121
  if (cleaned.length > 100) {
@@ -3842,13 +4124,13 @@ var AIChatPanel = ({
3842
4124
  return cleaned || "Thinking";
3843
4125
  }, []);
3844
4126
  const processThinkingTags = useCallback2((text) => {
3845
- var _a, _b;
4127
+ var _a2, _b;
3846
4128
  const blocks = [];
3847
4129
  let index = 0;
3848
4130
  const reasoningRegex = /<reasoning>([\s\S]*?)<\/reasoning>/gi;
3849
4131
  let match;
3850
4132
  while ((match = reasoningRegex.exec(text)) !== null) {
3851
- blocks.push({ type: "reasoning", content: (_a = match[1]) != null ? _a : "", index: index++ });
4133
+ blocks.push({ type: "reasoning", content: (_a2 = match[1]) != null ? _a2 : "", index: index++ });
3852
4134
  }
3853
4135
  const searchingRegex = /<searching>([\s\S]*?)<\/searching>/gi;
3854
4136
  while ((match = searchingRegex.exec(text)) !== null) {
@@ -3896,12 +4178,12 @@ var AIChatPanel = ({
3896
4178
  return displayPrompt;
3897
4179
  }, [hideRagContextInPrompt]);
3898
4180
  const interactionClicked = useCallback2((callId, action, emailaddress = "", comment = "") => __async(void 0, null, function* () {
3899
- var _a, _b;
4181
+ var _a2, _b;
3900
4182
  console.log(`[AIChatPanel] Interaction: ${action} for callId: ${callId}`);
3901
4183
  const convId = currentConversation || (yield ensureConversation());
3902
4184
  const finalCallId = callId || convId;
3903
- const isEmailAddress = (str) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(str);
3904
- const email = emailaddress && emailaddress !== "" ? emailaddress : isEmailAddress((_a = customer == null ? void 0 : customer.customer_user_email) != null ? _a : "") ? customer == null ? void 0 : customer.customer_user_email : isEmailAddress((_b = customer == null ? void 0 : customer.customer_id) != null ? _b : "") ? customer == null ? void 0 : customer.customer_id : "";
4185
+ const isEmailAddress2 = (str) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(str);
4186
+ const email = emailaddress && emailaddress !== "" ? emailaddress : isEmailAddress2((_a2 = customer == null ? void 0 : customer.customer_user_email) != null ? _a2 : "") ? customer == null ? void 0 : customer.customer_user_email : isEmailAddress2((_b = customer == null ? void 0 : customer.customer_id) != null ? _b : "") ? customer == null ? void 0 : customer.customer_id : "";
3905
4187
  try {
3906
4188
  yield fetch(`${publicAPIUrl}/feedback/${finalCallId}/${action}`, {
3907
4189
  method: "POST",
@@ -3949,20 +4231,20 @@ var AIChatPanel = ({
3949
4231
  }
3950
4232
  }), [thumbsDownClick, interactionClicked]);
3951
4233
  const scrollToBottom = useCallback2(() => {
3952
- var _a;
4234
+ var _a2;
3953
4235
  if (scrollRAFRef.current) {
3954
4236
  cancelAnimationFrame(scrollRAFRef.current);
3955
4237
  }
3956
4238
  const now = Date.now();
3957
4239
  if (now - lastScrollTimeRef.current < 100) {
3958
4240
  scrollRAFRef.current = requestAnimationFrame(() => {
3959
- var _a2;
3960
- (_a2 = bottomRef.current) == null ? void 0 : _a2.scrollIntoView({ behavior: "auto" });
4241
+ var _a3;
4242
+ (_a3 = bottomRef.current) == null ? void 0 : _a3.scrollIntoView({ behavior: "auto" });
3961
4243
  lastScrollTimeRef.current = Date.now();
3962
4244
  });
3963
4245
  return;
3964
4246
  }
3965
- (_a = bottomRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "auto" });
4247
+ (_a2 = bottomRef.current) == null ? void 0 : _a2.scrollIntoView({ behavior: "auto" });
3966
4248
  lastScrollTimeRef.current = now;
3967
4249
  }, []);
3968
4250
  const continueChat = useCallback2((promptText) => {
@@ -4020,11 +4302,6 @@ var AIChatPanel = ({
4020
4302
  if (messagesAndHistory.length === 0 && promptTemplate) {
4021
4303
  fullPromptToSend = promptTemplate.replace("{{prompt}}", fullPromptToSend);
4022
4304
  }
4023
- if (followOnPrompt) {
4024
- fullPromptToSend += `
4025
-
4026
- ${followOnPrompt}`;
4027
- }
4028
4305
  const newController = new AbortController();
4029
4306
  setLastController(newController);
4030
4307
  send(
@@ -4092,7 +4369,6 @@ ${followOnPrompt}`;
4092
4369
  clearFollowOnQuestionsNextPrompt,
4093
4370
  history,
4094
4371
  promptTemplate,
4095
- followOnPrompt,
4096
4372
  send,
4097
4373
  service,
4098
4374
  ensureConversation,
@@ -4134,9 +4410,9 @@ ${followOnPrompt}`;
4134
4410
  setUserHasScrolled(false);
4135
4411
  setError(null);
4136
4412
  setTimeout(() => {
4137
- var _a;
4413
+ var _a2;
4138
4414
  setJustReset(false);
4139
- (_a = responseAreaRef.current) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
4415
+ (_a2 = responseAreaRef.current) == null ? void 0 : _a2.scrollTo({ top: 0, behavior: "smooth" });
4140
4416
  }, 100);
4141
4417
  }, [newConversationConfirm, idle, stop, lastController, setResponse, followOnQuestions]);
4142
4418
  useEffect7(() => {
@@ -4180,10 +4456,11 @@ ${followOnPrompt}`;
4180
4456
  }
4181
4457
  }, [idle]);
4182
4458
  useEffect7(() => {
4183
- if (!idle && !userHasScrolled && response) {
4459
+ const shouldAutoScroll = scrollToEnd || !userHasScrolled;
4460
+ if (!idle && shouldAutoScroll && response) {
4184
4461
  scrollToBottom();
4185
4462
  }
4186
- }, [response, scrollToBottom, idle, userHasScrolled]);
4463
+ }, [response, scrollToBottom, idle, userHasScrolled, scrollToEnd]);
4187
4464
  const idleRef = useRef5(idle);
4188
4465
  idleRef.current = idle;
4189
4466
  const userHasScrolledRef = useRef5(userHasScrolled);
@@ -4242,6 +4519,12 @@ ${followOnPrompt}`;
4242
4519
  continueChat(initialPrompt);
4243
4520
  }
4244
4521
  }, [initialPrompt, continueChat]);
4522
+ useEffect7(() => {
4523
+ if (followOnPrompt && followOnPrompt !== "" && followOnPrompt !== lastFollowOnPromptRef.current) {
4524
+ lastFollowOnPromptRef.current = followOnPrompt;
4525
+ continueChat(followOnPrompt);
4526
+ }
4527
+ }, [followOnPrompt, continueChat]);
4245
4528
  useEffect7(() => {
4246
4529
  if (llmError && llmError.trim()) {
4247
4530
  console.log("[AIChatPanel] Error detected:", llmError);
@@ -4273,20 +4556,66 @@ ${followOnPrompt}`;
4273
4556
  }
4274
4557
  }
4275
4558
  }, [llmError, lastKey, lastCallId]);
4276
- const CodeBlock = useCallback2((_a) => {
4277
- var _b = _a, { node, inline, className, children } = _b, props = __objRest(_b, ["node", "inline", "className", "children"]);
4559
+ useEffect7(() => {
4560
+ const existingLinks = document.querySelectorAll(
4561
+ 'link[data-source="ai-chat-panel"]'
4562
+ );
4563
+ existingLinks.forEach((link) => {
4564
+ var _a2;
4565
+ return (_a2 = link.parentNode) == null ? void 0 : _a2.removeChild(link);
4566
+ });
4567
+ const existingStyles = document.querySelectorAll(
4568
+ 'style[data-source="ai-chat-panel"]'
4569
+ );
4570
+ existingStyles.forEach((style) => {
4571
+ var _a2;
4572
+ return (_a2 = style.parentNode) == null ? void 0 : _a2.removeChild(style);
4573
+ });
4574
+ if (cssUrl) {
4575
+ if (cssUrl.startsWith("http://") || cssUrl.startsWith("https://")) {
4576
+ const link = document.createElement("link");
4577
+ link.href = cssUrl;
4578
+ link.rel = "stylesheet";
4579
+ link.setAttribute("data-source", "ai-chat-panel");
4580
+ document.head.appendChild(link);
4581
+ } else {
4582
+ const style = document.createElement("style");
4583
+ style.textContent = cssUrl;
4584
+ style.setAttribute("data-source", "ai-chat-panel");
4585
+ document.head.appendChild(style);
4586
+ }
4587
+ }
4588
+ return () => {
4589
+ const links = document.querySelectorAll(
4590
+ 'link[data-source="ai-chat-panel"]'
4591
+ );
4592
+ links.forEach((link) => {
4593
+ var _a2;
4594
+ return (_a2 = link.parentNode) == null ? void 0 : _a2.removeChild(link);
4595
+ });
4596
+ const styles = document.querySelectorAll(
4597
+ 'style[data-source="ai-chat-panel"]'
4598
+ );
4599
+ styles.forEach((style) => {
4600
+ var _a2;
4601
+ return (_a2 = style.parentNode) == null ? void 0 : _a2.removeChild(style);
4602
+ });
4603
+ };
4604
+ }, [cssUrl]);
4605
+ const CodeBlock = useCallback2((_b) => {
4606
+ var _c = _b, { node, inline, className, children } = _c, props = __objRest(_c, ["node", "inline", "className", "children"]);
4278
4607
  const match = /language-(\w+)/.exec(className || "");
4279
- return !inline && match ? /* @__PURE__ */ React11.createElement(
4608
+ return !inline && match ? /* @__PURE__ */ React12.createElement(
4280
4609
  SyntaxHighlighter2,
4281
4610
  __spreadValues({
4282
- style: prismStyle,
4611
+ style: effectivePrismStyle,
4283
4612
  language: match[1],
4284
4613
  PreTag: "div"
4285
4614
  }, props),
4286
4615
  String(children).replace(/\n$/, "")
4287
- ) : /* @__PURE__ */ React11.createElement("code", __spreadValues({ className }, props), children);
4288
- }, [prismStyle]);
4289
- const AgentSuggestionCard = React11.memo(({ agentId, agentName, reason }) => {
4616
+ ) : /* @__PURE__ */ React12.createElement("code", __spreadValues({ className }, props), children);
4617
+ }, [effectivePrismStyle]);
4618
+ const AgentSuggestionCard = React12.memo(({ agentId, agentName, reason }) => {
4290
4619
  useEffect7(() => {
4291
4620
  const timer = setTimeout(() => {
4292
4621
  scrollToBottom();
@@ -4301,33 +4630,33 @@ ${followOnPrompt}`;
4301
4630
  const avatarUrl = agentOption == null ? void 0 : agentOption.avatarUrl;
4302
4631
  const isCurrentAgent = currentAgentId === agentId;
4303
4632
  if (!isValidAgent || agentId.includes("{") || agentId.includes("$")) {
4304
- return /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion ai-chat-agent-suggestion--invalid" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__content" }, avatarUrl ? /* @__PURE__ */ React11.createElement(
4633
+ return /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion ai-chat-agent-suggestion--invalid" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__content" }, avatarUrl ? /* @__PURE__ */ React12.createElement(
4305
4634
  "img",
4306
4635
  {
4307
4636
  src: avatarUrl,
4308
4637
  alt: agentName,
4309
4638
  className: "ai-chat-agent-suggestion__avatar"
4310
4639
  }
4311
- ) : /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__icon" }, /* @__PURE__ */ React11.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React11.createElement("path", { d: "M12 8V4H8" }), /* @__PURE__ */ React11.createElement("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }), /* @__PURE__ */ React11.createElement("path", { d: "M2 14h2" }), /* @__PURE__ */ React11.createElement("path", { d: "M20 14h2" }), /* @__PURE__ */ React11.createElement("path", { d: "M15 13v2" }), /* @__PURE__ */ React11.createElement("path", { d: "M9 13v2" }))), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__text" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__label" }, "Suggested: ", agentName), reason && /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__reason" }, reason))), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__unavailable" }, "Agent unavailable"));
4640
+ ) : /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__icon" }, /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React12.createElement("path", { d: "M12 8V4H8" }), /* @__PURE__ */ React12.createElement("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }), /* @__PURE__ */ React12.createElement("path", { d: "M2 14h2" }), /* @__PURE__ */ React12.createElement("path", { d: "M20 14h2" }), /* @__PURE__ */ React12.createElement("path", { d: "M15 13v2" }), /* @__PURE__ */ React12.createElement("path", { d: "M9 13v2" }))), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__text" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__label" }, "Suggested: ", agentName), reason && /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__reason" }, reason))), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__unavailable" }, "Agent unavailable"));
4312
4641
  }
4313
4642
  if (isCurrentAgent) {
4314
- return /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion ai-chat-agent-suggestion--switched" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__content" }, avatarUrl ? /* @__PURE__ */ React11.createElement(
4643
+ return /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion ai-chat-agent-suggestion--switched" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__content" }, avatarUrl ? /* @__PURE__ */ React12.createElement(
4315
4644
  "img",
4316
4645
  {
4317
4646
  src: avatarUrl,
4318
4647
  alt: agentName,
4319
4648
  className: "ai-chat-agent-suggestion__avatar"
4320
4649
  }
4321
- ) : /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__icon ai-chat-agent-suggestion__icon--switched" }, /* @__PURE__ */ React11.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React11.createElement("polyline", { points: "20 6 9 17 4 12" }))), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__text" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__label" }, "Switched to ", agentName), reason && /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__reason" }, reason))), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__switched-badge" }, /* @__PURE__ */ React11.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React11.createElement("polyline", { points: "20 6 9 17 4 12" })), "Active"));
4650
+ ) : /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__icon ai-chat-agent-suggestion__icon--switched" }, /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React12.createElement("polyline", { points: "20 6 9 17 4 12" }))), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__text" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__label" }, "Switched to ", agentName), reason && /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__reason" }, reason))), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__switched-badge" }, /* @__PURE__ */ React12.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React12.createElement("polyline", { points: "20 6 9 17 4 12" })), "Active"));
4322
4651
  }
4323
- return /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__content" }, avatarUrl ? /* @__PURE__ */ React11.createElement(
4652
+ return /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__content" }, avatarUrl ? /* @__PURE__ */ React12.createElement(
4324
4653
  "img",
4325
4654
  {
4326
4655
  src: avatarUrl,
4327
4656
  alt: agentName,
4328
4657
  className: "ai-chat-agent-suggestion__avatar"
4329
4658
  }
4330
- ) : /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__icon" }, /* @__PURE__ */ React11.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React11.createElement("path", { d: "M12 8V4H8" }), /* @__PURE__ */ React11.createElement("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }), /* @__PURE__ */ React11.createElement("path", { d: "M2 14h2" }), /* @__PURE__ */ React11.createElement("path", { d: "M20 14h2" }), /* @__PURE__ */ React11.createElement("path", { d: "M15 13v2" }), /* @__PURE__ */ React11.createElement("path", { d: "M9 13v2" }))), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__text" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__label" }, "Suggested: ", agentName), reason && /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-agent-suggestion__reason" }, reason))), /* @__PURE__ */ React11.createElement(
4659
+ ) : /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__icon" }, /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React12.createElement("path", { d: "M12 8V4H8" }), /* @__PURE__ */ React12.createElement("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }), /* @__PURE__ */ React12.createElement("path", { d: "M2 14h2" }), /* @__PURE__ */ React12.createElement("path", { d: "M20 14h2" }), /* @__PURE__ */ React12.createElement("path", { d: "M15 13v2" }), /* @__PURE__ */ React12.createElement("path", { d: "M9 13v2" }))), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__text" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__label" }, "Suggested: ", agentName), reason && /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-agent-suggestion__reason" }, reason))), /* @__PURE__ */ React12.createElement(
4331
4660
  Button,
4332
4661
  {
4333
4662
  variant: "default",
@@ -4345,13 +4674,13 @@ ${followOnPrompt}`;
4345
4674
  });
4346
4675
  const markdownComponents = useMemo2(() => ({
4347
4676
  code: CodeBlock,
4348
- "agent-suggestion": (_a) => {
4349
- var _b = _a, { node } = _b, props = __objRest(_b, ["node"]);
4677
+ "agent-suggestion": (_a2) => {
4678
+ var _b = _a2, { node } = _b, props = __objRest(_b, ["node"]);
4350
4679
  const agentId = props["data-agent-id"];
4351
4680
  const agentName = props["data-agent-name"];
4352
4681
  const reason = props["data-reason"];
4353
4682
  if (!agentId) return null;
4354
- return /* @__PURE__ */ React11.createElement(
4683
+ return /* @__PURE__ */ React12.createElement(
4355
4684
  AgentSuggestionCard,
4356
4685
  {
4357
4686
  agentId,
@@ -4366,126 +4695,339 @@ ${followOnPrompt}`;
4366
4695
  const currentBlock = thinkingBlocks[currentThinkingIndex];
4367
4696
  if (!currentBlock) return null;
4368
4697
  const isReasoning = currentBlock.type === "reasoning";
4369
- const icon = isReasoning ? /* @__PURE__ */ React11.createElement(BrainIcon, null) : /* @__PURE__ */ React11.createElement(SearchIcon, null);
4698
+ const icon = isReasoning ? /* @__PURE__ */ React12.createElement(BrainIcon, null) : /* @__PURE__ */ React12.createElement(SearchIcon, null);
4370
4699
  const title2 = isReasoning ? "Reasoning" : "Searching";
4371
- return /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-thinking" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-thinking__header" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-thinking__icon" }, icon), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-thinking__title" }, title2), thinkingBlocks.length > 1 && /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-thinking__nav" }, /* @__PURE__ */ React11.createElement(
4700
+ return /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-thinking" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-thinking__header" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-thinking__icon" }, icon), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-thinking__title" }, title2), thinkingBlocks.length > 1 && /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-thinking__nav" }, /* @__PURE__ */ React12.createElement(
4372
4701
  "button",
4373
4702
  {
4374
4703
  onClick: () => setCurrentThinkingIndex(Math.max(0, currentThinkingIndex - 1)),
4375
4704
  disabled: currentThinkingIndex === 0
4376
4705
  },
4377
4706
  "\u2039"
4378
- ), /* @__PURE__ */ React11.createElement("span", null, currentThinkingIndex + 1, " / ", thinkingBlocks.length), /* @__PURE__ */ React11.createElement(
4707
+ ), /* @__PURE__ */ React12.createElement("span", null, currentThinkingIndex + 1, " / ", thinkingBlocks.length), /* @__PURE__ */ React12.createElement(
4379
4708
  "button",
4380
4709
  {
4381
4710
  onClick: () => setCurrentThinkingIndex(Math.min(thinkingBlocks.length - 1, currentThinkingIndex + 1)),
4382
4711
  disabled: currentThinkingIndex === thinkingBlocks.length - 1
4383
4712
  },
4384
4713
  "\u203A"
4385
- ))), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-thinking__content" }, cleanContentForDisplay(currentBlock.content)));
4714
+ ))), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-thinking__content" }, cleanContentForDisplay(currentBlock.content)));
4386
4715
  }, [thinkingBlocks, currentThinkingIndex, cleanContentForDisplay]);
4387
4716
  const panelClasses = ["ai-chat-panel", theme === "dark" ? "dark-theme" : ""].filter(Boolean).join(" ");
4388
- return /* @__PURE__ */ React11.createElement("div", { className: panelClasses }, title && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-panel__title" }, title), error && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-error-banner" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-error-banner__icon" }, /* @__PURE__ */ React11.createElement(AlertCircleIcon, null)), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-error-banner__content" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-error-banner__message" }, error.message), error.code === "413" && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-error-banner__hint" }, "Try starting a new conversation or reducing the amount of information being sent.")), /* @__PURE__ */ React11.createElement(
4389
- "button",
4717
+ return /* @__PURE__ */ React12.createElement(
4718
+ "div",
4390
4719
  {
4391
- className: "ai-chat-error-banner__close",
4392
- onClick: () => setError(null),
4393
- "aria-label": "Dismiss error"
4720
+ className: panelClasses,
4721
+ style: __spreadValues(__spreadValues({}, width && { width }), height && { height })
4394
4722
  },
4395
- /* @__PURE__ */ React11.createElement(CloseIcon, null)
4396
- )), /* @__PURE__ */ React11.createElement(ScrollArea, { className: "ai-chat-panel__messages", ref: responseAreaRef }, initialMessage && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-message ai-chat-message--assistant" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-message__content" }, /* @__PURE__ */ React11.createElement(ReactMarkdown2, { remarkPlugins: [remarkGfm2], rehypePlugins: [rehypeRaw2] }, initialMessage))), Object.entries(history).map(([prompt, entry], index, entries) => {
4397
- const isLastEntry = index === entries.length - 1;
4398
- const isSystemMessage = prompt.startsWith("__system__:");
4399
- const { cleanedText } = processThinkingTags(entry.content);
4400
- const processedContent = processActions(cleanedText);
4401
- return /* @__PURE__ */ React11.createElement("div", { key: index, className: "ai-chat-entry" }, !(hideInitialPrompt && index === 0) && !isSystemMessage && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-message ai-chat-message--user" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-message__content" }, formatPromptForDisplay(prompt))), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-message ai-chat-message--assistant" }, /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-message__content" }, isLastEntry && (isLoading || !idle) && !justReset ? /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-streaming" }, thinkingBlocks.length > 0 && renderThinkingBlocks(), processedContent ? /* @__PURE__ */ React11.createElement(
4723
+ title && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-panel__title" }, title),
4724
+ error && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-error-banner" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-error-banner__icon" }, /* @__PURE__ */ React12.createElement(AlertCircleIcon, null)), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-error-banner__content" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-error-banner__message" }, error.message), error.code === "413" && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-error-banner__hint" }, "Try starting a new conversation or reducing the amount of information being sent.")), /* @__PURE__ */ React12.createElement(
4725
+ "button",
4726
+ {
4727
+ className: "ai-chat-error-banner__close",
4728
+ onClick: () => setError(null),
4729
+ "aria-label": "Dismiss error"
4730
+ },
4731
+ /* @__PURE__ */ React12.createElement(CloseIcon, null)
4732
+ )),
4733
+ /* @__PURE__ */ React12.createElement(ScrollArea, { className: "ai-chat-panel__messages", ref: responseAreaRef }, initialMessage && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-message ai-chat-message--assistant" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-message__content" }, markdownClass ? /* @__PURE__ */ React12.createElement("div", { className: markdownClass }, /* @__PURE__ */ React12.createElement(
4402
4734
  ReactMarkdown2,
4403
4735
  {
4404
4736
  remarkPlugins: [remarkGfm2],
4405
- rehypePlugins: [rehypeRaw2],
4406
- components: markdownComponents
4737
+ rehypePlugins: [rehypeRaw2]
4407
4738
  },
4408
- processedContent
4409
- ) : /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-loading" }, /* @__PURE__ */ React11.createElement("span", null, "Thinking"), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-loading__dots" }, /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-loading__dot" }), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-loading__dot" }), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-loading__dot" })))) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, isLastEntry && thinkingBlocks.length > 0 && renderThinkingBlocks(), /* @__PURE__ */ React11.createElement(
4739
+ initialMessage
4740
+ )) : /* @__PURE__ */ React12.createElement(
4410
4741
  ReactMarkdown2,
4411
4742
  {
4412
4743
  remarkPlugins: [remarkGfm2],
4413
- rehypePlugins: [rehypeRaw2],
4414
- components: markdownComponents
4744
+ rehypePlugins: [rehypeRaw2]
4415
4745
  },
4416
- processedContent
4417
- ))), (!isLastEntry || !isLoading) && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-message__actions" }, /* @__PURE__ */ React11.createElement(
4418
- "button",
4746
+ initialMessage
4747
+ ))), Object.entries(history).map(([prompt, entry], index, entries) => {
4748
+ const isLastEntry = index === entries.length - 1;
4749
+ const isSystemMessage = prompt.startsWith("__system__:");
4750
+ const { cleanedText } = processThinkingTags(entry.content);
4751
+ const processedContent = processActions(cleanedText);
4752
+ return /* @__PURE__ */ React12.createElement("div", { key: index, className: "ai-chat-entry" }, !(hideInitialPrompt && index === 0) && !isSystemMessage && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-message ai-chat-message--user" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-message__content" }, formatPromptForDisplay(prompt))), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-message ai-chat-message--assistant" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-message__content" }, isLastEntry && (isLoading || !idle) && !justReset ? /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-streaming" }, thinkingBlocks.length > 0 && renderThinkingBlocks(), processedContent ? markdownClass ? /* @__PURE__ */ React12.createElement("div", { className: markdownClass }, /* @__PURE__ */ React12.createElement(
4753
+ ReactMarkdown2,
4754
+ {
4755
+ remarkPlugins: [remarkGfm2],
4756
+ rehypePlugins: [rehypeRaw2],
4757
+ components: markdownComponents
4758
+ },
4759
+ processedContent
4760
+ )) : /* @__PURE__ */ React12.createElement(
4761
+ ReactMarkdown2,
4762
+ {
4763
+ remarkPlugins: [remarkGfm2],
4764
+ rehypePlugins: [rehypeRaw2],
4765
+ components: markdownComponents
4766
+ },
4767
+ processedContent
4768
+ ) : /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-loading" }, /* @__PURE__ */ React12.createElement("span", null, "Thinking"), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-loading__dots" }, /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-loading__dot" }), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-loading__dot" }), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-loading__dot" })))) : /* @__PURE__ */ React12.createElement(React12.Fragment, null, isLastEntry && thinkingBlocks.length > 0 && renderThinkingBlocks(), markdownClass ? /* @__PURE__ */ React12.createElement("div", { className: markdownClass }, /* @__PURE__ */ React12.createElement(
4769
+ ReactMarkdown2,
4770
+ {
4771
+ remarkPlugins: [remarkGfm2],
4772
+ rehypePlugins: [rehypeRaw2],
4773
+ components: markdownComponents
4774
+ },
4775
+ processedContent
4776
+ )) : /* @__PURE__ */ React12.createElement(
4777
+ ReactMarkdown2,
4778
+ {
4779
+ remarkPlugins: [remarkGfm2],
4780
+ rehypePlugins: [rehypeRaw2],
4781
+ components: markdownComponents
4782
+ },
4783
+ processedContent
4784
+ ))), (!isLastEntry || !isLoading) && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-message__actions" }, /* @__PURE__ */ React12.createElement(
4785
+ "button",
4786
+ {
4787
+ className: "ai-chat-action-button",
4788
+ onClick: () => copyToClipboard(entry.content, entry.callId),
4789
+ title: copiedCallId === entry.callId ? "Copied!" : "Copy"
4790
+ },
4791
+ copiedCallId === entry.callId ? /* @__PURE__ */ React12.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Copied!") : /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ React12.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
4792
+ ), /* @__PURE__ */ React12.createElement(
4793
+ "button",
4794
+ {
4795
+ className: "ai-chat-action-button",
4796
+ onClick: () => handleThumbsUp(entry.callId),
4797
+ title: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? "Thanks!" : "Good response",
4798
+ style: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? { color: "#22c55e" } : void 0
4799
+ },
4800
+ (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? /* @__PURE__ */ React12.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Thanks!") : /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("path", { d: "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3" }))
4801
+ ), /* @__PURE__ */ React12.createElement(
4802
+ "button",
4803
+ {
4804
+ className: "ai-chat-action-button",
4805
+ onClick: () => handleThumbsDown(entry.callId),
4806
+ title: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? "Thanks!" : "Poor response",
4807
+ style: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? { color: "#ef4444" } : void 0
4808
+ },
4809
+ (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? /* @__PURE__ */ React12.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Thanks!") : /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("path", { d: "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17" }))
4810
+ ), (entry.toolCalls || entry.toolResponses) && /* @__PURE__ */ React12.createElement(
4811
+ "button",
4812
+ {
4813
+ className: "ai-chat-action-button",
4814
+ onClick: () => {
4815
+ setToolInfoData({
4816
+ calls: entry.toolCalls || [],
4817
+ responses: entry.toolResponses || []
4818
+ });
4819
+ setIsToolInfoModalOpen(true);
4820
+ },
4821
+ title: "View tool information"
4822
+ },
4823
+ /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React12.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ React12.createElement("line", { x1: "12", x2: "12", y1: "16", y2: "12" }), /* @__PURE__ */ React12.createElement("line", { x1: "12", x2: "12.01", y1: "8", y2: "8" }))
4824
+ ))));
4825
+ }), followOnQuestionsState.length > 0 && idle && !isLoading && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-suggestions" }, followOnQuestionsState.map((question, index) => /* @__PURE__ */ React12.createElement(
4826
+ Button,
4419
4827
  {
4420
- className: "ai-chat-action-button",
4421
- onClick: () => copyToClipboard(entry.content, entry.callId),
4422
- title: copiedCallId === entry.callId ? "Copied!" : "Copy"
4828
+ key: index,
4829
+ variant: "outline",
4830
+ size: "sm",
4831
+ onClick: () => handleSuggestionClick(question),
4832
+ className: "ai-chat-suggestions__button"
4423
4833
  },
4424
- copiedCallId === entry.callId ? /* @__PURE__ */ React11.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Copied!") : /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ React11.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
4425
- ), /* @__PURE__ */ React11.createElement(
4426
- "button",
4834
+ question
4835
+ ))), /* @__PURE__ */ React12.createElement("div", { ref: bottomRef })),
4836
+ pendingToolRequests.length > 0 && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-approve-tools-panel" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-approve-tools-header" }, "Tool Approval Required"), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-approve-tools-description" }, "The AI wants to use the following tools:"), getUniqueToolNames().map((toolName) => /* @__PURE__ */ React12.createElement("div", { key: toolName, className: "ai-chat-approve-tool-item" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-approve-tool-name" }, toolName), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-approve-tools-buttons" }, /* @__PURE__ */ React12.createElement(
4837
+ Button,
4838
+ {
4839
+ size: "sm",
4840
+ variant: "outline",
4841
+ className: "ai-chat-approve-tools-button",
4842
+ onClick: () => handleToolApproval(toolName, "once")
4843
+ },
4844
+ "Once"
4845
+ ), /* @__PURE__ */ React12.createElement(
4846
+ Button,
4847
+ {
4848
+ size: "sm",
4849
+ variant: "outline",
4850
+ className: "ai-chat-approve-tools-button",
4851
+ onClick: () => handleToolApproval(toolName, "session")
4852
+ },
4853
+ "This Session"
4854
+ ), /* @__PURE__ */ React12.createElement(
4855
+ Button,
4856
+ {
4857
+ size: "sm",
4858
+ variant: "default",
4859
+ className: "ai-chat-approve-tools-button",
4860
+ onClick: () => handleToolApproval(toolName, "always")
4861
+ },
4862
+ "Always"
4863
+ ))))),
4864
+ (showSaveButton || showEmailButton || showCallToAction) && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-button-container" }, showSaveButton && /* @__PURE__ */ React12.createElement(
4865
+ Button,
4866
+ {
4867
+ variant: "outline",
4868
+ size: "sm",
4869
+ onClick: saveAsHTMLFile,
4870
+ disabled: Object.keys(history).length === 0,
4871
+ className: "ai-chat-save-button"
4872
+ },
4873
+ "\u{1F4BE} Save"
4874
+ ), showEmailButton && /* @__PURE__ */ React12.createElement(
4875
+ Button,
4876
+ {
4877
+ variant: "outline",
4878
+ size: "sm",
4879
+ onClick: () => {
4880
+ if (isEmailAddress(emailInput)) {
4881
+ setEmailInputSet(true);
4882
+ setEmailValid(true);
4883
+ handleSendEmail(emailInput, emailInput);
4884
+ setEmailClickedButNoEmail(false);
4885
+ } else {
4886
+ setShowEmailPanel(true);
4887
+ setEmailValid(false);
4888
+ setEmailClickedButNoEmail(true);
4889
+ }
4890
+ },
4891
+ disabled: Object.keys(history).length === 0 || isDisabledDueToNoEmail(),
4892
+ className: "ai-chat-email-button"
4893
+ },
4894
+ "\u{1F4E7} Email Conversation",
4895
+ emailSent ? " \u2713" : ""
4896
+ ), showCallToAction && /* @__PURE__ */ React12.createElement(
4897
+ Button,
4427
4898
  {
4428
- className: "ai-chat-action-button",
4429
- onClick: () => handleThumbsUp(entry.callId),
4430
- title: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? "Thanks!" : "Good response",
4431
- style: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? { color: "#22c55e" } : void 0
4899
+ variant: callToActionSent ? "outline" : "default",
4900
+ size: "sm",
4901
+ onClick: () => {
4902
+ if (customerEmailCaptureMode !== "HIDE" && !emailInputSet) {
4903
+ setCTAClickedButNoEmail(true);
4904
+ setTimeout(() => setCTAClickedButNoEmail(false), 3e3);
4905
+ return;
4906
+ }
4907
+ const fromEmail = emailInput || (customer == null ? void 0 : customer.customer_user_email) || "";
4908
+ sendCallToActionEmail(fromEmail);
4909
+ },
4910
+ disabled: callToActionSent || Object.keys(history).length === 0,
4911
+ className: "ai-chat-cta-button"
4432
4912
  },
4433
- (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? /* @__PURE__ */ React11.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Thanks!") : /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("path", { d: "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3" }))
4434
- ), /* @__PURE__ */ React11.createElement(
4913
+ callToActionSent ? "\u2713 Submitted" : callToActionButtonText
4914
+ )),
4915
+ showNewConversationButton && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-panel__new-conversation" }, /* @__PURE__ */ React12.createElement(
4916
+ Button,
4917
+ {
4918
+ variant: newConversationConfirm ? "destructive" : "outline",
4919
+ size: "sm",
4920
+ onClick: handleNewConversation,
4921
+ className: "ai-chat-new-conversation"
4922
+ },
4923
+ newConversationConfirm ? "Click to Confirm" : "New Conversation"
4924
+ )),
4925
+ showEmailPanel && /* @__PURE__ */ React12.createElement(React12.Fragment, null, !emailValid && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-email-input-message" }, isDisabledDueToNoEmail() ? "Let's get started - please enter your email" : CTAClickedButNoEmail || emailClickedButNoEmail ? "Sure, we just need an email address to contact you" : "Email address is invalid"), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-email-input-container" }, /* @__PURE__ */ React12.createElement(
4926
+ "input",
4927
+ {
4928
+ type: "email",
4929
+ name: "email",
4930
+ id: "email",
4931
+ className: emailValid ? emailInputSet ? "ai-chat-email-input-set" : "ai-chat-email-input" : "ai-chat-email-input-invalid",
4932
+ placeholder: customerEmailCapturePlaceholder,
4933
+ value: emailInput,
4934
+ onChange: (e) => {
4935
+ const newEmail = e.target.value;
4936
+ setEmailInput(newEmail);
4937
+ if (!emailInputSet) {
4938
+ if (customerEmailCaptureMode === "REQUIRED" && newEmail !== "") {
4939
+ setEmailValid(isEmailAddress(newEmail));
4940
+ } else {
4941
+ setEmailValid(true);
4942
+ }
4943
+ }
4944
+ },
4945
+ onBlur: () => {
4946
+ if (emailInput && isEmailAddress(emailInput) && !emailInputSet) {
4947
+ setEmailInputSet(true);
4948
+ setEmailValid(true);
4949
+ interactionClicked("", "emailcapture", emailInput);
4950
+ if (CTAClickedButNoEmail) {
4951
+ sendCallToActionEmail(emailInput);
4952
+ setCTAClickedButNoEmail(false);
4953
+ }
4954
+ if (emailClickedButNoEmail) {
4955
+ handleSendEmail(emailInput, emailInput);
4956
+ setEmailClickedButNoEmail(false);
4957
+ }
4958
+ } else if (customerEmailCaptureMode === "REQUIRED" && emailInput !== "") {
4959
+ setEmailValid(isEmailAddress(emailInput));
4960
+ }
4961
+ },
4962
+ onKeyDown: (e) => {
4963
+ if (e.key === "Enter") {
4964
+ if (isEmailAddress(emailInput)) {
4965
+ setEmailInputSet(true);
4966
+ setEmailValid(true);
4967
+ interactionClicked("", "emailcapture", emailInput);
4968
+ if (CTAClickedButNoEmail) {
4969
+ sendCallToActionEmail(emailInput);
4970
+ setCTAClickedButNoEmail(false);
4971
+ }
4972
+ if (emailClickedButNoEmail) {
4973
+ handleSendEmail(emailInput, emailInput);
4974
+ setEmailClickedButNoEmail(false);
4975
+ }
4976
+ } else {
4977
+ setEmailValid(false);
4978
+ }
4979
+ }
4980
+ },
4981
+ disabled: false
4982
+ }
4983
+ ), emailInputSet && /* @__PURE__ */ React12.createElement(
4435
4984
  "button",
4436
4985
  {
4437
- className: "ai-chat-action-button",
4438
- onClick: () => handleThumbsDown(entry.callId),
4439
- title: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? "Thanks!" : "Poor response",
4440
- style: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? { color: "#ef4444" } : void 0
4986
+ className: "ai-chat-email-edit-button",
4987
+ onClick: () => {
4988
+ setEmailInputSet(false);
4989
+ setEmailValid(true);
4990
+ },
4991
+ title: "Edit email"
4441
4992
  },
4442
- (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? /* @__PURE__ */ React11.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Thanks!") : /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ React11.createElement("path", { d: "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17" }))
4443
- ))));
4444
- }), followOnQuestionsState.length > 0 && idle && !isLoading && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-suggestions" }, followOnQuestionsState.map((question, index) => /* @__PURE__ */ React11.createElement(
4445
- Button,
4446
- {
4447
- key: index,
4448
- variant: "outline",
4449
- size: "sm",
4450
- onClick: () => handleSuggestionClick(question),
4451
- className: "ai-chat-suggestions__button"
4452
- },
4453
- question
4454
- ))), /* @__PURE__ */ React11.createElement("div", { ref: bottomRef })), showNewConversationButton && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-panel__new-conversation" }, /* @__PURE__ */ React11.createElement(
4455
- Button,
4456
- {
4457
- variant: newConversationConfirm ? "destructive" : "outline",
4458
- size: "sm",
4459
- onClick: handleNewConversation,
4460
- className: "ai-chat-new-conversation"
4461
- },
4462
- newConversationConfirm ? "Click to Confirm" : "New Conversation"
4463
- )), /* @__PURE__ */ React11.createElement(
4464
- ChatInput,
4465
- {
4466
- placeholder,
4467
- idle,
4468
- onSubmit: continueChat,
4469
- onStop: handleStop,
4470
- agentOptions,
4471
- currentAgentId,
4472
- onAgentChange,
4473
- agentsLoading,
4474
- currentAgentLabel: currentAgentLabel || void 0,
4475
- currentAgentAvatarUrl: currentAgentAvatarUrl || void 0,
4476
- contextSections,
4477
- totalContextTokens,
4478
- maxContextTokens,
4479
- enableContextDetailView
4480
- }
4481
- ), showPoweredBy && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-panel__footer" }, mcpServers && mcpServers.length > 0 && /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-tools-status" }, /* @__PURE__ */ React11.createElement(
4482
- "span",
4483
- {
4484
- className: `ai-chat-tools-status__dot ${toolsLoading ? "loading" : toolsFetchError ? "error" : "ready"}`
4485
- }
4486
- ), /* @__PURE__ */ React11.createElement("span", { className: "ai-chat-tools-status__text" }, toolsLoading ? "tools loading..." : toolsFetchError ? "tool fetch failed" : toolList.length > 0 ? `${toolList.length} tools ready` : "no tools found")), /* @__PURE__ */ React11.createElement("div", { className: "ai-chat-powered-by" }, /* @__PURE__ */ React11.createElement("span", null, "brought to you by"), /* @__PURE__ */ React11.createElement("a", { href: "https://llmasaservice.io", target: "_blank", rel: "noopener noreferrer" }, /* @__PURE__ */ React11.createElement(LLMAsAServiceLogo, null), /* @__PURE__ */ React11.createElement("span", null, "llmasaservice.io")))));
4993
+ "\u270E"
4994
+ ))),
4995
+ /* @__PURE__ */ React12.createElement(
4996
+ ChatInput,
4997
+ {
4998
+ placeholder,
4999
+ idle,
5000
+ onSubmit: continueChat,
5001
+ onStop: handleStop,
5002
+ agentOptions,
5003
+ currentAgentId,
5004
+ onAgentChange,
5005
+ agentsLoading,
5006
+ currentAgentLabel: currentAgentLabel || void 0,
5007
+ currentAgentAvatarUrl: currentAgentAvatarUrl || void 0,
5008
+ contextSections,
5009
+ totalContextTokens,
5010
+ maxContextTokens,
5011
+ enableContextDetailView
5012
+ }
5013
+ ),
5014
+ showPoweredBy && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-panel__footer" }, mcpServers && mcpServers.length > 0 && /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-tools-status" }, /* @__PURE__ */ React12.createElement(
5015
+ "span",
5016
+ {
5017
+ className: `ai-chat-tools-status__dot ${toolsLoading ? "loading" : toolsFetchError ? "error" : "ready"}`
5018
+ }
5019
+ ), /* @__PURE__ */ React12.createElement("span", { className: "ai-chat-tools-status__text" }, toolsLoading ? "tools loading..." : toolsFetchError ? "tool fetch failed" : toolList.length > 0 ? `${toolList.length} tools ready` : "no tools found")), /* @__PURE__ */ React12.createElement("div", { className: "ai-chat-powered-by" }, /* @__PURE__ */ React12.createElement("span", null, "brought to you by"), /* @__PURE__ */ React12.createElement("a", { href: "https://llmasaservice.io", target: "_blank", rel: "noopener noreferrer" }, /* @__PURE__ */ React12.createElement(LLMAsAServiceLogo, null), /* @__PURE__ */ React12.createElement("span", null, "llmasaservice.io")))),
5020
+ /* @__PURE__ */ React12.createElement(
5021
+ ToolInfoModal_default2,
5022
+ {
5023
+ isOpen: isToolInfoModalOpen,
5024
+ onClose: () => setIsToolInfoModalOpen(false),
5025
+ data: toolInfoData
5026
+ }
5027
+ )
5028
+ );
4487
5029
  };
4488
- var AIChatPanel_default = React11.memo(AIChatPanel);
5030
+ var AIChatPanel_default = React12.memo(AIChatPanel);
4489
5031
 
4490
5032
  // src/hooks/useAgentRegistry.ts
4491
5033
  import { useState as useState7, useEffect as useEffect8, useCallback as useCallback3, useMemo as useMemo3 } from "react";
@@ -4687,15 +5229,15 @@ function extractAgentNameFromMessage(message) {
4687
5229
  }
4688
5230
 
4689
5231
  // src/AIAgentPanel.tsx
4690
- var SearchIcon2 = () => /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("path", { d: "M7.333 12.667A5.333 5.333 0 1 0 7.333 2a5.333 5.333 0 0 0 0 10.667ZM14 14l-2.9-2.9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
4691
- var PlusIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("path", { d: "M8 3.333v9.334M3.333 8h9.334", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
4692
- var ChevronLeftIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("path", { d: "M10 12L6 8l4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
4693
- var ChevronRightIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("path", { d: "M6 12l4-4-4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
4694
- var MessageIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("path", { d: "M14 10a1.333 1.333 0 0 1-1.333 1.333H4L2 14V3.333A1.333 1.333 0 0 1 3.333 2h9.334A1.333 1.333 0 0 1 14 3.333V10Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
4695
- var CloseIcon2 = () => /* @__PURE__ */ React12.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("path", { d: "M9 3L3 9M3 3l6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
4696
- var LoadingDotIcon = () => /* @__PURE__ */ React12.createElement("span", { className: "ai-agent-panel__loading-dot" });
4697
- var SidebarIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("rect", { x: "2", y: "2", width: "12", height: "12", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }), /* @__PURE__ */ React12.createElement("path", { d: "M6 2v12", stroke: "currentColor", strokeWidth: "1.5" }));
4698
- var SparkleIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("path", { d: "M8 1v3M8 12v3M3 8H0M16 8h-3M12.95 3.05l-2.12 2.12M5.17 10.83l-2.12 2.12M12.95 12.95l-2.12-2.12M5.17 5.17L3.05 3.05", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }), /* @__PURE__ */ React12.createElement("circle", { cx: "8", cy: "8", r: "2", fill: "currentColor" }));
5232
+ var SearchIcon2 = () => /* @__PURE__ */ React13.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13.createElement("path", { d: "M7.333 12.667A5.333 5.333 0 1 0 7.333 2a5.333 5.333 0 0 0 0 10.667ZM14 14l-2.9-2.9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
5233
+ var PlusIcon = () => /* @__PURE__ */ React13.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13.createElement("path", { d: "M8 3.333v9.334M3.333 8h9.334", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
5234
+ var ChevronLeftIcon = () => /* @__PURE__ */ React13.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13.createElement("path", { d: "M10 12L6 8l4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
5235
+ var ChevronRightIcon = () => /* @__PURE__ */ React13.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13.createElement("path", { d: "M6 12l4-4-4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
5236
+ var MessageIcon = () => /* @__PURE__ */ React13.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13.createElement("path", { d: "M14 10a1.333 1.333 0 0 1-1.333 1.333H4L2 14V3.333A1.333 1.333 0 0 1 3.333 2h9.334A1.333 1.333 0 0 1 14 3.333V10Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
5237
+ var CloseIcon2 = () => /* @__PURE__ */ React13.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13.createElement("path", { d: "M9 3L3 9M3 3l6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
5238
+ var LoadingDotIcon = () => /* @__PURE__ */ React13.createElement("span", { className: "ai-agent-panel__loading-dot" });
5239
+ var SidebarIcon = () => /* @__PURE__ */ React13.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13.createElement("rect", { x: "2", y: "2", width: "12", height: "12", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }), /* @__PURE__ */ React13.createElement("path", { d: "M6 2v12", stroke: "currentColor", strokeWidth: "1.5" }));
5240
+ var SparkleIcon = () => /* @__PURE__ */ React13.createElement("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13.createElement("path", { d: "M8 1v3M8 12v3M3 8H0M16 8h-3M12.95 3.05l-2.12 2.12M5.17 10.83l-2.12 2.12M12.95 12.95l-2.12-2.12M5.17 5.17L3.05 3.05", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }), /* @__PURE__ */ React13.createElement("circle", { cx: "8", cy: "8", r: "2", fill: "currentColor" }));
4699
5241
  var normalizeConversationListPayload = (payload) => {
4700
5242
  if (!payload) return [];
4701
5243
  const conversations = Array.isArray(payload) ? payload : payload.conversations || [];
@@ -4818,9 +5360,25 @@ var ChatPanelWrapper = ({
4818
5360
  maxContextTokens,
4819
5361
  enableContextDetailView,
4820
5362
  onConversationCreated,
4821
- conversationInitialPrompt
5363
+ conversationInitialPrompt,
5364
+ // New props from ChatPanel port
5365
+ cssUrl,
5366
+ markdownClass,
5367
+ width,
5368
+ height,
5369
+ scrollToEnd,
5370
+ prismStyle,
5371
+ showSaveButton,
5372
+ showEmailButton,
5373
+ messages,
5374
+ showCallToAction,
5375
+ callToActionButtonText,
5376
+ callToActionEmailAddress,
5377
+ callToActionEmailSubject,
5378
+ customerEmailCaptureMode,
5379
+ customerEmailCapturePlaceholder
4822
5380
  }) => {
4823
- var _a, _b;
5381
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4824
5382
  const convAgentProfile = getAgent(activeConv.agentId);
4825
5383
  const convAgentMetadata = convAgentProfile == null ? void 0 : convAgentProfile.metadata;
4826
5384
  const isVisible = currentConversationId === activeConv.conversationId;
@@ -4856,13 +5414,13 @@ var ChatPanelWrapper = ({
4856
5414
  }, [convAgentProfile == null ? void 0 : convAgentProfile.mcpServers]);
4857
5415
  const effectiveInitialPrompt = conversationInitialPrompt || initialPrompt;
4858
5416
  if (!convAgentMetadata) return null;
4859
- return /* @__PURE__ */ React12.createElement(
5417
+ return /* @__PURE__ */ React13.createElement(
4860
5418
  "div",
4861
5419
  {
4862
5420
  className: "ai-agent-panel__chat-wrapper",
4863
5421
  style: { display: isVisible ? "flex" : "none" }
4864
5422
  },
4865
- /* @__PURE__ */ React12.createElement(
5423
+ /* @__PURE__ */ React13.createElement(
4866
5424
  AIChatPanel_default,
4867
5425
  {
4868
5426
  project_id: convAgentMetadata.projectId,
@@ -4887,7 +5445,7 @@ var ChatPanelWrapper = ({
4887
5445
  customer: effectiveCustomer,
4888
5446
  showPoweredBy,
4889
5447
  showNewConversationButton: false,
4890
- createConversationOnFirstChat: (_b = convAgentMetadata.createConversationOnFirstChat) != null ? _b : true,
5448
+ createConversationOnFirstChat: (_b = convAgentProfile == null ? void 0 : convAgentProfile.createConversationOnFirstChat) != null ? _b : true,
4891
5449
  mcpServers,
4892
5450
  actions,
4893
5451
  followOnQuestions: effectiveFollowOnQuestions,
@@ -4902,13 +5460,28 @@ var ChatPanelWrapper = ({
4902
5460
  totalContextTokens,
4903
5461
  maxContextTokens,
4904
5462
  enableContextDetailView,
4905
- onConversationCreated: conversationCreatedCallback
5463
+ onConversationCreated: conversationCreatedCallback,
5464
+ cssUrl,
5465
+ markdownClass,
5466
+ width,
5467
+ height,
5468
+ scrollToEnd: scrollToEnd != null ? scrollToEnd : convAgentMetadata.displayAutoScroll,
5469
+ prismStyle,
5470
+ showSaveButton: (_c = showSaveButton != null ? showSaveButton : convAgentMetadata.displayShowSaveButton) != null ? _c : true,
5471
+ showEmailButton: (_d = showEmailButton != null ? showEmailButton : convAgentMetadata.displayShowEmailButton) != null ? _d : true,
5472
+ messages,
5473
+ showCallToAction: (_e = showCallToAction != null ? showCallToAction : convAgentMetadata.displayShowCallToAction) != null ? _e : false,
5474
+ callToActionButtonText: (_f = callToActionButtonText != null ? callToActionButtonText : convAgentMetadata.displayCallToActionButtonText) != null ? _f : "Submit",
5475
+ callToActionEmailAddress: (_g = callToActionEmailAddress != null ? callToActionEmailAddress : convAgentMetadata.displayCallToActionEmailAddress) != null ? _g : "",
5476
+ callToActionEmailSubject: (_h = callToActionEmailSubject != null ? callToActionEmailSubject : convAgentMetadata.displayCallToActionEmailSubject) != null ? _h : "Agent CTA submitted",
5477
+ customerEmailCaptureMode: (_i = customerEmailCaptureMode != null ? customerEmailCaptureMode : convAgentMetadata == null ? void 0 : convAgentMetadata.customerEmailCaptureMode) != null ? _i : "HIDE",
5478
+ customerEmailCapturePlaceholder: (_j = customerEmailCapturePlaceholder != null ? customerEmailCapturePlaceholder : convAgentMetadata == null ? void 0 : convAgentMetadata.customerEmailCapturePlaceholder) != null ? _j : "Please enter your email..."
4906
5479
  }
4907
5480
  )
4908
5481
  );
4909
5482
  };
4910
5483
  ChatPanelWrapper.displayName = "ChatPanelWrapper";
4911
- var AIAgentPanel = React12.forwardRef(({
5484
+ var AIAgentPanel = React13.forwardRef(({
4912
5485
  agents,
4913
5486
  defaultAgent,
4914
5487
  customerId,
@@ -4947,7 +5520,23 @@ var AIAgentPanel = React12.forwardRef(({
4947
5520
  followOnQuestions = [],
4948
5521
  followOnPrompt = "",
4949
5522
  historyListLimit = 50,
4950
- showConversationHistory = true
5523
+ showConversationHistory = true,
5524
+ // New props from ChatPanel port
5525
+ cssUrl,
5526
+ markdownClass,
5527
+ width,
5528
+ height,
5529
+ scrollToEnd,
5530
+ prismStyle,
5531
+ showSaveButton,
5532
+ showEmailButton,
5533
+ messages,
5534
+ showCallToAction,
5535
+ callToActionButtonText,
5536
+ callToActionEmailAddress,
5537
+ callToActionEmailSubject,
5538
+ customerEmailCaptureMode,
5539
+ customerEmailCapturePlaceholder
4951
5540
  }, ref) => {
4952
5541
  var _a, _b, _c, _d;
4953
5542
  const [isCollapsed, setIsCollapsed] = useState8(collapsible && defaultCollapsed);
@@ -4962,9 +5551,9 @@ var AIAgentPanel = React12.forwardRef(({
4962
5551
  if (typeof window !== "undefined") {
4963
5552
  const savedWidth = localStorage.getItem("ai-agent-panel-width");
4964
5553
  if (savedWidth) {
4965
- const width = parseInt(savedWidth, 10);
4966
- if (width >= minWidth && width <= maxWidth) {
4967
- return width;
5554
+ const width2 = parseInt(savedWidth, 10);
5555
+ if (width2 >= minWidth && width2 <= maxWidth) {
5556
+ return width2;
4968
5557
  }
4969
5558
  }
4970
5559
  }
@@ -5030,7 +5619,7 @@ var AIAgentPanel = React12.forwardRef(({
5030
5619
  activeConversationsRef.current = activeConversations;
5031
5620
  const currentConversationIdRef = useRef6(currentConversationId);
5032
5621
  currentConversationIdRef.current = currentConversationId;
5033
- React12.useImperativeHandle(ref, () => ({
5622
+ React13.useImperativeHandle(ref, () => ({
5034
5623
  startNewConversation: (prompt, agent) => {
5035
5624
  const targetAgent = agent || currentAgentId;
5036
5625
  const tempId = `new-${Date.now()}`;
@@ -5734,7 +6323,7 @@ var AIAgentPanel = React12.forwardRef(({
5734
6323
  !showConversationHistory ? "ai-agent-panel--no-history" : ""
5735
6324
  ].filter(Boolean).join(" ");
5736
6325
  if (collapsible && isCollapsed) {
5737
- return /* @__PURE__ */ React12.createElement("div", { className: panelClasses, ref: panelRef }, /* @__PURE__ */ React12.createElement(
6326
+ return /* @__PURE__ */ React13.createElement("div", { className: panelClasses, ref: panelRef }, /* @__PURE__ */ React13.createElement(
5738
6327
  "div",
5739
6328
  {
5740
6329
  className: "ai-agent-panel__collapsed-bar",
@@ -5745,9 +6334,9 @@ var AIAgentPanel = React12.forwardRef(({
5745
6334
  },
5746
6335
  title: "Click to expand"
5747
6336
  },
5748
- /* @__PURE__ */ React12.createElement(Tooltip, { content: "Expand Panel", side: "left" }, /* @__PURE__ */ React12.createElement(Button, { variant: "ghost", size: "icon", onClick: toggleCollapse }, position === "right" ? /* @__PURE__ */ React12.createElement(ChevronLeftIcon, null) : /* @__PURE__ */ React12.createElement(ChevronRightIcon, null))),
5749
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__collapsed-divider" }),
5750
- showConversationHistory && /* @__PURE__ */ React12.createElement(Tooltip, { content: "Search", side: "left" }, /* @__PURE__ */ React12.createElement(
6337
+ /* @__PURE__ */ React13.createElement(Tooltip, { content: "Expand Panel", side: "left" }, /* @__PURE__ */ React13.createElement(Button, { variant: "ghost", size: "icon", onClick: toggleCollapse }, position === "right" ? /* @__PURE__ */ React13.createElement(ChevronLeftIcon, null) : /* @__PURE__ */ React13.createElement(ChevronRightIcon, null))),
6338
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__collapsed-divider" }),
6339
+ showConversationHistory && /* @__PURE__ */ React13.createElement(Tooltip, { content: "Search", side: "left" }, /* @__PURE__ */ React13.createElement(
5751
6340
  Button,
5752
6341
  {
5753
6342
  variant: "ghost",
@@ -5757,9 +6346,9 @@ var AIAgentPanel = React12.forwardRef(({
5757
6346
  setShowSearch(true);
5758
6347
  }
5759
6348
  },
5760
- /* @__PURE__ */ React12.createElement(SearchIcon2, null)
6349
+ /* @__PURE__ */ React13.createElement(SearchIcon2, null)
5761
6350
  )),
5762
- /* @__PURE__ */ React12.createElement(Tooltip, { content: "New Chat", side: "left" }, /* @__PURE__ */ React12.createElement(
6351
+ /* @__PURE__ */ React13.createElement(Tooltip, { content: "New Chat", side: "left" }, /* @__PURE__ */ React13.createElement(
5763
6352
  Button,
5764
6353
  {
5765
6354
  variant: "ghost",
@@ -5769,15 +6358,15 @@ var AIAgentPanel = React12.forwardRef(({
5769
6358
  handleNewConversation();
5770
6359
  }
5771
6360
  },
5772
- /* @__PURE__ */ React12.createElement(PlusIcon, null)
6361
+ /* @__PURE__ */ React13.createElement(PlusIcon, null)
5773
6362
  )),
5774
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__collapsed-divider" }),
6363
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__collapsed-divider" }),
5775
6364
  agentList.map((agent) => {
5776
6365
  const activeConvForAgent = activeConversationsList.find(
5777
6366
  (conv) => conv.agentId === agent.id
5778
6367
  );
5779
6368
  const hasActiveConversation = !!activeConvForAgent;
5780
- return /* @__PURE__ */ React12.createElement(Tooltip, { key: agent.id, content: agent.name, side: "left" }, /* @__PURE__ */ React12.createElement(
6369
+ return /* @__PURE__ */ React13.createElement(Tooltip, { key: agent.id, content: agent.name, side: "left" }, /* @__PURE__ */ React13.createElement(
5781
6370
  Button,
5782
6371
  {
5783
6372
  variant: agent.id === currentAgentId ? "secondary" : "ghost",
@@ -5811,7 +6400,7 @@ var AIAgentPanel = React12.forwardRef(({
5811
6400
  },
5812
6401
  className: `ai-agent-panel__agent-icon ${hasActiveConversation ? "ai-agent-panel__agent-icon--active" : ""}`
5813
6402
  },
5814
- agent.avatarUrl ? /* @__PURE__ */ React12.createElement(
6403
+ agent.avatarUrl ? /* @__PURE__ */ React13.createElement(
5815
6404
  "img",
5816
6405
  {
5817
6406
  src: agent.avatarUrl,
@@ -5819,20 +6408,20 @@ var AIAgentPanel = React12.forwardRef(({
5819
6408
  className: "ai-agent-panel__agent-avatar"
5820
6409
  }
5821
6410
  ) : agent.name.charAt(0).toUpperCase(),
5822
- hasActiveConversation && /* @__PURE__ */ React12.createElement("span", { className: "ai-agent-panel__agent-active-indicator" })
6411
+ hasActiveConversation && /* @__PURE__ */ React13.createElement("span", { className: "ai-agent-panel__agent-active-indicator" })
5823
6412
  ));
5824
6413
  }),
5825
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__collapsed-spacer" })
6414
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__collapsed-spacer" })
5826
6415
  ));
5827
6416
  }
5828
- return /* @__PURE__ */ React12.createElement(
6417
+ return /* @__PURE__ */ React13.createElement(
5829
6418
  "div",
5830
6419
  {
5831
6420
  className: panelClasses,
5832
6421
  ref: panelRef,
5833
6422
  style: { width: `${panelWidth}px` }
5834
6423
  },
5835
- /* @__PURE__ */ React12.createElement(
6424
+ /* @__PURE__ */ React13.createElement(
5836
6425
  "div",
5837
6426
  {
5838
6427
  ref: resizeRef,
@@ -5844,9 +6433,9 @@ var AIAgentPanel = React12.forwardRef(({
5844
6433
  tabIndex: 0
5845
6434
  }
5846
6435
  ),
5847
- showConversationHistory && /* @__PURE__ */ React12.createElement("div", { className: `ai-agent-panel__sidebar ${isHistoryCollapsed ? "ai-agent-panel__sidebar--collapsed" : ""}` }, isHistoryCollapsed ? (
6436
+ showConversationHistory && /* @__PURE__ */ React13.createElement("div", { className: `ai-agent-panel__sidebar ${isHistoryCollapsed ? "ai-agent-panel__sidebar--collapsed" : ""}` }, isHistoryCollapsed ? (
5848
6437
  // Collapsed history bar
5849
- /* @__PURE__ */ React12.createElement(
6438
+ /* @__PURE__ */ React13.createElement(
5850
6439
  "div",
5851
6440
  {
5852
6441
  className: "ai-agent-panel__history-collapsed-bar",
@@ -5857,32 +6446,32 @@ var AIAgentPanel = React12.forwardRef(({
5857
6446
  },
5858
6447
  title: "Click to expand history"
5859
6448
  },
5860
- /* @__PURE__ */ React12.createElement(Tooltip, { content: "Expand History", side: sidebarPosition === "left" ? "right" : "left" }, /* @__PURE__ */ React12.createElement(
6449
+ /* @__PURE__ */ React13.createElement(Tooltip, { content: "Expand History", side: sidebarPosition === "left" ? "right" : "left" }, /* @__PURE__ */ React13.createElement(
5861
6450
  Button,
5862
6451
  {
5863
6452
  variant: "ghost",
5864
6453
  size: "icon",
5865
6454
  onClick: toggleHistoryCollapse
5866
6455
  },
5867
- /* @__PURE__ */ React12.createElement(ChevronRightIcon, null)
6456
+ /* @__PURE__ */ React13.createElement(ChevronRightIcon, null)
5868
6457
  )),
5869
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__collapsed-divider" }),
5870
- /* @__PURE__ */ React12.createElement(Tooltip, { content: "New Chat", side: sidebarPosition === "left" ? "right" : "left" }, /* @__PURE__ */ React12.createElement(
6458
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__collapsed-divider" }),
6459
+ /* @__PURE__ */ React13.createElement(Tooltip, { content: "New Chat", side: sidebarPosition === "left" ? "right" : "left" }, /* @__PURE__ */ React13.createElement(
5871
6460
  Button,
5872
6461
  {
5873
6462
  variant: "ghost",
5874
6463
  size: "icon",
5875
6464
  onClick: handleNewConversation
5876
6465
  },
5877
- /* @__PURE__ */ React12.createElement(PlusIcon, null)
6466
+ /* @__PURE__ */ React13.createElement(PlusIcon, null)
5878
6467
  )),
5879
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__collapsed-divider" }),
6468
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__collapsed-divider" }),
5880
6469
  agentList.map((agent) => {
5881
6470
  const activeConvForAgent = activeConversationsList.find(
5882
6471
  (conv) => conv.agentId === agent.id
5883
6472
  );
5884
6473
  const hasActiveConversation = !!activeConvForAgent;
5885
- return /* @__PURE__ */ React12.createElement(Tooltip, { key: agent.id, content: agent.name, side: sidebarPosition === "left" ? "right" : "left" }, /* @__PURE__ */ React12.createElement(
6474
+ return /* @__PURE__ */ React13.createElement(Tooltip, { key: agent.id, content: agent.name, side: sidebarPosition === "left" ? "right" : "left" }, /* @__PURE__ */ React13.createElement(
5886
6475
  Button,
5887
6476
  {
5888
6477
  variant: agent.id === currentAgentId ? "secondary" : "ghost",
@@ -5915,7 +6504,7 @@ var AIAgentPanel = React12.forwardRef(({
5915
6504
  },
5916
6505
  className: `ai-agent-panel__agent-icon ${hasActiveConversation ? "ai-agent-panel__agent-icon--active" : ""}`
5917
6506
  },
5918
- agent.avatarUrl ? /* @__PURE__ */ React12.createElement(
6507
+ agent.avatarUrl ? /* @__PURE__ */ React13.createElement(
5919
6508
  "img",
5920
6509
  {
5921
6510
  src: agent.avatarUrl,
@@ -5923,40 +6512,40 @@ var AIAgentPanel = React12.forwardRef(({
5923
6512
  className: "ai-agent-panel__agent-avatar"
5924
6513
  }
5925
6514
  ) : agent.name.charAt(0).toUpperCase(),
5926
- hasActiveConversation && /* @__PURE__ */ React12.createElement("span", { className: "ai-agent-panel__agent-active-indicator" })
6515
+ hasActiveConversation && /* @__PURE__ */ React13.createElement("span", { className: "ai-agent-panel__agent-active-indicator" })
5927
6516
  ));
5928
6517
  }),
5929
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__history-collapsed-spacer" })
6518
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__history-collapsed-spacer" })
5930
6519
  )
5931
- ) : /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__header" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__header-actions" }, showSearch ? /* @__PURE__ */ React12.createElement(
6520
+ ) : /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__header" }, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__header-actions" }, showSearch ? /* @__PURE__ */ React13.createElement(
5932
6521
  Input,
5933
6522
  {
5934
6523
  placeholder: "Search conversations...",
5935
6524
  value: searchQuery,
5936
6525
  onChange: (e) => setSearchQuery(e.target.value),
5937
- icon: /* @__PURE__ */ React12.createElement(SearchIcon2, null),
6526
+ icon: /* @__PURE__ */ React13.createElement(SearchIcon2, null),
5938
6527
  autoFocus: true,
5939
6528
  onBlur: () => {
5940
6529
  if (!searchQuery) setShowSearch(false);
5941
6530
  }
5942
6531
  }
5943
- ) : /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
6532
+ ) : /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
5944
6533
  Button,
5945
6534
  {
5946
6535
  variant: "ghost",
5947
6536
  size: "icon",
5948
6537
  onClick: () => setShowSearch(true)
5949
6538
  },
5950
- /* @__PURE__ */ React12.createElement(SearchIcon2, null)
5951
- ), /* @__PURE__ */ React12.createElement(
6539
+ /* @__PURE__ */ React13.createElement(SearchIcon2, null)
6540
+ ), /* @__PURE__ */ React13.createElement(
5952
6541
  Button,
5953
6542
  {
5954
6543
  variant: "ghost",
5955
6544
  size: "icon",
5956
6545
  onClick: handleNewConversation
5957
6546
  },
5958
- /* @__PURE__ */ React12.createElement(PlusIcon, null)
5959
- ))), /* @__PURE__ */ React12.createElement(Tooltip, { content: "Collapse History", side: "bottom" }, /* @__PURE__ */ React12.createElement(Button, { variant: "ghost", size: "icon", onClick: toggleHistoryCollapse }, /* @__PURE__ */ React12.createElement(SidebarIcon, null))), collapsible && /* @__PURE__ */ React12.createElement(Button, { variant: "ghost", size: "icon", onClick: toggleCollapse }, position === "right" ? /* @__PURE__ */ React12.createElement(ChevronRightIcon, null) : /* @__PURE__ */ React12.createElement(ChevronLeftIcon, null))), /* @__PURE__ */ React12.createElement(ScrollArea, { className: "ai-agent-panel__conversations" }, activeConversationsList.length > 0 && /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__group ai-agent-panel__group--active" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__group-label" }, /* @__PURE__ */ React12.createElement("span", null, "Active (", activeConversationsList.length, ")")), activeConversationsList.map((activeConv) => /* @__PURE__ */ React12.createElement(
6547
+ /* @__PURE__ */ React13.createElement(PlusIcon, null)
6548
+ ))), /* @__PURE__ */ React13.createElement(Tooltip, { content: "Collapse History", side: "bottom" }, /* @__PURE__ */ React13.createElement(Button, { variant: "ghost", size: "icon", onClick: toggleHistoryCollapse }, /* @__PURE__ */ React13.createElement(SidebarIcon, null))), collapsible && /* @__PURE__ */ React13.createElement(Button, { variant: "ghost", size: "icon", onClick: toggleCollapse }, position === "right" ? /* @__PURE__ */ React13.createElement(ChevronRightIcon, null) : /* @__PURE__ */ React13.createElement(ChevronLeftIcon, null))), /* @__PURE__ */ React13.createElement(ScrollArea, { className: "ai-agent-panel__conversations" }, activeConversationsList.length > 0 && /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__group ai-agent-panel__group--active" }, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__group-label" }, /* @__PURE__ */ React13.createElement("span", null, "Active (", activeConversationsList.length, ")")), activeConversationsList.map((activeConv) => /* @__PURE__ */ React13.createElement(
5960
6549
  "div",
5961
6550
  {
5962
6551
  key: activeConv.stableKey,
@@ -5968,37 +6557,37 @@ var AIAgentPanel = React12.forwardRef(({
5968
6557
  }
5969
6558
  }
5970
6559
  },
5971
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__conversation-content" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__conversation-title" }, activeConv.isLoading && /* @__PURE__ */ React12.createElement(LoadingDotIcon, null), /* @__PURE__ */ React12.createElement("span", null, activeConv.title))),
5972
- /* @__PURE__ */ React12.createElement(
6560
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__conversation-content" }, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__conversation-title" }, activeConv.isLoading && /* @__PURE__ */ React13.createElement(LoadingDotIcon, null), /* @__PURE__ */ React13.createElement("span", null, activeConv.title))),
6561
+ /* @__PURE__ */ React13.createElement(
5973
6562
  "button",
5974
6563
  {
5975
6564
  className: "ai-agent-panel__conversation-close",
5976
6565
  onClick: (e) => handleCloseConversation(activeConv.conversationId, e),
5977
6566
  title: "Close conversation"
5978
6567
  },
5979
- /* @__PURE__ */ React12.createElement(CloseIcon2, null)
6568
+ /* @__PURE__ */ React13.createElement(CloseIcon2, null)
5980
6569
  )
5981
- ))), conversationsLoading ? /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__loading" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ React12.createElement("span", null, "Loading conversations...")) : conversationsError ? /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__empty" }, /* @__PURE__ */ React12.createElement("p", null, "Error: ", conversationsError), /* @__PURE__ */ React12.createElement(Button, { variant: "secondary", size: "sm", onClick: handleRefreshConversations }, "Retry")) : groupedConversations.length === 0 && activeConversationsList.length === 0 ? /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__empty" }, /* @__PURE__ */ React12.createElement(MessageIcon, null), /* @__PURE__ */ React12.createElement("p", null, "No conversations yet"), /* @__PURE__ */ React12.createElement("p", { className: "ai-agent-panel__empty-hint" }, "Start chatting to create your first conversation")) : /* @__PURE__ */ React12.createElement(React12.Fragment, null, activeConversationsList.length > 0 && groupedConversations.some((g) => g.count > 0) && /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__group-divider" }), groupedConversations.map((group) => /* @__PURE__ */ React12.createElement("div", { key: group.label, className: "ai-agent-panel__group" }, /* @__PURE__ */ React12.createElement(
6570
+ ))), conversationsLoading ? /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__loading" }, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ React13.createElement("span", null, "Loading conversations...")) : conversationsError ? /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__empty" }, /* @__PURE__ */ React13.createElement("p", null, "Error: ", conversationsError), /* @__PURE__ */ React13.createElement(Button, { variant: "secondary", size: "sm", onClick: handleRefreshConversations }, "Retry")) : groupedConversations.length === 0 && activeConversationsList.length === 0 ? /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__empty" }, /* @__PURE__ */ React13.createElement(MessageIcon, null), /* @__PURE__ */ React13.createElement("p", null, "No conversations yet"), /* @__PURE__ */ React13.createElement("p", { className: "ai-agent-panel__empty-hint" }, "Start chatting to create your first conversation")) : /* @__PURE__ */ React13.createElement(React13.Fragment, null, activeConversationsList.length > 0 && groupedConversations.some((g) => g.count > 0) && /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__group-divider" }), groupedConversations.map((group) => /* @__PURE__ */ React13.createElement("div", { key: group.label, className: "ai-agent-panel__group" }, /* @__PURE__ */ React13.createElement(
5982
6571
  "div",
5983
6572
  {
5984
6573
  className: "ai-agent-panel__group-label ai-agent-panel__group-label--clickable",
5985
6574
  onClick: () => toggleSection(group.label)
5986
6575
  },
5987
- /* @__PURE__ */ React12.createElement("span", null, group.label, " ", group.count > 0 && `(${group.count})`),
5988
- /* @__PURE__ */ React12.createElement("span", { className: "ai-agent-panel__group-chevron" }, expandedSections[group.label] ? "\u25BC" : "\u25B6")
6576
+ /* @__PURE__ */ React13.createElement("span", null, group.label, " ", group.count > 0 && `(${group.count})`),
6577
+ /* @__PURE__ */ React13.createElement("span", { className: "ai-agent-panel__group-chevron" }, expandedSections[group.label] ? "\u25BC" : "\u25B6")
5989
6578
  ), expandedSections[group.label] && group.conversations.length > 0 && group.conversations.map((conv) => {
5990
6579
  const isActive = activeConversations.has(conv.conversationId);
5991
- return /* @__PURE__ */ React12.createElement(
6580
+ return /* @__PURE__ */ React13.createElement(
5992
6581
  "div",
5993
6582
  {
5994
6583
  key: conv.conversationId,
5995
6584
  className: `ai-agent-panel__conversation ${currentConversationId === conv.conversationId ? "ai-agent-panel__conversation--current" : ""} ${isActive ? "ai-agent-panel__conversation--in-active" : ""}`,
5996
6585
  onClick: () => handleConversationSelect(conv)
5997
6586
  },
5998
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__conversation-content" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__conversation-title" }, isActive && /* @__PURE__ */ React12.createElement("span", { className: "ai-agent-panel__active-badge" }, "\u25CF"), conversationFirstPrompts[conv.conversationId] || conv.title))
6587
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__conversation-content" }, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__conversation-title" }, isActive && /* @__PURE__ */ React13.createElement("span", { className: "ai-agent-panel__active-badge" }, "\u25CF"), conversationFirstPrompts[conv.conversationId] || conv.title))
5999
6588
  );
6000
6589
  }))))))),
6001
- /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__chat" }, !showConversationHistory && collapsible && /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__chat-header" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__chat-header-spacer" }), /* @__PURE__ */ React12.createElement(Tooltip, { content: "Collapse Panel", side: position === "right" ? "left" : "right" }, /* @__PURE__ */ React12.createElement(Button, { variant: "ghost", size: "icon", onClick: toggleCollapse }, position === "right" ? /* @__PURE__ */ React12.createElement(ChevronRightIcon, null) : /* @__PURE__ */ React12.createElement(ChevronLeftIcon, null)))), showContextNotification && /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__context-notification" }, /* @__PURE__ */ React12.createElement(SparkleIcon, null), /* @__PURE__ */ React12.createElement("span", null, "Agent now has new context")), activeConversationsList.map((activeConv) => /* @__PURE__ */ React12.createElement(
6590
+ /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__chat" }, !showConversationHistory && collapsible && /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__chat-header" }, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__chat-header-spacer" }), /* @__PURE__ */ React13.createElement(Tooltip, { content: "Collapse Panel", side: position === "right" ? "left" : "right" }, /* @__PURE__ */ React13.createElement(Button, { variant: "ghost", size: "icon", onClick: toggleCollapse }, position === "right" ? /* @__PURE__ */ React13.createElement(ChevronRightIcon, null) : /* @__PURE__ */ React13.createElement(ChevronLeftIcon, null)))), showContextNotification && /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__context-notification" }, /* @__PURE__ */ React13.createElement(SparkleIcon, null), /* @__PURE__ */ React13.createElement("span", null, "Agent now has new context")), activeConversationsList.map((activeConv) => /* @__PURE__ */ React13.createElement(
6002
6591
  ChatPanelWrapper,
6003
6592
  {
6004
6593
  key: `${activeConv.stableKey}-${activeConv.agentId}`,
@@ -6030,10 +6619,25 @@ var AIAgentPanel = React12.forwardRef(({
6030
6619
  maxContextTokens,
6031
6620
  enableContextDetailView,
6032
6621
  onConversationCreated: handleConversationCreated,
6033
- conversationInitialPrompt: activeConv.conversationInitialPrompt
6622
+ conversationInitialPrompt: activeConv.conversationInitialPrompt,
6623
+ cssUrl,
6624
+ markdownClass,
6625
+ width,
6626
+ height,
6627
+ scrollToEnd,
6628
+ prismStyle,
6629
+ showSaveButton,
6630
+ showEmailButton,
6631
+ messages,
6632
+ showCallToAction,
6633
+ callToActionButtonText,
6634
+ callToActionEmailAddress,
6635
+ callToActionEmailSubject,
6636
+ customerEmailCaptureMode,
6637
+ customerEmailCapturePlaceholder
6034
6638
  }
6035
- )), loadingConversationId && /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__conversation-loading-overlay" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ React12.createElement("p", null, "Loading conversation...")), currentAgentMetadata && activeConversationsList.length === 0 && !loadingConversationId && /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__empty-chat" }, /* @__PURE__ */ React12.createElement(MessageIcon, null), /* @__PURE__ */ React12.createElement("p", null, "Select a conversation or start a new one"), /* @__PURE__ */ React12.createElement(Button, { variant: "default", size: "sm", onClick: handleNewConversation }, "New Conversation")), agentsLoading && !currentAgentMetadata && /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__loading" }, /* @__PURE__ */ React12.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ React12.createElement("p", null, "Loading agent..."))),
6036
- /* @__PURE__ */ React12.createElement(
6639
+ )), loadingConversationId && /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__conversation-loading-overlay" }, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ React13.createElement("p", null, "Loading conversation...")), currentAgentMetadata && activeConversationsList.length === 0 && !loadingConversationId && /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__empty-chat" }, /* @__PURE__ */ React13.createElement(MessageIcon, null), /* @__PURE__ */ React13.createElement("p", null, "Select a conversation or start a new one"), /* @__PURE__ */ React13.createElement(Button, { variant: "default", size: "sm", onClick: handleNewConversation }, "New Conversation")), agentsLoading && !currentAgentMetadata && /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__loading" }, /* @__PURE__ */ React13.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ React13.createElement("p", null, "Loading agent..."))),
6640
+ /* @__PURE__ */ React13.createElement(
6037
6641
  Dialog,
6038
6642
  {
6039
6643
  isOpen: showHandoffDialog,
@@ -6041,7 +6645,7 @@ var AIAgentPanel = React12.forwardRef(({
6041
6645
  title: "Switch Agent?",
6042
6646
  description: handoffSource === "page" ? `This page has a recommended agent: ${suggestedAgent ? ((_b = (_a = getAgent(suggestedAgent)) == null ? void 0 : _a.metadata) == null ? void 0 : _b.displayTitle) || suggestedAgent : "another agent"}. Would you like to switch?` : `The current agent suggests transferring this conversation to ${suggestedAgent ? ((_d = (_c = getAgent(suggestedAgent)) == null ? void 0 : _c.metadata) == null ? void 0 : _d.displayTitle) || suggestedAgent : "another agent"}.`
6043
6647
  },
6044
- /* @__PURE__ */ React12.createElement(DialogFooter, null, /* @__PURE__ */ React12.createElement(Button, { variant: "outline", onClick: handleHandoffCancel }, "Stay with current agent"), /* @__PURE__ */ React12.createElement(Button, { onClick: handleHandoffConfirm }, "Switch agent"))
6648
+ /* @__PURE__ */ React13.createElement(DialogFooter, null, /* @__PURE__ */ React13.createElement(Button, { variant: "outline", onClick: handleHandoffCancel }, "Stay with current agent"), /* @__PURE__ */ React13.createElement(Button, { onClick: handleHandoffConfirm }, "Switch agent"))
6045
6649
  )
6046
6650
  );
6047
6651
  });