@djangocfg/ui-tools 2.1.334 → 2.1.336

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 (196) hide show
  1. package/README.md +68 -2
  2. package/dist/ChatRoot-IIYQEWUU.mjs +5 -0
  3. package/dist/ChatRoot-IIYQEWUU.mjs.map +1 -0
  4. package/dist/ChatRoot-PNNGQCYF.css +7 -0
  5. package/dist/ChatRoot-PNNGQCYF.css.map +1 -0
  6. package/dist/ChatRoot-UUKTYM4N.cjs +14 -0
  7. package/dist/ChatRoot-UUKTYM4N.cjs.map +1 -0
  8. package/dist/{CronScheduler.client-3O3VU4CI.mjs → CronScheduler.client-DLMXCPAJ.mjs} +4 -4
  9. package/dist/{CronScheduler.client-3O3VU4CI.mjs.map → CronScheduler.client-DLMXCPAJ.mjs.map} +1 -1
  10. package/dist/{CronScheduler.client-A4GO6YBY.cjs → CronScheduler.client-WEJF4PWQ.cjs} +14 -14
  11. package/dist/{CronScheduler.client-A4GO6YBY.cjs.map → CronScheduler.client-WEJF4PWQ.cjs.map} +1 -1
  12. package/dist/{DocsLayout-XLDB6CJ2.cjs → DocsLayout-N5ZJZPBY.cjs} +200 -199
  13. package/dist/DocsLayout-N5ZJZPBY.cjs.map +1 -0
  14. package/dist/{DocsLayout-CTJINVBM.mjs → DocsLayout-VFPPNKSQ.mjs} +7 -6
  15. package/dist/DocsLayout-VFPPNKSQ.mjs.map +1 -0
  16. package/dist/JsonSchemaForm-DD7CLRIG.cjs +13 -0
  17. package/dist/{JsonSchemaForm-OSPUUUHM.cjs.map → JsonSchemaForm-DD7CLRIG.cjs.map} +1 -1
  18. package/dist/JsonSchemaForm-XKUIVELK.mjs +4 -0
  19. package/dist/{JsonSchemaForm-TSLX2GRO.mjs.map → JsonSchemaForm-XKUIVELK.mjs.map} +1 -1
  20. package/dist/JsonTree-55625VVH.mjs +5 -0
  21. package/dist/{JsonTree-F27RMYSI.cjs.map → JsonTree-55625VVH.mjs.map} +1 -1
  22. package/dist/JsonTree-DCM5QGWF.cjs +11 -0
  23. package/dist/{JsonTree-QTJYSHCV.mjs.map → JsonTree-DCM5QGWF.cjs.map} +1 -1
  24. package/dist/{LottiePlayer.client-6WVWDO75.cjs → LottiePlayer.client-2S7ISJ2S.cjs} +6 -6
  25. package/dist/{LottiePlayer.client-6WVWDO75.cjs.map → LottiePlayer.client-2S7ISJ2S.cjs.map} +1 -1
  26. package/dist/{LottiePlayer.client-B4I6WNZM.mjs → LottiePlayer.client-5LDSSJWS.mjs} +4 -4
  27. package/dist/{LottiePlayer.client-B4I6WNZM.mjs.map → LottiePlayer.client-5LDSSJWS.mjs.map} +1 -1
  28. package/dist/{MapContainer-RYG4HPH4.cjs → MapContainer-76YL2JXL.cjs} +8 -8
  29. package/dist/{MapContainer-RYG4HPH4.cjs.map → MapContainer-76YL2JXL.cjs.map} +1 -1
  30. package/dist/{MapContainer-GXQLP5WY.mjs → MapContainer-7HXBI3OH.mjs} +3 -3
  31. package/dist/{MapContainer-GXQLP5WY.mjs.map → MapContainer-7HXBI3OH.mjs.map} +1 -1
  32. package/dist/{Mermaid.client-SXRRI2YW.mjs → Mermaid.client-NL4SVR7F.mjs} +4 -4
  33. package/dist/{Mermaid.client-SXRRI2YW.mjs.map → Mermaid.client-NL4SVR7F.mjs.map} +1 -1
  34. package/dist/{Mermaid.client-W76R5AKJ.cjs → Mermaid.client-NNTI6DFX.cjs} +26 -26
  35. package/dist/{Mermaid.client-W76R5AKJ.cjs.map → Mermaid.client-NNTI6DFX.cjs.map} +1 -1
  36. package/dist/Player-BRV7XTWR.mjs +4 -0
  37. package/dist/{Player-M3GC3VPE.mjs.map → Player-BRV7XTWR.mjs.map} +1 -1
  38. package/dist/Player-PM7F7DD7.cjs +13 -0
  39. package/dist/{Player-ZL2X5LGG.cjs.map → Player-PM7F7DD7.cjs.map} +1 -1
  40. package/dist/{PrettyCode.client-RPDIE5CH.cjs → PrettyCode.client-KOHDVPPN.cjs} +13 -13
  41. package/dist/{PrettyCode.client-RPDIE5CH.cjs.map → PrettyCode.client-KOHDVPPN.cjs.map} +1 -1
  42. package/dist/{PrettyCode.client-SPMTQEG4.mjs → PrettyCode.client-ZGYGKE7G.mjs} +4 -4
  43. package/dist/{PrettyCode.client-SPMTQEG4.mjs.map → PrettyCode.client-ZGYGKE7G.mjs.map} +1 -1
  44. package/dist/TreeRoot-N72OYKXU.cjs +19 -0
  45. package/dist/{TreeRoot-A3J65L6F.mjs.map → TreeRoot-N72OYKXU.cjs.map} +1 -1
  46. package/dist/TreeRoot-VGAIXCUA.mjs +4 -0
  47. package/dist/{TreeRoot-DSK5JILT.cjs.map → TreeRoot-VGAIXCUA.mjs.map} +1 -1
  48. package/dist/chunk-2ZLKZ5VR.mjs +631 -0
  49. package/dist/chunk-2ZLKZ5VR.mjs.map +1 -0
  50. package/dist/{chunk-LFWQ36LJ.mjs → chunk-5G5YBFS6.mjs} +4 -4
  51. package/dist/{chunk-LFWQ36LJ.mjs.map → chunk-5G5YBFS6.mjs.map} +1 -1
  52. package/dist/{chunk-IHAY6FO6.cjs → chunk-5I5QNGUG.cjs} +17 -17
  53. package/dist/{chunk-IHAY6FO6.cjs.map → chunk-5I5QNGUG.cjs.map} +1 -1
  54. package/dist/{chunk-F2CMIIOH.cjs → chunk-76NNDZH6.cjs} +42 -42
  55. package/dist/{chunk-F2CMIIOH.cjs.map → chunk-76NNDZH6.cjs.map} +1 -1
  56. package/dist/chunk-B5AWZOHJ.cjs +649 -0
  57. package/dist/chunk-B5AWZOHJ.cjs.map +1 -0
  58. package/dist/{chunk-KR6B3LVY.mjs → chunk-B6IR5KSC.mjs} +3 -3
  59. package/dist/{chunk-KR6B3LVY.mjs.map → chunk-B6IR5KSC.mjs.map} +1 -1
  60. package/dist/{chunk-5LBDYFWH.mjs → chunk-C6GXVH5J.mjs} +3 -3
  61. package/dist/{chunk-5LBDYFWH.mjs.map → chunk-C6GXVH5J.mjs.map} +1 -1
  62. package/dist/{chunk-4IW7GZFQ.cjs → chunk-FEN5S772.cjs} +74 -48
  63. package/dist/chunk-FEN5S772.cjs.map +1 -0
  64. package/dist/{chunk-2SMCH62O.cjs → chunk-FP2RLYQZ.cjs} +11 -11
  65. package/dist/{chunk-2SMCH62O.cjs.map → chunk-FP2RLYQZ.cjs.map} +1 -1
  66. package/dist/{chunk-MOME6KYD.mjs → chunk-G5IEC7SR.mjs} +3 -3
  67. package/dist/{chunk-MOME6KYD.mjs.map → chunk-G5IEC7SR.mjs.map} +1 -1
  68. package/dist/{chunk-EXGXUK2N.mjs → chunk-GYIO7W7M.mjs} +41 -15
  69. package/dist/chunk-GYIO7W7M.mjs.map +1 -0
  70. package/dist/{chunk-3Z3A7FHA.cjs → chunk-IEEAENLX.cjs} +48 -48
  71. package/dist/{chunk-3Z3A7FHA.cjs.map → chunk-IEEAENLX.cjs.map} +1 -1
  72. package/dist/{chunk-DFTVB66S.cjs → chunk-KNDLV4PI.cjs} +85 -85
  73. package/dist/{chunk-DFTVB66S.cjs.map → chunk-KNDLV4PI.cjs.map} +1 -1
  74. package/dist/{chunk-SSUOENAZ.mjs → chunk-KNEQRUBA.mjs} +3 -3
  75. package/dist/{chunk-SSUOENAZ.mjs.map → chunk-KNEQRUBA.mjs.map} +1 -1
  76. package/dist/chunk-KRETIZU6.mjs +2218 -0
  77. package/dist/chunk-KRETIZU6.mjs.map +1 -0
  78. package/dist/{chunk-CGILA3WO.mjs → chunk-N2XQF2OL.mjs} +5 -3
  79. package/dist/{chunk-CGILA3WO.mjs.map → chunk-N2XQF2OL.mjs.map} +1 -1
  80. package/dist/{chunk-EUADAUBQ.mjs → chunk-N4MZYNR4.mjs} +4 -4
  81. package/dist/{chunk-EUADAUBQ.mjs.map → chunk-N4MZYNR4.mjs.map} +1 -1
  82. package/dist/chunk-NRXYYO5V.cjs +2257 -0
  83. package/dist/chunk-NRXYYO5V.cjs.map +1 -0
  84. package/dist/{chunk-GGKGH5PM.mjs → chunk-OBRSGM64.mjs} +4 -4
  85. package/dist/{chunk-GGKGH5PM.mjs.map → chunk-OBRSGM64.mjs.map} +1 -1
  86. package/dist/{chunk-6JTB2X72.mjs → chunk-ODO4GMW7.mjs} +3 -3
  87. package/dist/{chunk-6JTB2X72.mjs.map → chunk-ODO4GMW7.mjs.map} +1 -1
  88. package/dist/{chunk-WGEGR3DF.cjs → chunk-OLISEQHS.cjs} +5 -2
  89. package/dist/{chunk-WGEGR3DF.cjs.map → chunk-OLISEQHS.cjs.map} +1 -1
  90. package/dist/{chunk-PZKAH7WQ.mjs → chunk-PVAX67JG.mjs} +3 -3
  91. package/dist/{chunk-PZKAH7WQ.mjs.map → chunk-PVAX67JG.mjs.map} +1 -1
  92. package/dist/{chunk-PRPG2T2E.cjs → chunk-QJ6GTUCO.cjs} +6 -6
  93. package/dist/{chunk-PRPG2T2E.cjs.map → chunk-QJ6GTUCO.cjs.map} +1 -1
  94. package/dist/chunk-QW4RBGHN.cjs +961 -0
  95. package/dist/chunk-QW4RBGHN.cjs.map +1 -0
  96. package/dist/{chunk-33AMWFBZ.cjs → chunk-SGP7V2UW.cjs} +15 -15
  97. package/dist/{chunk-33AMWFBZ.cjs.map → chunk-SGP7V2UW.cjs.map} +1 -1
  98. package/dist/{chunk-FX2QFYWF.mjs → chunk-VWQ5WOIL.mjs} +3 -3
  99. package/dist/{chunk-FX2QFYWF.mjs.map → chunk-VWQ5WOIL.mjs.map} +1 -1
  100. package/dist/{chunk-ZLQHUZDU.cjs → chunk-YDPDTOSP.cjs} +139 -139
  101. package/dist/{chunk-ZLQHUZDU.cjs.map → chunk-YDPDTOSP.cjs.map} +1 -1
  102. package/dist/{chunk-77HQWEQ6.cjs → chunk-YW5IVWHQ.cjs} +33 -33
  103. package/dist/{chunk-77HQWEQ6.cjs.map → chunk-YW5IVWHQ.cjs.map} +1 -1
  104. package/dist/{chunk-YXBOAGIM.cjs → chunk-YXZ6GU7H.cjs} +7 -7
  105. package/dist/{chunk-YXBOAGIM.cjs.map → chunk-YXZ6GU7H.cjs.map} +1 -1
  106. package/dist/{chunk-62Y65TGK.mjs → chunk-ZUFTH5IR.mjs} +8 -631
  107. package/dist/chunk-ZUFTH5IR.mjs.map +1 -0
  108. package/dist/components-EHOGXATG.cjs +22 -0
  109. package/dist/{components-5UXYNAKR.cjs.map → components-EHOGXATG.cjs.map} +1 -1
  110. package/dist/components-MQ6DR7TX.cjs +26 -0
  111. package/dist/{components-CFXOEVPN.mjs.map → components-MQ6DR7TX.cjs.map} +1 -1
  112. package/dist/components-XRX7QGLB.mjs +5 -0
  113. package/dist/{components-WYEZL5TE.cjs.map → components-XRX7QGLB.mjs.map} +1 -1
  114. package/dist/components-YATKRWLH.mjs +5 -0
  115. package/dist/{components-ZAGG2PBO.mjs.map → components-YATKRWLH.mjs.map} +1 -1
  116. package/dist/file-icon/index.cjs +6 -6
  117. package/dist/file-icon/index.mjs +1 -1
  118. package/dist/index.cjs +735 -215
  119. package/dist/index.cjs.map +1 -1
  120. package/dist/index.d.cts +972 -39
  121. package/dist/index.d.ts +972 -39
  122. package/dist/index.mjs +387 -31
  123. package/dist/index.mjs.map +1 -1
  124. package/dist/tree/index.cjs +38 -38
  125. package/dist/tree/index.d.cts +2 -2
  126. package/dist/tree/index.d.ts +2 -2
  127. package/dist/tree/index.mjs +3 -3
  128. package/package.json +6 -6
  129. package/src/index.ts +5 -0
  130. package/src/stories/index.ts +3 -1
  131. package/src/tools/Chat/Chat.story.tsx +1006 -0
  132. package/src/tools/Chat/README.md +528 -0
  133. package/src/tools/Chat/components/Attachments.tsx +192 -0
  134. package/src/tools/Chat/components/ChatRoot.tsx +201 -0
  135. package/src/tools/Chat/components/Composer.tsx +134 -0
  136. package/src/tools/Chat/components/EmptyState.tsx +47 -0
  137. package/src/tools/Chat/components/ErrorBanner.tsx +47 -0
  138. package/src/tools/Chat/components/JumpToLatest.tsx +30 -0
  139. package/src/tools/Chat/components/MessageActions.tsx +72 -0
  140. package/src/tools/Chat/components/MessageBubble.tsx +228 -0
  141. package/src/tools/Chat/components/MessageList.tsx +82 -0
  142. package/src/tools/Chat/components/Sources.tsx +55 -0
  143. package/src/tools/Chat/components/StreamingIndicator.tsx +29 -0
  144. package/src/tools/Chat/components/ToolCalls.tsx +172 -0
  145. package/src/tools/Chat/components/index.ts +24 -0
  146. package/src/tools/Chat/config.ts +55 -0
  147. package/src/tools/Chat/context/ChatProvider.tsx +122 -0
  148. package/src/tools/Chat/context/index.ts +9 -0
  149. package/src/tools/Chat/core/audio/audioBus.ts +172 -0
  150. package/src/tools/Chat/core/audio/index.ts +8 -0
  151. package/src/tools/Chat/core/audio/preferences.ts +68 -0
  152. package/src/tools/Chat/core/audio/types.ts +49 -0
  153. package/src/tools/Chat/core/ids.ts +16 -0
  154. package/src/tools/Chat/core/index.ts +5 -0
  155. package/src/tools/Chat/core/markdown.ts +56 -0
  156. package/src/tools/Chat/core/payload-dispatch.ts +54 -0
  157. package/src/tools/Chat/core/persona.ts +35 -0
  158. package/src/tools/Chat/core/reducer.ts +335 -0
  159. package/src/tools/Chat/core/transport/http.ts +167 -0
  160. package/src/tools/Chat/core/transport/index.ts +13 -0
  161. package/src/tools/Chat/core/transport/mock.ts +134 -0
  162. package/src/tools/Chat/core/transport/sse.ts +116 -0
  163. package/src/tools/Chat/core/transport/types.ts +24 -0
  164. package/src/tools/Chat/hooks/index.ts +26 -0
  165. package/src/tools/Chat/hooks/useChat.ts +440 -0
  166. package/src/tools/Chat/hooks/useChatAudio.ts +191 -0
  167. package/src/tools/Chat/hooks/useChatComposer.ts +227 -0
  168. package/src/tools/Chat/hooks/useChatHistory.ts +59 -0
  169. package/src/tools/Chat/hooks/useChatLayout.ts +111 -0
  170. package/src/tools/Chat/hooks/useChatLightbox.ts +34 -0
  171. package/src/tools/Chat/hooks/useChatScroll.ts +132 -0
  172. package/src/tools/Chat/index.ts +158 -0
  173. package/src/tools/Chat/lazy.tsx +14 -0
  174. package/src/tools/Chat/types.ts +237 -0
  175. package/src/tools/Chat/utils/collectImageAttachments.ts +13 -0
  176. package/src/tools/JsonForm/JsonSchemaForm.tsx +32 -1
  177. package/src/tools/Map/README.md +384 -0
  178. package/dist/DocsLayout-CTJINVBM.mjs.map +0 -1
  179. package/dist/DocsLayout-XLDB6CJ2.cjs.map +0 -1
  180. package/dist/JsonSchemaForm-OSPUUUHM.cjs +0 -13
  181. package/dist/JsonSchemaForm-TSLX2GRO.mjs +0 -4
  182. package/dist/JsonTree-F27RMYSI.cjs +0 -11
  183. package/dist/JsonTree-QTJYSHCV.mjs +0 -5
  184. package/dist/Player-M3GC3VPE.mjs +0 -4
  185. package/dist/Player-ZL2X5LGG.cjs +0 -13
  186. package/dist/TreeRoot-A3J65L6F.mjs +0 -4
  187. package/dist/TreeRoot-DSK5JILT.cjs +0 -19
  188. package/dist/chunk-4IW7GZFQ.cjs.map +0 -1
  189. package/dist/chunk-62Y65TGK.mjs.map +0 -1
  190. package/dist/chunk-EXGXUK2N.mjs.map +0 -1
  191. package/dist/chunk-TKSFZHCG.cjs +0 -1597
  192. package/dist/chunk-TKSFZHCG.cjs.map +0 -1
  193. package/dist/components-5UXYNAKR.cjs +0 -22
  194. package/dist/components-CFXOEVPN.mjs +0 -5
  195. package/dist/components-WYEZL5TE.cjs +0 -26
  196. package/dist/components-ZAGG2PBO.mjs +0 -5
