@copilotkit/react-ui 1.5.11-next.0 → 1.5.12-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/{chunk-7II4YL7R.mjs → chunk-34FREWVK.mjs} +16 -6
  3. package/dist/chunk-34FREWVK.mjs.map +1 -0
  4. package/dist/chunk-3VNMQWGT.mjs +25 -0
  5. package/dist/chunk-3VNMQWGT.mjs.map +1 -0
  6. package/dist/{chunk-WSMMTZCM.mjs → chunk-B23XDGH4.mjs} +2 -2
  7. package/dist/chunk-F7VWGY77.mjs +22 -0
  8. package/dist/chunk-F7VWGY77.mjs.map +1 -0
  9. package/dist/chunk-HEIDCT7I.mjs +10 -0
  10. package/dist/chunk-HEIDCT7I.mjs.map +1 -0
  11. package/dist/{chunk-DCNCY2PL.mjs → chunk-I7MG52I5.mjs} +19 -9
  12. package/dist/chunk-I7MG52I5.mjs.map +1 -0
  13. package/dist/{chunk-375NVWZM.mjs → chunk-O6JFOQQA.mjs} +2 -2
  14. package/dist/chunk-OFYI4UU4.mjs +35 -0
  15. package/dist/chunk-OFYI4UU4.mjs.map +1 -0
  16. package/dist/{chunk-3E7HY2UN.mjs → chunk-P5A3A5FO.mjs} +58 -31
  17. package/dist/chunk-P5A3A5FO.mjs.map +1 -0
  18. package/dist/chunk-SQMEPWVT.mjs +1 -0
  19. package/dist/chunk-UWWMAJ7R.mjs +100 -0
  20. package/dist/chunk-UWWMAJ7R.mjs.map +1 -0
  21. package/dist/{chunk-UWVGLGFQ.mjs → chunk-VKVNMHM5.mjs} +14 -4
  22. package/dist/chunk-VKVNMHM5.mjs.map +1 -0
  23. package/dist/components/chat/Chat.d.ts +10 -2
  24. package/dist/components/chat/Chat.js +384 -271
  25. package/dist/components/chat/Chat.js.map +1 -1
  26. package/dist/components/chat/Chat.mjs +8 -6
  27. package/dist/components/chat/Messages.d.ts +1 -1
  28. package/dist/components/chat/Messages.js +15 -5
  29. package/dist/components/chat/Messages.js.map +1 -1
  30. package/dist/components/chat/Messages.mjs +1 -1
  31. package/dist/components/chat/Modal.d.ts +1 -1
  32. package/dist/components/chat/Modal.js +396 -279
  33. package/dist/components/chat/Modal.js.map +1 -1
  34. package/dist/components/chat/Modal.mjs +9 -7
  35. package/dist/components/chat/Popup.js +398 -281
  36. package/dist/components/chat/Popup.js.map +1 -1
  37. package/dist/components/chat/Popup.mjs +10 -8
  38. package/dist/components/chat/Sidebar.js +398 -281
  39. package/dist/components/chat/Sidebar.js.map +1 -1
  40. package/dist/components/chat/Sidebar.mjs +10 -8
  41. package/dist/components/chat/index.d.ts +4 -1
  42. package/dist/components/chat/index.js +406 -283
  43. package/dist/components/chat/index.js.map +1 -1
  44. package/dist/components/chat/index.mjs +22 -11
  45. package/dist/components/chat/messages/AssistantMessage.d.ts +7 -0
  46. package/dist/components/chat/messages/AssistantMessage.js +615 -0
  47. package/dist/components/chat/messages/AssistantMessage.js.map +1 -0
  48. package/dist/components/chat/messages/AssistantMessage.mjs +13 -0
  49. package/dist/components/chat/messages/AssistantMessage.mjs.map +1 -0
  50. package/dist/components/chat/messages/RenderActionExecutionMessage.js +59 -54
  51. package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
  52. package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +1 -3
  53. package/dist/components/chat/messages/RenderAgentStateMessage.js +55 -42
  54. package/dist/components/chat/messages/RenderAgentStateMessage.js.map +1 -1
  55. package/dist/components/chat/messages/RenderAgentStateMessage.mjs +1 -3
  56. package/dist/components/chat/messages/RenderResultMessage.js +11 -29
  57. package/dist/components/chat/messages/RenderResultMessage.js.map +1 -1
  58. package/dist/components/chat/messages/RenderResultMessage.mjs +1 -3
  59. package/dist/components/chat/messages/RenderTextMessage.js +11 -581
  60. package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
  61. package/dist/components/chat/messages/RenderTextMessage.mjs +1 -6
  62. package/dist/components/chat/messages/UserMessage.d.ts +7 -0
  63. package/dist/components/chat/messages/UserMessage.js +34 -0
  64. package/dist/components/chat/messages/UserMessage.js.map +1 -0
  65. package/dist/components/chat/messages/UserMessage.mjs +8 -0
  66. package/dist/components/chat/messages/UserMessage.mjs.map +1 -0
  67. package/dist/components/chat/props.d.ts +36 -1
  68. package/dist/components/chat/props.js.map +1 -1
  69. package/dist/components/index.d.ts +4 -1
  70. package/dist/components/index.js +406 -283
  71. package/dist/components/index.js.map +1 -1
  72. package/dist/components/index.mjs +22 -11
  73. package/dist/index.d.ts +4 -1
  74. package/dist/index.js +406 -283
  75. package/dist/index.js.map +1 -1
  76. package/dist/index.mjs +22 -11
  77. package/package.json +4 -4
  78. package/src/components/chat/Chat.tsx +25 -1
  79. package/src/components/chat/Messages.tsx +10 -0
  80. package/src/components/chat/Modal.tsx +7 -0
  81. package/src/components/chat/index.tsx +3 -0
  82. package/src/components/chat/messages/AssistantMessage.tsx +20 -0
  83. package/src/components/chat/messages/RenderActionExecutionMessage.tsx +45 -24
  84. package/src/components/chat/messages/RenderAgentStateMessage.tsx +39 -19
  85. package/src/components/chat/messages/RenderResultMessage.tsx +9 -7
  86. package/src/components/chat/messages/RenderTextMessage.tsx +12 -19
  87. package/src/components/chat/messages/UserMessage.tsx +5 -0
  88. package/src/components/chat/props.ts +43 -0
  89. package/dist/chunk-3E7HY2UN.mjs.map +0 -1
  90. package/dist/chunk-6INMITFA.mjs +0 -18
  91. package/dist/chunk-6INMITFA.mjs.map +0 -1
  92. package/dist/chunk-7II4YL7R.mjs.map +0 -1
  93. package/dist/chunk-DCNCY2PL.mjs.map +0 -1
  94. package/dist/chunk-MRFF7GSQ.mjs +0 -1
  95. package/dist/chunk-RU73BEZM.mjs +0 -41
  96. package/dist/chunk-RU73BEZM.mjs.map +0 -1
  97. package/dist/chunk-UWVGLGFQ.mjs.map +0 -1
  98. package/dist/chunk-ZABXREBH.mjs +0 -65
  99. package/dist/chunk-ZABXREBH.mjs.map +0 -1
  100. /package/dist/{chunk-WSMMTZCM.mjs.map → chunk-B23XDGH4.mjs.map} +0 -0
  101. /package/dist/{chunk-375NVWZM.mjs.map → chunk-O6JFOQQA.mjs.map} +0 -0
  102. /package/dist/{chunk-MRFF7GSQ.mjs.map → chunk-SQMEPWVT.mjs.map} +0 -0
