@copilotkit/react-ui 0.14.0-alpha.5 → 0.14.1-alpha.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 (143) hide show
  1. package/.turbo/turbo-build.log +80 -80
  2. package/CHANGELOG.md +31 -0
  3. package/dist/chunk-2KAF7NKC.mjs +484 -0
  4. package/dist/chunk-2KAF7NKC.mjs.map +1 -0
  5. package/dist/chunk-5KEDV5VC.mjs +27 -0
  6. package/dist/chunk-5KEDV5VC.mjs.map +1 -0
  7. package/dist/chunk-6LAZQHEB.mjs +129 -0
  8. package/dist/chunk-6LAZQHEB.mjs.map +1 -0
  9. package/dist/chunk-7NSRDJ5C.mjs +3 -0
  10. package/dist/chunk-7NSRDJ5C.mjs.map +1 -0
  11. package/dist/chunk-C34L4AWW.mjs +39 -0
  12. package/dist/chunk-C34L4AWW.mjs.map +1 -0
  13. package/dist/chunk-CF3BK4OX.mjs +53 -0
  14. package/dist/chunk-CF3BK4OX.mjs.map +1 -0
  15. package/dist/chunk-CNQX2VY3.mjs +66 -0
  16. package/dist/chunk-CNQX2VY3.mjs.map +1 -0
  17. package/dist/chunk-GCOPYGHH.mjs +27 -0
  18. package/dist/chunk-GCOPYGHH.mjs.map +1 -0
  19. package/dist/chunk-H4VKQGVU.mjs +3 -0
  20. package/dist/chunk-H4VKQGVU.mjs.map +1 -0
  21. package/dist/chunk-IJLMKBSZ.mjs +25 -0
  22. package/dist/chunk-IJLMKBSZ.mjs.map +1 -0
  23. package/dist/chunk-INCNMGJ7.mjs +72 -0
  24. package/dist/chunk-INCNMGJ7.mjs.map +1 -0
  25. package/dist/chunk-IU3WTXLQ.mjs +3 -0
  26. package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
  27. package/dist/chunk-M3CZWJI3.mjs +44 -0
  28. package/dist/chunk-M3CZWJI3.mjs.map +1 -0
  29. package/dist/chunk-MC6KTH4X.mjs +12 -0
  30. package/dist/chunk-MC6KTH4X.mjs.map +1 -0
  31. package/dist/chunk-MRXNTQOX.mjs +55 -0
  32. package/dist/chunk-MRXNTQOX.mjs.map +1 -0
  33. package/dist/chunk-OHWEJUCS.mjs +18 -0
  34. package/dist/chunk-OHWEJUCS.mjs.map +1 -0
  35. package/dist/chunk-OOBQC5H6.mjs +34 -0
  36. package/dist/chunk-OOBQC5H6.mjs.map +1 -0
  37. package/dist/chunk-POVINPXX.mjs +26 -0
  38. package/dist/chunk-POVINPXX.mjs.map +1 -0
  39. package/dist/chunk-Q6YO7LDK.mjs +40 -0
  40. package/dist/chunk-Q6YO7LDK.mjs.map +1 -0
  41. package/dist/chunk-RPTRCFSO.mjs +42 -0
  42. package/dist/chunk-RPTRCFSO.mjs.map +1 -0
  43. package/dist/chunk-SEH5PQVW.mjs +52 -0
  44. package/dist/chunk-SEH5PQVW.mjs.map +1 -0
  45. package/dist/chunk-SHOTWRKC.mjs +18 -0
  46. package/dist/chunk-SHOTWRKC.mjs.map +1 -0
  47. package/dist/chunk-SRBUGQTM.mjs +109 -0
  48. package/dist/chunk-SRBUGQTM.mjs.map +1 -0
  49. package/dist/chunk-TEYIQHMK.mjs +12 -0
  50. package/dist/chunk-TEYIQHMK.mjs.map +1 -0
  51. package/dist/chunk-U6NJWGTV.mjs +3 -0
  52. package/dist/chunk-U6NJWGTV.mjs.map +1 -0
  53. package/dist/chunk-VGX2W5ZB.mjs +28 -0
  54. package/dist/chunk-VGX2W5ZB.mjs.map +1 -0
  55. package/dist/chunk-XGUBRIUV.mjs +72 -0
  56. package/dist/chunk-XGUBRIUV.mjs.map +1 -0
  57. package/dist/chunk-ZYC5YVDO.mjs +21 -0
  58. package/dist/chunk-ZYC5YVDO.mjs.map +1 -0
  59. package/dist/components/chat-components/chat-list.mjs +12 -440
  60. package/dist/components/chat-components/chat-list.mjs.map +1 -1
  61. package/dist/components/chat-components/chat-message-actions.mjs +7 -168
  62. package/dist/components/chat-components/chat-message-actions.mjs.map +1 -1
  63. package/dist/components/chat-components/chat-message.mjs +10 -403
  64. package/dist/components/chat-components/chat-message.mjs.map +1 -1
  65. package/dist/components/chat-components/chat-panel.mjs +9 -301
  66. package/dist/components/chat-components/chat-panel.mjs.map +1 -1
  67. package/dist/components/chat-components/chat-scroll-anchor.mjs +4 -44
  68. package/dist/components/chat-components/chat-scroll-anchor.mjs.map +1 -1
  69. package/dist/components/chat-components/clear-history.mjs +25 -249
  70. package/dist/components/chat-components/clear-history.mjs.map +1 -1
  71. package/dist/components/chat-components/copilot-chat.mjs +21 -809
  72. package/dist/components/chat-components/copilot-chat.mjs.map +1 -1
  73. package/dist/components/chat-components/default-empty-screen.mjs +7 -175
  74. package/dist/components/chat-components/default-empty-screen.mjs.map +1 -1
  75. package/dist/components/chat-components/external-link.mjs +3 -25
  76. package/dist/components/chat-components/external-link.mjs.map +1 -1
  77. package/dist/components/chat-components/markdown.mjs +3 -10
  78. package/dist/components/chat-components/markdown.mjs.map +1 -1
  79. package/dist/components/chat-components/prompt-form.mjs +8 -227
  80. package/dist/components/chat-components/prompt-form.mjs.map +1 -1
  81. package/dist/components/chat-components/theme-toggle.mjs +14 -130
  82. package/dist/components/chat-components/theme-toggle.mjs.map +1 -1
  83. package/dist/components/chat-components/toaster.mjs +3 -7
  84. package/dist/components/chat-components/toaster.mjs.map +1 -1
  85. package/dist/components/chat-components/ui/alert-dialog.mjs +5 -199
  86. package/dist/components/chat-components/ui/alert-dialog.mjs.map +1 -1
  87. package/dist/components/chat-components/ui/badge.mjs +7 -49
  88. package/dist/components/chat-components/ui/badge.mjs.map +1 -1
  89. package/dist/components/chat-components/ui/button.mjs +4 -85
  90. package/dist/components/chat-components/ui/button.mjs.map +1 -1
  91. package/dist/components/chat-components/ui/codeblock.mjs +7 -283
  92. package/dist/components/chat-components/ui/codeblock.mjs.map +1 -1
  93. package/dist/components/chat-components/ui/dialog.mjs +25 -93
  94. package/dist/components/chat-components/ui/dialog.mjs.map +1 -1
  95. package/dist/components/chat-components/ui/dropdown-menu.mjs +8 -61
  96. package/dist/components/chat-components/ui/dropdown-menu.mjs.map +1 -1
  97. package/dist/components/chat-components/ui/icons.mjs +4 -554
  98. package/dist/components/chat-components/ui/icons.mjs.map +1 -1
  99. package/dist/components/chat-components/ui/input.mjs +7 -48
  100. package/dist/components/chat-components/ui/input.mjs.map +1 -1
  101. package/dist/components/chat-components/ui/label.mjs +9 -51
  102. package/dist/components/chat-components/ui/label.mjs.map +1 -1
  103. package/dist/components/chat-components/ui/select.mjs +23 -106
  104. package/dist/components/chat-components/ui/select.mjs.map +1 -1
  105. package/dist/components/chat-components/ui/separator.mjs +4 -68
  106. package/dist/components/chat-components/ui/separator.mjs.map +1 -1
  107. package/dist/components/chat-components/ui/sheet.mjs +23 -92
  108. package/dist/components/chat-components/ui/sheet.mjs.map +1 -1
  109. package/dist/components/chat-components/ui/switch.mjs +8 -53
  110. package/dist/components/chat-components/ui/switch.mjs.map +1 -1
  111. package/dist/components/chat-components/ui/textarea.mjs +7 -48
  112. package/dist/components/chat-components/ui/textarea.mjs.map +1 -1
  113. package/dist/components/chat-components/ui/tooltip.mjs +4 -72
  114. package/dist/components/chat-components/ui/tooltip.mjs.map +1 -1
  115. package/dist/components/index.mjs +25 -925
  116. package/dist/components/index.mjs.map +1 -1
  117. package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +24 -920
  118. package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs.map +1 -1
  119. package/dist/components/sidebar/copilot-sidebar.mjs +22 -842
  120. package/dist/components/sidebar/copilot-sidebar.mjs.map +1 -1
  121. package/dist/components/sidebar/sidebar-context.mjs +3 -10
  122. package/dist/components/sidebar/sidebar-context.mjs.map +1 -1
  123. package/dist/context/index.mjs +2 -0
  124. package/dist/context/index.mjs.map +1 -1
  125. package/dist/hooks/index.mjs +2 -0
  126. package/dist/hooks/index.mjs.map +1 -1
  127. package/dist/hooks/use-at-bottom.mjs +3 -19
  128. package/dist/hooks/use-at-bottom.mjs.map +1 -1
  129. package/dist/hooks/use-copy-to-clipboard.mjs +3 -26
  130. package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -1
  131. package/dist/hooks/use-enter-submit.mjs +3 -16
  132. package/dist/hooks/use-enter-submit.mjs.map +1 -1
  133. package/dist/index.mjs +28 -925
  134. package/dist/index.mjs.map +1 -1
  135. package/dist/lib/utils.mjs +3 -62
  136. package/dist/lib/utils.mjs.map +1 -1
  137. package/dist/lib/utils.test.mjs +1 -0
  138. package/dist/lib/utils.test.mjs.map +1 -1
  139. package/dist/types/index.mjs +2 -0
  140. package/dist/types/index.mjs.map +1 -1
  141. package/dist/types/types.mjs +2 -0
  142. package/dist/types/types.mjs.map +1 -1
  143. package/package.json +4 -4