@@ -1,632 +1,9 @@
1
- import { __name } from './chunk-CGILA3WO.mjs';
2
- import React6, { lazy, createContext, useState, useMemo, useCallback, Suspense, useContext, useReducer, useRef, useEffect } from 'react';
3
- import '@djangocfg/ui-core/styles/palette';
4
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import ReactMarkdown from 'react-markdown';
6
- import rehypeExternalLinks from 'rehype-external-links';
7
- import rehypeRaw from 'rehype-raw';
8
- import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
9
- import remarkBreaks from 'remark-breaks';
10
- import remarkEmoji from 'remark-emoji';
11
- import remarkGfm from 'remark-gfm';
12
- import remarkSmartypants from 'remark-smartypants';
13
- import { CopyButton } from '@djangocfg/ui-core/components';
14
- import { useResolvedTheme, useSessionStorage } from '@djangocfg/ui-core/hooks';
1
+ import { __name } from './chunk-N2XQF2OL.mjs';
15
2
  import consola2 from 'consola';
3
+ import React, { createContext, useContext, useReducer, useRef, useEffect, useCallback } from 'react';
4
+ import { useSessionStorage } from '@djangocfg/ui-core/hooks';
16
5
  import { sample } from 'openapi-sampler';
17
-
18
- function smartTruncate(content, maxLength) {
19
- if (content.length <= maxLength) {
20
- return content;
21
- }
22
- let breakPoint = maxLength;
23
- while (breakPoint > maxLength - 50 && breakPoint > 0) {
24
- const char = content[breakPoint];
25
- if (char === " " || char === "\n" || char === " ") {
26
- break;
27
- }
28
- breakPoint--;
29
- }
30
- if (breakPoint <= maxLength - 50) {
31
- breakPoint = maxLength;
32
- }
33
- let truncated = content.slice(0, breakPoint).trimEnd();
34
- truncated = fixUnclosedMarkdown(truncated);
35
- return truncated;
36
- }
37
- __name(smartTruncate, "smartTruncate");
38
- function truncateByLines(content, maxLines) {
39
- const lines = content.split("\n");
40
- if (lines.length <= maxLines) {
41
- return content;
42
- }
43
- let truncated = lines.slice(0, maxLines).join("\n").trimEnd();
44
- truncated = fixUnclosedMarkdown(truncated);
45
- return truncated;
46
- }
47
- __name(truncateByLines, "truncateByLines");
48
- function fixUnclosedMarkdown(content) {
49
- let result = content;
50
- const countOccurrences = /* @__PURE__ */ __name((str, marker) => {
51
- const escaped = marker.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
52
- const matches = str.match(new RegExp(escaped, "g"));
53
- return matches ? matches.length : 0;
54
- }, "countOccurrences");
55
- const boldCount = countOccurrences(result, "**");
56
- if (boldCount % 2 !== 0) {
57
- result += "**";
58
- }
59
- const withoutBold = result.replace(/\*\*/g, "");
60
- const italicCount = countOccurrences(withoutBold, "*");
61
- if (italicCount % 2 !== 0) {
62
- result += "*";
63
- }
64
- const codeCount = countOccurrences(result, "`");
65
- const tripleCount = countOccurrences(result, "```");
66
- const singleCodeCount = codeCount - tripleCount * 3;
67
- if (singleCodeCount % 2 !== 0) {
68
- result += "`";
69
- }
70
- if (tripleCount % 2 !== 0) {
71
- result += "\n```";
72
- }
73
- const strikeCount = countOccurrences(result, "~~");
74
- if (strikeCount % 2 !== 0) {
75
- result += "~~";
76
- }
77
- const underlineBoldCount = countOccurrences(result, "__");
78
- if (underlineBoldCount % 2 !== 0) {
79
- result += "__";
80
- }
81
- const withoutUnderlineBold = result.replace(/__/g, "");
82
- const underlineItalicCount = countOccurrences(withoutUnderlineBold, "_");
83
- if (underlineItalicCount % 2 !== 0) {
84
- result += "_";
85
- }
86
- return result;
87
- }
88
- __name(fixUnclosedMarkdown, "fixUnclosedMarkdown");
89
- function useCollapsibleContent(content, options = {}) {
90
- const { maxLength, maxLines, defaultExpanded = false } = options;
91
- const [isCollapsed, setIsCollapsed] = useState(!defaultExpanded);
92
- const originalLength = content.length;
93
- const originalLineCount = content.split("\n").length;
94
- const { shouldCollapse, truncatedContent } = useMemo(() => {
95
- if (maxLength === void 0 && maxLines === void 0) {
96
- return { shouldCollapse: false, truncatedContent: content };
97
- }
98
- let needsCollapse = false;
99
- let result = content;
100
- if (maxLines !== void 0 && originalLineCount > maxLines) {
101
- needsCollapse = true;
102
- result = truncateByLines(result, maxLines);
103
- }
104
- if (maxLength !== void 0 && result.length > maxLength) {
105
- needsCollapse = true;
106
- result = smartTruncate(result, maxLength);
107
- }
108
- return { shouldCollapse: needsCollapse, truncatedContent: result };
109
- }, [content, maxLength, maxLines, originalLineCount]);
110
- const displayContent = useMemo(() => {
111
- if (!shouldCollapse || !isCollapsed) {
112
- return content;
113
- }
114
- return truncatedContent;
115
- }, [content, truncatedContent, shouldCollapse, isCollapsed]);
116
- const toggleCollapsed = useCallback(() => {
117
- setIsCollapsed((prev) => !prev);
118
- }, []);
119
- const setCollapsed = useCallback((collapsed) => {
120
- setIsCollapsed(collapsed);
121
- }, []);
122
- return {
123
- isCollapsed,
124
- toggleCollapsed,
125
- setCollapsed,
126
- displayContent,
127
- shouldCollapse,
128
- originalLength,
129
- originalLineCount
130
- };
131
- }
132
- __name(useCollapsibleContent, "useCollapsibleContent");
133
- function extractTextFromChildren(children) {
134
- if (typeof children === "string") return children;
135
- if (typeof children === "number") return String(children);
136
- if (React6.isValidElement(children)) {
137
- const props = children.props;
138
- return extractTextFromChildren(props.children);
139
- }
140
- if (Array.isArray(children)) {
141
- return children.map(extractTextFromChildren).join("");
142
- }
143
- return "";
144
- }
145
- __name(extractTextFromChildren, "extractTextFromChildren");
146
- function looksLikePlainProse(text) {
147
- const trimmed = text.trim();
148
- if (trimmed.length === 0) return true;
149
- if (trimmed.length > 500) return false;
150
- if (/\n\s*\n/.test(trimmed)) return false;
151
- const newlineCount = (trimmed.match(/\n/g) || []).length;
152
- if (newlineCount > 4) return false;
153
- if (hasMarkdownSyntax(trimmed)) return false;
154
- return true;
155
- }
156
- __name(looksLikePlainProse, "looksLikePlainProse");
157
- function hasMarkdownSyntax(text) {
158
- if (text.trim().includes("\n")) return true;
159
- if (/<\/?[a-zA-Z][a-zA-Z0-9-]*(\s[^>]*)?\/?>/.test(text)) return true;
160
- const patterns = [
161
- /^#{1,6}\s/m,
162
- // Headers
163
- /\*\*[^*]+\*\*/,
164
- // Bold
165
- /\*[^*]+\*/,
166
- // Italic
167
- /__[^_]+__/,
168
- // Bold (underscore)
169
- /_[^_]+_/,
170
- // Italic (underscore)
171
- /\[.+\]\(.+\)/,
172
- // Links
173
- /!\[.*\]\(.+\)/,
174
- // Images
175
- /```[\s\S]*```/,
176
- // Code blocks
177
- /`[^`]+`/,
178
- // Inline code
179
- /^\s*[-*+]\s/m,
180
- // Unordered lists
181
- /^\s*\d+\.\s/m,
182
- // Ordered lists
183
- /^\s*>/m,
184
- // Blockquotes
185
- /\|.+\|/,
186
- // Tables
187
- /^---+$/m,
188
- // Horizontal rules
189
- /~~[^~]+~~/
190
- // Strikethrough
191
- ];
192
- return patterns.some((p) => p.test(text));
193
- }
194
- __name(hasMarkdownSyntax, "hasMarkdownSyntax");
195
- var MermaidClient = lazy(() => import('./Mermaid.client-SXRRI2YW.mjs'));
196
- var LoadingFallback = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center min-h-[100px]", children: /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-primary" }) }), "LoadingFallback");
197
- var Mermaid = /* @__PURE__ */ __name((props) => {
198
- return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingFallback, {}), children: /* @__PURE__ */ jsx(MermaidClient, { ...props }) });
199
- }, "Mermaid");
200
- var Mermaid_default = Mermaid;
201
- var PrettyCodeClient = lazy(() => import('./PrettyCode.client-SPMTQEG4.mjs'));
202
- var LoadingFallback2 = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("div", { className: "relative rounded-sm border border-border overflow-hidden bg-muted dark:bg-zinc-900", children: /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
203
- /* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-4 rounded-full bg-muted-foreground/20" }),
204
- /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Loading code..." })
205
- ] }) }) }), "LoadingFallback");
206
- var PrettyCode = /* @__PURE__ */ __name((props) => {
207
- return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingFallback2, {}), children: /* @__PURE__ */ jsx(PrettyCodeClient, { ...props }) });
208
- }, "PrettyCode");
209
- var PrettyCode_default = PrettyCode;
210
- var HTML_SCHEMA_BASE = {
211
- ...defaultSchema,
212
- tagNames: [
213
- ...defaultSchema.tagNames ?? [],
214
- "br",
215
- "b",
216
- "i",
217
- "u",
218
- "s",
219
- "sub",
220
- "sup",
221
- "small",
222
- "mark",
223
- "kbd",
224
- "code",
225
- "pre",
226
- "details",
227
- "summary"
228
- ]
229
- };
230
- function buildSchema(extraProtocols) {
231
- if (!extraProtocols || extraProtocols.length === 0) return HTML_SCHEMA_BASE;
232
- const baseProtocols = HTML_SCHEMA_BASE.protocols ?? defaultSchema.protocols ?? {};
233
- const baseHref = baseProtocols.href ?? ["http", "https", "mailto", "xmpp", "irc", "ircs"];
234
- return {
235
- ...HTML_SCHEMA_BASE,
236
- protocols: {
237
- ...baseProtocols,
238
- href: [...baseHref, ...extraProtocols]
239
- }
240
- };
241
- }
242
- __name(buildSchema, "buildSchema");
243
- function buildUrlTransform(extraProtocols) {
244
- if (!extraProtocols || extraProtocols.length === 0) return void 0;
245
- const lower = extraProtocols.map((p) => p.toLowerCase() + ":");
246
- return (url) => {
247
- const u = url.trim().toLowerCase();
248
- for (const p of lower) {
249
- if (u.startsWith(p)) return url;
250
- }
251
- if (/^(https?:|mailto:|tel:|xmpp:|irc:|ircs:|#|\/|\.\/|\.\.\/|\?)/i.test(u) || /^[a-z0-9._~!$&'()*+,;=:@%-]+$/i.test(u)) {
252
- return url;
253
- }
254
- return "";
255
- };
256
- }
257
- __name(buildUrlTransform, "buildUrlTransform");
258
- var CodeBlock = /* @__PURE__ */ __name(({ code, language }) => {
259
- const theme = useResolvedTheme();
260
- return /* @__PURE__ */ jsx("div", { className: "my-2", children: /* @__PURE__ */ jsx(
261
- PrettyCode_default,
262
- {
263
- data: code,
264
- language,
265
- className: "text-xs",
266
- customBg: "bg-code",
267
- mode: theme,
268
- isCompact: true,
269
- scrollIsolation: false
270
- }
271
- ) });
272
- }, "CodeBlock");
273
- var CodeBlockFallback = /* @__PURE__ */ __name(({ code, isUser }) => {
274
- const copyHoverClass = isUser ? "hover:bg-white/20 text-white" : "hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground";
275
- const copyButtonClass = `absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity h-8 w-8 ${copyHoverClass}`;
276
- return /* @__PURE__ */ jsxs("div", { className: "relative group my-3", children: [
277
- /* @__PURE__ */ jsx(
278
- CopyButton,
279
- {
280
- value: code,
281
- variant: "ghost",
282
- className: copyButtonClass,
283
- title: "Copy code"
284
- }
285
- ),
286
- /* @__PURE__ */ jsx("pre", { className: "p-3 rounded text-xs font-mono overflow-x-auto bg-code text-code-foreground border border-code-border", children: /* @__PURE__ */ jsx("code", { children: code }) })
287
- ] });
288
- }, "CodeBlockFallback");
289
- function createMarkdownComponents(isUser = false, isCompact = false) {
290
- const textSize = isCompact ? "text-xs" : "text-sm";
291
- const headingBase = isCompact ? "text-sm" : "text-base";
292
- const headingSm = isCompact ? "text-xs" : "text-sm";
293
- return {
294
- h1: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h1", { className: `${headingBase} font-semibold mb-2 mt-3 first:mt-0`, children }), "h1"),
295
- h2: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h2", { className: `${headingSm} font-semibold mb-2 mt-3 first:mt-0`, children }), "h2"),
296
- h3: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h3", { className: `${headingSm} font-semibold mb-1 mt-2 first:mt-0`, children }), "h3"),
297
- h4: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h4", { className: `${headingSm} font-semibold mb-1 mt-2 first:mt-0`, children }), "h4"),
298
- h5: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h5", { className: `${headingSm} font-medium mb-1 mt-2 first:mt-0`, children }), "h5"),
299
- h6: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h6", { className: `${headingSm} font-medium mb-1 mt-2 first:mt-0`, children }), "h6"),
300
- p: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("p", { className: `${textSize} mb-4 last:mb-0 leading-relaxed break-words`, children }), "p"),
301
- ul: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("ul", { className: `list-disc list-inside mb-2 space-y-1 ${textSize}`, children }), "ul"),
302
- ol: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("ol", { className: `list-decimal list-inside mb-2 space-y-1 ${textSize}`, children }), "ol"),
303
- li: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("li", { className: "break-words", children }), "li"),
304
- // `target` / `rel` for external links are NOT set here — the
305
- // rehype-external-links plugin tags them on the rehype side, so
306
- // every `<a>` that sanitize let through gets the same security
307
- // treatment regardless of which renderer (default vs linkRules
308
- // override) emitted it. Doing it twice here would just duplicate
309
- // attributes; doing it only here would miss the linkRules path.
310
- a: /* @__PURE__ */ __name(({ href, children, ...rest }) => /* @__PURE__ */ jsx(
311
- "a",
312
- {
313
- ...rest,
314
- href,
315
- className: `${textSize} ${isUser ? "text-white/90 underline hover:text-white" : "text-primary underline hover:text-primary/80"} transition-colors break-all`,
316
- children
317
- }
318
- ), "a"),
319
- pre: /* @__PURE__ */ __name(({ children }) => {
320
- let codeContent = "";
321
- let language = "plaintext";
322
- if (React6.isValidElement(children)) {
323
- const child = children;
324
- if (child.type === "code" || typeof child.type === "function" && child.type.name === "code") {
325
- const codeProps = child.props;
326
- const rawClassName = codeProps.className;
327
- language = rawClassName?.replace(/language-/, "").trim() || "plaintext";
328
- codeContent = extractTextFromChildren(codeProps.children).trim();
329
- } else {
330
- codeContent = extractTextFromChildren(children).trim();
331
- }
332
- } else {
333
- codeContent = extractTextFromChildren(children).trim();
334
- }
335
- if (!codeContent) {
336
- return /* @__PURE__ */ jsx("div", { className: "my-3 p-3 bg-muted rounded text-sm text-muted-foreground", children: "No content available" });
337
- }
338
- if (language === "mermaid") {
339
- return /* @__PURE__ */ jsx("div", { className: "my-3 w-full", children: /* @__PURE__ */ jsx(Mermaid_default, { chart: codeContent, isCompact }) });
340
- }
341
- try {
342
- return /* @__PURE__ */ jsx(CodeBlock, { code: codeContent, language, isUser, isCompact });
343
- } catch (error) {
344
- console.warn("CodeBlock failed, using fallback:", error);
345
- return /* @__PURE__ */ jsx(CodeBlockFallback, { code: codeContent, language, isUser, isCompact });
346
- }
347
- }, "pre"),
348
- code: /* @__PURE__ */ __name(({ children, className }) => {
349
- if (className?.includes("language-")) {
350
- return /* @__PURE__ */ jsx("code", { className, children });
351
- }
352
- const inlineCodeClass = isUser ? "bg-primary-foreground/15 text-primary-foreground" : "bg-code-inline text-code-inline-foreground";
353
- return /* @__PURE__ */ jsx("code", { className: `px-1 py-0.5 rounded font-mono text-[0.875em] ${inlineCodeClass} break-all`, children: extractTextFromChildren(children) });
354
- }, "code"),
355
- // Modern chat convention drops italic on blockquotes — italic +
356
- // tight bubble = hard to read. Border-left at 2px (4px reads
357
- // heavy in a 320–480px bubble). On the saturated user bubble we
358
- // use a primary-foreground tint; on the assistant bubble we use
359
- // the muted-foreground role for de-emphasis.
360
- blockquote: /* @__PURE__ */ __name(({ children }) => {
361
- const cls = isUser ? "border-primary-foreground/40 text-primary-foreground/80" : "border-border text-muted-foreground";
362
- return /* @__PURE__ */ jsx("blockquote", { className: `${textSize} border-l-2 pl-3 my-3 break-words ${cls}`, children });
363
- }, "blockquote"),
364
- // Tables: outer wrapper handles overflow, inner `<table>`
365
- // inherits the chat-density text size. Borders / header use
366
- // semantic tokens — `border-code-border` for the assistant
367
- // (matches the code-fence panel for visual cohesion when both
368
- // appear in the same reply); primary-foreground/N for the user
369
- // bubble so lines read against the saturated `bg-primary`.
370
- table: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("div", { className: "overflow-x-auto my-3", children: /* @__PURE__ */ jsx("table", { className: `min-w-full ${textSize} border-collapse`, children }) }), "table"),
371
- thead: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("thead", { className: isUser ? "bg-primary-foreground/10" : "bg-muted/40", children }), "thead"),
372
- tbody: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("tbody", { children }), "tbody"),
373
- tr: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("tr", { className: isUser ? "border-b border-primary-foreground/15" : "border-b border-border", children }), "tr"),
374
- th: /* @__PURE__ */ __name(({ children }) => {
375
- const borderCls = isUser ? "border-primary-foreground/25" : "border-border";
376
- return /* @__PURE__ */ jsx("th", { className: `px-2 py-1.5 text-left font-semibold border-b ${borderCls} break-words`, children });
377
- }, "th"),
378
- td: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("td", { className: "px-2 py-1.5 break-words", children }), "td"),
379
- // Soft separator. ChatGPT / Slack / Linear strip the visible
380
- // line, Claude.ai keeps a hairline. We follow Claude — present
381
- // but quiet. Palette switches by role so the hairline reads on
382
- // both surfaces.
383
- hr: /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx(
384
- "hr",
385
- {
386
- className: `my-4 border-0 h-px ${isUser ? "bg-primary-foreground/20" : "bg-border"}`
387
- }
388
- ), "hr"),
389
- strong: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold", children }), "strong"),
390
- em: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("em", { className: "italic", children }), "em")
391
- };
392
- }
393
- __name(createMarkdownComponents, "createMarkdownComponents");
394
- var CollapseToggle = /* @__PURE__ */ __name(({
395
- isCollapsed,
396
- onClick,
397
- readMoreLabel,
398
- showLessLabel,
399
- isUser,
400
- isCompact
401
- }) => {
402
- const textSize = isCompact ? "text-xs" : "text-sm";
403
- return /* @__PURE__ */ jsx(
404
- "button",
405
- {
406
- type: "button",
407
- onClick,
408
- className: `
409
- ${textSize} font-medium cursor-pointer
410
- transition-colors duration-200
411
- ${isUser ? "text-white/80 hover:text-white" : "text-primary hover:text-primary/80"}
412
- inline-flex items-center gap-1
413
- mt-1
414
- `,
415
- children: isCollapsed ? /* @__PURE__ */ jsxs(Fragment, { children: [
416
- readMoreLabel,
417
- /* @__PURE__ */ jsx(Chevron, { direction: "down" })
418
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
419
- showLessLabel,
420
- /* @__PURE__ */ jsx(Chevron, { direction: "up" })
421
- ] })
422
- }
423
- );
424
- }, "CollapseToggle");
425
- function Chevron({ direction }) {
426
- return /* @__PURE__ */ jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx(
427
- "path",
428
- {
429
- strokeLinecap: "round",
430
- strokeLinejoin: "round",
431
- strokeWidth: 2,
432
- d: direction === "down" ? "M19 9l-7 7-7-7" : "M5 15l7-7 7 7"
433
- }
434
- ) });
435
- }
436
- __name(Chevron, "Chevron");
437
- function applyPreprocess(source, rules) {
438
- if (!rules || rules.length === 0) return source;
439
- let s = source;
440
- for (const rule of rules) {
441
- if (!rule.preprocess) continue;
442
- try {
443
- s = rule.preprocess(s);
444
- } catch (err) {
445
- console.warn(
446
- `[MarkdownMessage] linkRule "${rule.name ?? "(anonymous)"}" preprocess threw; skipping`,
447
- err
448
- );
449
- }
450
- }
451
- return s;
452
- }
453
- __name(applyPreprocess, "applyPreprocess");
454
- function collectProtocols(extraHrefProtocols, rules) {
455
- const set = /* @__PURE__ */ new Set();
456
- if (extraHrefProtocols) for (const p of extraHrefProtocols) set.add(p);
457
- if (rules) {
458
- for (const r of rules) {
459
- if (r.protocols) for (const p of r.protocols) set.add(p);
460
- }
461
- }
462
- return set.size === 0 ? void 0 : Array.from(set);
463
- }
464
- __name(collectProtocols, "collectProtocols");
465
- function buildLinkRulesComponent(rules, isUser, callerA) {
466
- const Renderer = /* @__PURE__ */ __name((props) => {
467
- const { href, children } = props;
468
- if (typeof href === "string") {
469
- for (const rule of rules) {
470
- if (rule.match(href)) {
471
- return React6.createElement(
472
- React6.Fragment,
473
- null,
474
- rule.render({ href, children, isUser })
475
- );
476
- }
477
- }
478
- }
479
- if (callerA && typeof callerA === "function") {
480
- const Caller = callerA;
481
- return React6.createElement(Caller, props);
482
- }
483
- return React6.createElement("a", props, children);
484
- }, "Renderer");
485
- return Renderer;
486
- }
487
- __name(buildLinkRulesComponent, "buildLinkRulesComponent");
488
- var MarkdownMessage = /* @__PURE__ */ __name(({
489
- content,
490
- className = "",
491
- isUser = false,
492
- isCompact = false,
493
- plainText,
494
- customComponents,
495
- extraHrefProtocols,
496
- linkRules,
497
- collapsible = false,
498
- maxLength,
499
- maxLines,
500
- readMoreLabel = "Read more...",
501
- showLessLabel = "Show less",
502
- defaultExpanded = false,
503
- onCollapseChange
504
- }) => {
505
- const preprocessed = React6.useMemo(
506
- () => applyPreprocess(content, linkRules),
507
- [content, linkRules]
508
- );
509
- const effectiveProtocols = React6.useMemo(
510
- () => collectProtocols(extraHrefProtocols, linkRules),
511
- [extraHrefProtocols, linkRules]
512
- );
513
- const effectiveCustomComponents = React6.useMemo(() => {
514
- if (!linkRules || linkRules.length === 0) return customComponents;
515
- const callerA = customComponents?.a;
516
- const aRenderer = buildLinkRulesComponent(linkRules, isUser, callerA);
517
- return { ...customComponents ?? {}, a: aRenderer };
518
- }, [customComponents, linkRules, isUser]);
519
- const trimmedContent = preprocessed.trim();
520
- const collapsibleOptions = React6.useMemo(() => {
521
- if (!collapsible) return {};
522
- return {
523
- maxLength: maxLength ?? 1e3,
524
- maxLines: maxLines ?? 10,
525
- defaultExpanded
526
- };
527
- }, [collapsible, maxLength, maxLines, defaultExpanded]);
528
- const { isCollapsed, toggleCollapsed, displayContent, shouldCollapse } = useCollapsibleContent(trimmedContent, collapsible ? collapsibleOptions : {});
529
- React6.useEffect(() => {
530
- if (collapsible && shouldCollapse && onCollapseChange) {
531
- onCollapseChange(isCollapsed);
532
- }
533
- }, [isCollapsed, collapsible, shouldCollapse, onCollapseChange]);
534
- const components = React6.useMemo(() => {
535
- const base = createMarkdownComponents(isUser, isCompact);
536
- return effectiveCustomComponents ? { ...base, ...effectiveCustomComponents } : base;
537
- }, [isUser, isCompact, effectiveCustomComponents]);
538
- const schema = React6.useMemo(() => buildSchema(effectiveProtocols), [effectiveProtocols]);
539
- const urlTransform = React6.useMemo(
540
- () => buildUrlTransform(effectiveProtocols),
541
- [effectiveProtocols]
542
- );
543
- const textSizeClass = isCompact ? "text-xs" : "text-sm";
544
- const proseClass = isCompact ? "prose-xs" : "prose-sm";
545
- const customComponentsBeyondLinks = React6.useMemo(() => {
546
- if (!customComponents) return false;
547
- return Object.keys(customComponents).some((k) => k !== "a");
548
- }, [customComponents]);
549
- const isPlainText = plainText !== void 0 ? plainText : !customComponentsBeyondLinks && looksLikePlainProse(displayContent);
550
- if (isPlainText) {
551
- return /* @__PURE__ */ jsxs(
552
- "div",
553
- {
554
- className: `${textSizeClass} font-normal antialiased leading-snug break-words whitespace-pre-wrap ${className}`,
555
- children: [
556
- displayContent,
557
- collapsible && shouldCollapse && /* @__PURE__ */ jsxs(Fragment, { children: [
558
- isCollapsed && "... ",
559
- /* @__PURE__ */ jsx(
560
- CollapseToggle,
561
- {
562
- isCollapsed,
563
- onClick: toggleCollapsed,
564
- readMoreLabel,
565
- showLessLabel,
566
- isUser,
567
- isCompact
568
- }
569
- )
570
- ] })
571
- ]
572
- }
573
- );
574
- }
575
- return /* @__PURE__ */ jsxs("div", { className, children: [
576
- /* @__PURE__ */ jsx(
577
- "div",
578
- {
579
- className: `
580
- prose ${proseClass} max-w-none break-words overflow-hidden ${textSizeClass} font-normal antialiased
581
- ${isUser ? "prose-invert" : "dark:prose-invert"}
582
- [&>*]:leading-relaxed
583
- [&>*:first-child]:mt-0 [&>*:last-child]:mb-0
584
- [&_p]:my-2
585
- [&_ul]:my-2 [&_ol]:my-2 [&_ul]:pl-5 [&_ol]:pl-5
586
- [&_li]:my-1 [&_li>p]:my-0
587
- [&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-base [&_h1]:font-semibold
588
- [&_h2]:mt-3.5 [&_h2]:mb-1.5 [&_h2]:text-[15px] [&_h2]:font-semibold
589
- [&_h3]:mt-3 [&_h3]:mb-1 [&_h3]:text-sm [&_h3]:font-medium
590
- [&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:text-sm [&_h4]:font-medium
591
- `,
592
- style: {
593
- // Inherit colors from parent — fixes issues with external
594
- // CSS variables overriding prose tokens.
595
- "--tw-prose-body": "inherit",
596
- "--tw-prose-headings": "inherit",
597
- "--tw-prose-bold": "inherit",
598
- "--tw-prose-links": "inherit",
599
- color: "inherit"
600
- },
601
- children: /* @__PURE__ */ jsx(
602
- ReactMarkdown,
603
- {
604
- remarkPlugins: [remarkGfm, remarkBreaks, remarkSmartypants, remarkEmoji],
605
- rehypePlugins: [
606
- rehypeRaw,
607
- [rehypeSanitize, schema],
608
- [rehypeExternalLinks, { target: "_blank", rel: ["noopener", "noreferrer"] }]
609
- ],
610
- components,
611
- urlTransform,
612
- children: displayContent
613
- }
614
- )
615
- }
616
- ),
617
- collapsible && shouldCollapse && /* @__PURE__ */ jsx(
618
- CollapseToggle,
619
- {
620
- isCollapsed,
621
- onClick: toggleCollapsed,
622
- readMoreLabel,
623
- showLessLabel,
624
- isUser,
625
- isCompact
626
- }
627
- )
628
- ] });
629
- }, "MarkdownMessage");
6
+ import { jsx } from 'react/jsx-runtime';
630
7
 
631
8
  // src/tools/OpenapiViewer/utils/apiKeyManager.ts
632
9
  function findApiKeyById(apiKeys, keyId) {
@@ -1382,7 +759,7 @@ var usePlaygroundContext = /* @__PURE__ */ __name(() => {
1382
759
  var PlaygroundProvider = /* @__PURE__ */ __name(({ children, config }) => {
1383
760
  const [state, dispatch] = useReducer(reducer, void 0, createInitialState);
1384
761
  const abortControllerRef = useRef(null);
1385
- const apiKeys = React6.useMemo(
762
+ const apiKeys = React.useMemo(
1386
763
  () => config.apiKeys ?? [],
1387
764
  [config.apiKeys]
1388
765
  );
@@ -1552,6 +929,6 @@ var PlaygroundProvider = /* @__PURE__ */ __name(({ children, config }) => {
1552
929
  return /* @__PURE__ */ jsx(PlaygroundContext.Provider, { value: contextValue, children });
1553
930
  }, "PlaygroundProvider");
1554
931
 
1555
- export { CODE_SAMPLE_TARGETS, MarkdownMessage, Mermaid_default, PlaygroundProvider, PrettyCode_default, UrlBuilder, buildHarRequest, deduplicateEndpoints, dereferenceSchema, endpointToMarkdown, extractTextFromChildren, findApiKeyById, formatBytes, isValidJson, joinUrl, parseRequestHeaders, relativePath, renderSnippet, resolveAbsolute, resolveBaseUrl, sampleSchemaJson, toCompactJson, toMarkdown, toRawJson, useCollapsibleContent, usePlaygroundContext };
1556
- //# sourceMappingURL=chunk-62Y65TGK.mjs.map
1557
- //# sourceMappingURL=chunk-62Y65TGK.mjs.map
932
+ export { CODE_SAMPLE_TARGETS, PlaygroundProvider, UrlBuilder, buildHarRequest, deduplicateEndpoints, dereferenceSchema, endpointToMarkdown, findApiKeyById, formatBytes, isValidJson, joinUrl, parseRequestHeaders, relativePath, renderSnippet, resolveAbsolute, resolveBaseUrl, sampleSchemaJson, toCompactJson, toMarkdown, toRawJson, usePlaygroundContext };
933
+ //# sourceMappingURL=chunk-ZUFTH5IR.mjs.map
934
+ //# sourceMappingURL=chunk-ZUFTH5IR.mjs.map