@copilotkit/react-ui 0.0.0-fix-interrupt-persistence-20250925085251 → 0.0.0-fix-old-browser-syntax-highlight-support-20250925124846
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/CHANGELOG.md +33 -5
- package/dist/{chunk-3QYTKBWC.mjs → chunk-2NYQ2E5O.mjs} +2 -2
- package/dist/{chunk-DSNTTAJX.mjs → chunk-AGR2A5WI.mjs} +6 -6
- package/dist/{chunk-5XLGXUQI.mjs → chunk-BF7JXE5J.mjs} +2 -2
- package/dist/chunk-COTKXR52.mjs +19 -0
- package/dist/chunk-COTKXR52.mjs.map +1 -0
- package/dist/{chunk-DTRPPNSA.mjs → chunk-FITTF4FJ.mjs} +4 -4
- package/dist/{chunk-SDQTGCT2.mjs → chunk-JII2NB7P.mjs} +2 -2
- package/dist/{chunk-2LIO4Z3E.mjs → chunk-JYFHHWPK.mjs} +2 -2
- package/dist/{chunk-IK2BPURM.mjs → chunk-NSRIQJ6W.mjs} +16 -14
- package/dist/chunk-NSRIQJ6W.mjs.map +1 -0
- package/dist/{chunk-W7ONZTSW.mjs → chunk-NX77RRNX.mjs} +2 -2
- package/dist/{chunk-QPONDGDJ.mjs → chunk-O23JBS3R.mjs} +2 -2
- package/dist/chunk-P5XUVVOY.mjs +43 -0
- package/dist/chunk-P5XUVVOY.mjs.map +1 -0
- package/dist/{chunk-K2FLPUR5.mjs → chunk-T7IGDWWV.mjs} +5 -5
- package/dist/{chunk-GDSZGYCE.mjs → chunk-V6DDX4LH.mjs} +2 -2
- package/dist/{chunk-JZ3RFQQ6.mjs → chunk-VSULSNL7.mjs} +32 -5
- package/dist/chunk-VSULSNL7.mjs.map +1 -0
- package/dist/{chunk-FFJHOZX6.mjs → chunk-WBPBTTQD.mjs} +4 -4
- package/dist/components/chat/Chat.js +167 -111
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +11 -9
- package/dist/components/chat/CodeBlock.js +82 -20
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +3 -1
- package/dist/components/chat/CodeBlockLightRenderer.d.ts +6 -0
- package/dist/components/chat/CodeBlockLightRenderer.js +62 -0
- package/dist/components/chat/CodeBlockLightRenderer.js.map +1 -0
- package/dist/components/chat/CodeBlockLightRenderer.mjs +8 -0
- package/dist/components/chat/CodeBlockLightRenderer.mjs.map +1 -0
- package/dist/components/chat/CodeBlockPrismRenderer.d.ts +6 -0
- package/dist/components/chat/CodeBlockPrismRenderer.js +62 -0
- package/dist/components/chat/CodeBlockPrismRenderer.js.map +1 -0
- package/dist/components/chat/CodeBlockPrismRenderer.mjs +18 -0
- package/dist/components/chat/CodeBlockPrismRenderer.mjs.map +1 -0
- package/dist/components/chat/Header.mjs +4 -4
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Markdown.js +115 -39
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +4 -2
- package/dist/components/chat/Messages.js +152 -76
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +8 -6
- package/dist/components/chat/Modal.js +175 -119
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +16 -14
- package/dist/components/chat/Popup.js +177 -121
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +17 -15
- package/dist/components/chat/Sidebar.js +177 -121
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +17 -15
- package/dist/components/chat/index.js +179 -123
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +20 -18
- package/dist/components/chat/messages/AssistantMessage.js +128 -52
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +5 -3
- package/dist/components/chat/messages/ErrorMessage.js +122 -46
- package/dist/components/chat/messages/ErrorMessage.js.map +1 -1
- package/dist/components/chat/messages/ErrorMessage.mjs +4 -2
- package/dist/components/chat/messages/ErrorMessage.mjs.map +1 -1
- package/dist/components/chat/messages/LegacyRenderMessage.js +145 -69
- package/dist/components/chat/messages/LegacyRenderMessage.js.map +1 -1
- package/dist/components/chat/messages/LegacyRenderMessage.mjs +7 -5
- package/dist/components/chat/messages/RenderMessage.js +138 -62
- package/dist/components/chat/messages/RenderMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderMessage.mjs +6 -4
- package/dist/components/dev-console/console.mjs +3 -3
- package/dist/components/dev-console/index.mjs +3 -3
- package/dist/components/index.js +179 -123
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +20 -18
- package/dist/index.js +179 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -19
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/utils.js +11 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs +7 -29
- package/dist/lib/utils.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/chat/CodeBlock.tsx +17 -18
- package/src/components/chat/CodeBlockLightRenderer.tsx +7 -0
- package/src/components/chat/CodeBlockPrismRenderer.tsx +7 -0
- package/src/components/chat/Markdown.tsx +36 -3
- package/src/lib/utils.ts +8 -0
- package/dist/chunk-IK2BPURM.mjs.map +0 -1
- package/dist/chunk-JZ3RFQQ6.mjs.map +0 -1
- /package/dist/{chunk-3QYTKBWC.mjs.map → chunk-2NYQ2E5O.mjs.map} +0 -0
- /package/dist/{chunk-DSNTTAJX.mjs.map → chunk-AGR2A5WI.mjs.map} +0 -0
- /package/dist/{chunk-5XLGXUQI.mjs.map → chunk-BF7JXE5J.mjs.map} +0 -0
- /package/dist/{chunk-DTRPPNSA.mjs.map → chunk-FITTF4FJ.mjs.map} +0 -0
- /package/dist/{chunk-SDQTGCT2.mjs.map → chunk-JII2NB7P.mjs.map} +0 -0
- /package/dist/{chunk-2LIO4Z3E.mjs.map → chunk-JYFHHWPK.mjs.map} +0 -0
- /package/dist/{chunk-W7ONZTSW.mjs.map → chunk-NX77RRNX.mjs.map} +0 -0
- /package/dist/{chunk-QPONDGDJ.mjs.map → chunk-O23JBS3R.mjs.map} +0 -0
- /package/dist/{chunk-K2FLPUR5.mjs.map → chunk-T7IGDWWV.mjs.map} +0 -0
- /package/dist/{chunk-GDSZGYCE.mjs.map → chunk-V6DDX4LH.mjs.map} +0 -0
- /package/dist/{chunk-FFJHOZX6.mjs.map → chunk-WBPBTTQD.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,44 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-old-browser-syntax-highlight-support-20250925124846
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 1b56589: - fix: support older browsers in markdown and code block components
|
|
8
|
+
- c2de25d: - fix: refrain from using prismjs for syntax highlighting on older browsers
|
|
8
9
|
- Updated dependencies [b7bc3a0]
|
|
10
|
+
- Updated dependencies [f3fdd7a]
|
|
9
11
|
- Updated dependencies [32c163e]
|
|
10
12
|
- Updated dependencies [6112a67]
|
|
11
|
-
- @copilotkit/react-core@0.0.0-fix-
|
|
12
|
-
- @copilotkit/runtime-client-gql@0.0.0-fix-
|
|
13
|
-
- @copilotkit/shared@0.0.0-fix-
|
|
13
|
+
- @copilotkit/react-core@0.0.0-fix-old-browser-syntax-highlight-support-20250925124846
|
|
14
|
+
- @copilotkit/runtime-client-gql@0.0.0-fix-old-browser-syntax-highlight-support-20250925124846
|
|
15
|
+
- @copilotkit/shared@0.0.0-fix-old-browser-syntax-highlight-support-20250925124846
|
|
16
|
+
|
|
17
|
+
## 1.10.5-next.8
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- c2de25d: - fix: refrain from using prismjs for syntax highlighting on older browsers
|
|
22
|
+
- @copilotkit/react-core@1.10.5-next.8
|
|
23
|
+
- @copilotkit/runtime-client-gql@1.10.5-next.8
|
|
24
|
+
- @copilotkit/shared@1.10.5-next.8
|
|
25
|
+
|
|
26
|
+
## 1.10.5-next.7
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- @copilotkit/runtime-client-gql@1.10.5-next.7
|
|
31
|
+
- @copilotkit/react-core@1.10.5-next.7
|
|
32
|
+
- @copilotkit/shared@1.10.5-next.7
|
|
33
|
+
|
|
34
|
+
## 1.10.5-next.6
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [f3fdd7a]
|
|
39
|
+
- @copilotkit/react-core@1.10.5-next.6
|
|
40
|
+
- @copilotkit/runtime-client-gql@1.10.5-next.6
|
|
41
|
+
- @copilotkit/shared@1.10.5-next.6
|
|
14
42
|
|
|
15
43
|
## 1.10.5-next.5
|
|
16
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Markdown
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VSULSNL7.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useChatContext
|
|
6
6
|
} from "./chunk-IEMQ2SQW.mjs";
|
|
@@ -110,4 +110,4 @@ var AssistantMessage = (props) => {
|
|
|
110
110
|
export {
|
|
111
111
|
AssistantMessage
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=chunk-
|
|
113
|
+
//# sourceMappingURL=chunk-2NYQ2E5O.mjs.map
|
|
@@ -3,22 +3,22 @@ import {
|
|
|
3
3
|
} from "./chunk-C3GSYRC3.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Header
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-V6DDX4LH.mjs";
|
|
7
7
|
import {
|
|
8
8
|
Button
|
|
9
9
|
} from "./chunk-UFN2VWSR.mjs";
|
|
10
10
|
import {
|
|
11
11
|
CopilotChat
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-T7IGDWWV.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Input
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FITTF4FJ.mjs";
|
|
16
16
|
import {
|
|
17
17
|
Messages
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NX77RRNX.mjs";
|
|
19
19
|
import {
|
|
20
20
|
AssistantMessage
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-2NYQ2E5O.mjs";
|
|
22
22
|
import {
|
|
23
23
|
UserMessage
|
|
24
24
|
} from "./chunk-VVL6JFCJ.mjs";
|
|
@@ -219,4 +219,4 @@ var CopilotModal = (_a) => {
|
|
|
219
219
|
export {
|
|
220
220
|
CopilotModal
|
|
221
221
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-AGR2A5WI.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AssistantMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2NYQ2E5O.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ImageRenderer
|
|
6
6
|
} from "./chunk-DBKRAOH7.mjs";
|
|
@@ -73,4 +73,4 @@ function RenderMessage(_a) {
|
|
|
73
73
|
export {
|
|
74
74
|
RenderMessage
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-BF7JXE5J.mjs.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-MRXNTQOX.mjs";
|
|
6
|
+
|
|
7
|
+
// src/components/chat/CodeBlockLightRenderer.tsx
|
|
8
|
+
import { Light } from "react-syntax-highlighter";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var CodeBlockLightRenderer = (_a) => {
|
|
11
|
+
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
12
|
+
return /* @__PURE__ */ jsx(Light, __spreadProps(__spreadValues({}, props), { children }));
|
|
13
|
+
};
|
|
14
|
+
var CodeBlockLightRenderer_default = CodeBlockLightRenderer;
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
CodeBlockLightRenderer_default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-COTKXR52.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/CodeBlockLightRenderer.tsx"],"sourcesContent":["import { Light, SyntaxHighlighterProps } from \"react-syntax-highlighter\";\n\nconst CodeBlockLightRenderer = ({ children, ...props }: SyntaxHighlighterProps) => {\n return <Light {...props}>{children}</Light>;\n};\n\nexport default CodeBlockLightRenderer;\n"],"mappings":";;;;;;;AAAA,SAAS,aAAqC;AAGrC;AADT,IAAM,yBAAyB,CAAC,OAAmD;AAAnD,eAAE,WAFlC,IAEgC,IAAe,kBAAf,IAAe,CAAb;AAChC,SAAO,oBAAC,wCAAU,QAAV,EAAkB,WAAS;AACrC;AAEA,IAAO,iCAAQ;","names":[]}
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
Textarea_default
|
|
6
6
|
} from "./chunk-QIOJXTIQ.mjs";
|
|
7
|
-
import {
|
|
8
|
-
useChatContext
|
|
9
|
-
} from "./chunk-IEMQ2SQW.mjs";
|
|
10
7
|
import {
|
|
11
8
|
usePushToTalk
|
|
12
9
|
} from "./chunk-O72ZB5V3.mjs";
|
|
10
|
+
import {
|
|
11
|
+
useChatContext
|
|
12
|
+
} from "./chunk-IEMQ2SQW.mjs";
|
|
13
13
|
|
|
14
14
|
// src/components/chat/Input.tsx
|
|
15
15
|
import { useMemo, useRef, useState } from "react";
|
|
@@ -120,4 +120,4 @@ var Input = ({
|
|
|
120
120
|
export {
|
|
121
121
|
Input
|
|
122
122
|
};
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
123
|
+
//# sourceMappingURL=chunk-FITTF4FJ.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AGR2A5WI.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues
|
|
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
|
|
|
27
27
|
export {
|
|
28
28
|
CopilotSidebar
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-JII2NB7P.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RenderMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BF7JXE5J.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/messages/LegacyRenderMessage.tsx
|
|
6
6
|
import { aguiToGQL } from "@copilotkit/runtime-client-gql";
|
|
@@ -123,4 +123,4 @@ var LegacyRenderMessage = ({
|
|
|
123
123
|
export {
|
|
124
124
|
LegacyRenderMessage
|
|
125
125
|
};
|
|
126
|
-
//# sourceMappingURL=chunk-
|
|
126
|
+
//# sourceMappingURL=chunk-JYFHHWPK.mjs.map
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CodeBlockLightRenderer_default
|
|
3
|
+
} from "./chunk-COTKXR52.mjs";
|
|
1
4
|
import {
|
|
2
5
|
CheckIcon,
|
|
3
6
|
CopyIcon,
|
|
4
7
|
DownloadIcon
|
|
5
8
|
} from "./chunk-XWG3L6QC.mjs";
|
|
9
|
+
import {
|
|
10
|
+
supportsRegexLookbehind
|
|
11
|
+
} from "./chunk-P5XUVVOY.mjs";
|
|
6
12
|
import {
|
|
7
13
|
useCopyToClipboard
|
|
8
14
|
} from "./chunk-54JAUBUJ.mjs";
|
|
15
|
+
import {
|
|
16
|
+
__spreadValues
|
|
17
|
+
} from "./chunk-MRXNTQOX.mjs";
|
|
9
18
|
|
|
10
19
|
// src/components/chat/CodeBlock.tsx
|
|
11
|
-
import { memo,
|
|
12
|
-
import { Prism, Light } from "react-syntax-highlighter";
|
|
20
|
+
import { memo, Suspense, lazy } from "react";
|
|
13
21
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var CodeBlockPrismRenderer = lazy(() => import("./components/chat/CodeBlockPrismRenderer.mjs"));
|
|
14
23
|
var programmingLanguages = {
|
|
15
24
|
javascript: ".js",
|
|
16
25
|
python: ".py",
|
|
@@ -45,19 +54,12 @@ var generateRandomString = (length, lowercase = false) => {
|
|
|
45
54
|
}
|
|
46
55
|
return lowercase ? result.toLowerCase() : result;
|
|
47
56
|
};
|
|
57
|
+
var SyntaxHighlighter = (props) => {
|
|
58
|
+
const canUsePrism = supportsRegexLookbehind();
|
|
59
|
+
return canUsePrism ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CodeBlockLightRenderer_default, __spreadValues({}, props)), children: /* @__PURE__ */ jsx(CodeBlockPrismRenderer, __spreadValues({}, props)) }) : /* @__PURE__ */ jsx(CodeBlockLightRenderer_default, __spreadValues({}, props));
|
|
60
|
+
};
|
|
48
61
|
var CodeBlock = memo(({ language, value }) => {
|
|
49
62
|
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
50
|
-
const [SyntaxHighlighter, setSyntaxHighlighter] = useState(
|
|
51
|
-
() => Light
|
|
52
|
-
);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
try {
|
|
55
|
-
new RegExp("(?<=#)\\w+");
|
|
56
|
-
setSyntaxHighlighter(() => Prism);
|
|
57
|
-
} catch (e) {
|
|
58
|
-
setSyntaxHighlighter(() => Light);
|
|
59
|
-
}
|
|
60
|
-
}, []);
|
|
61
63
|
const downloadAsFile = () => {
|
|
62
64
|
if (typeof window === "undefined") {
|
|
63
65
|
return;
|
|
@@ -397,4 +399,4 @@ export {
|
|
|
397
399
|
generateRandomString,
|
|
398
400
|
CodeBlock
|
|
399
401
|
};
|
|
400
|
-
//# sourceMappingURL=chunk-
|
|
402
|
+
//# sourceMappingURL=chunk-NSRIQJ6W.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/CodeBlock.tsx"],"sourcesContent":["import { FC, memo, Suspense, lazy, useMemo } from \"react\";\nimport type { CSSProperties } from \"react\";\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard\";\nimport { CheckIcon, CopyIcon, DownloadIcon } from \"./Icons\";\nimport { supportsRegexLookbehind } from \"../../lib/utils\";\nimport CodeBlockLightRenderer from \"./CodeBlockLightRenderer\";\nimport { SyntaxHighlighterProps } from \"react-syntax-highlighter\";\n\nconst CodeBlockPrismRenderer = lazy(() => import(\"./CodeBlockPrismRenderer\"));\n\ninterface Props {\n language: string;\n value: string;\n}\n\ninterface languageMap {\n [key: string]: string | undefined;\n}\n\nexport const programmingLanguages: languageMap = {\n javascript: \".js\",\n python: \".py\",\n java: \".java\",\n c: \".c\",\n cpp: \".cpp\",\n \"c++\": \".cpp\",\n \"c#\": \".cs\",\n ruby: \".rb\",\n php: \".php\",\n swift: \".swift\",\n \"objective-c\": \".m\",\n kotlin: \".kt\",\n typescript: \".ts\",\n go: \".go\",\n perl: \".pl\",\n rust: \".rs\",\n scala: \".scala\",\n haskell: \".hs\",\n lua: \".lua\",\n shell: \".sh\",\n sql: \".sql\",\n html: \".html\",\n css: \".css\",\n // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component\n};\n\nexport const generateRandomString = (length: number, lowercase = false) => {\n const chars = \"ABCDEFGHJKLMNPQRSTUVWXY3456789\"; // excluding similar looking characters like Z, 2, I, 1, O, 0\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return lowercase ? result.toLowerCase() : result;\n};\n\nconst SyntaxHighlighter = (props: SyntaxHighlighterProps) => {\n const canUsePrism = supportsRegexLookbehind();\n return canUsePrism ? (\n <Suspense fallback={<CodeBlockLightRenderer {...props} />}>\n <CodeBlockPrismRenderer {...props} />\n </Suspense>\n ) : (\n <CodeBlockLightRenderer {...props} />\n );\n};\n\nconst CodeBlock: FC<Props> = memo(({ language, value }) => {\n const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });\n\n const downloadAsFile = () => {\n if (typeof window === \"undefined\") {\n return;\n }\n const fileExtension = programmingLanguages[language] || \".file\";\n const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;\n const fileName = window.prompt(\"Enter file name\", suggestedFileName);\n\n if (!fileName) {\n // User pressed cancel on prompt.\n return;\n }\n\n const blob = new Blob([value], { type: \"text/plain\" });\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = url;\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n const onCopy = () => {\n if (isCopied) return;\n copyToClipboard(value);\n };\n\n return (\n <div className=\"copilotKitCodeBlock\">\n <div className=\"copilotKitCodeBlockToolbar\">\n <span className=\"copilotKitCodeBlockToolbarLanguage\">{language}</span>\n <div className=\"copilotKitCodeBlockToolbarButtons\">\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={downloadAsFile}>\n {DownloadIcon}\n </button>\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={onCopy}>\n {isCopied ? CheckIcon : CopyIcon}\n </button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n style={highlightStyle}\n PreTag=\"div\"\n customStyle={{\n margin: 0,\n borderBottomLeftRadius: \"0.375rem\",\n borderBottomRightRadius: \"0.375rem\",\n }}\n >\n {value}\n </SyntaxHighlighter>\n </div>\n );\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nexport { CodeBlock };\n\n// import { vscDarkPlus as highlightStyle } from \"react-syntax-highlighter/dist/esm/styles/prism\";\n// As a workaround, we inline the vscDarkPlus from react-syntax-highlighter.\n// Importing it as recommended in the documentation leads to build errors in the non app router\n// (Next.js classic) setup.\nconst highlightStyle: any = {\n 'pre[class*=\"language-\"]': {\n color: \"#d4d4d4\",\n fontSize: \"13px\",\n textShadow: \"none\",\n fontFamily: 'Menlo, Monaco, Consolas, \"Andale Mono\", \"Ubuntu Mono\", \"Courier New\", monospace',\n direction: \"ltr\",\n textAlign: \"left\",\n whiteSpace: \"pre\",\n wordSpacing: \"normal\",\n wordBreak: \"normal\",\n lineHeight: \"1.5\",\n MozTabSize: \"4\",\n OTabSize: \"4\",\n tabSize: \"4\",\n WebkitHyphens: \"none\",\n MozHyphens: \"none\",\n msHyphens: \"none\",\n hyphens: \"none\",\n padding: \"1em\",\n margin: \".5em 0\",\n overflow: \"auto\",\n background: \"#1e1e1e\",\n },\n 'code[class*=\"language-\"]': {\n color: \"#d4d4d4\",\n fontSize: \"13px\",\n textShadow: \"none\",\n fontFamily: 'Menlo, Monaco, Consolas, \"Andale Mono\", \"Ubuntu Mono\", \"Courier New\", monospace',\n direction: \"ltr\",\n textAlign: \"left\",\n whiteSpace: \"pre\",\n wordSpacing: \"normal\",\n wordBreak: \"normal\",\n lineHeight: \"1.5\",\n MozTabSize: \"4\",\n OTabSize: \"4\",\n tabSize: \"4\",\n WebkitHyphens: \"none\",\n MozHyphens: \"none\",\n msHyphens: \"none\",\n hyphens: \"none\",\n },\n 'pre[class*=\"language-\"]::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'code[class*=\"language-\"]::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'pre[class*=\"language-\"] *::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'code[class*=\"language-\"] *::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n ':not(pre) > code[class*=\"language-\"]': {\n padding: \".1em .3em\",\n borderRadius: \".3em\",\n color: \"#db4c69\",\n background: \"#1e1e1e\",\n },\n \".namespace\": {\n Opacity: \".7\",\n },\n \"doctype.doctype-tag\": {\n color: \"#569CD6\",\n },\n \"doctype.name\": {\n color: \"#9cdcfe\",\n },\n comment: {\n color: \"#6a9955\",\n },\n prolog: {\n color: \"#6a9955\",\n },\n punctuation: {\n color: \"#d4d4d4\",\n },\n \".language-html .language-css .token.punctuation\": {\n color: \"#d4d4d4\",\n },\n \".language-html .language-javascript .token.punctuation\": {\n color: \"#d4d4d4\",\n },\n property: {\n color: \"#9cdcfe\",\n },\n tag: {\n color: \"#569cd6\",\n },\n boolean: {\n color: \"#569cd6\",\n },\n number: {\n color: \"#b5cea8\",\n },\n constant: {\n color: \"#9cdcfe\",\n },\n symbol: {\n color: \"#b5cea8\",\n },\n inserted: {\n color: \"#b5cea8\",\n },\n unit: {\n color: \"#b5cea8\",\n },\n selector: {\n color: \"#d7ba7d\",\n },\n \"attr-name\": {\n color: \"#9cdcfe\",\n },\n string: {\n color: \"#ce9178\",\n },\n char: {\n color: \"#ce9178\",\n },\n builtin: {\n color: \"#ce9178\",\n },\n deleted: {\n color: \"#ce9178\",\n },\n \".language-css .token.string.url\": {\n textDecoration: \"underline\",\n },\n operator: {\n color: \"#d4d4d4\",\n },\n entity: {\n color: \"#569cd6\",\n },\n \"operator.arrow\": {\n color: \"#569CD6\",\n },\n atrule: {\n color: \"#ce9178\",\n },\n \"atrule.rule\": {\n color: \"#c586c0\",\n },\n \"atrule.url\": {\n color: \"#9cdcfe\",\n },\n \"atrule.url.function\": {\n color: \"#dcdcaa\",\n },\n \"atrule.url.punctuation\": {\n color: \"#d4d4d4\",\n },\n keyword: {\n color: \"#569CD6\",\n },\n \"keyword.module\": {\n color: \"#c586c0\",\n },\n \"keyword.control-flow\": {\n color: \"#c586c0\",\n },\n function: {\n color: \"#dcdcaa\",\n },\n \"function.maybe-class-name\": {\n color: \"#dcdcaa\",\n },\n regex: {\n color: \"#d16969\",\n },\n important: {\n color: \"#569cd6\",\n },\n italic: {\n fontStyle: \"italic\",\n },\n \"class-name\": {\n color: \"#4ec9b0\",\n },\n \"maybe-class-name\": {\n color: \"#4ec9b0\",\n },\n console: {\n color: \"#9cdcfe\",\n },\n parameter: {\n color: \"#9cdcfe\",\n },\n interpolation: {\n color: \"#9cdcfe\",\n },\n \"punctuation.interpolation-punctuation\": {\n color: \"#569cd6\",\n },\n variable: {\n color: \"#9cdcfe\",\n },\n \"imports.maybe-class-name\": {\n color: \"#9cdcfe\",\n },\n \"exports.maybe-class-name\": {\n color: \"#9cdcfe\",\n },\n escape: {\n color: \"#d7ba7d\",\n },\n \"tag.punctuation\": {\n color: \"#808080\",\n },\n cdata: {\n color: \"#808080\",\n },\n \"attr-value\": {\n color: \"#ce9178\",\n },\n \"attr-value.punctuation\": {\n color: \"#ce9178\",\n },\n \"attr-value.punctuation.attr-equals\": {\n color: \"#d4d4d4\",\n },\n namespace: {\n color: \"#4ec9b0\",\n },\n 'pre[class*=\"language-javascript\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-javascript\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-jsx\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-jsx\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-typescript\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-typescript\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-tsx\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-tsx\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-css\"]': {\n color: \"#ce9178\",\n },\n 'code[class*=\"language-css\"]': {\n color: \"#ce9178\",\n },\n 'pre[class*=\"language-html\"]': {\n color: \"#d4d4d4\",\n },\n 'code[class*=\"language-html\"]': {\n color: \"#d4d4d4\",\n },\n \".language-regex .token.anchor\": {\n color: \"#dcdcaa\",\n },\n \".language-html .token.punctuation\": {\n color: \"#808080\",\n },\n 'pre[class*=\"language-\"] > code[class*=\"language-\"]': {\n position: \"relative\",\n zIndex: \"1\",\n },\n \".line-highlight.line-highlight\": {\n background: \"#f7ebc6\",\n boxShadow: \"inset 5px 0 0 #f7d87c\",\n zIndex: \"0\",\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,SAAa,MAAM,UAAU,YAAqB;AA0D1B,cA6ChB,YA7CgB;AAlDxB,IAAM,yBAAyB,KAAK,MAAM,OAAO,8CAA0B,CAAC;AAWrE,IAAM,uBAAoC;AAAA,EAC/C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,GAAG;AAAA,EACH,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA;AAEP;AAEO,IAAM,uBAAuB,CAAC,QAAgB,YAAY,UAAU;AACzE,QAAM,QAAQ;AACd,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,cAAU,MAAM,OAAO,KAAK,MAAM,KAAK,OAAO,IAAI,MAAM,MAAM,CAAC;AAAA,EACjE;AACA,SAAO,YAAY,OAAO,YAAY,IAAI;AAC5C;AAEA,IAAM,oBAAoB,CAAC,UAAkC;AAC3D,QAAM,cAAc,wBAAwB;AAC5C,SAAO,cACL,oBAAC,YAAS,UAAU,oBAAC,mDAA2B,MAAO,GACrD,8BAAC,2CAA2B,MAAO,GACrC,IAEA,oBAAC,mDAA2B,MAAO;AAEvC;AAEA,IAAM,YAAuB,KAAK,CAAC,EAAE,UAAU,MAA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AA,IACnC,OAAO;AAAA,EACT;AAAA,EACA,sCAAsC;AAAA,IACpC,OAAO;AAAA,EACT;AAAA,EACA,8BAA8B;AAAA,IAC5B,OAAO;AAAA,EACT;AAAA,EACA,+BAA+B;AAAA,IAC7B,OAAO;AAAA,EACT;AAAA,EACA,qCAAqC;AAAA,IACnC,OAAO;AAAA,EACT;AAAA,EACA,sCAAsC;AAAA,IACpC,OAAO;AAAA,EACT;AAAA,EACA,8BAA8B;AAAA,IAC5B,OAAO;AAAA,EACT;AAAA,EACA,+BAA+B;AAAA,IAC7B,OAAO;AAAA,EACT;AAAA,EACA,8BAA8B;AAAA,IAC5B,OAAO;AAAA,EACT;AAAA,EACA,+BAA+B;AAAA,IAC7B,OAAO;AAAA,EACT;AAAA,EACA,+BAA+B;AAAA,IAC7B,OAAO;AAAA,EACT;AAAA,EACA,gCAAgC;AAAA,IAC9B,OAAO;AAAA,EACT;AAAA,EACA,iCAAiC;AAAA,IAC/B,OAAO;AAAA,EACT;AAAA,EACA,qCAAqC;AAAA,IACnC,OAAO;AAAA,EACT;AAAA,EACA,sDAAsD;AAAA,IACpD,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,kCAAkC;AAAA,IAChC,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,QAAQ;AAAA,EACV;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LegacyRenderMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JYFHHWPK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useChatContext
|
|
6
6
|
} from "./chunk-IEMQ2SQW.mjs";
|
|
@@ -175,4 +175,4 @@ export {
|
|
|
175
175
|
Messages,
|
|
176
176
|
useScrollToBottom
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
178
|
+
//# sourceMappingURL=chunk-NX77RRNX.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AGR2A5WI.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues
|
|
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
|
|
|
18
18
|
export {
|
|
19
19
|
CopilotPopup
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-O23JBS3R.mjs.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__async
|
|
3
|
+
} from "./chunk-MRXNTQOX.mjs";
|
|
4
|
+
|
|
5
|
+
// src/lib/utils.ts
|
|
6
|
+
function fetcher(input, init) {
|
|
7
|
+
return __async(this, null, function* () {
|
|
8
|
+
const res = yield fetch(input, init);
|
|
9
|
+
if (!res.ok) {
|
|
10
|
+
const json = yield res.json();
|
|
11
|
+
if (json.error) {
|
|
12
|
+
const error = new Error(json.error);
|
|
13
|
+
error.status = res.status;
|
|
14
|
+
throw error;
|
|
15
|
+
} else {
|
|
16
|
+
throw new Error("An unexpected error occurred");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return res.json();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function formatDate(input) {
|
|
23
|
+
const date = new Date(input);
|
|
24
|
+
return date.toLocaleDateString("en-US", {
|
|
25
|
+
month: "long",
|
|
26
|
+
day: "numeric",
|
|
27
|
+
year: "numeric"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
var supportsRegexLookbehind = () => {
|
|
31
|
+
try {
|
|
32
|
+
return new Function("return /(?<=#)\\w+/.test('#tag');")();
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
fetcher,
|
|
40
|
+
formatDate,
|
|
41
|
+
supportsRegexLookbehind
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=chunk-P5XUVVOY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts"],"sourcesContent":["export async function fetcher<JSON = any>(input: RequestInfo, init?: RequestInit): Promise<JSON> {\n const res = await fetch(input, init);\n\n if (!res.ok) {\n const json = await res.json();\n if (json.error) {\n const error = new Error(json.error) as Error & {\n status: number;\n };\n error.status = res.status;\n throw error;\n } else {\n throw new Error(\"An unexpected error occurred\");\n }\n }\n\n return res.json();\n}\n\nexport function formatDate(input: string | number | Date): string {\n const date = new Date(input);\n return date.toLocaleDateString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n });\n}\n\nexport const supportsRegexLookbehind = (): boolean => {\n try {\n return new Function(\"return /(?<=#)\\\\w+/.test('#tag');\")();\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;AAAA,SAAsB,QAAoB,OAAoB,MAAmC;AAAA;AAC/F,UAAM,MAAM,MAAM,MAAM,OAAO,IAAI;AAEnC,QAAI,CAAC,IAAI,IAAI;AACX,YAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,UAAI,KAAK,OAAO;AACd,cAAM,QAAQ,IAAI,MAAM,KAAK,KAAK;AAGlC,cAAM,SAAS,IAAI;AACnB,cAAM;AAAA,MACR,OAAO;AACL,cAAM,IAAI,MAAM,8BAA8B;AAAA,MAChD;AAAA,IACF;AAEA,WAAO,IAAI,KAAK;AAAA,EAClB;AAAA;AAEO,SAAS,WAAW,OAAuC;AAChE,QAAM,OAAO,IAAI,KAAK,KAAK;AAC3B,SAAO,KAAK,mBAAmB,SAAS;AAAA,IACtC,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,0BAA0B,MAAe;AACpD,MAAI;AACF,WAAO,IAAI,SAAS,mCAAmC,EAAE;AAAA,EAC3D,SAAQ,GAAN;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
} from "./chunk-PLHTVHUW.mjs";
|
|
7
7
|
import {
|
|
8
8
|
Input
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FITTF4FJ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Messages
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NX77RRNX.mjs";
|
|
13
13
|
import {
|
|
14
14
|
RenderMessage
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BF7JXE5J.mjs";
|
|
16
16
|
import {
|
|
17
17
|
AssistantMessage
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2NYQ2E5O.mjs";
|
|
19
19
|
import {
|
|
20
20
|
ImageRenderer
|
|
21
21
|
} from "./chunk-DBKRAOH7.mjs";
|
|
@@ -652,4 +652,4 @@ export {
|
|
|
652
652
|
WrappedCopilotChat,
|
|
653
653
|
useCopilotChatLogic
|
|
654
654
|
};
|
|
655
|
-
//# sourceMappingURL=chunk-
|
|
655
|
+
//# sourceMappingURL=chunk-T7IGDWWV.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotDevConsole
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WBPBTTQD.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useChatContext
|
|
6
6
|
} from "./chunk-IEMQ2SQW.mjs";
|
|
@@ -29,4 +29,4 @@ var Header = ({}) => {
|
|
|
29
29
|
export {
|
|
30
30
|
Header
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-V6DDX4LH.mjs.map
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CodeBlock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NSRIQJ6W.mjs";
|
|
4
4
|
import {
|
|
5
|
+
supportsRegexLookbehind
|
|
6
|
+
} from "./chunk-P5XUVVOY.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__async,
|
|
5
9
|
__objRest,
|
|
6
10
|
__spreadProps,
|
|
7
11
|
__spreadValues
|
|
8
12
|
} from "./chunk-MRXNTQOX.mjs";
|
|
9
13
|
|
|
10
14
|
// src/components/chat/Markdown.tsx
|
|
11
|
-
import { memo } from "react";
|
|
15
|
+
import { memo, useEffect, useMemo, useState } from "react";
|
|
12
16
|
import ReactMarkdown from "react-markdown";
|
|
13
|
-
import remarkGfm from "remark-gfm";
|
|
14
17
|
import remarkMath from "remark-math";
|
|
15
18
|
import rehypeRaw from "rehype-raw";
|
|
16
19
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -111,11 +114,35 @@ var MemoizedReactMarkdown = memo(
|
|
|
111
114
|
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.components === nextProps.components
|
|
112
115
|
);
|
|
113
116
|
var Markdown = ({ content, components }) => {
|
|
117
|
+
const baseRemarkPlugins = useMemo(
|
|
118
|
+
() => [[remarkMath, { singleDollarTextMath: false }]],
|
|
119
|
+
[]
|
|
120
|
+
);
|
|
121
|
+
const [remarkPlugins, setRemarkPlugins] = useState(baseRemarkPlugins);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (!supportsRegexLookbehind()) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
let cancelled = false;
|
|
127
|
+
const loadRemarkGfm = () => __async(void 0, null, function* () {
|
|
128
|
+
try {
|
|
129
|
+
const module = yield import("remark-gfm");
|
|
130
|
+
if (!cancelled && (module == null ? void 0 : module.default)) {
|
|
131
|
+
setRemarkPlugins([module.default, ...baseRemarkPlugins]);
|
|
132
|
+
}
|
|
133
|
+
} catch (e) {
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
void loadRemarkGfm();
|
|
137
|
+
return () => {
|
|
138
|
+
cancelled = true;
|
|
139
|
+
};
|
|
140
|
+
}, [baseRemarkPlugins]);
|
|
114
141
|
return /* @__PURE__ */ jsx("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ jsx(
|
|
115
142
|
MemoizedReactMarkdown,
|
|
116
143
|
{
|
|
117
144
|
components: __spreadValues(__spreadValues({}, defaultComponents), components),
|
|
118
|
-
remarkPlugins
|
|
145
|
+
remarkPlugins,
|
|
119
146
|
rehypePlugins: [rehypeRaw],
|
|
120
147
|
children: content
|
|
121
148
|
}
|
|
@@ -125,4 +152,4 @@ var Markdown = ({ content, components }) => {
|
|
|
125
152
|
export {
|
|
126
153
|
Markdown
|
|
127
154
|
};
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
155
|
+
//# sourceMappingURL=chunk-VSULSNL7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Markdown.tsx"],"sourcesContent":["import { FC, memo, useEffect, useMemo, useState } from \"react\";\nimport ReactMarkdown, { Options, Components } from \"react-markdown\";\nimport { CodeBlock } from \"./CodeBlock\";\nimport remarkMath from \"remark-math\";\nimport rehypeRaw from \"rehype-raw\";\nimport { supportsRegexLookbehind } from \"../../lib/utils\";\n\nconst defaultComponents: Components = {\n a({ children, ...props }) {\n return (\n <a className=\"copilotKitMarkdownElement\" {...props} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n },\n // @ts-expect-error -- inline\n code({ children, className, inline, ...props }) {\n if (Array.isArray(children) && children.length) {\n if (children[0] == \"▍\") {\n return (\n <span\n style={{\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n marginTop: \"0.25rem\",\n }}\n >\n ▍\n </span>\n );\n }\n\n children[0] = (children?.[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n // Detect inline code: if it has a language class or contains newlines, it's likely a code block\n // Otherwise, treat it as inline code\n const hasLanguage = match && match[1];\n const content = String(children);\n const hasNewlines = content.includes(\"\\n\");\n const isInline = !hasLanguage && !hasNewlines;\n\n if (isInline) {\n return (\n <code\n className={`copilotKitMarkdownElement copilotKitInlineCode ${className || \"\"}`}\n {...props}\n >\n {children}\n </code>\n );\n }\n\n return (\n <CodeBlock\n key={Math.random()}\n language={(match && match[1]) || \"\"}\n value={String(children).replace(/\\n$/, \"\")}\n {...props}\n />\n );\n },\n h1: ({ children, ...props }) => (\n <h1 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h1>\n ),\n h2: ({ children, ...props }) => (\n <h2 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h2>\n ),\n h3: ({ children, ...props }) => (\n <h3 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h3>\n ),\n h4: ({ children, ...props }) => (\n <h4 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h4>\n ),\n h5: ({ children, ...props }) => (\n <h5 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h5>\n ),\n h6: ({ children, ...props }) => (\n <h6 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h6>\n ),\n p: ({ children, ...props }) => (\n <p className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </p>\n ),\n pre: ({ children, ...props }) => (\n <pre className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </pre>\n ),\n blockquote: ({ children, ...props }) => (\n <blockquote className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </blockquote>\n ),\n ul: ({ children, ...props }) => (\n <ul className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </ul>\n ),\n li: ({ children, ...props }) => (\n <li className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </li>\n ),\n};\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children && prevProps.components === nextProps.components,\n);\n\ntype MarkdownProps = {\n content: string;\n components?: Components;\n};\n\nexport const Markdown = ({ content, components }: MarkdownProps) => {\n type RemarkPluginList = NonNullable<Options[\"remarkPlugins\"]>;\n\n const baseRemarkPlugins = useMemo<RemarkPluginList>(\n () => [[remarkMath, { singleDollarTextMath: false }]],\n [],\n );\n const [remarkPlugins, setRemarkPlugins] = useState<RemarkPluginList>(baseRemarkPlugins);\n\n useEffect(() => {\n if (!supportsRegexLookbehind()) {\n return;\n }\n\n let cancelled = false;\n\n const loadRemarkGfm = async () => {\n try {\n const module = await import(\"remark-gfm\");\n if (!cancelled && module?.default) {\n setRemarkPlugins([module.default, ...baseRemarkPlugins]);\n }\n } catch {\n // Keep fallback plugins when dynamic import fails.\n }\n };\n\n void loadRemarkGfm();\n\n return () => {\n cancelled = true;\n };\n }, [baseRemarkPlugins]);\n\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown\n components={{ ...defaultComponents, ...components }}\n remarkPlugins={remarkPlugins}\n rehypePlugins={[rehypeRaw]}\n >\n {content}\n </MemoizedReactMarkdown>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAa,MAAM,WAAW,SAAS,gBAAgB;AACvD,OAAO,mBAA4C;AAEnD,OAAO,gBAAgB;AACvB,OAAO,eAAe;AAMhB;AAHN,IAAM,oBAAgC;AAAA,EACpC,EAAE,IAAwB;AAAxB,iBAAE,WARN,IAQI,IAAe,kBAAf,IAAe,CAAb;AACF,WACE,oBAAC,oCAAE,WAAU,+BAAgC,QAA5C,EAAmD,QAAO,UAAS,KAAI,uBACrE,WACH;AAAA,EAEJ;AAAA;AAAA,EAEA,KAAK,IAA2C;AAA3C,iBAAE,YAAU,WAAW,OAhB9B,IAgBO,IAAkC,kBAAlC,IAAkC,CAAhC,YAAU,aAAW;AAC1B,QAAI,MAAM,QAAQ,QAAQ,KAAK,SAAS,QAAQ;AAC9C,UAAI,SAAS,CAAC,KAAK,UAAK;AACtB,eACE;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,WAAW;AAAA,cACX,WAAW;AAAA,YACb;AAAA,YACD;AAAA;AAAA,QAED;AAAA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gB,IAAI,SAA2B,iBAAiB;AAEtF,YAAU,MAAM;AACd,QAAI,CAAC,wBAAwB,GAAG;AAC9B;AAAA,IACF;AAEA,QAAI,YAAY;AAEhB,UAAM,gBAAgB,MAAY;AAChC,UAAI;AACF,cAAM,SAAS,MAAM,OAAO,YAAY;AACxC,YAAI,CAAC,cAAa,iCAAQ,UAAS;AACjC,2BAAiB,CAAC,OAAO,SAAS,GAAG,iBAAiB,CAAC;AAAA,QACzD;AAAA,MACF,SAAQ,GAAN;AAAA,MAEF;AAAA,IACF;AAEA,SAAK,cAAc;AAEnB,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,iBAAiB,CAAC;AAEtB,SACE,oBAAC,SAAI,WAAU,sBACb;AAAA,IAAC;AAAA;AAAA,MACC,YAAY,kCAAK,oBAAsB;AAAA,MACvC;AAAA,MACA,eAAe,CAAC,SAAS;AAAA,MAExB;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CopilotKitHelpModal
|
|
3
|
+
} from "./chunk-NRA3CFEE.mjs";
|
|
1
4
|
import {
|
|
2
5
|
CheckIcon,
|
|
3
6
|
ChevronDownIcon,
|
|
@@ -11,9 +14,6 @@ import {
|
|
|
11
14
|
logReadables,
|
|
12
15
|
shouldShowDevConsole
|
|
13
16
|
} from "./chunk-JY2CSDKN.mjs";
|
|
14
|
-
import {
|
|
15
|
-
CopilotKitHelpModal
|
|
16
|
-
} from "./chunk-NRA3CFEE.mjs";
|
|
17
17
|
import {
|
|
18
18
|
SmallSpinnerIcon
|
|
19
19
|
} from "./chunk-XWG3L6QC.mjs";
|
|
@@ -199,4 +199,4 @@ export {
|
|
|
199
199
|
CopilotDevConsole,
|
|
200
200
|
DebugMenuButton
|
|
201
201
|
};
|
|
202
|
-
//# sourceMappingURL=chunk-
|
|
202
|
+
//# sourceMappingURL=chunk-WBPBTTQD.mjs.map
|