@@ -0,0 +1,129 @@
1
+ import { Button } from './chunk-M3CZWJI3.mjs';
2
+ import { IconDownload, IconCheck, IconCopy } from './chunk-2KAF7NKC.mjs';
3
+ import { useCopyToClipboard } from './chunk-POVINPXX.mjs';
4
+ import { memo } from 'react';
5
+ import { Prism } from 'react-syntax-highlighter';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
8
+ var programmingLanguages = {
9
+ javascript: ".js",
10
+ python: ".py",
11
+ java: ".java",
12
+ c: ".c",
13
+ cpp: ".cpp",
14
+ "c++": ".cpp",
15
+ "c#": ".cs",
16
+ ruby: ".rb",
17
+ php: ".php",
18
+ swift: ".swift",
19
+ "objective-c": ".m",
20
+ kotlin: ".kt",
21
+ typescript: ".ts",
22
+ go: ".go",
23
+ perl: ".pl",
24
+ rust: ".rs",
25
+ scala: ".scala",
26
+ haskell: ".hs",
27
+ lua: ".lua",
28
+ shell: ".sh",
29
+ sql: ".sql",
30
+ html: ".html",
31
+ css: ".css"
32
+ // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
33
+ };
34
+ var generateRandomString = (length, lowercase = false) => {
35
+ const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
36
+ let result = "";
37
+ for (let i = 0; i < length; i++) {
38
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
39
+ }
40
+ return lowercase ? result.toLowerCase() : result;
41
+ };
42
+ var CodeBlock = memo(({ language, value }) => {
43
+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
44
+ const downloadAsFile = () => {
45
+ if (typeof window === "undefined") {
46
+ return;
47
+ }
48
+ const fileExtension = programmingLanguages[language] || ".file";
49
+ const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
50
+ const fileName = window.prompt("Enter file name", suggestedFileName);
51
+ if (!fileName) {
52
+ return;
53
+ }
54
+ const blob = new Blob([value], { type: "text/plain" });
55
+ const url = URL.createObjectURL(blob);
56
+ const link = document.createElement("a");
57
+ link.download = fileName;
58
+ link.href = url;
59
+ link.style.display = "none";
60
+ document.body.appendChild(link);
61
+ link.click();
62
+ document.body.removeChild(link);
63
+ URL.revokeObjectURL(url);
64
+ };
65
+ const onCopy = () => {
66
+ if (isCopied)
67
+ return;
68
+ copyToClipboard(value);
69
+ };
70
+ return /* @__PURE__ */ jsxs("div", { className: "codeblock relative w-full bg-zinc-950 font-sans", children: [
71
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100", children: [
72
+ /* @__PURE__ */ jsx("span", { className: "text-xs lowercase", children: language }),
73
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
74
+ /* @__PURE__ */ jsxs(
75
+ Button,
76
+ {
77
+ variant: "ghost",
78
+ className: "hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",
79
+ onClick: downloadAsFile,
80
+ size: "icon",
81
+ children: [
82
+ /* @__PURE__ */ jsx(IconDownload, {}),
83
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Download" })
84
+ ]
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsxs(
88
+ Button,
89
+ {
90
+ variant: "ghost",
91
+ size: "icon",
92
+ className: "text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",
93
+ onClick: onCopy,
94
+ children: [
95
+ isCopied ? /* @__PURE__ */ jsx(IconCheck, {}) : /* @__PURE__ */ jsx(IconCopy, {}),
96
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Copy code" })
97
+ ]
98
+ }
99
+ )
100
+ ] })
101
+ ] }),
102
+ /* @__PURE__ */ jsx(
103
+ Prism,
104
+ {
105
+ language,
106
+ PreTag: "div",
107
+ showLineNumbers: true,
108
+ customStyle: {
109
+ margin: 0,
110
+ width: "100%",
111
+ background: "transparent",
112
+ padding: "1.5rem 1rem"
113
+ },
114
+ codeTagProps: {
115
+ style: {
116
+ fontSize: "0.9rem",
117
+ fontFamily: "var(--font-mono)"
118
+ }
119
+ },
120
+ children: value
121
+ }
122
+ )
123
+ ] });
124
+ });
125
+ CodeBlock.displayName = "CodeBlock";
126
+
127
+ export { CodeBlock, generateRandomString, programmingLanguages };
128
+ //# sourceMappingURL=out.js.map
129
+ //# sourceMappingURL=chunk-6LAZQHEB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat-components/ui/codeblock.tsx"],"names":[],"mappings":"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","sourcesContent":["\"use client\";\n\nimport { FC, memo } from \"react\";\nimport { Prism as SyntaxHighlighter } from \"react-syntax-highlighter\";\n\nimport { useCopyToClipboard } from \"../../../hooks/use-copy-to-clipboard\";\nimport { IconCheck, IconCopy, IconDownload } from \"./icons\";\nimport { Button } from \"./button\";\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 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=\"codeblock relative w-full bg-zinc-950 font-sans\">\n <div className=\"flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100\">\n <span className=\"text-xs lowercase\">{language}</span>\n <div className=\"flex items-center space-x-1\">\n <Button\n variant=\"ghost\"\n className=\"hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0\"\n onClick={downloadAsFile}\n size=\"icon\"\n >\n <IconDownload />\n <span className=\"sr-only\">Download</span>\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0\"\n onClick={onCopy}\n >\n {isCopied ? <IconCheck /> : <IconCopy />}\n <span className=\"sr-only\">Copy code</span>\n </Button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n PreTag=\"div\"\n showLineNumbers\n customStyle={{\n margin: 0,\n width: \"100%\",\n background: \"transparent\",\n padding: \"1.5rem 1rem\",\n }}\n codeTagProps={{\n style: {\n fontSize: \"0.9rem\",\n fontFamily: \"var(--font-mono)\",\n },\n }}\n >\n {value}\n </SyntaxHighlighter>\n </div>\n );\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nexport { CodeBlock };\n"]}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=chunk-7NSRDJ5C.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { CopilotChat } from './chunk-RPTRCFSO.mjs';
2
+ import { __spreadValues } from './chunk-MRXNTQOX.mjs';
3
+ import { XMarkIcon } from '@heroicons/react/24/outline';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ function CopilotSidebar(props) {
7
+ return /* @__PURE__ */ jsxs(
8
+ "div",
9
+ {
10
+ className: "shadow-lg bg-gray-50 flex flex-col border-l-2",
11
+ style: { width: "100%", height: "100%" },
12
+ children: [
13
+ /* @__PURE__ */ jsx(TopBar, __spreadValues({}, props)),
14
+ /* @__PURE__ */ jsx(CopilotChat, {})
15
+ ]
16
+ }
17
+ );
18
+ }
19
+ function TopBar(props) {
20
+ return /* @__PURE__ */ jsxs("div", { className: "py-6 flex bg-gray-50 items-center justify-between px-4", children: [
21
+ /* @__PURE__ */ jsx("h1", { className: "text-base font-semibold leading-6 text-gray-900", children: "Copilot Chat" }),
22
+ /* @__PURE__ */ jsx("div", { className: "ml-3 flex h-7 items-center", children: /* @__PURE__ */ jsxs(
23
+ "button",
24
+ {
25
+ type: "button",
26
+ className: "rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",
27
+ onClick: () => props.setSidebarOpen(false),
28
+ children: [
29
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close panel" }),
30
+ /* @__PURE__ */ jsx(XMarkIcon, { className: "h-6 w-6", "aria-hidden": "true" })
31
+ ]
32
+ }
33
+ ) })
34
+ ] });
35
+ }
36
+
37
+ export { CopilotSidebar };
38
+ //# sourceMappingURL=out.js.map
39
+ //# sourceMappingURL=chunk-C34L4AWW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/sidebar/copilot-sidebar.tsx"],"names":[],"mappings":";;;;;;;;AAmBA,SAAS,iBAAiB;AAVtB,SAIE,KAJF;AAFG,SAAS,eAAe,OAAkC;AAC/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAO;AAAA,MAEvC;AAAA,4BAAC,2BAAW,MAAO;AAAA,QACnB,oBAAC,eAAY;AAAA;AAAA;AAAA,EACf;AAEJ;AAIA,SAAS,OAAO,OAAkC;AAChD,SACE,qBAAC,SAAI,WAAU,0DACb;AAAA,wBAAC,QAAG,WAAU,mDAAkD,0BAAY;AAAA,IAC5E,oBAAC,SAAI,WAAU,8BACb;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,WAAU;AAAA,QACV,SAAS,MAAM,MAAM,eAAe,KAAK;AAAA,QAEzC;AAAA,8BAAC,UAAK,WAAU,WAAU,yBAAW;AAAA,UACrC,oBAAC,aAAU,WAAU,WAAU,eAAY,QAAO;AAAA;AAAA;AAAA,IACpD,GACF;AAAA,KACF;AAEJ","sourcesContent":["import React from \"react\";\nimport { CopilotChat } from \"../chat-components/copilot-chat\";\n\nexport interface SidebarProps {\n setSidebarOpen: (open: boolean) => void;\n}\n\nexport function CopilotSidebar(props: SidebarProps): JSX.Element {\n return (\n <div\n className=\"shadow-lg bg-gray-50 flex flex-col border-l-2\"\n style={{ width: \"100%\", height: \"100%\" }}\n >\n <TopBar {...props} />\n <CopilotChat />\n </div>\n );\n}\n\nimport { XMarkIcon } from \"@heroicons/react/24/outline\";\n\nfunction TopBar(props: SidebarProps): JSX.Element {\n return (\n <div className=\"py-6 flex bg-gray-50 items-center justify-between px-4\">\n <h1 className=\"text-base font-semibold leading-6 text-gray-900\">Copilot Chat</h1>\n <div className=\"ml-3 flex h-7 items-center\">\n <button\n type=\"button\"\n className=\"rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2\"\n onClick={() => props.setSidebarOpen(false)}\n >\n <span className=\"sr-only\">Close panel</span>\n <XMarkIcon className=\"h-6 w-6\" aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n );\n}\n"]}
@@ -0,0 +1,53 @@
1
+ import { PromptForm } from './chunk-INCNMGJ7.mjs';
2
+ import { Button } from './chunk-M3CZWJI3.mjs';
3
+ import { IconStop, IconRefresh } from './chunk-2KAF7NKC.mjs';
4
+ import { __async } from './chunk-MRXNTQOX.mjs';
5
+ import { nanoid } from 'nanoid';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
+
8
+ function ChatPanel({
9
+ id,
10
+ isLoading,
11
+ stop,
12
+ append,
13
+ reload,
14
+ input,
15
+ setInput,
16
+ messages
17
+ }) {
18
+ return /* @__PURE__ */ jsx(
19
+ "div",
20
+ {
21
+ className: "inset-x-0 bottom-0 bg-gradient-to-b from-muted/10 from-10% to-muted/30 to-50% mt-4 mb-8",
22
+ style: { width: "100%", overflow: "hidden", boxSizing: "border-box" },
23
+ children: /* @__PURE__ */ jsxs("div", { className: "mx-auto sm:max-w-2xl sm:px-4", children: [
24
+ /* @__PURE__ */ jsx("div", { className: "flex h-10 items-center justify-center mb-4", children: isLoading ? /* @__PURE__ */ jsxs(Button, { variant: "outline", onClick: () => stop(), className: "bg-background", children: [
25
+ /* @__PURE__ */ jsx(IconStop, { className: "mr-2" }),
26
+ "Stop generating"
27
+ ] }) : (messages == null ? void 0 : messages.length) > 0 && /* @__PURE__ */ jsxs(Button, { variant: "outline", onClick: () => reload(), className: "bg-background", children: [
28
+ /* @__PURE__ */ jsx(IconRefresh, { className: "mr-2" }),
29
+ "Regenerate response"
30
+ ] }) }),
31
+ /* @__PURE__ */ jsx("div", { className: "space-y-4 border-2 bg-background px-4 py-2 shadow-lg sm:rounded-xl md:py-4", children: /* @__PURE__ */ jsx(
32
+ PromptForm,
33
+ {
34
+ onSubmit: (value) => __async(this, null, function* () {
35
+ yield append({
36
+ id: id || nanoid(),
37
+ content: value,
38
+ role: "user"
39
+ });
40
+ }),
41
+ input,
42
+ setInput,
43
+ isLoading
44
+ }
45
+ ) })
46
+ ] })
47
+ }
48
+ );
49
+ }
50
+
51
+ export { ChatPanel };
52
+ //# sourceMappingURL=out.js.map
53
+ //# sourceMappingURL=chunk-CF3BK4OX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat-components/chat-panel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,SAAS,cAAc;AA4BX,SACE,KADF;AAlBL,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAmB;AACjB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO,EAAE,OAAO,QAAQ,UAAU,UAAU,WAAW,aAAa;AAAA,MAEpE,+BAAC,SAAI,WAAU,gCACb;AAAA,4BAAC,SAAI,WAAU,8CACZ,sBACC,qBAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,KAAK,GAAG,WAAU,iBACzD;AAAA,8BAAC,YAAS,WAAU,QAAO;AAAA,UAAE;AAAA,WAE/B,KAEA,qCAAU,UAAS,KACjB,qBAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,OAAO,GAAG,WAAU,iBAC3D;AAAA,8BAAC,eAAY,WAAU,QAAO;AAAA,UAAE;AAAA,WAElC,GAGN;AAAA,QACA,oBAAC,SAAI,WAAU,8EACb;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,CAAO,UAAU;AACzB,oBAAM,OAAO;AAAA,gBACX,IAAI,MAAM,OAAO;AAAA,gBACjB,SAAS;AAAA,gBACT,MAAM;AAAA,cACR,CAAC;AAAA,YACH;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF,GACF;AAAA,SACF;AAAA;AAAA,EACF;AAEJ","sourcesContent":["import { type UseChatHelpers } from \"@copilotkit/react-core\";\n\nimport { Button } from \"./ui/button\";\nimport { PromptForm } from \"./prompt-form\";\nimport { IconRefresh, IconStop } from \"./ui/icons\";\nimport { nanoid } from \"nanoid\";\n\nexport interface ChatPanelProps\n extends Pick<\n UseChatHelpers,\n \"append\" | \"isLoading\" | \"reload\" | \"messages\" | \"stop\" | \"input\" | \"setInput\"\n > {\n id?: string;\n}\n\nexport function ChatPanel({\n id,\n isLoading,\n stop,\n append,\n reload,\n input,\n setInput,\n messages,\n}: ChatPanelProps) {\n return (\n <div\n className=\"inset-x-0 bottom-0 bg-gradient-to-b from-muted/10 from-10% to-muted/30 to-50% mt-4 mb-8\"\n style={{ width: \"100%\", overflow: \"hidden\", boxSizing: \"border-box\" }}\n >\n <div className=\"mx-auto sm:max-w-2xl sm:px-4\">\n <div className=\"flex h-10 items-center justify-center mb-4\">\n {isLoading ? (\n <Button variant=\"outline\" onClick={() => stop()} className=\"bg-background\">\n <IconStop className=\"mr-2\" />\n Stop generating\n </Button>\n ) : (\n messages?.length > 0 && (\n <Button variant=\"outline\" onClick={() => reload()} className=\"bg-background\">\n <IconRefresh className=\"mr-2\" />\n Regenerate response\n </Button>\n )\n )}\n </div>\n <div className=\"space-y-4 border-2 bg-background px-4 py-2 shadow-lg sm:rounded-xl md:py-4\">\n <PromptForm\n onSubmit={async (value) => {\n await append({\n id: id || nanoid(),\n content: value,\n role: \"user\",\n });\n }}\n input={input}\n setInput={setInput}\n isLoading={isLoading}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
@@ -0,0 +1,66 @@
1
+ import { CodeBlock } from './chunk-6LAZQHEB.mjs';
2
+ import { MemoizedReactMarkdown } from './chunk-TEYIQHMK.mjs';
3
+ import { ChatMessageActions } from './chunk-OOBQC5H6.mjs';
4
+ import { IconUser, IconOpenAI } from './chunk-2KAF7NKC.mjs';
5
+ import { cn } from './chunk-Q6YO7LDK.mjs';
6
+ import { __objRest, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
7
+ import remarkGfm from 'remark-gfm';
8
+ import remarkMath from 'remark-math';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
+
11
+ function ChatMessage(_a) {
12
+ var _b = _a, { message } = _b, props = __objRest(_b, ["message"]);
13
+ return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: cn("group relative mb-4 flex items-start") }, props), { children: [
14
+ /* @__PURE__ */ jsx(
15
+ "div",
16
+ {
17
+ className: cn(
18
+ "flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow",
19
+ message.role === "user" ? "bg-background" : "bg-primary text-primary-foreground"
20
+ ),
21
+ children: message.role === "user" ? /* @__PURE__ */ jsx(IconUser, {}) : /* @__PURE__ */ jsx(IconOpenAI, {})
22
+ }
23
+ ),
24
+ /* @__PURE__ */ jsxs("div", { className: "ml-4 flex-1 space-y-2 overflow-hidden px-1", children: [
25
+ /* @__PURE__ */ jsx(
26
+ MemoizedReactMarkdown,
27
+ {
28
+ className: "prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm",
29
+ remarkPlugins: [remarkGfm, remarkMath],
30
+ components: {
31
+ p({ children }) {
32
+ return /* @__PURE__ */ jsx("p", { className: "mb-2 last:mb-0", children });
33
+ },
34
+ code(_a2) {
35
+ var _b2 = _a2, { children, className, inline } = _b2, props2 = __objRest(_b2, ["children", "className", "inline"]);
36
+ if (children.length) {
37
+ if (children[0] == "\u258D") {
38
+ return /* @__PURE__ */ jsx("span", { className: "mt-1 animate-pulse cursor-default", children: "\u258D" });
39
+ }
40
+ children[0] = children[0].replace("`\u258D`", "\u258D");
41
+ }
42
+ const match = /language-(\w+)/.exec(className || "");
43
+ if (inline) {
44
+ return /* @__PURE__ */ jsx("code", __spreadProps(__spreadValues({ className }, props2), { children }));
45
+ }
46
+ return /* @__PURE__ */ jsx(
47
+ CodeBlock,
48
+ __spreadValues({
49
+ language: match && match[1] || "",
50
+ value: String(children).replace(/\n$/, "")
51
+ }, props2),
52
+ Math.random()
53
+ );
54
+ }
55
+ },
56
+ children: message.content
57
+ }
58
+ ),
59
+ /* @__PURE__ */ jsx(ChatMessageActions, { message })
60
+ ] })
61
+ ] }));
62
+ }
63
+
64
+ export { ChatMessage };
65
+ //# sourceMappingURL=out.js.map
66
+ //# sourceMappingURL=chunk-CNQX2VY3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat-components/chat-message.tsx"],"names":["_a","_b","props"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,eAAe;AACtB,OAAO,gBAAgB;AAqBY,cAE7B,YAF6B;AAT5B,SAAS,YAAY,IAAyC;AAAzC,eAAE,UAd9B,IAc4B,IAAc,kBAAd,IAAc,CAAZ;AAC5B,SACE,qBAAC,sCAAI,WAAW,GAAG,sCAAsC,KAAO,QAA/D,EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,QAAQ,SAAS,SAAS,kBAAkB;AAAA,QAC9C;AAAA,QAEC,kBAAQ,SAAS,SAAS,oBAAC,YAAS,IAAK,oBAAC,cAAW;AAAA;AAAA,IACxD;AAAA,IACA,qBAAC,SAAI,WAAU,8CACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,eAAe,CAAC,WAAW,UAAU;AAAA,UACrC,YAAY;AAAA,YACV,EAAE,EAAE,SAAS,GAAG;AACd,qBAAO,oBAAC,OAAE,WAAU,kBAAkB,UAAS;AAAA,YACjD;AAAA,YACA,KAAKA,KAA2C;AAA3C,kBAAAC,MAAAD,KAAE,YAAU,WAAW,OAjCxC,IAiCiBC,KAAkCC,SAAA,UAAlCD,KAAkC,CAAhC,YAAU,aAAW;AAC1B,kBAAI,SAAS,QAAQ;AACnB,oBAAI,SAAS,CAAC,KAAK,UAAK;AACtB,yBAAO,oBAAC,UAAK,WAAU,qCAAoC,oBAAC;AAAA,gBAC9D;AAEA,yBAAS,CAAC,IAAK,SAAS,CAAC,EAAa,QAAQ,YAAO,QAAG;AAAA,cAC1D;AAEA,oBAAM,QAAQ,iBAAiB,KAAK,aAAa,EAAE;AAEnD,kBAAI,QAAQ;AACV,uBACE,oBAAC,uCAAK,aAA0BC,SAA/B,EACE,WACH;AAAA,cAEJ;AAEA,qBACE;AAAA,gBAAC;AAAA;AAAA,kBAEC,UAAW,SAAS,MAAM,CAAC,KAAM;AAAA,kBACjC,OAAO,OAAO,QAAQ,EAAE,QAAQ,OAAO,EAAE;AAAA,mBACrCA;AAAA,gBAHC,KAAK,OAAO;AAAA,cAInB;AAAA,YAEJ;AAAA,UACF;AAAA,UAEC,kBAAQ;AAAA;AAAA,MACX;AAAA,MACA,oBAAC,sBAAmB,SAAkB;AAAA,OACxC;AAAA,MACF;AAEJ","sourcesContent":["import { Message } from \"@copilotkit/react-core\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\n\nimport { cn } from \"../../lib/utils\";\nimport { CodeBlock } from \"./ui/codeblock\";\nimport { MemoizedReactMarkdown } from \"./markdown\";\nimport { IconOpenAI, IconUser } from \"./ui/icons\";\nimport { ChatMessageActions } from \"./chat-message-actions\";\n\nexport interface ChatMessageProps {\n message: Message;\n}\n\nexport function ChatMessage({ message, ...props }: ChatMessageProps) {\n return (\n <div className={cn(\"group relative mb-4 flex items-start\")} {...props}>\n <div\n className={cn(\n \"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow\",\n message.role === \"user\" ? \"bg-background\" : \"bg-primary text-primary-foreground\",\n )}\n >\n {message.role === \"user\" ? <IconUser /> : <IconOpenAI />}\n </div>\n <div className=\"ml-4 flex-1 space-y-2 overflow-hidden px-1\">\n <MemoizedReactMarkdown\n className=\"prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm\"\n remarkPlugins={[remarkGfm, remarkMath]}\n components={{\n p({ children }) {\n return <p className=\"mb-2 last:mb-0\">{children}</p>;\n },\n code({ children, className, inline, ...props }) {\n if (children.length) {\n if (children[0] == \"▍\") {\n return <span className=\"mt-1 animate-pulse cursor-default\">▍</span>;\n }\n\n children[0] = (children[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n if (inline) {\n return (\n <code className={className} {...props}>\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 }}\n >\n {message.content}\n </MemoizedReactMarkdown>\n <ChatMessageActions message={message} />\n </div>\n </div>\n );\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { cn } from './chunk-Q6YO7LDK.mjs';
2
+ import { __objRest, __spreadValues } from './chunk-MRXNTQOX.mjs';
3
+ import * as React from 'react';
4
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var Separator = React.forwardRef((_a, ref) => {
8
+ var _b = _a, { className, orientation = "horizontal", decorative = true } = _b, props = __objRest(_b, ["className", "orientation", "decorative"]);
9
+ return /* @__PURE__ */ jsx(
10
+ SeparatorPrimitive.Root,
11
+ __spreadValues({
12
+ ref,
13
+ decorative,
14
+ orientation,
15
+ className: cn(
16
+ "shrink-0 bg-border",
17
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
18
+ className
19
+ )
20
+ }, props)
21
+ );
22
+ });
23
+ Separator.displayName = SeparatorPrimitive.Root.displayName;
24
+
25
+ export { Separator };
26
+ //# sourceMappingURL=out.js.map
27
+ //# sourceMappingURL=chunk-GCOPYGHH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat-components/ui/separator.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AACvB,YAAY,wBAAwB;AAQlC;AAJF,IAAM,YAAkB,iBAGtB,CAAC,IAAwE,QAAK;AAA7E,eAAE,aAAW,cAAc,cAAc,aAAa,KAVzD,IAUG,IAA+D,kBAA/D,IAA+D,CAA7D,aAAW,eAA4B;AAC1C;AAAA,IAAoB;AAAA,IAAnB;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,gBAAgB,eAAe,mBAAmB;AAAA,QAClD;AAAA,MACF;AAAA,OACI;AAAA,EACN;AAAA,CACD;AACD,UAAU,cAAiC,wBAAK","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-[1px] w-full\" : \"h-full w-[1px]\",\n className,\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n\nexport { Separator };\n"]}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=chunk-H4VKQGVU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { useAtBottom } from './chunk-ZYC5YVDO.mjs';
2
+ import * as React from 'react';
3
+ import { useInView } from 'react-intersection-observer';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ function ChatScrollAnchor({ trackVisibility }) {
7
+ const isAtBottom = useAtBottom();
8
+ const { ref, entry, inView } = useInView({
9
+ trackVisibility,
10
+ delay: 100,
11
+ rootMargin: "0px 0px -150px 0px"
12
+ });
13
+ React.useEffect(() => {
14
+ if (isAtBottom && trackVisibility && !inView) {
15
+ entry == null ? void 0 : entry.target.scrollIntoView({
16
+ block: "start"
17
+ });
18
+ }
19
+ }, [inView, entry, isAtBottom, trackVisibility]);
20
+ return /* @__PURE__ */ jsx("div", { ref, className: "h-px w-full" });
21
+ }
22
+
23
+ export { ChatScrollAnchor };
24
+ //# sourceMappingURL=out.js.map
25
+ //# sourceMappingURL=chunk-IJLMKBSZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat-components/chat-scroll-anchor.tsx"],"names":[],"mappings":";;;;;AAEA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAwBjB;AAhBF,SAAS,iBAAiB,EAAE,gBAAgB,GAA0B;AAC3E,QAAM,aAAa,YAAY;AAC/B,QAAM,EAAE,KAAK,OAAO,OAAO,IAAI,UAAU;AAAA,IACvC;AAAA,IACA,OAAO;AAAA,IACP,YAAY;AAAA,EACd,CAAC;AAED,EAAM,gBAAU,MAAM;AACpB,QAAI,cAAc,mBAAmB,CAAC,QAAQ;AAC5C,qCAAO,OAAO,eAAe;AAAA,QAC3B,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,OAAO,YAAY,eAAe,CAAC;AAE/C,SAAO,oBAAC,SAAI,KAAU,WAAU,eAAc;AAChD","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { useInView } from \"react-intersection-observer\";\n\nimport { useAtBottom } from \"../../hooks/use-at-bottom\";\n\ninterface ChatScrollAnchorProps {\n trackVisibility?: boolean;\n}\n\nexport function ChatScrollAnchor({ trackVisibility }: ChatScrollAnchorProps) {\n const isAtBottom = useAtBottom();\n const { ref, entry, inView } = useInView({\n trackVisibility,\n delay: 100,\n rootMargin: \"0px 0px -150px 0px\",\n });\n\n React.useEffect(() => {\n if (isAtBottom && trackVisibility && !inView) {\n entry?.target.scrollIntoView({\n block: \"start\",\n });\n }\n }, [inView, entry, isAtBottom, trackVisibility]);\n\n return <div ref={ref} className=\"h-px w-full\" />;\n}\n"]}
@@ -0,0 +1,72 @@
1
+ import { Tooltip, TooltipTrigger, TooltipContent } from './chunk-VGX2W5ZB.mjs';
2
+ import { Button } from './chunk-M3CZWJI3.mjs';
3
+ import { IconArrowElbow } from './chunk-2KAF7NKC.mjs';
4
+ import { useEnterSubmit } from './chunk-OHWEJUCS.mjs';
5
+ import { __async } from './chunk-MRXNTQOX.mjs';
6
+ import * as React from 'react';
7
+ import TextareaAutosize from 'react-textarea-autosize';
8
+ import { jsx, jsxs } from 'react/jsx-runtime';
9
+
10
+ function PromptForm({ onSubmit, input, setInput, isLoading }) {
11
+ const { formRef, onKeyDown } = useEnterSubmit();
12
+ const inputRef = React.useRef(null);
13
+ React.useEffect(() => {
14
+ if (inputRef.current) {
15
+ inputRef.current.focus();
16
+ }
17
+ }, []);
18
+ return /* @__PURE__ */ jsx(
19
+ "form",
20
+ {
21
+ onSubmit: (e) => __async(this, null, function* () {
22
+ e.preventDefault();
23
+ if (!(input == null ? void 0 : input.trim())) {
24
+ return;
25
+ }
26
+ setInput("");
27
+ yield onSubmit(input);
28
+ }),
29
+ ref: formRef,
30
+ children: /* @__PURE__ */ jsxs("div", { className: "relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md border sm:px-12", children: [
31
+ /* @__PURE__ */ jsxs(Tooltip, { children: [
32
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true }),
33
+ /* @__PURE__ */ jsx(TooltipContent, { children: "New Chat" })
34
+ ] }),
35
+ /* @__PURE__ */ jsx(
36
+ TextareaAutosize,
37
+ {
38
+ ref: inputRef,
39
+ tabIndex: 0,
40
+ onKeyDown,
41
+ rows: 1,
42
+ value: input,
43
+ onChange: (e) => setInput(e.target.value),
44
+ placeholder: "Send a message.",
45
+ spellCheck: false,
46
+ className: "min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"
47
+ }
48
+ ),
49
+ /* @__PURE__ */ jsx("div", { className: "absolute right-0 top-4 sm:right-4", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
50
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
51
+ Button,
52
+ {
53
+ type: "submit",
54
+ size: "icon",
55
+ disabled: isLoading || input === "",
56
+ className: " bg-slate-300",
57
+ children: [
58
+ /* @__PURE__ */ jsx(IconArrowElbow, {}),
59
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Send message" })
60
+ ]
61
+ }
62
+ ) }),
63
+ /* @__PURE__ */ jsx(TooltipContent, { children: "Send message" })
64
+ ] }) })
65
+ ] })
66
+ }
67
+ );
68
+ }
69
+
70
+ export { PromptForm };
71
+ //# sourceMappingURL=out.js.map
72
+ //# sourceMappingURL=chunk-INCNMGJ7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat-components/prompt-form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,YAAY,WAAW;AACvB,OAAO,sBAAsB;AAsCrB,SACE,KADF;AAvBD,SAAS,WAAW,EAAE,UAAU,OAAO,UAAU,UAAU,GAAgB;AAChF,QAAM,EAAE,SAAS,UAAU,IAAI,eAAe;AAC9C,QAAM,WAAiB,aAA4B,IAAI;AAEvD,EAAM,gBAAU,MAAM;AACpB,QAAI,SAAS,SAAS;AACpB,eAAS,QAAQ,MAAM;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,CAAO,MAAM;AACrB,UAAE,eAAe;AACjB,YAAI,EAAC,+BAAO,SAAQ;AAClB;AAAA,QACF;AACA,iBAAS,EAAE;AACX,cAAM,SAAS,KAAK;AAAA,MACtB;AAAA,MACA,KAAK;AAAA,MAEL,+BAAC,SAAI,WAAU,gHACb;AAAA,6BAAC,WACC;AAAA,8BAAC,kBAAe,SAAO,MAWvB;AAAA,UACA,oBAAC,kBAAe,sBAAQ;AAAA,WAC1B;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,UAAU;AAAA,YACV;AAAA,YACA,MAAM;AAAA,YACN,OAAO;AAAA,YACP,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,YACxC,aAAY;AAAA,YACZ,YAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,QACA,oBAAC,SAAI,WAAU,qCACb,+BAAC,WACC;AAAA,8BAAC,kBAAe,SAAO,MACrB;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,MAAK;AAAA,cACL,UAAU,aAAa,UAAU;AAAA,cACjC,WAAU;AAAA,cAEV;AAAA,oCAAC,kBAAe;AAAA,gBAChB,oBAAC,UAAK,WAAU,WAAU,0BAAY;AAAA;AAAA;AAAA,UACxC,GACF;AAAA,UACA,oBAAC,kBAAe,0BAAY;AAAA,WAC9B,GACF;AAAA,SACF;AAAA;AAAA,EACF;AAEJ","sourcesContent":["import * as React from \"react\";\nimport TextareaAutosize from \"react-textarea-autosize\";\nimport { UseChatHelpers } from \"@copilotkit/react-core\";\n\nimport { useEnterSubmit } from \"../../hooks/use-enter-submit\";\nimport { cn } from \"../../lib/utils\";\nimport { Button, buttonVariants } from \"./ui/button\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\nimport { IconArrowElbow, IconPlus } from \"./ui/icons\";\n// import Link from \"next/link\";\n\nexport interface PromptProps extends Pick<UseChatHelpers, \"input\" | \"setInput\"> {\n onSubmit: (value: string) => Promise<void>;\n isLoading: boolean;\n}\n\nexport function PromptForm({ onSubmit, input, setInput, isLoading }: PromptProps) {\n const { formRef, onKeyDown } = useEnterSubmit();\n const inputRef = React.useRef<HTMLTextAreaElement>(null);\n\n React.useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, []);\n\n return (\n <form\n onSubmit={async (e) => {\n e.preventDefault();\n if (!input?.trim()) {\n return;\n }\n setInput(\"\");\n await onSubmit(input);\n }}\n ref={formRef}\n >\n <div className=\"relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md border sm:px-12\">\n <Tooltip>\n <TooltipTrigger asChild>\n {/* <Link\n href=\"/\"\n className={cn(\n buttonVariants({ size: \"sm\", variant: \"outline\" }),\n \"absolute left-0 top-4 h-8 w-8 rounded-full bg-background p-0 sm:left-4\"\n )}\n >\n <IconPlus />\n <span className=\"sr-only\">New Chat</span>\n </Link> */}\n </TooltipTrigger>\n <TooltipContent>New Chat</TooltipContent>\n </Tooltip>\n <TextareaAutosize\n ref={inputRef}\n tabIndex={0}\n onKeyDown={onKeyDown}\n rows={1}\n value={input}\n onChange={(e) => setInput(e.target.value)}\n placeholder=\"Send a message.\"\n spellCheck={false}\n className=\"min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm\"\n />\n <div className=\"absolute right-0 top-4 sm:right-4\">\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"submit\"\n size=\"icon\"\n disabled={isLoading || input === \"\"}\n className=\" bg-slate-300\"\n >\n <IconArrowElbow />\n <span className=\"sr-only\">Send message</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent>Send message</TooltipContent>\n </Tooltip>\n </div>\n </div>\n </form>\n );\n}\n"]}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=chunk-IU3WTXLQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ import { cn } from './chunk-Q6YO7LDK.mjs';
2
+ import { __objRest, __spreadValues } from './chunk-MRXNTQOX.mjs';
3
+ import * as React from 'react';
4
+ import { Slot } from '@radix-ui/react-slot';
5
+ import { cva } from 'class-variance-authority';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ var buttonVariants = cva(
9
+ "inline-flex items-center justify-center rounded-md text-sm font-medium shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default: "bg-primary text-primary-foreground shadow-md hover:bg-primary/90",
14
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
15
+ outline: "border border-input hover:bg-accent hover:text-accent-foreground",
16
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
17
+ ghost: "shadow-none hover:bg-accent hover:text-accent-foreground",
18
+ link: "text-primary underline-offset-4 shadow-none hover:underline"
19
+ },
20
+ size: {
21
+ default: "h-8 px-4 py-2",
22
+ sm: "h-8 rounded-md px-3",
23
+ lg: "h-11 rounded-md px-8",
24
+ icon: "h-8 w-8 p-0"
25
+ }
26
+ },
27
+ defaultVariants: {
28
+ variant: "default",
29
+ size: "default"
30
+ }
31
+ }
32
+ );
33
+ var Button = React.forwardRef(
34
+ (_a, ref) => {
35
+ var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
36
+ const Comp = asChild ? Slot : "button";
37
+ return /* @__PURE__ */ jsx(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
38
+ }
39
+ );
40
+ Button.displayName = "Button";
41
+
42
+ export { Button, buttonVariants };
43
+ //# sourceMappingURL=out.js.map
44
+ //# sourceMappingURL=chunk-M3CZWJI3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat-components/ui/button.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AAwCjC;AApCN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aAAa;AAAA,QACb,SAAS;AAAA,QACT,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAQA,IAAM,SAAe;AAAA,EACnB,CAAC,IAAyD,QAAQ;AAAjE,iBAAE,aAAW,SAAS,MAAM,UAAU,MAvCzC,IAuCG,IAAgD,kBAAhD,IAAgD,CAA9C,aAAW,WAAS,QAAM;AAC3B,UAAM,OAAO,UAAU,OAAO;AAC9B,WACE,oBAAC,uBAAK,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GAAG,OAAc,MAAO;AAAA,EAE5F;AACF;AACA,OAAO,cAAc","sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow-md hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline: \"border border-input hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"shadow-none hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 shadow-none hover:underline\",\n },\n size: {\n default: \"h-8 px-4 py-2\",\n sm: \"h-8 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-8 w-8 p-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />\n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n"]}
@@ -0,0 +1,12 @@
1
+ import { createContext } from 'react';
2
+
3
+ // src/components/sidebar/sidebar-context.tsx
4
+ var CopilotSidebarContext = createContext({
5
+ isSidebarOpen: false,
6
+ toggleSidebar: () => {
7
+ }
8
+ });
9
+
10
+ export { CopilotSidebarContext };
11
+ //# sourceMappingURL=out.js.map
12
+ //# sourceMappingURL=chunk-MC6KTH4X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/sidebar/sidebar-context.tsx"],"names":[],"mappings":";AAAA,SAAS,qBAAgC;AAOlC,IAAM,wBAAwB,cAAyC;AAAA,EAC5E,eAAe;AAAA,EACf,eAAe,MAAM;AAAA,EAAC;AACxB,CAAC","sourcesContent":["import { createContext, ReactNode } from \"react\";\n\nexport interface CopilotSidebarContextType {\n isSidebarOpen: boolean;\n toggleSidebar: () => void;\n}\n\nexport const CopilotSidebarContext = createContext<CopilotSidebarContextType>({\n isSidebarOpen: false,\n toggleSidebar: () => {},\n});\n"]}
@@ -0,0 +1,55 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __async = (__this, __arguments, generator) => {
33
+ return new Promise((resolve, reject) => {
34
+ var fulfilled = (value) => {
35
+ try {
36
+ step(generator.next(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var rejected = (value) => {
42
+ try {
43
+ step(generator.throw(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
+ step((generator = generator.apply(__this, __arguments)).next());
50
+ });
51
+ };
52
+
53
+ export { __async, __objRest, __spreadProps, __spreadValues };
54
+ //# sourceMappingURL=out.js.map
55
+ //# sourceMappingURL=chunk-MRXNTQOX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}