@@ -1,23 +1,29 @@
1
- import "../../chunk-MRFF7GSQ.mjs";
1
+ import "../../chunk-SQMEPWVT.mjs";
2
2
  import {
3
3
  CopilotSidebar
4
- } from "../../chunk-WSMMTZCM.mjs";
4
+ } from "../../chunk-B23XDGH4.mjs";
5
5
  import "../../chunk-WB3YULQ4.mjs";
6
6
  import {
7
7
  CopilotPopup
8
- } from "../../chunk-375NVWZM.mjs";
9
- import "../../chunk-UWVGLGFQ.mjs";
8
+ } from "../../chunk-O6JFOQQA.mjs";
9
+ import "../../chunk-VKVNMHM5.mjs";
10
10
  import "../../chunk-YAGE7RCE.mjs";
11
11
  import "../../chunk-VEC45H6Q.mjs";
12
12
  import "../../chunk-RQNJNK2W.mjs";
13
13
  import {
14
14
  CopilotChat
15
- } from "../../chunk-DCNCY2PL.mjs";
16
- import "../../chunk-6INMITFA.mjs";
17
- import "../../chunk-RU73BEZM.mjs";
15
+ } from "../../chunk-I7MG52I5.mjs";
16
+ import "../../chunk-UWWMAJ7R.mjs";
17
+ import "../../chunk-F7VWGY77.mjs";
18
+ import "../../chunk-OFYI4UU4.mjs";
19
+ import {
20
+ UserMessage
21
+ } from "../../chunk-HEIDCT7I.mjs";
18
22
  import "../../chunk-V7W6IM2V.mjs";
19
- import "../../chunk-3E7HY2UN.mjs";
20
- import "../../chunk-ZABXREBH.mjs";
23
+ import {
24
+ AssistantMessage
25
+ } from "../../chunk-3VNMQWGT.mjs";
26
+ import "../../chunk-P5A3A5FO.mjs";
21
27
  import "../../chunk-RJCZRKTV.mjs";
22
28
  import "../../chunk-F2W5FD7L.mjs";
23
29
  import "../../chunk-PNQVKBPN.mjs";
@@ -27,8 +33,10 @@ import "../../chunk-BH6PCAAL.mjs";
27
33
  import "../../chunk-OTPAZXVR.mjs";
28
34
  import "../../chunk-EMQEEXUB.mjs";
29
35
  import "../../chunk-YQFVRDNC.mjs";
30
- import "../../chunk-YQ3D5IQV.mjs";
31
- import "../../chunk-7II4YL7R.mjs";
36
+ import {
37
+ Markdown
38
+ } from "../../chunk-YQ3D5IQV.mjs";
39
+ import "../../chunk-34FREWVK.mjs";
32
40
  import "../../chunk-3XAXY2Z3.mjs";
33
41
  import {
34
42
  useChatContext
@@ -39,9 +47,12 @@ import "../../chunk-54JAUBUJ.mjs";
39
47
  import "../../chunk-S5MBUNGN.mjs";
40
48
  import "../../chunk-MRXNTQOX.mjs";
41
49
  export {
50
+ AssistantMessage,
42
51
  CopilotChat,
43
52
  CopilotPopup,
44
53
  CopilotSidebar,
54
+ Markdown,
55
+ UserMessage,
45
56
  useChatContext
46
57
  };
47
58
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { AssistantMessageProps } from '../props.js';
3
+ import '@copilotkit/runtime-client-gql';
4
+
5
+ declare const AssistantMessage: (props: AssistantMessageProps) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { AssistantMessage };
@@ -0,0 +1,615 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
57
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
+
59
+ // src/components/chat/messages/AssistantMessage.tsx
60
+ var AssistantMessage_exports = {};
61
+ __export(AssistantMessage_exports, {
62
+ AssistantMessage: () => AssistantMessage
63
+ });
64
+ module.exports = __toCommonJS(AssistantMessage_exports);
65
+
66
+ // src/components/chat/ChatContext.tsx
67
+ var import_react = __toESM(require("react"));
68
+
69
+ // src/components/chat/Icons.tsx
70
+ var import_jsx_runtime = require("react/jsx-runtime");
71
+ function CheckIcon(_a) {
72
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ "svg",
75
+ __spreadProps(__spreadValues({
76
+ xmlns: "http://www.w3.org/2000/svg",
77
+ viewBox: "0 0 256 256",
78
+ fill: "currentColor",
79
+ style: { height: "1rem", width: "1rem" },
80
+ className
81
+ }, props), {
82
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z" })
83
+ })
84
+ );
85
+ }
86
+ function DownloadIcon(_a) {
87
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
88
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ "svg",
90
+ __spreadProps(__spreadValues({
91
+ xmlns: "http://www.w3.org/2000/svg",
92
+ viewBox: "0 0 256 256",
93
+ fill: "currentColor",
94
+ style: { height: "1rem", width: "1rem" },
95
+ className
96
+ }, props), {
97
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z" })
98
+ })
99
+ );
100
+ }
101
+ function CopyIcon(_a) {
102
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
103
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
+ "svg",
105
+ __spreadProps(__spreadValues({
106
+ xmlns: "http://www.w3.org/2000/svg",
107
+ viewBox: "0 0 256 256",
108
+ fill: "currentColor",
109
+ style: { height: "1rem", width: "1rem" },
110
+ className
111
+ }, props), {
112
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" })
113
+ })
114
+ );
115
+ }
116
+
117
+ // src/components/chat/ChatContext.tsx
118
+ var import_jsx_runtime2 = require("react/jsx-runtime");
119
+ var ChatContext = import_react.default.createContext(void 0);
120
+ function useChatContext() {
121
+ const context = import_react.default.useContext(ChatContext);
122
+ if (context === void 0) {
123
+ throw new Error(
124
+ "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
125
+ );
126
+ }
127
+ return context;
128
+ }
129
+
130
+ // src/components/chat/Markdown.tsx
131
+ var import_react3 = require("react");
132
+ var import_react_markdown = __toESM(require("react-markdown"));
133
+
134
+ // src/components/chat/CodeBlock.tsx
135
+ var import_react2 = require("react");
136
+ var import_react_syntax_highlighter = require("react-syntax-highlighter");
137
+
138
+ // src/hooks/use-copy-to-clipboard.tsx
139
+ var React2 = __toESM(require("react"));
140
+ function useCopyToClipboard({ timeout = 2e3 }) {
141
+ const [isCopied, setIsCopied] = React2.useState(false);
142
+ const copyToClipboard = (value) => {
143
+ var _a;
144
+ if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
145
+ return;
146
+ }
147
+ if (!value) {
148
+ return;
149
+ }
150
+ navigator.clipboard.writeText(value).then(() => {
151
+ setIsCopied(true);
152
+ setTimeout(() => {
153
+ setIsCopied(false);
154
+ }, timeout);
155
+ });
156
+ };
157
+ return { isCopied, copyToClipboard };
158
+ }
159
+
160
+ // src/components/chat/CodeBlock.tsx
161
+ var import_jsx_runtime3 = require("react/jsx-runtime");
162
+ var programmingLanguages = {
163
+ javascript: ".js",
164
+ python: ".py",
165
+ java: ".java",
166
+ c: ".c",
167
+ cpp: ".cpp",
168
+ "c++": ".cpp",
169
+ "c#": ".cs",
170
+ ruby: ".rb",
171
+ php: ".php",
172
+ swift: ".swift",
173
+ "objective-c": ".m",
174
+ kotlin: ".kt",
175
+ typescript: ".ts",
176
+ go: ".go",
177
+ perl: ".pl",
178
+ rust: ".rs",
179
+ scala: ".scala",
180
+ haskell: ".hs",
181
+ lua: ".lua",
182
+ shell: ".sh",
183
+ sql: ".sql",
184
+ html: ".html",
185
+ css: ".css"
186
+ // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
187
+ };
188
+ var generateRandomString = (length, lowercase = false) => {
189
+ const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
190
+ let result = "";
191
+ for (let i = 0; i < length; i++) {
192
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
193
+ }
194
+ return lowercase ? result.toLowerCase() : result;
195
+ };
196
+ var CodeBlock = (0, import_react2.memo)(({ language, value }) => {
197
+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
198
+ const downloadAsFile = () => {
199
+ if (typeof window === "undefined") {
200
+ return;
201
+ }
202
+ const fileExtension = programmingLanguages[language] || ".file";
203
+ const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
204
+ const fileName = window.prompt("Enter file name", suggestedFileName);
205
+ if (!fileName) {
206
+ return;
207
+ }
208
+ const blob = new Blob([value], { type: "text/plain" });
209
+ const url = URL.createObjectURL(blob);
210
+ const link = document.createElement("a");
211
+ link.download = fileName;
212
+ link.href = url;
213
+ link.style.display = "none";
214
+ document.body.appendChild(link);
215
+ link.click();
216
+ document.body.removeChild(link);
217
+ URL.revokeObjectURL(url);
218
+ };
219
+ const onCopy = () => {
220
+ if (isCopied)
221
+ return;
222
+ copyToClipboard(value);
223
+ };
224
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "copilotKitCodeBlock", children: [
225
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
226
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
227
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
228
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: [
229
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DownloadIcon, {}),
230
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sr-only", children: "Download" })
231
+ ] }),
232
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: [
233
+ isCopied ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CopyIcon, {}),
234
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sr-only", children: "Copy code" })
235
+ ] })
236
+ ] })
237
+ ] }),
238
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
239
+ import_react_syntax_highlighter.Prism,
240
+ {
241
+ language,
242
+ style: highlightStyle,
243
+ PreTag: "div",
244
+ customStyle: {
245
+ margin: 0,
246
+ borderBottomLeftRadius: "0.375rem",
247
+ borderBottomRightRadius: "0.375rem"
248
+ },
249
+ children: value
250
+ }
251
+ )
252
+ ] });
253
+ });
254
+ CodeBlock.displayName = "CodeBlock";
255
+ var highlightStyle = {
256
+ 'pre[class*="language-"]': {
257
+ color: "#d4d4d4",
258
+ fontSize: "13px",
259
+ textShadow: "none",
260
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
261
+ direction: "ltr",
262
+ textAlign: "left",
263
+ whiteSpace: "pre",
264
+ wordSpacing: "normal",
265
+ wordBreak: "normal",
266
+ lineHeight: "1.5",
267
+ MozTabSize: "4",
268
+ OTabSize: "4",
269
+ tabSize: "4",
270
+ WebkitHyphens: "none",
271
+ MozHyphens: "none",
272
+ msHyphens: "none",
273
+ hyphens: "none",
274
+ padding: "1em",
275
+ margin: ".5em 0",
276
+ overflow: "auto",
277
+ background: "#1e1e1e"
278
+ },
279
+ 'code[class*="language-"]': {
280
+ color: "#d4d4d4",
281
+ fontSize: "13px",
282
+ textShadow: "none",
283
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
284
+ direction: "ltr",
285
+ textAlign: "left",
286
+ whiteSpace: "pre",
287
+ wordSpacing: "normal",
288
+ wordBreak: "normal",
289
+ lineHeight: "1.5",
290
+ MozTabSize: "4",
291
+ OTabSize: "4",
292
+ tabSize: "4",
293
+ WebkitHyphens: "none",
294
+ MozHyphens: "none",
295
+ msHyphens: "none",
296
+ hyphens: "none"
297
+ },
298
+ 'pre[class*="language-"]::selection': {
299
+ textShadow: "none",
300
+ background: "#264F78"
301
+ },
302
+ 'code[class*="language-"]::selection': {
303
+ textShadow: "none",
304
+ background: "#264F78"
305
+ },
306
+ 'pre[class*="language-"] *::selection': {
307
+ textShadow: "none",
308
+ background: "#264F78"
309
+ },
310
+ 'code[class*="language-"] *::selection': {
311
+ textShadow: "none",
312
+ background: "#264F78"
313
+ },
314
+ ':not(pre) > code[class*="language-"]': {
315
+ padding: ".1em .3em",
316
+ borderRadius: ".3em",
317
+ color: "#db4c69",
318
+ background: "#1e1e1e"
319
+ },
320
+ ".namespace": {
321
+ Opacity: ".7"
322
+ },
323
+ "doctype.doctype-tag": {
324
+ color: "#569CD6"
325
+ },
326
+ "doctype.name": {
327
+ color: "#9cdcfe"
328
+ },
329
+ comment: {
330
+ color: "#6a9955"
331
+ },
332
+ prolog: {
333
+ color: "#6a9955"
334
+ },
335
+ punctuation: {
336
+ color: "#d4d4d4"
337
+ },
338
+ ".language-html .language-css .token.punctuation": {
339
+ color: "#d4d4d4"
340
+ },
341
+ ".language-html .language-javascript .token.punctuation": {
342
+ color: "#d4d4d4"
343
+ },
344
+ property: {
345
+ color: "#9cdcfe"
346
+ },
347
+ tag: {
348
+ color: "#569cd6"
349
+ },
350
+ boolean: {
351
+ color: "#569cd6"
352
+ },
353
+ number: {
354
+ color: "#b5cea8"
355
+ },
356
+ constant: {
357
+ color: "#9cdcfe"
358
+ },
359
+ symbol: {
360
+ color: "#b5cea8"
361
+ },
362
+ inserted: {
363
+ color: "#b5cea8"
364
+ },
365
+ unit: {
366
+ color: "#b5cea8"
367
+ },
368
+ selector: {
369
+ color: "#d7ba7d"
370
+ },
371
+ "attr-name": {
372
+ color: "#9cdcfe"
373
+ },
374
+ string: {
375
+ color: "#ce9178"
376
+ },
377
+ char: {
378
+ color: "#ce9178"
379
+ },
380
+ builtin: {
381
+ color: "#ce9178"
382
+ },
383
+ deleted: {
384
+ color: "#ce9178"
385
+ },
386
+ ".language-css .token.string.url": {
387
+ textDecoration: "underline"
388
+ },
389
+ operator: {
390
+ color: "#d4d4d4"
391
+ },
392
+ entity: {
393
+ color: "#569cd6"
394
+ },
395
+ "operator.arrow": {
396
+ color: "#569CD6"
397
+ },
398
+ atrule: {
399
+ color: "#ce9178"
400
+ },
401
+ "atrule.rule": {
402
+ color: "#c586c0"
403
+ },
404
+ "atrule.url": {
405
+ color: "#9cdcfe"
406
+ },
407
+ "atrule.url.function": {
408
+ color: "#dcdcaa"
409
+ },
410
+ "atrule.url.punctuation": {
411
+ color: "#d4d4d4"
412
+ },
413
+ keyword: {
414
+ color: "#569CD6"
415
+ },
416
+ "keyword.module": {
417
+ color: "#c586c0"
418
+ },
419
+ "keyword.control-flow": {
420
+ color: "#c586c0"
421
+ },
422
+ function: {
423
+ color: "#dcdcaa"
424
+ },
425
+ "function.maybe-class-name": {
426
+ color: "#dcdcaa"
427
+ },
428
+ regex: {
429
+ color: "#d16969"
430
+ },
431
+ important: {
432
+ color: "#569cd6"
433
+ },
434
+ italic: {
435
+ fontStyle: "italic"
436
+ },
437
+ "class-name": {
438
+ color: "#4ec9b0"
439
+ },
440
+ "maybe-class-name": {
441
+ color: "#4ec9b0"
442
+ },
443
+ console: {
444
+ color: "#9cdcfe"
445
+ },
446
+ parameter: {
447
+ color: "#9cdcfe"
448
+ },
449
+ interpolation: {
450
+ color: "#9cdcfe"
451
+ },
452
+ "punctuation.interpolation-punctuation": {
453
+ color: "#569cd6"
454
+ },
455
+ variable: {
456
+ color: "#9cdcfe"
457
+ },
458
+ "imports.maybe-class-name": {
459
+ color: "#9cdcfe"
460
+ },
461
+ "exports.maybe-class-name": {
462
+ color: "#9cdcfe"
463
+ },
464
+ escape: {
465
+ color: "#d7ba7d"
466
+ },
467
+ "tag.punctuation": {
468
+ color: "#808080"
469
+ },
470
+ cdata: {
471
+ color: "#808080"
472
+ },
473
+ "attr-value": {
474
+ color: "#ce9178"
475
+ },
476
+ "attr-value.punctuation": {
477
+ color: "#ce9178"
478
+ },
479
+ "attr-value.punctuation.attr-equals": {
480
+ color: "#d4d4d4"
481
+ },
482
+ namespace: {
483
+ color: "#4ec9b0"
484
+ },
485
+ 'pre[class*="language-javascript"]': {
486
+ color: "#9cdcfe"
487
+ },
488
+ 'code[class*="language-javascript"]': {
489
+ color: "#9cdcfe"
490
+ },
491
+ 'pre[class*="language-jsx"]': {
492
+ color: "#9cdcfe"
493
+ },
494
+ 'code[class*="language-jsx"]': {
495
+ color: "#9cdcfe"
496
+ },
497
+ 'pre[class*="language-typescript"]': {
498
+ color: "#9cdcfe"
499
+ },
500
+ 'code[class*="language-typescript"]': {
501
+ color: "#9cdcfe"
502
+ },
503
+ 'pre[class*="language-tsx"]': {
504
+ color: "#9cdcfe"
505
+ },
506
+ 'code[class*="language-tsx"]': {
507
+ color: "#9cdcfe"
508
+ },
509
+ 'pre[class*="language-css"]': {
510
+ color: "#ce9178"
511
+ },
512
+ 'code[class*="language-css"]': {
513
+ color: "#ce9178"
514
+ },
515
+ 'pre[class*="language-html"]': {
516
+ color: "#d4d4d4"
517
+ },
518
+ 'code[class*="language-html"]': {
519
+ color: "#d4d4d4"
520
+ },
521
+ ".language-regex .token.anchor": {
522
+ color: "#dcdcaa"
523
+ },
524
+ ".language-html .token.punctuation": {
525
+ color: "#808080"
526
+ },
527
+ 'pre[class*="language-"] > code[class*="language-"]': {
528
+ position: "relative",
529
+ zIndex: "1"
530
+ },
531
+ ".line-highlight.line-highlight": {
532
+ background: "#f7ebc6",
533
+ boxShadow: "inset 5px 0 0 #f7d87c",
534
+ zIndex: "0"
535
+ }
536
+ };
537
+
538
+ // src/components/chat/Markdown.tsx
539
+ var import_remark_gfm = __toESM(require("remark-gfm"));
540
+ var import_remark_math = __toESM(require("remark-math"));
541
+ var import_jsx_runtime4 = require("react/jsx-runtime");
542
+ var MemoizedReactMarkdown = (0, import_react3.memo)(
543
+ import_react_markdown.default,
544
+ (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
545
+ );
546
+ var Markdown = ({ content }) => {
547
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
548
+ };
549
+ var components = {
550
+ p({ children }) {
551
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children });
552
+ },
553
+ a(_a) {
554
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
555
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
556
+ "a",
557
+ __spreadProps(__spreadValues({
558
+ style: { color: "blue", textDecoration: "underline" }
559
+ }, props), {
560
+ target: "_blank",
561
+ rel: "noopener noreferrer",
562
+ children
563
+ })
564
+ );
565
+ },
566
+ code(_c) {
567
+ var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
568
+ if (children.length) {
569
+ if (children[0] == "\u258D") {
570
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
571
+ "span",
572
+ {
573
+ style: {
574
+ animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
575
+ marginTop: "0.25rem"
576
+ },
577
+ children: "\u258D"
578
+ }
579
+ );
580
+ }
581
+ children[0] = children[0].replace("`\u258D`", "\u258D");
582
+ }
583
+ const match = /language-(\w+)/.exec(className || "");
584
+ if (inline) {
585
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
586
+ }
587
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
588
+ CodeBlock,
589
+ __spreadValues({
590
+ language: match && match[1] || "",
591
+ value: String(children).replace(/\n$/, "")
592
+ }, props),
593
+ Math.random()
594
+ );
595
+ }
596
+ };
597
+
598
+ // src/components/chat/messages/AssistantMessage.tsx
599
+ var import_jsx_runtime5 = require("react/jsx-runtime");
600
+ var AssistantMessage = (props) => {
601
+ const { icons } = useChatContext();
602
+ const { message, isLoading, subComponent } = props;
603
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
604
+ (message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
605
+ message && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Markdown, { content: message || "" }),
606
+ isLoading && icons.spinnerIcon
607
+ ] }),
608
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
609
+ ] });
610
+ };
611
+ // Annotate the CommonJS export names for ESM import in node:
612
+ 0 && (module.exports = {
613
+ AssistantMessage
614
+ });
615
+ //# sourceMappingURL=AssistantMessage.js.map