@red-hat-developer-hub/backstage-plugin-lightspeed 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/alpha/LightspeedFAB.esm.js.map +1 -1
  3. package/dist/alpha/LightspeedProvider.esm.js.map +1 -1
  4. package/dist/alpha.esm.js +1 -1
  5. package/dist/alpha.esm.js.map +1 -1
  6. package/dist/api/LightspeedApiClient.esm.js +1 -1
  7. package/dist/api/LightspeedApiClient.esm.js.map +1 -1
  8. package/dist/api/NotebooksApiClient.esm.js.map +1 -1
  9. package/dist/api/api.esm.js.map +1 -1
  10. package/dist/api/notebooksApi.esm.js.map +1 -1
  11. package/dist/components/Attachment.esm.js +2 -2
  12. package/dist/components/Attachment.esm.js.map +1 -1
  13. package/dist/components/AttachmentContext.esm.js +1 -1
  14. package/dist/components/AttachmentContext.esm.js.map +1 -1
  15. package/dist/components/DeleteModal.esm.js.map +1 -1
  16. package/dist/components/FilePreview.esm.js.map +1 -1
  17. package/dist/components/LightSpeedChat.esm.js +16 -16
  18. package/dist/components/LightSpeedChat.esm.js.map +1 -1
  19. package/dist/components/LightspeedChatBox.esm.js +5 -5
  20. package/dist/components/LightspeedChatBox.esm.js.map +1 -1
  21. package/dist/components/LightspeedChatBoxHeader.esm.js +1 -1
  22. package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
  23. package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
  24. package/dist/components/LightspeedChatModelsState.esm.js.map +1 -1
  25. package/dist/components/LightspeedDrawerContext.esm.js +1 -1
  26. package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
  27. package/dist/components/LightspeedDrawerProvider.esm.js.map +1 -1
  28. package/dist/components/LightspeedDrawerStateExposer.esm.js.map +1 -1
  29. package/dist/components/LightspeedFAB.esm.js.map +1 -1
  30. package/dist/components/LightspeedIcon.esm.js.map +1 -1
  31. package/dist/components/LightspeedPage.esm.js.map +1 -1
  32. package/dist/components/McpServersSettings.esm.js +3 -3
  33. package/dist/components/McpServersSettings.esm.js.map +1 -1
  34. package/dist/components/McpSettingsIcon.esm.js.map +1 -1
  35. package/dist/components/PermissionRequiredIcon.esm.js.map +1 -1
  36. package/dist/components/PermissionRequiredState.esm.js.map +1 -1
  37. package/dist/components/RenameConversationModal.esm.js.map +1 -1
  38. package/dist/components/Router.esm.js.map +1 -1
  39. package/dist/components/ToolCallContent.esm.js +3 -3
  40. package/dist/components/ToolCallContent.esm.js.map +1 -1
  41. package/dist/components/Trans.esm.js.map +1 -1
  42. package/dist/components/notebooks/AddDocumentModal.esm.js.map +1 -1
  43. package/dist/components/notebooks/DeleteNotebookModal.esm.js.map +1 -1
  44. package/dist/components/notebooks/DocumentSidebar.esm.js +2 -2
  45. package/dist/components/notebooks/DocumentSidebar.esm.js.map +1 -1
  46. package/dist/components/notebooks/FileListItem.esm.js.map +1 -1
  47. package/dist/components/notebooks/FileTypeIcon.esm.js.map +1 -1
  48. package/dist/components/notebooks/NotebookCard.esm.js +1 -1
  49. package/dist/components/notebooks/NotebookCard.esm.js.map +1 -1
  50. package/dist/components/notebooks/NotebookView.esm.js +3 -3
  51. package/dist/components/notebooks/NotebookView.esm.js.map +1 -1
  52. package/dist/components/notebooks/NotebooksTab.esm.js.map +1 -1
  53. package/dist/components/notebooks/OverwriteConfirmModal.esm.js.map +1 -1
  54. package/dist/components/notebooks/RenameNotebookModal.esm.js.map +1 -1
  55. package/dist/components/notebooks/SidebarCollapseIcon.esm.js.map +1 -1
  56. package/dist/components/notebooks/UploadResourceScreen.esm.js +1 -1
  57. package/dist/components/notebooks/UploadResourceScreen.esm.js.map +1 -1
  58. package/dist/const.esm.js.map +1 -1
  59. package/dist/dev.esm.js.map +1 -1
  60. package/dist/hooks/notebooks/useCreateNotebook.esm.js.map +1 -1
  61. package/dist/hooks/notebooks/useCreateNotebookMessage.esm.js.map +1 -1
  62. package/dist/hooks/notebooks/useDeleteNotebook.esm.js.map +1 -1
  63. package/dist/hooks/notebooks/useDocumentStatusPolling.esm.js.map +1 -1
  64. package/dist/hooks/notebooks/useLightspeedNotebooksPermission.esm.js.map +1 -1
  65. package/dist/hooks/notebooks/useNotebookDocuments.esm.js.map +1 -1
  66. package/dist/hooks/notebooks/useNotebookSession.esm.js.map +1 -1
  67. package/dist/hooks/notebooks/useNotebookSessions.esm.js.map +1 -1
  68. package/dist/hooks/notebooks/useRenameNotebook.esm.js.map +1 -1
  69. package/dist/hooks/notebooks/useUploadDocument.esm.js.map +1 -1
  70. package/dist/hooks/toolCallsCacheStore.esm.js +1 -1
  71. package/dist/hooks/toolCallsCacheStore.esm.js.map +1 -1
  72. package/dist/hooks/useAllModels.esm.js.map +1 -1
  73. package/dist/hooks/useAutoScroll.esm.js +1 -1
  74. package/dist/hooks/useAutoScroll.esm.js.map +1 -1
  75. package/dist/hooks/useBackstageUserIdentity.esm.js.map +1 -1
  76. package/dist/hooks/useBufferedMessages.esm.js.map +1 -1
  77. package/dist/hooks/useCaptureFeedback.esm.js.map +1 -1
  78. package/dist/hooks/useConversationMessages.esm.js +1 -1
  79. package/dist/hooks/useConversationMessages.esm.js.map +1 -1
  80. package/dist/hooks/useConversations.esm.js.map +1 -1
  81. package/dist/hooks/useCreateCoversationMessage.esm.js.map +1 -1
  82. package/dist/hooks/useDeleteConversation.esm.js.map +1 -1
  83. package/dist/hooks/useDisplayModeSettings.esm.js +1 -1
  84. package/dist/hooks/useDisplayModeSettings.esm.js.map +1 -1
  85. package/dist/hooks/useFeedbackActions.esm.js +3 -3
  86. package/dist/hooks/useFeedbackActions.esm.js.map +1 -1
  87. package/dist/hooks/useFeedbackState.esm.js.map +1 -1
  88. package/dist/hooks/useFeedbackStatus.esm.js.map +1 -1
  89. package/dist/hooks/useIsMobile.esm.js.map +1 -1
  90. package/dist/hooks/useLastOpenedConversation.esm.js.map +1 -1
  91. package/dist/hooks/useLightspeedDeletePermission.esm.js.map +1 -1
  92. package/dist/hooks/useLightspeedDrawerContext.esm.js +1 -1
  93. package/dist/hooks/useLightspeedDrawerContext.esm.js.map +1 -1
  94. package/dist/hooks/useLightspeedProviderState.esm.js +2 -2
  95. package/dist/hooks/useLightspeedProviderState.esm.js.map +1 -1
  96. package/dist/hooks/useLightspeedUpdatePermission.esm.js.map +1 -1
  97. package/dist/hooks/useLightspeedViewPermission.esm.js.map +1 -1
  98. package/dist/hooks/usePinnedChatsSettings.esm.js +2 -2
  99. package/dist/hooks/usePinnedChatsSettings.esm.js.map +1 -1
  100. package/dist/hooks/useQuestionValidation.esm.js.map +1 -1
  101. package/dist/hooks/useRenameConversation.esm.js.map +1 -1
  102. package/dist/hooks/useSortSettings.esm.js +2 -2
  103. package/dist/hooks/useSortSettings.esm.js.map +1 -1
  104. package/dist/hooks/useStopConversation.esm.js.map +1 -1
  105. package/dist/hooks/useTranslation.esm.js.map +1 -1
  106. package/dist/hooks/useWelcomePrompts.esm.js.map +1 -1
  107. package/dist/plugin.esm.js +2 -2
  108. package/dist/plugin.esm.js.map +1 -1
  109. package/dist/routes.esm.js.map +1 -1
  110. package/dist/translations/de.esm.js.map +1 -1
  111. package/dist/translations/es.esm.js.map +1 -1
  112. package/dist/translations/fr.esm.js.map +1 -1
  113. package/dist/translations/index.esm.js.map +1 -1
  114. package/dist/translations/it.esm.js.map +1 -1
  115. package/dist/translations/ja.esm.js.map +1 -1
  116. package/dist/translations/ref.esm.js.map +1 -1
  117. package/dist/types.esm.js.map +1 -1
  118. package/dist/utils/attachment-utils.esm.js.map +1 -1
  119. package/dist/utils/formatToolResponseForMarkdown.esm.js.map +1 -1
  120. package/dist/utils/lightspeed-chatbox-utils.esm.js +4 -4
  121. package/dist/utils/lightspeed-chatbox-utils.esm.js.map +1 -1
  122. package/dist/utils/notebook-upload-utils.esm.js +1 -1
  123. package/dist/utils/notebook-upload-utils.esm.js.map +1 -1
  124. package/dist/utils/notebooks-utils.esm.js +1 -1
  125. package/dist/utils/notebooks-utils.esm.js.map +1 -1
  126. package/dist/utils/prompt-utils.esm.js.map +1 -1
  127. package/dist/utils/queryClient.esm.js.map +1 -1
  128. package/dist/utils/reasoningParser.esm.js.map +1 -1
  129. package/dist/utils/toolCallMapper.esm.js +2 -2
  130. package/dist/utils/toolCallMapper.esm.js.map +1 -1
  131. package/dist/utils/user-utils.esm.js.map +1 -1
  132. package/package.json +2 -2
@@ -95,7 +95,7 @@ const LightspeedChatBox = forwardRef(
95
95
  }
96
96
  }));
97
97
  useEffect(() => {
98
- if (!autoScroll || scrollQueued.current) return undefined;
98
+ if (!autoScroll || scrollQueued.current) return void 0;
99
99
  scrollQueued.current = true;
100
100
  const rafId = requestAnimationFrame(() => {
101
101
  const container = containerRef.current;
@@ -168,10 +168,10 @@ const LightspeedChatBox = forwardRef(
168
168
  const messageContent = message.content;
169
169
  const parsedReasoning = parseReasoning(messageContent || "");
170
170
  const firstToolCall = message.toolCalls?.[0];
171
- const toolCallProp = firstToolCall ? mapToPatternFlyToolCall(firstToolCall, t, message.role) : undefined;
171
+ const toolCallProp = firstToolCall ? mapToPatternFlyToolCall(firstToolCall, t, message.role) : void 0;
172
172
  const additionalToolCalls = message.toolCalls?.slice(1);
173
173
  const extraContentParts = {};
174
- let deepThinking = undefined;
174
+ let deepThinking = void 0;
175
175
  if (parsedReasoning.isReasoningInProgress || parsedReasoning.hasReasoning) {
176
176
  const reasoningContent = parsedReasoning.reasoning;
177
177
  if (reasoningContent) {
@@ -179,7 +179,7 @@ const LightspeedChatBox = forwardRef(
179
179
  cardBodyProps: {
180
180
  id: `deep-thinking-${index}`,
181
181
  style: { whiteSpace: "pre-line" },
182
- className: parsedReasoning.isReasoningInProgress ? classes.deepThinking : undefined
182
+ className: parsedReasoning.isReasoningInProgress ? classes.deepThinking : void 0
183
183
  },
184
184
  toggleContent: t("reasoning.thinking"),
185
185
  body: reasoningContent,
@@ -221,7 +221,7 @@ const LightspeedChatBox = forwardRef(
221
221
  allToolCalls.length > 0 && /* @__PURE__ */ jsx("div", { style: { marginTop: deepThinking ? "8px" : "0" }, children: allToolCalls })
222
222
  ] });
223
223
  }
224
- const extraContent = extraContentParts.beforeMainContent || extraContentParts.afterMainContent ? extraContentParts : undefined;
224
+ const extraContent = extraContentParts.beforeMainContent || extraContentParts.afterMainContent ? extraContentParts : void 0;
225
225
  const finalMessage = parsedReasoning.hasReasoning || parsedReasoning.isReasoningInProgress ? { ...message, content: parsedReasoning.mainContent } : message;
226
226
  return /* @__PURE__ */ jsx(
227
227
  Message,
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedChatBox.esm.js","sources":["../../src/components/LightspeedChatBox.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ForwardedRef,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\n\nimport { makeStyles } from '@material-ui/core';\nimport {\n ChatbotDisplayMode,\n ChatbotWelcomePrompt,\n DeepThinking,\n DeepThinkingProps,\n Message,\n MessageBox,\n MessageBoxHandle,\n MessageProps,\n ToolCall as PatternFlyToolCall,\n WelcomePrompt,\n} from '@patternfly/chatbot';\nimport { Alert } from '@patternfly/react-core';\n\nimport { useAutoScroll } from '../hooks/useAutoScroll';\nimport { useBufferedMessages } from '../hooks/useBufferedMessages';\nimport { useFeedbackActions } from '../hooks/useFeedbackActions';\nimport { useTranslation } from '../hooks/useTranslation';\nimport { ToolCall } from '../types';\nimport { parseReasoning } from '../utils/reasoningParser';\nimport { mapToPatternFlyToolCall } from '../utils/toolCallMapper';\n\nconst useStyles = makeStyles(theme => ({\n prompt: {\n 'justify-content': 'flex-end',\n },\n container: {\n maxWidth: 'unset !important',\n },\n alert: {\n background: 'unset !important',\n },\n promptSuggestions: {\n '& div.pf-chatbot__prompt-suggestions': {\n 'flex-direction': 'column !important',\n },\n },\n\n userMessageText: {\n '& div.pf-chatbot__message--user': {\n '& div.pf-chatbot__message-text': {\n '& p': {\n color: theme.palette.common.white,\n },\n },\n },\n },\n deepThinking: {\n animation: '$deepThinking 1.6s ease-in-out infinite',\n },\n\n '@keyframes deepThinking': {\n '0%': {\n opacity: 0.65,\n },\n '50%': {\n opacity: 1,\n },\n '100%': {\n opacity: 0.65,\n },\n },\n // Message box fills remaining height and scrolls when there are messages.\n messageBoxFlex: {\n flex: 1,\n minHeight: 0,\n },\n // New chat: message box sizes to content so ChatbotContent is the scroll container.\n // overflow: visible so full height is included in parent's scrollHeight (no clipping).\n messageBoxAutoHeight: {\n flex: 'none',\n height: 'auto',\n overflow: 'visible',\n },\n}));\n\n// Extended message type that includes tool calls\ninterface ExtendedMessageProps extends MessageProps {\n toolCalls?: ToolCall[];\n}\n\ntype LightspeedChatBoxProps = {\n userName?: string;\n messages: ExtendedMessageProps[];\n profileLoading: boolean;\n announcement: string | undefined;\n topicRestrictionEnabled: boolean;\n welcomePrompts: WelcomePrompt[];\n conversationId: string;\n isStreaming: boolean;\n displayMode?: ChatbotDisplayMode;\n};\n\nexport interface ScrollContainerHandle {\n scrollToBottom: () => void;\n}\n\nexport const LightspeedChatBox = forwardRef(\n (\n {\n userName,\n messages,\n announcement,\n conversationId,\n profileLoading,\n welcomePrompts,\n isStreaming,\n topicRestrictionEnabled,\n displayMode,\n }: LightspeedChatBoxProps,\n ref: ForwardedRef<ScrollContainerHandle | null>,\n ) => {\n const classes = useStyles();\n const scrollQueued = useRef(false);\n const containerRef = useRef<MessageBoxHandle>(null);\n const { t } = useTranslation();\n\n const cmessages = useBufferedMessages(messages, 30);\n const { autoScroll, scrollToBottom, scrollToTop } =\n useAutoScroll(containerRef);\n const conversationMessages = useFeedbackActions(\n cmessages,\n conversationId,\n isStreaming,\n );\n\n useImperativeHandle(ref, () => ({\n scrollToBottom: () => {\n if (scrollQueued.current) return;\n scrollQueued.current = true;\n\n requestAnimationFrame(() => {\n scrollToBottom();\n scrollQueued.current = false;\n });\n },\n }));\n\n // Auto-scrolls to the latest message\n useEffect(() => {\n if (!autoScroll || scrollQueued.current) return undefined;\n\n scrollQueued.current = true;\n\n const rafId = requestAnimationFrame(() => {\n const container = containerRef.current;\n if (!container) return;\n\n setTimeout(() => {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: 'auto',\n });\n }, 0);\n\n scrollQueued.current = false;\n });\n\n return () => {\n cancelAnimationFrame(rafId);\n scrollQueued.current = false;\n };\n\n // eslint-disable-next-line\n }, [autoScroll, cmessages, containerRef]);\n\n const messageBoxClasses = `${classes.container} ${classes.userMessageText}`;\n const isEmbeddedMode = displayMode === ChatbotDisplayMode.embedded;\n\n const isNewChat = welcomePrompts.length > 0 && messages.length === 0;\n const getMessageBoxClassName = () => {\n const base = isNewChat\n ? `${messageBoxClasses} ${classes.messageBoxAutoHeight}`\n : `${messageBoxClasses} ${classes.messageBoxFlex}`;\n if (!welcomePrompts.length) {\n return base;\n }\n const withPrompt = `${base} ${classes.prompt}`;\n if (isEmbeddedMode) {\n return withPrompt;\n }\n return `${withPrompt} ${classes.promptSuggestions}`;\n };\n\n return (\n <MessageBox\n className={getMessageBoxClassName()}\n announcement={announcement}\n ref={containerRef}\n onScrollToTopClick={scrollToTop}\n onScrollToBottomClick={scrollToBottom}\n jumpButtonBottomProps={{ 'aria-label': t('aria.scroll.down') }}\n jumpButtonTopProps={{ 'aria-label': t('aria.scroll.up') }}\n jumpButtonBottomTooltipProps={{ content: t('tooltip.backToBottom') }}\n jumpButtonTopTooltipProps={{ content: t('tooltip.backToTop') }}\n >\n <div>\n <Alert\n title={t('aria.important')}\n variant=\"info\"\n isInline\n className={classes.alert}\n >\n {topicRestrictionEnabled\n ? t('disclaimer.withValidation')\n : t('disclaimer.withoutValidation')}\n </Alert>\n <br />\n </div>\n {welcomePrompts.length ? (\n <ChatbotWelcomePrompt\n title={t('chatbox.welcome.greeting' as any, {\n userName: profileLoading\n ? t('user.loading')\n : (userName ?? t('user.guest')),\n })}\n description={t('chatbox.welcome.description')}\n prompts={welcomePrompts}\n style={{ paddingBottom: '0' }}\n />\n ) : (\n <br />\n )}\n {conversationMessages.map((message, index) => {\n const messageContent = message.content as string;\n const parsedReasoning = parseReasoning(messageContent || '');\n\n // Map first tool call to PatternFly's toolCall prop\n const firstToolCall = message.toolCalls?.[0];\n const toolCallProp = firstToolCall\n ? mapToPatternFlyToolCall(firstToolCall, t, message.role)\n : undefined;\n\n // Handle additional tool calls (if any) via extraContent\n const additionalToolCalls = message.toolCalls?.slice(1);\n\n const extraContentParts: {\n beforeMainContent?: React.ReactNode;\n afterMainContent?: React.ReactNode;\n } = {};\n\n let deepThinking: DeepThinkingProps | undefined = undefined;\n\n if (\n parsedReasoning.isReasoningInProgress ||\n parsedReasoning.hasReasoning\n ) {\n const reasoningContent = parsedReasoning.reasoning;\n\n if (reasoningContent) {\n deepThinking = {\n cardBodyProps: {\n id: `deep-thinking-${index}`,\n style: { whiteSpace: 'pre-line' },\n className: parsedReasoning.isReasoningInProgress\n ? classes.deepThinking\n : undefined,\n },\n toggleContent: t('reasoning.thinking'),\n body: reasoningContent,\n isDefaultExpanded: false,\n };\n }\n }\n\n const allToolCalls: React.ReactNode[] = [];\n\n // Add first tool call if it exists\n if (toolCallProp && firstToolCall) {\n allToolCalls.push(\n <div\n key={`tool-${firstToolCall.id}-${firstToolCall.toolName}`}\n style={{ marginTop: '8px' }}\n >\n <PatternFlyToolCall {...toolCallProp} />\n </div>,\n );\n }\n\n // Add additional tool calls\n if (additionalToolCalls && additionalToolCalls.length > 0) {\n additionalToolCalls.forEach(tc => {\n const tcProps = mapToPatternFlyToolCall(tc, t, message.role);\n allToolCalls.push(\n <div\n key={`tool-${tc.id}-${tc.toolName}`}\n style={{ marginTop: '8px' }}\n >\n <PatternFlyToolCall {...tcProps} />\n </div>,\n );\n });\n }\n\n // Show Thinking first, then tool calls\n if (deepThinking || allToolCalls.length > 0) {\n extraContentParts.beforeMainContent = (\n <>\n {deepThinking && <DeepThinking {...deepThinking} />}\n {allToolCalls.length > 0 && (\n <div style={{ marginTop: deepThinking ? '8px' : '0' }}>\n {allToolCalls}\n </div>\n )}\n </>\n );\n }\n\n const extraContent =\n extraContentParts.beforeMainContent ||\n extraContentParts.afterMainContent\n ? extraContentParts\n : undefined;\n\n const finalMessage =\n parsedReasoning.hasReasoning ||\n parsedReasoning.isReasoningInProgress\n ? { ...message, content: parsedReasoning.mainContent }\n : message;\n\n return (\n <Message\n key={`${message.role}-${index}`}\n extraContent={extraContent}\n {...finalMessage}\n />\n );\n })}\n </MessageBox>\n );\n },\n);\n"],"names":["PatternFlyToolCall"],"mappings":";;;;;;;;;;;;AA+CA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,iBAAmB,EAAA;AAAA,GACrB;AAAA,EACA,SAAW,EAAA;AAAA,IACT,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,KAAO,EAAA;AAAA,IACL,UAAY,EAAA;AAAA,GACd;AAAA,EACA,iBAAmB,EAAA;AAAA,IACjB,sCAAwC,EAAA;AAAA,MACtC,gBAAkB,EAAA;AAAA;AACpB,GACF;AAAA,EAEA,eAAiB,EAAA;AAAA,IACf,iCAAmC,EAAA;AAAA,MACjC,gCAAkC,EAAA;AAAA,QAChC,KAAO,EAAA;AAAA,UACL,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA;AAC9B;AACF;AACF,GACF;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,SAAW,EAAA;AAAA,GACb;AAAA,EAEA,yBAA2B,EAAA;AAAA,IACzB,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA;AAAA,KACX;AAAA,IAC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a,CAAA,MAAA,GAAS,CAAG,EAAA;AAC3C,cAAA,iBAAA,CAAkB,oCAEb,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,gBAAgB,YAAA,oBAAA,GAAA,CAAC,YAAc,EAAA,EAAA,GAAG,YAAc,EAAA,CAAA;AAAA,gBAChD,YAAa,CAAA,MAAA,GAAS,CACrB,oBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,SAAA,EAAW,YAAe,GAAA,KAAA,GAAQ,GAAI,EAAA,EACjD,QACH,EAAA,YAAA,EAAA;AAAA,eAEJ,EAAA,CAAA;AAAA;AAIJ,YAAA,MAAM,YACJ,GAAA,iBAAA,CAAkB,iBAClB,IAAA,iBAAA,CAAkB,mBACd,iBACA,GAAA,SAAA;AAEN,YAAM,MAAA,YAAA,GACJ,eAAgB,CAAA,YAAA,IAChB,eAAgB,CAAA,qBAAA,GACZ,EAAE,GAAG,OAAS,EAAA,OAAA,EAAS,eAAgB,CAAA,WAAA,EACvC,GAAA,OAAA;AAEN,YACE,uBAAA,GAAA;AAAA,cAAC,OAAA;AAAA,cAAA;AAAA,gBAEC,YAAA;AAAA,gBACC,GAAG;AAAA,eAAA;AAAA,cAFC,CAAG,EAAA,OAAA,CAAQ,IAAI,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,aAG/B;AAAA,WAEH;AAAA;AAAA;AAAA,KACH;AAAA;AAGN;;;;"}
1
+ {"version":3,"file":"LightspeedChatBox.esm.js","sources":["../../src/components/LightspeedChatBox.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ForwardedRef,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\n\nimport { makeStyles } from '@material-ui/core';\nimport {\n ChatbotDisplayMode,\n ChatbotWelcomePrompt,\n DeepThinking,\n DeepThinkingProps,\n Message,\n MessageBox,\n MessageBoxHandle,\n MessageProps,\n ToolCall as PatternFlyToolCall,\n WelcomePrompt,\n} from '@patternfly/chatbot';\nimport { Alert } from '@patternfly/react-core';\n\nimport { useAutoScroll } from '../hooks/useAutoScroll';\nimport { useBufferedMessages } from '../hooks/useBufferedMessages';\nimport { useFeedbackActions } from '../hooks/useFeedbackActions';\nimport { useTranslation } from '../hooks/useTranslation';\nimport { ToolCall } from '../types';\nimport { parseReasoning } from '../utils/reasoningParser';\nimport { mapToPatternFlyToolCall } from '../utils/toolCallMapper';\n\nconst useStyles = makeStyles(theme => ({\n prompt: {\n 'justify-content': 'flex-end',\n },\n container: {\n maxWidth: 'unset !important',\n },\n alert: {\n background: 'unset !important',\n },\n promptSuggestions: {\n '& div.pf-chatbot__prompt-suggestions': {\n 'flex-direction': 'column !important',\n },\n },\n\n userMessageText: {\n '& div.pf-chatbot__message--user': {\n '& div.pf-chatbot__message-text': {\n '& p': {\n color: theme.palette.common.white,\n },\n },\n },\n },\n deepThinking: {\n animation: '$deepThinking 1.6s ease-in-out infinite',\n },\n\n '@keyframes deepThinking': {\n '0%': {\n opacity: 0.65,\n },\n '50%': {\n opacity: 1,\n },\n '100%': {\n opacity: 0.65,\n },\n },\n // Message box fills remaining height and scrolls when there are messages.\n messageBoxFlex: {\n flex: 1,\n minHeight: 0,\n },\n // New chat: message box sizes to content so ChatbotContent is the scroll container.\n // overflow: visible so full height is included in parent's scrollHeight (no clipping).\n messageBoxAutoHeight: {\n flex: 'none',\n height: 'auto',\n overflow: 'visible',\n },\n}));\n\n// Extended message type that includes tool calls\ninterface ExtendedMessageProps extends MessageProps {\n toolCalls?: ToolCall[];\n}\n\ntype LightspeedChatBoxProps = {\n userName?: string;\n messages: ExtendedMessageProps[];\n profileLoading: boolean;\n announcement: string | undefined;\n topicRestrictionEnabled: boolean;\n welcomePrompts: WelcomePrompt[];\n conversationId: string;\n isStreaming: boolean;\n displayMode?: ChatbotDisplayMode;\n};\n\nexport interface ScrollContainerHandle {\n scrollToBottom: () => void;\n}\n\nexport const LightspeedChatBox = forwardRef(\n (\n {\n userName,\n messages,\n announcement,\n conversationId,\n profileLoading,\n welcomePrompts,\n isStreaming,\n topicRestrictionEnabled,\n displayMode,\n }: LightspeedChatBoxProps,\n ref: ForwardedRef<ScrollContainerHandle | null>,\n ) => {\n const classes = useStyles();\n const scrollQueued = useRef(false);\n const containerRef = useRef<MessageBoxHandle>(null);\n const { t } = useTranslation();\n\n const cmessages = useBufferedMessages(messages, 30);\n const { autoScroll, scrollToBottom, scrollToTop } =\n useAutoScroll(containerRef);\n const conversationMessages = useFeedbackActions(\n cmessages,\n conversationId,\n isStreaming,\n );\n\n useImperativeHandle(ref, () => ({\n scrollToBottom: () => {\n if (scrollQueued.current) return;\n scrollQueued.current = true;\n\n requestAnimationFrame(() => {\n scrollToBottom();\n scrollQueued.current = false;\n });\n },\n }));\n\n // Auto-scrolls to the latest message\n useEffect(() => {\n if (!autoScroll || scrollQueued.current) return undefined;\n\n scrollQueued.current = true;\n\n const rafId = requestAnimationFrame(() => {\n const container = containerRef.current;\n if (!container) return;\n\n setTimeout(() => {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: 'auto',\n });\n }, 0);\n\n scrollQueued.current = false;\n });\n\n return () => {\n cancelAnimationFrame(rafId);\n scrollQueued.current = false;\n };\n\n // eslint-disable-next-line\n }, [autoScroll, cmessages, containerRef]);\n\n const messageBoxClasses = `${classes.container} ${classes.userMessageText}`;\n const isEmbeddedMode = displayMode === ChatbotDisplayMode.embedded;\n\n const isNewChat = welcomePrompts.length > 0 && messages.length === 0;\n const getMessageBoxClassName = () => {\n const base = isNewChat\n ? `${messageBoxClasses} ${classes.messageBoxAutoHeight}`\n : `${messageBoxClasses} ${classes.messageBoxFlex}`;\n if (!welcomePrompts.length) {\n return base;\n }\n const withPrompt = `${base} ${classes.prompt}`;\n if (isEmbeddedMode) {\n return withPrompt;\n }\n return `${withPrompt} ${classes.promptSuggestions}`;\n };\n\n return (\n <MessageBox\n className={getMessageBoxClassName()}\n announcement={announcement}\n ref={containerRef}\n onScrollToTopClick={scrollToTop}\n onScrollToBottomClick={scrollToBottom}\n jumpButtonBottomProps={{ 'aria-label': t('aria.scroll.down') }}\n jumpButtonTopProps={{ 'aria-label': t('aria.scroll.up') }}\n jumpButtonBottomTooltipProps={{ content: t('tooltip.backToBottom') }}\n jumpButtonTopTooltipProps={{ content: t('tooltip.backToTop') }}\n >\n <div>\n <Alert\n title={t('aria.important')}\n variant=\"info\"\n isInline\n className={classes.alert}\n >\n {topicRestrictionEnabled\n ? t('disclaimer.withValidation')\n : t('disclaimer.withoutValidation')}\n </Alert>\n <br />\n </div>\n {welcomePrompts.length ? (\n <ChatbotWelcomePrompt\n title={t('chatbox.welcome.greeting' as any, {\n userName: profileLoading\n ? t('user.loading')\n : (userName ?? t('user.guest')),\n })}\n description={t('chatbox.welcome.description')}\n prompts={welcomePrompts}\n style={{ paddingBottom: '0' }}\n />\n ) : (\n <br />\n )}\n {conversationMessages.map((message, index) => {\n const messageContent = message.content as string;\n const parsedReasoning = parseReasoning(messageContent || '');\n\n // Map first tool call to PatternFly's toolCall prop\n const firstToolCall = message.toolCalls?.[0];\n const toolCallProp = firstToolCall\n ? mapToPatternFlyToolCall(firstToolCall, t, message.role)\n : undefined;\n\n // Handle additional tool calls (if any) via extraContent\n const additionalToolCalls = message.toolCalls?.slice(1);\n\n const extraContentParts: {\n beforeMainContent?: React.ReactNode;\n afterMainContent?: React.ReactNode;\n } = {};\n\n let deepThinking: DeepThinkingProps | undefined = undefined;\n\n if (\n parsedReasoning.isReasoningInProgress ||\n parsedReasoning.hasReasoning\n ) {\n const reasoningContent = parsedReasoning.reasoning;\n\n if (reasoningContent) {\n deepThinking = {\n cardBodyProps: {\n id: `deep-thinking-${index}`,\n style: { whiteSpace: 'pre-line' },\n className: parsedReasoning.isReasoningInProgress\n ? classes.deepThinking\n : undefined,\n },\n toggleContent: t('reasoning.thinking'),\n body: reasoningContent,\n isDefaultExpanded: false,\n };\n }\n }\n\n const allToolCalls: React.ReactNode[] = [];\n\n // Add first tool call if it exists\n if (toolCallProp && firstToolCall) {\n allToolCalls.push(\n <div\n key={`tool-${firstToolCall.id}-${firstToolCall.toolName}`}\n style={{ marginTop: '8px' }}\n >\n <PatternFlyToolCall {...toolCallProp} />\n </div>,\n );\n }\n\n // Add additional tool calls\n if (additionalToolCalls && additionalToolCalls.length > 0) {\n additionalToolCalls.forEach(tc => {\n const tcProps = mapToPatternFlyToolCall(tc, t, message.role);\n allToolCalls.push(\n <div\n key={`tool-${tc.id}-${tc.toolName}`}\n style={{ marginTop: '8px' }}\n >\n <PatternFlyToolCall {...tcProps} />\n </div>,\n );\n });\n }\n\n // Show Thinking first, then tool calls\n if (deepThinking || allToolCalls.length > 0) {\n extraContentParts.beforeMainContent = (\n <>\n {deepThinking && <DeepThinking {...deepThinking} />}\n {allToolCalls.length > 0 && (\n <div style={{ marginTop: deepThinking ? '8px' : '0' }}>\n {allToolCalls}\n </div>\n )}\n </>\n );\n }\n\n const extraContent =\n extraContentParts.beforeMainContent ||\n extraContentParts.afterMainContent\n ? extraContentParts\n : undefined;\n\n const finalMessage =\n parsedReasoning.hasReasoning ||\n parsedReasoning.isReasoningInProgress\n ? { ...message, content: parsedReasoning.mainContent }\n : message;\n\n return (\n <Message\n key={`${message.role}-${index}`}\n extraContent={extraContent}\n {...finalMessage}\n />\n );\n })}\n </MessageBox>\n );\n },\n);\n"],"names":["PatternFlyToolCall"],"mappings":";;;;;;;;;;;;AA+CA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,MAAA,EAAQ;AAAA,IACN,iBAAA,EAAmB;AA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OAAA,EAAS,OAAA,EAAS,eAAA,CAAgB,WAAA,EAAY,GACnD,OAAA;AAEN,YAAA,uBACE,GAAA;AAAA,cAAC,OAAA;AAAA,cAAA;AAAA,gBAEC,YAAA;AAAA,gBACC,GAAG;AAAA,eAAA;AAAA,cAFC,CAAA,EAAG,OAAA,CAAQ,IAAI,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,aAG/B;AAAA,UAEJ,CAAC;AAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;;;;"}
@@ -97,7 +97,7 @@ const LightspeedChatBoxHeader = ({
97
97
  shouldFocusFirstItemOnOpen: false,
98
98
  toggle,
99
99
  isScrollable: isModelDropdownScrollable,
100
- maxMenuHeight: isModelDropdownScrollable ? "240px" : undefined,
100
+ maxMenuHeight: isModelDropdownScrollable ? "240px" : void 0,
101
101
  children: /* @__PURE__ */ jsx(DropdownList, { children: models.map((model) => /* @__PURE__ */ jsx(DropdownGroup, { className: styles.groupTitle, children: /* @__PURE__ */ jsx(
102
102
  DropdownItem,
103
103
  {
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedChatBoxHeader.esm.js","sources":["../../src/components/LightspeedChatBoxHeader.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Ref, useState } from 'react';\n\nimport { createStyles, makeStyles } from '@material-ui/core';\nimport ToggleOffOutlinedIcon from '@mui/icons-material/ToggleOffOutlined';\nimport ToggleOnOutlinedIcon from '@mui/icons-material/ToggleOnOutlined';\nimport Divider from '@mui/material/Divider';\nimport {\n ChatbotDisplayMode,\n ChatbotHeaderActions,\n ChatbotHeaderOptionsDropdown,\n} from '@patternfly/chatbot';\nimport {\n Dropdown,\n DropdownGroup,\n DropdownItem,\n DropdownList,\n MenuToggle,\n MenuToggleElement,\n} from '@patternfly/react-core';\nimport {\n ExpandIcon,\n OpenDrawerRightIcon,\n OutlinedWindowRestoreIcon,\n} from '@patternfly/react-icons';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport { McpSettingsIcon } from './McpSettingsIcon';\n\ntype LightspeedChatBoxHeaderProps = {\n displayMode: ChatbotDisplayMode;\n selectedModel: string;\n handleSelectedModel: (item: string) => void;\n models: { label: string; value: string; provider: string }[];\n isPinningChatsEnabled: boolean;\n onPinnedChatsToggle: (state: boolean) => void;\n onMcpSettingsClick: () => void;\n isModelSelectorDisabled?: boolean;\n hideModelSelector?: boolean;\n setDisplayMode: (mode: ChatbotDisplayMode) => void;\n};\n\nconst useStyles = makeStyles(theme =>\n createStyles({\n dropdown: {\n '& ul, & li': {\n padding: 0,\n margin: 0,\n },\n },\n header: {\n backgroundColor: theme.palette.action.disabled,\n },\n optionsToggle: {\n '& svg': {\n transform: 'none !important',\n },\n },\n groupTitle: {\n fontWeight: 'bold',\n },\n }),\n);\n\nexport const LightspeedChatBoxHeader = ({\n selectedModel,\n displayMode,\n handleSelectedModel,\n models,\n isPinningChatsEnabled,\n onPinnedChatsToggle,\n onMcpSettingsClick,\n isModelSelectorDisabled = false,\n hideModelSelector = false,\n setDisplayMode,\n}: LightspeedChatBoxHeaderProps) => {\n const [isOptionsMenuOpen, setIsOptionsMenuOpen] = useState(false);\n const { t } = useTranslation();\n\n const styles = useStyles();\n\n const maxLabelLength = Math.max(\n ...models.map(m => m.label.length),\n selectedModel.length,\n 1,\n );\n const toggleMinWidth = `${maxLabelLength + 4}ch`;\n\n const toggle = (toggleRef: Ref<MenuToggleElement>) => (\n <MenuToggle\n className={isModelSelectorDisabled ? styles.header : ''}\n variant=\"secondary\"\n aria-label={t('aria.chatbotSelector')}\n ref={toggleRef}\n isExpanded={isOptionsMenuOpen}\n isDisabled={isModelSelectorDisabled}\n onClick={() => setIsOptionsMenuOpen(!isOptionsMenuOpen)}\n style={{ minWidth: toggleMinWidth }}\n >\n {selectedModel}\n </MenuToggle>\n );\n\n const handlePinningChatsToggle = (state: boolean) => {\n onPinnedChatsToggle(state);\n };\n\n const handleDockedToWindow = () => {\n setDisplayMode(ChatbotDisplayMode.docked);\n };\n\n const handleFullscreen = () => {\n setDisplayMode(ChatbotDisplayMode.embedded);\n };\n\n const handleOverlay = () => {\n setDisplayMode(ChatbotDisplayMode.default);\n };\n\n const isOverlayMode = displayMode === ChatbotDisplayMode.default;\n const scrollThreshold = isOverlayMode ? 8 : 10;\n const isModelDropdownScrollable = models.length > scrollThreshold;\n\n return (\n <ChatbotHeaderActions>\n {!hideModelSelector && (\n <Dropdown\n className={styles.dropdown}\n isOpen={isOptionsMenuOpen}\n onSelect={(_e, value) => {\n handleSelectedModel(value as string);\n setIsOptionsMenuOpen(false);\n }}\n onOpenChange={isOpen => setIsOptionsMenuOpen(isOpen)}\n popperProps={{ position: 'right' }}\n shouldFocusToggleOnSelect\n shouldFocusFirstItemOnOpen={false}\n toggle={toggle}\n isScrollable={isModelDropdownScrollable}\n maxMenuHeight={isModelDropdownScrollable ? '240px' : undefined}\n >\n <DropdownList>\n {models.map(model => (\n <DropdownGroup className={styles.groupTitle} key={model.label}>\n <DropdownItem\n value={model.value}\n key={model.value}\n isSelected={selectedModel === model.value}\n >\n {model.label}\n </DropdownItem>\n </DropdownGroup>\n ))}\n </DropdownList>\n </Dropdown>\n )}\n <ChatbotHeaderOptionsDropdown\n isCompact\n toggleProps={{\n 'aria-label': t('aria.settings.label'),\n className: styles.optionsToggle,\n }}\n tooltipProps={{\n content: t('tooltip.settings'),\n }}\n >\n <DropdownGroup>\n <DropdownList>\n <DropdownItem key=\"displayModeLabel\" isDisabled>\n {t('settings.displayMode.label')}\n </DropdownItem>\n <DropdownItem\n value={ChatbotDisplayMode.default}\n key=\"switchDisplayOverlay\"\n icon={<OutlinedWindowRestoreIcon />}\n onClick={handleOverlay}\n isSelected={displayMode === ChatbotDisplayMode.default}\n >\n {t('settings.displayMode.overlay')}\n </DropdownItem>\n <DropdownItem\n value={ChatbotDisplayMode.docked}\n key=\"switchDisplayDock\"\n icon={<OpenDrawerRightIcon />}\n onClick={handleDockedToWindow}\n isSelected={displayMode === ChatbotDisplayMode.docked}\n >\n {t('settings.displayMode.docked')}\n </DropdownItem>\n <DropdownItem\n value={ChatbotDisplayMode.embedded}\n key=\"switchDisplayFullscreen\"\n icon={<ExpandIcon />}\n onClick={handleFullscreen}\n isSelected={displayMode === ChatbotDisplayMode.embedded}\n >\n {t('settings.displayMode.fullscreen')}\n </DropdownItem>\n </DropdownList>\n </DropdownGroup>\n <Divider />\n <DropdownGroup>\n <DropdownList>\n {isPinningChatsEnabled ? (\n <DropdownItem\n value=\"disablePinningChats\"\n key=\"disablePinningChat\"\n icon={<ToggleOnOutlinedIcon sx={{ marginTop: '8px' }} />}\n description={t('settings.pinned.enabled.description')}\n onClick={() => handlePinningChatsToggle(false)}\n >\n {t('settings.pinned.disable')}\n </DropdownItem>\n ) : (\n <DropdownItem\n value=\"enablePinningChats\"\n key=\"enablePinningChats\"\n icon={<ToggleOffOutlinedIcon sx={{ marginTop: '8px' }} />}\n description={t('settings.pinned.disabled.description')}\n onClick={() => handlePinningChatsToggle(true)}\n >\n {t('settings.pinned.enable')}\n </DropdownItem>\n )}\n <DropdownItem\n value=\"mcpSettings\"\n key=\"mcpSettings\"\n icon={<McpSettingsIcon />}\n onClick={onMcpSettingsClick}\n >\n {t('settings.mcp.label')}\n </DropdownItem>\n </DropdownList>\n </DropdownGroup>\n </ChatbotHeaderOptionsDropdown>\n </ChatbotHeaderActions>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAyDA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,WAC3B,YAAa,CAAA;AAAA,IACX,QAAU,EAAA;AAAA,MACR,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;AAAA,eAAA;AAAA,cALxB;AAAA,aAQN,mBAAA,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,KAAM,EAAA,oBAAA;AAAA,gBAEN,sBAAO,GAAA,CAAA,qBAAA,EAAA,EAAsB,IAAI,EAAE,SAAA,EAAW,OAAS,EAAA,CAAA;AAAA,gBACvD,WAAA,EAAa,EAAE,sCAAsC,CAAA;AAAA,gBACrD,OAAA,EAAS,MAAM,wBAAA,CAAyB,IAAI,CAAA;AAAA,gBAE3C,YAAE,wBAAwB;AAAA,eAAA;AAAA,cALvB;AAAA,aAMN;AAAA,4BAEF,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,KAAM,EAAA,aAAA;AAAA,gBAEN,IAAA,sBAAO,eAAgB,EAAA,EAAA,CAAA;AAAA,gBACvB,OAAS,EAAA,kBAAA;AAAA,gBAER,YAAE,oBAAoB;AAAA,eAAA;AAAA,cAJnB;AAAA;AAKN,WAAA,EACF,CACF,EAAA;AAAA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LightspeedChatBoxHeader.esm.js","sources":["../../src/components/LightspeedChatBoxHeader.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Ref, useState } from 'react';\n\nimport { createStyles, makeStyles } from '@material-ui/core';\nimport ToggleOffOutlinedIcon from '@mui/icons-material/ToggleOffOutlined';\nimport ToggleOnOutlinedIcon from '@mui/icons-material/ToggleOnOutlined';\nimport Divider from '@mui/material/Divider';\nimport {\n ChatbotDisplayMode,\n ChatbotHeaderActions,\n ChatbotHeaderOptionsDropdown,\n} from '@patternfly/chatbot';\nimport {\n Dropdown,\n DropdownGroup,\n DropdownItem,\n DropdownList,\n MenuToggle,\n MenuToggleElement,\n} from '@patternfly/react-core';\nimport {\n ExpandIcon,\n OpenDrawerRightIcon,\n OutlinedWindowRestoreIcon,\n} from '@patternfly/react-icons';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport { McpSettingsIcon } from './McpSettingsIcon';\n\ntype LightspeedChatBoxHeaderProps = {\n displayMode: ChatbotDisplayMode;\n selectedModel: string;\n handleSelectedModel: (item: string) => void;\n models: { label: string; value: string; provider: string }[];\n isPinningChatsEnabled: boolean;\n onPinnedChatsToggle: (state: boolean) => void;\n onMcpSettingsClick: () => void;\n isModelSelectorDisabled?: boolean;\n hideModelSelector?: boolean;\n setDisplayMode: (mode: ChatbotDisplayMode) => void;\n};\n\nconst useStyles = makeStyles(theme =>\n createStyles({\n dropdown: {\n '& ul, & li': {\n padding: 0,\n margin: 0,\n },\n },\n header: {\n backgroundColor: theme.palette.action.disabled,\n },\n optionsToggle: {\n '& svg': {\n transform: 'none !important',\n },\n },\n groupTitle: {\n fontWeight: 'bold',\n },\n }),\n);\n\nexport const LightspeedChatBoxHeader = ({\n selectedModel,\n displayMode,\n handleSelectedModel,\n models,\n isPinningChatsEnabled,\n onPinnedChatsToggle,\n onMcpSettingsClick,\n isModelSelectorDisabled = false,\n hideModelSelector = false,\n setDisplayMode,\n}: LightspeedChatBoxHeaderProps) => {\n const [isOptionsMenuOpen, setIsOptionsMenuOpen] = useState(false);\n const { t } = useTranslation();\n\n const styles = useStyles();\n\n const maxLabelLength = Math.max(\n ...models.map(m => m.label.length),\n selectedModel.length,\n 1,\n );\n const toggleMinWidth = `${maxLabelLength + 4}ch`;\n\n const toggle = (toggleRef: Ref<MenuToggleElement>) => (\n <MenuToggle\n className={isModelSelectorDisabled ? styles.header : ''}\n variant=\"secondary\"\n aria-label={t('aria.chatbotSelector')}\n ref={toggleRef}\n isExpanded={isOptionsMenuOpen}\n isDisabled={isModelSelectorDisabled}\n onClick={() => setIsOptionsMenuOpen(!isOptionsMenuOpen)}\n style={{ minWidth: toggleMinWidth }}\n >\n {selectedModel}\n </MenuToggle>\n );\n\n const handlePinningChatsToggle = (state: boolean) => {\n onPinnedChatsToggle(state);\n };\n\n const handleDockedToWindow = () => {\n setDisplayMode(ChatbotDisplayMode.docked);\n };\n\n const handleFullscreen = () => {\n setDisplayMode(ChatbotDisplayMode.embedded);\n };\n\n const handleOverlay = () => {\n setDisplayMode(ChatbotDisplayMode.default);\n };\n\n const isOverlayMode = displayMode === ChatbotDisplayMode.default;\n const scrollThreshold = isOverlayMode ? 8 : 10;\n const isModelDropdownScrollable = models.length > scrollThreshold;\n\n return (\n <ChatbotHeaderActions>\n {!hideModelSelector && (\n <Dropdown\n className={styles.dropdown}\n isOpen={isOptionsMenuOpen}\n onSelect={(_e, value) => {\n handleSelectedModel(value as string);\n setIsOptionsMenuOpen(false);\n }}\n onOpenChange={isOpen => setIsOptionsMenuOpen(isOpen)}\n popperProps={{ position: 'right' }}\n shouldFocusToggleOnSelect\n shouldFocusFirstItemOnOpen={false}\n toggle={toggle}\n isScrollable={isModelDropdownScrollable}\n maxMenuHeight={isModelDropdownScrollable ? '240px' : undefined}\n >\n <DropdownList>\n {models.map(model => (\n <DropdownGroup className={styles.groupTitle} key={model.label}>\n <DropdownItem\n value={model.value}\n key={model.value}\n isSelected={selectedModel === model.value}\n >\n {model.label}\n </DropdownItem>\n </DropdownGroup>\n ))}\n </DropdownList>\n </Dropdown>\n )}\n <ChatbotHeaderOptionsDropdown\n isCompact\n toggleProps={{\n 'aria-label': t('aria.settings.label'),\n className: styles.optionsToggle,\n }}\n tooltipProps={{\n content: t('tooltip.settings'),\n }}\n >\n <DropdownGroup>\n <DropdownList>\n <DropdownItem key=\"displayModeLabel\" isDisabled>\n {t('settings.displayMode.label')}\n </DropdownItem>\n <DropdownItem\n value={ChatbotDisplayMode.default}\n key=\"switchDisplayOverlay\"\n icon={<OutlinedWindowRestoreIcon />}\n onClick={handleOverlay}\n isSelected={displayMode === ChatbotDisplayMode.default}\n >\n {t('settings.displayMode.overlay')}\n </DropdownItem>\n <DropdownItem\n value={ChatbotDisplayMode.docked}\n key=\"switchDisplayDock\"\n icon={<OpenDrawerRightIcon />}\n onClick={handleDockedToWindow}\n isSelected={displayMode === ChatbotDisplayMode.docked}\n >\n {t('settings.displayMode.docked')}\n </DropdownItem>\n <DropdownItem\n value={ChatbotDisplayMode.embedded}\n key=\"switchDisplayFullscreen\"\n icon={<ExpandIcon />}\n onClick={handleFullscreen}\n isSelected={displayMode === ChatbotDisplayMode.embedded}\n >\n {t('settings.displayMode.fullscreen')}\n </DropdownItem>\n </DropdownList>\n </DropdownGroup>\n <Divider />\n <DropdownGroup>\n <DropdownList>\n {isPinningChatsEnabled ? (\n <DropdownItem\n value=\"disablePinningChats\"\n key=\"disablePinningChat\"\n icon={<ToggleOnOutlinedIcon sx={{ marginTop: '8px' }} />}\n description={t('settings.pinned.enabled.description')}\n onClick={() => handlePinningChatsToggle(false)}\n >\n {t('settings.pinned.disable')}\n </DropdownItem>\n ) : (\n <DropdownItem\n value=\"enablePinningChats\"\n key=\"enablePinningChats\"\n icon={<ToggleOffOutlinedIcon sx={{ marginTop: '8px' }} />}\n description={t('settings.pinned.disabled.description')}\n onClick={() => handlePinningChatsToggle(true)}\n >\n {t('settings.pinned.enable')}\n </DropdownItem>\n )}\n <DropdownItem\n value=\"mcpSettings\"\n key=\"mcpSettings\"\n icon={<McpSettingsIcon />}\n onClick={onMcpSettingsClick}\n >\n {t('settings.mcp.label')}\n </DropdownItem>\n </DropdownList>\n </DropdownGroup>\n </ChatbotHeaderOptionsDropdown>\n </ChatbotHeaderActions>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAyDA,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,WAC3B,YAAA,CAAa;AAAA,IACX,QAAA,E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AAyB,KAAK,CAAA;AAAA,gBAE5C,YAAE,yBAAyB;AAAA,eAAA;AAAA,cALxB;AAAA,aAMN,mBAEA,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,KAAA,EAAM,oBAAA;AAAA,gBAEN,sBAAM,GAAA,CAAC,qBAAA,EAAA,EAAsB,IAAI,EAAE,SAAA,EAAW,OAAM,EAAG,CAAA;AAAA,gBACvD,WAAA,EAAa,EAAE,sCAAsC,CAAA;AAAA,gBACrD,OAAA,EAAS,MAAM,wBAAA,CAAyB,IAAI,CAAA;AAAA,gBAE3C,YAAE,wBAAwB;AAAA,eAAA;AAAA,cALvB;AAAA,aAMN;AAAA,4BAEF,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,KAAA,EAAM,aAAA;AAAA,gBAEN,IAAA,sBAAO,eAAA,EAAA,EAAgB,CAAA;AAAA,gBACvB,OAAA,EAAS,kBAAA;AAAA,gBAER,YAAE,oBAAoB;AAAA,eAAA;AAAA,cAJnB;AAAA;AAKN,WAAA,EACF,CAAA,EACF;AAAA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedChatContainer.esm.js","sources":["../../src/components/LightspeedChatContainer.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useMemo, useState } from 'react';\nimport { useAsync } from 'react-use';\n\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport { Button } from '@material-ui/core';\nimport { useTheme } from '@material-ui/core/styles';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { QueryClientProvider } from '@tanstack/react-query';\n\nimport { useAllModels } from '../hooks/useAllModels';\nimport { useLightspeedViewPermission } from '../hooks/useLightspeedViewPermission';\nimport { useTopicRestrictionStatus } from '../hooks/useQuestionValidation';\nimport { useTranslation } from '../hooks/useTranslation';\nimport queryClient from '../utils/queryClient';\nimport FileAttachmentContextProvider from './AttachmentContext';\nimport { LightspeedChat } from './LightSpeedChat';\nimport {\n LcoreNotConfiguredEmptyState,\n LightspeedChatModelsLoading,\n ModelsLoadErrorEmptyState,\n} from './LightspeedChatModelsState';\nimport PermissionRequiredState from './PermissionRequiredState';\n\nconst THEME_DARK = 'dark';\nconst THEME_DARK_CLASS = 'pf-v6-theme-dark';\nconst LAST_SELECTED_MODEL_KEY = 'lastSelectedModel';\n\n/**\n * Inner component that contains all the Lightspeed chat rendering logic\n */\nconst LightspeedChatContainerInner = () => {\n const {\n palette: { type },\n } = useTheme();\n const { t } = useTranslation();\n\n const identityApi = useApi(identityApiRef);\n\n const {\n data: models,\n isLoading: modelsLoading,\n isError: modelsError,\n refetch: refetchModels,\n } = useAllModels();\n\n const { allowed: hasViewAccess, loading } = useLightspeedViewPermission();\n\n const { value: profile, loading: profileLoading } = useAsync(\n async () => await identityApi.getProfileInfo(),\n );\n\n const [selectedModel, setSelectedModel] = useState('');\n const [selectedProvider, setSelectedProvider] = useState('');\n\n const { data: topicRestrictionEnabled } = useTopicRestrictionStatus();\n\n const modelsItems = useMemo(\n () =>\n models\n ? models\n .filter(model => model.model_type === 'llm')\n .map(m => ({\n label: m.provider_resource_id,\n value: m.provider_resource_id,\n provider: m.provider_id,\n }))\n : [],\n [models],\n );\n\n // Handle dark theme class on document\n useEffect(() => {\n const htmlTagElement = document.documentElement;\n if (type === THEME_DARK) {\n htmlTagElement.classList.add(THEME_DARK_CLASS);\n } else {\n htmlTagElement.classList.remove(THEME_DARK_CLASS);\n }\n }, [type]);\n\n // Load last selected model from localStorage\n useEffect(() => {\n if (modelsItems.length > 0) {\n try {\n const storedData = localStorage.getItem(LAST_SELECTED_MODEL_KEY);\n const parsedData = storedData ? JSON.parse(storedData) : null;\n\n const storedModel = parsedData?.model\n ? modelsItems.find(m => m.value === parsedData.model)\n : null;\n\n if (storedModel) {\n setSelectedModel(storedModel.value);\n setSelectedProvider(storedModel.provider);\n } else {\n setSelectedModel(modelsItems[0].value);\n setSelectedProvider(modelsItems[0].provider);\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\n 'Error loading last selected model from localStorage:',\n error,\n );\n setSelectedModel(modelsItems[0].value);\n setSelectedProvider(modelsItems[0].provider);\n }\n }\n }, [modelsItems]);\n\n // Save selected model to localStorage\n useEffect(() => {\n if (selectedModel && selectedProvider) {\n try {\n localStorage.setItem(\n LAST_SELECTED_MODEL_KEY,\n JSON.stringify({\n model: selectedModel,\n provider: selectedProvider,\n }),\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\n 'Error saving last selected model to localStorage:',\n error,\n );\n }\n }\n }, [selectedModel, selectedProvider]);\n\n if (loading) {\n // Never return null inside the overlay modal: PatternFly's focus-trap requires at least\n // one tabbable node (e.g. after removing the modal close button). Locale switches can\n // briefly re-enter this loading state.\n return <LightspeedChatModelsLoading />;\n }\n\n if (!hasViewAccess) {\n return (\n <PermissionRequiredState\n subject={t('permission.subject.plugin')}\n permissions={['lightspeed.chat.read', 'lightspeed.chat.create']}\n action={\n <Button\n variant=\"outlined\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://github.com/redhat-developer/rhdh-plugins/blob/main/workspaces/lightspeed/plugins/lightspeed/README.md#permission-framework-support\"\n >\n {t('common.readMore')} &nbsp; <OpenInNewIcon />\n </Button>\n }\n />\n );\n }\n\n if (modelsLoading) {\n return <LightspeedChatModelsLoading />;\n }\n\n // TanStack Query can keep the last successful `data` while `isError` is true after a\n // failed refetch. Prefer showing chat when we still have LLM rows; only use the full-page\n // error state when there is nothing usable to render.\n if (modelsError && modelsItems.length === 0) {\n return <ModelsLoadErrorEmptyState onRetry={() => refetchModels()} />;\n }\n\n if (modelsItems.length === 0) {\n return <LcoreNotConfiguredEmptyState />;\n }\n\n return (\n <FileAttachmentContextProvider>\n <LightspeedChat\n selectedModel={selectedModel}\n selectedProvider={selectedProvider}\n topicRestrictionEnabled={topicRestrictionEnabled ?? false}\n handleSelectedModel={item => {\n setSelectedModel(item);\n setSelectedProvider(\n modelsItems.find((m: any) => m.value === item)?.provider || '',\n );\n }}\n models={modelsItems}\n userName={profile?.displayName}\n avatar={profile?.picture}\n profileLoading={profileLoading}\n />\n </FileAttachmentContextProvider>\n );\n};\n\n/**\n * @public\n */\nexport const LightspeedChatContainer = () => {\n return (\n <QueryClientProvider client={queryClient}>\n <LightspeedChatContainerInner />\n </QueryClientProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,MAAM,UAAa,GAAA,MAAA;AACnB,MAAM,gBAAmB,GAAA,kBAAA;AACzB,MAAM,uBAA0B,GAAA,mBAAA;AAKhC,MAAM,+BAA+B,MAAM;AACzC,EAAM,MAAA;AAAA,IACJ,OAAA,EAAS,EAAE,IAAK;AAAA,MACd,QAAS,EAAA;AACb,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AAEzC,EAAM,MAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,SAAW,EAAA,aAAA;AAAA,IACX,OAAS,EAAA,WAAA;AAAA,IACT,OAAS,EAAA;AAAA,MACP,YAAa,EAAA;AAEjB,EAAA,MAAM,EAAE,OAAA,EAAS,aAAe,EAAA,OAAA,KAAY,2BAA4B,EAAA;AAExE,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,OAAA,EAAS,gBAAmB,GAAA,QAAA;AAAA,IAClD,YAAY,MAAM,WAAA,CAAY,cAAe;AAAA,GAC/C;AAEA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AAEJ,CAAA;AAKO,MAAM,0BAA0B,MAAM;AAC3C,EAAA,2BACG,mBAAoB,EAAA,EAAA,MAAA,EAAQ,WAC3B,EAAA,QAAA,kBAAA,GAAA,CAAC,gCAA6B,CAChC,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LightspeedChatContainer.esm.js","sources":["../../src/components/LightspeedChatContainer.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useMemo, useState } from 'react';\nimport { useAsync } from 'react-use';\n\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport { Button } from '@material-ui/core';\nimport { useTheme } from '@material-ui/core/styles';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { QueryClientProvider } from '@tanstack/react-query';\n\nimport { useAllModels } from '../hooks/useAllModels';\nimport { useLightspeedViewPermission } from '../hooks/useLightspeedViewPermission';\nimport { useTopicRestrictionStatus } from '../hooks/useQuestionValidation';\nimport { useTranslation } from '../hooks/useTranslation';\nimport queryClient from '../utils/queryClient';\nimport FileAttachmentContextProvider from './AttachmentContext';\nimport { LightspeedChat } from './LightSpeedChat';\nimport {\n LcoreNotConfiguredEmptyState,\n LightspeedChatModelsLoading,\n ModelsLoadErrorEmptyState,\n} from './LightspeedChatModelsState';\nimport PermissionRequiredState from './PermissionRequiredState';\n\nconst THEME_DARK = 'dark';\nconst THEME_DARK_CLASS = 'pf-v6-theme-dark';\nconst LAST_SELECTED_MODEL_KEY = 'lastSelectedModel';\n\n/**\n * Inner component that contains all the Lightspeed chat rendering logic\n */\nconst LightspeedChatContainerInner = () => {\n const {\n palette: { type },\n } = useTheme();\n const { t } = useTranslation();\n\n const identityApi = useApi(identityApiRef);\n\n const {\n data: models,\n isLoading: modelsLoading,\n isError: modelsError,\n refetch: refetchModels,\n } = useAllModels();\n\n const { allowed: hasViewAccess, loading } = useLightspeedViewPermission();\n\n const { value: profile, loading: profileLoading } = useAsync(\n async () => await identityApi.getProfileInfo(),\n );\n\n const [selectedModel, setSelectedModel] = useState('');\n const [selectedProvider, setSelectedProvider] = useState('');\n\n const { data: topicRestrictionEnabled } = useTopicRestrictionStatus();\n\n const modelsItems = useMemo(\n () =>\n models\n ? models\n .filter(model => model.model_type === 'llm')\n .map(m => ({\n label: m.provider_resource_id,\n value: m.provider_resource_id,\n provider: m.provider_id,\n }))\n : [],\n [models],\n );\n\n // Handle dark theme class on document\n useEffect(() => {\n const htmlTagElement = document.documentElement;\n if (type === THEME_DARK) {\n htmlTagElement.classList.add(THEME_DARK_CLASS);\n } else {\n htmlTagElement.classList.remove(THEME_DARK_CLASS);\n }\n }, [type]);\n\n // Load last selected model from localStorage\n useEffect(() => {\n if (modelsItems.length > 0) {\n try {\n const storedData = localStorage.getItem(LAST_SELECTED_MODEL_KEY);\n const parsedData = storedData ? JSON.parse(storedData) : null;\n\n const storedModel = parsedData?.model\n ? modelsItems.find(m => m.value === parsedData.model)\n : null;\n\n if (storedModel) {\n setSelectedModel(storedModel.value);\n setSelectedProvider(storedModel.provider);\n } else {\n setSelectedModel(modelsItems[0].value);\n setSelectedProvider(modelsItems[0].provider);\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\n 'Error loading last selected model from localStorage:',\n error,\n );\n setSelectedModel(modelsItems[0].value);\n setSelectedProvider(modelsItems[0].provider);\n }\n }\n }, [modelsItems]);\n\n // Save selected model to localStorage\n useEffect(() => {\n if (selectedModel && selectedProvider) {\n try {\n localStorage.setItem(\n LAST_SELECTED_MODEL_KEY,\n JSON.stringify({\n model: selectedModel,\n provider: selectedProvider,\n }),\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\n 'Error saving last selected model to localStorage:',\n error,\n );\n }\n }\n }, [selectedModel, selectedProvider]);\n\n if (loading) {\n // Never return null inside the overlay modal: PatternFly's focus-trap requires at least\n // one tabbable node (e.g. after removing the modal close button). Locale switches can\n // briefly re-enter this loading state.\n return <LightspeedChatModelsLoading />;\n }\n\n if (!hasViewAccess) {\n return (\n <PermissionRequiredState\n subject={t('permission.subject.plugin')}\n permissions={['lightspeed.chat.read', 'lightspeed.chat.create']}\n action={\n <Button\n variant=\"outlined\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://github.com/redhat-developer/rhdh-plugins/blob/main/workspaces/lightspeed/plugins/lightspeed/README.md#permission-framework-support\"\n >\n {t('common.readMore')} &nbsp; <OpenInNewIcon />\n </Button>\n }\n />\n );\n }\n\n if (modelsLoading) {\n return <LightspeedChatModelsLoading />;\n }\n\n // TanStack Query can keep the last successful `data` while `isError` is true after a\n // failed refetch. Prefer showing chat when we still have LLM rows; only use the full-page\n // error state when there is nothing usable to render.\n if (modelsError && modelsItems.length === 0) {\n return <ModelsLoadErrorEmptyState onRetry={() => refetchModels()} />;\n }\n\n if (modelsItems.length === 0) {\n return <LcoreNotConfiguredEmptyState />;\n }\n\n return (\n <FileAttachmentContextProvider>\n <LightspeedChat\n selectedModel={selectedModel}\n selectedProvider={selectedProvider}\n topicRestrictionEnabled={topicRestrictionEnabled ?? false}\n handleSelectedModel={item => {\n setSelectedModel(item);\n setSelectedProvider(\n modelsItems.find((m: any) => m.value === item)?.provider || '',\n );\n }}\n models={modelsItems}\n userName={profile?.displayName}\n avatar={profile?.picture}\n profileLoading={profileLoading}\n />\n </FileAttachmentContextProvider>\n );\n};\n\n/**\n * @public\n */\nexport const LightspeedChatContainer = () => {\n return (\n <QueryClientProvider client={queryClient}>\n <LightspeedChatContainerInner />\n </QueryClientProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,M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IAAe,WAAA,CAAY,MAAA,KAAW,CAAA,EAAG;AAC3C,IAAA,uBAAO,GAAA,CAAC,yBAAA,EAAA,EAA0B,OAAA,EAAS,MAAM,eAAc,EAAG,CAAA;AAAA,EACpE;AAEA,EAAA,IAAI,WAAA,CAAY,WAAW,CAAA,EAAG;AAC5B,IAAA,2BAAQ,4BAAA,EAAA,EAA6B,CAAA;AAAA,EACvC;AAEA,EAAA,2BACG,6BAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,aAAA;AAAA,MACA,gBAAA;AAAA,MACA,yBAAyB,uBAAA,IAA2B,KAAA;AAAA,MACpD,qBAAqB,CAAA,IAAA,KAAQ;AAC3B,QAAA,gBAAA,CAAiB,IAAI,CAAA;AACrB,QAAA,mBAAA;AAAA,UACE,WAAA,CAAY,KAAK,CAAC,CAAA,KAAW,EAAE,KAAA,KAAU,IAAI,GAAG,QAAA,IAAY;AAAA,SAC9D;AAAA,MACF,CAAA;AAAA,MACA,MAAA,EAAQ,WAAA;AAAA,MACR,UAAU,OAAA,EAAS,WAAA;AAAA,MACnB,QAAQ,OAAA,EAAS,OAAA;AAAA,MACjB;AAAA;AAAA,GACF,EACF,CAAA;AAEJ,CAAA;AAKO,MAAM,0BAA0B,MAAM;AAC3C,EAAA,2BACG,mBAAA,EAAA,EAAoB,MAAA,EAAQ,WAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,gCAA6B,CAAA,EAChC,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedChatModelsState.esm.js","sources":["../../src/components/LightspeedChatModelsState.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Box,\n Button,\n CircularProgress,\n Link,\n Typography,\n} from '@material-ui/core';\nimport { createStyles, makeStyles } from '@material-ui/core/styles';\nimport ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport SmartToyOutlinedIcon from '@mui/icons-material/SmartToyOutlined';\n\nimport { useTranslation } from '../hooks/useTranslation';\n\nconst LLAMA_STACK_CONFIGURE_DOCS_URL =\n 'https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html/interacting_with_red_hat_developer_lightspeed_for_red_hat_developer_hub/developer-lightspeed#proc-installing-and-configuring-lightspeed_developer-lightspeed';\nconst LIGHTSPEED_BACKEND_README_URL =\n 'https://github.com/redhat-developer/rhdh-plugins/blob/main/workspaces/lightspeed/plugins/lightspeed-backend/README.md';\n\nconst useStyles = makeStyles(theme =>\n createStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n boxSizing: 'border-box',\n width: '100%',\n maxWidth: '100%',\n minWidth: 0,\n minHeight: '100%',\n height: '100%',\n flex: '1 1 auto',\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing(4, 2),\n backgroundColor: theme.palette.background.default,\n },\n panel: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n textAlign: 'center',\n width: '100%',\n maxWidth: 440,\n gap: theme.spacing(2),\n },\n emptyStateIcon: {\n fontSize: 64,\n color: theme.palette.text.secondary,\n },\n errorIcon: {\n fontSize: 64,\n color: theme.palette.warning.main,\n },\n description: {\n lineHeight: 1.5,\n color: theme.palette.text.secondary,\n },\n actions: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n marginTop: theme.spacing(1),\n },\n backendLink: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: theme.spacing(0.5),\n fontSize: theme.typography.body1.fontSize,\n fontWeight: 500,\n },\n }),\n);\n\n/**\n * Shown while the models list is loading for an authorized user.\n */\nexport const LightspeedChatModelsLoading = () => {\n const classes = useStyles();\n const { t } = useTranslation();\n return (\n <div\n className={classes.root}\n data-testid=\"lightspeed-models-loading\"\n role=\"status\"\n aria-busy=\"true\"\n aria-label={t('common.loading')}\n >\n <CircularProgress aria-hidden />\n </div>\n );\n};\n\n/**\n * Shown when LCORE / Llama Stack is up but no LLM models are registered.\n */\nexport const LcoreNotConfiguredEmptyState = () => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <div className={classes.root} data-testid=\"lightspeed-lcore-not-configured\">\n <Box\n className={classes.panel}\n component=\"section\"\n aria-labelledby=\"lightspeed-lcore-empty-title\"\n >\n <SmartToyOutlinedIcon\n className={classes.emptyStateIcon}\n aria-hidden\n focusable={false}\n />\n <Typography\n id=\"lightspeed-lcore-empty-title\"\n variant=\"h5\"\n component=\"h2\"\n >\n {t('lcore.notConfigured.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n component=\"p\"\n className={classes.description}\n >\n {t('lcore.notConfigured.description')}\n </Typography>\n <Box className={classes.actions}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={LLAMA_STACK_CONFIGURE_DOCS_URL}\n >\n {t('lcore.notConfigured.developerLightspeedDocs')} &nbsp;{' '}\n <OpenInNewIcon fontSize=\"small\" aria-hidden />\n </Button>\n <Link\n className={classes.backendLink}\n component=\"a\"\n color=\"primary\"\n href={LIGHTSPEED_BACKEND_README_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {t('lcore.notConfigured.backendDocs')}\n <OpenInNewIcon fontSize=\"small\" aria-hidden />\n </Link>\n </Box>\n </Box>\n </div>\n );\n};\n\ntype ModelsLoadErrorEmptyStateProps = {\n onRetry: () => void;\n};\n\n/**\n * Shown when the models API fails (distinct from “no models configured”).\n */\nexport const ModelsLoadErrorEmptyState = ({\n onRetry,\n}: ModelsLoadErrorEmptyStateProps) => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <div className={classes.root} data-testid=\"lightspeed-models-load-error\">\n <Box\n className={classes.panel}\n component=\"section\"\n aria-labelledby=\"lightspeed-models-error-title\"\n >\n <ErrorOutlineIcon\n className={classes.errorIcon}\n aria-hidden\n focusable={false}\n />\n <Typography\n id=\"lightspeed-models-error-title\"\n variant=\"h5\"\n component=\"h2\"\n >\n {t('lcore.loadError.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n component=\"p\"\n className={classes.description}\n >\n {t('lcore.loadError.description')}\n </Typography>\n <Box className={classes.actions}>\n <Button variant=\"contained\" color=\"primary\" onClick={() => onRetry()}>\n {t('common.retry')}\n </Button>\n </Box>\n </Box>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA8BA,MAAM,8BACJ,GAAA,yOAAA;AACF,MAAM,6BACJ,GAAA,uHAAA;AAEF,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,WAC3B,YAAa,CAAA;AAAA,IACX,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,QAAA;AAAA,MACf,SAAW,EAAA,YAAA;AAAA,MACX,KAAO,EAAA,MAAA;AAAA,MACP,QAAU,EAAA,MAAA;AAAA,MACV,QAAU,EAAA,CAAA;AAAA,MACV,SAAW,EAAA,MAAA;AAAA,MACX,MAAQ,EAAA,MAAA;AAAA,MACR,IAAM,EAAA,UAAA;AAAA,MACN,UAAY,EAAA,QAAA;AAAA,MACZ,cAAgB,EAAA,QAAA;AAAA,MAChB,OAAS,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,MAC3B,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA;AAAA,KAC5C;AAAA,IACA,KAAO,EAAA;AAAA,MACL,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,QAAA;AA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AAQ,CAAA,KAAA;AAAA,MACnB,SAAU,EAAA,SAAA;AAAA,MACV,iBAAgB,EAAA,+BAAA;AAAA,MAEhB,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,WAAW,OAAQ,CAAA,SAAA;AAAA,YACnB,aAAW,EAAA,IAAA;AAAA,YACX,SAAW,EAAA;AAAA;AAAA,SACb;AAAA,wBACA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,EAAG,EAAA,+BAAA;AAAA,YACH,OAAQ,EAAA,IAAA;AAAA,YACR,SAAU,EAAA,IAAA;AAAA,YAET,YAAE,uBAAuB;AAAA;AAAA,SAC5B;AAAA,wBACA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,OAAQ,EAAA,OAAA;AAAA,YACR,SAAU,EAAA,GAAA;AAAA,YACV,WAAW,OAAQ,CAAA,WAAA;AAAA,YAElB,YAAE,6BAA6B;AAAA;AAAA,SAClC;AAAA,4BACC,GAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,OACtB,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAO,OAAQ,EAAA,WAAA,EAAY,KAAM,EAAA,SAAA,EAAU,SAAS,MAAM,OAAA,IACxD,QAAE,EAAA,CAAA,CAAA,cAAc,GACnB,CACF,EAAA;AAAA;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LightspeedChatModelsState.esm.js","sources":["../../src/components/LightspeedChatModelsState.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Box,\n Button,\n CircularProgress,\n Link,\n Typography,\n} from '@material-ui/core';\nimport { createStyles, makeStyles } from '@material-ui/core/styles';\nimport ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport SmartToyOutlinedIcon from '@mui/icons-material/SmartToyOutlined';\n\nimport { useTranslation } from '../hooks/useTranslation';\n\nconst LLAMA_STACK_CONFIGURE_DOCS_URL =\n 'https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html/interacting_with_red_hat_developer_lightspeed_for_red_hat_developer_hub/developer-lightspeed#proc-installing-and-configuring-lightspeed_developer-lightspeed';\nconst LIGHTSPEED_BACKEND_README_URL =\n 'https://github.com/redhat-developer/rhdh-plugins/blob/main/workspaces/lightspeed/plugins/lightspeed-backend/README.md';\n\nconst useStyles = makeStyles(theme =>\n createStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n boxSizing: 'border-box',\n width: '100%',\n maxWidth: '100%',\n minWidth: 0,\n minHeight: '100%',\n height: '100%',\n flex: '1 1 auto',\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing(4, 2),\n backgroundColor: theme.palette.background.default,\n },\n panel: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n textAlign: 'center',\n width: '100%',\n maxWidth: 440,\n gap: theme.spacing(2),\n },\n emptyStateIcon: {\n fontSize: 64,\n color: theme.palette.text.secondary,\n },\n errorIcon: {\n fontSize: 64,\n color: theme.palette.warning.main,\n },\n description: {\n lineHeight: 1.5,\n color: theme.palette.text.secondary,\n },\n actions: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n marginTop: theme.spacing(1),\n },\n backendLink: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: theme.spacing(0.5),\n fontSize: theme.typography.body1.fontSize,\n fontWeight: 500,\n },\n }),\n);\n\n/**\n * Shown while the models list is loading for an authorized user.\n */\nexport const LightspeedChatModelsLoading = () => {\n const classes = useStyles();\n const { t } = useTranslation();\n return (\n <div\n className={classes.root}\n data-testid=\"lightspeed-models-loading\"\n role=\"status\"\n aria-busy=\"true\"\n aria-label={t('common.loading')}\n >\n <CircularProgress aria-hidden />\n </div>\n );\n};\n\n/**\n * Shown when LCORE / Llama Stack is up but no LLM models are registered.\n */\nexport const LcoreNotConfiguredEmptyState = () => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <div className={classes.root} data-testid=\"lightspeed-lcore-not-configured\">\n <Box\n className={classes.panel}\n component=\"section\"\n aria-labelledby=\"lightspeed-lcore-empty-title\"\n >\n <SmartToyOutlinedIcon\n className={classes.emptyStateIcon}\n aria-hidden\n focusable={false}\n />\n <Typography\n id=\"lightspeed-lcore-empty-title\"\n variant=\"h5\"\n component=\"h2\"\n >\n {t('lcore.notConfigured.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n component=\"p\"\n className={classes.description}\n >\n {t('lcore.notConfigured.description')}\n </Typography>\n <Box className={classes.actions}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={LLAMA_STACK_CONFIGURE_DOCS_URL}\n >\n {t('lcore.notConfigured.developerLightspeedDocs')} &nbsp;{' '}\n <OpenInNewIcon fontSize=\"small\" aria-hidden />\n </Button>\n <Link\n className={classes.backendLink}\n component=\"a\"\n color=\"primary\"\n href={LIGHTSPEED_BACKEND_README_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {t('lcore.notConfigured.backendDocs')}\n <OpenInNewIcon fontSize=\"small\" aria-hidden />\n </Link>\n </Box>\n </Box>\n </div>\n );\n};\n\ntype ModelsLoadErrorEmptyStateProps = {\n onRetry: () => void;\n};\n\n/**\n * Shown when the models API fails (distinct from “no models configured”).\n */\nexport const ModelsLoadErrorEmptyState = ({\n onRetry,\n}: ModelsLoadErrorEmptyStateProps) => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <div className={classes.root} data-testid=\"lightspeed-models-load-error\">\n <Box\n className={classes.panel}\n component=\"section\"\n aria-labelledby=\"lightspeed-models-error-title\"\n >\n <ErrorOutlineIcon\n className={classes.errorIcon}\n aria-hidden\n focusable={false}\n />\n <Typography\n id=\"lightspeed-models-error-title\"\n variant=\"h5\"\n component=\"h2\"\n >\n {t('lcore.loadError.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n component=\"p\"\n className={classes.description}\n >\n {t('lcore.loadError.description')}\n </Typography>\n <Box className={classes.actions}>\n <Button variant=\"contained\" color=\"primary\" onClick={() => onRetry()}>\n {t('common.retry')}\n </Button>\n </Box>\n </Box>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA8BA,MAAM,8BAAA,GACJ,yOAAA;AACF,MAAM,6BAAA,GACJ,uHAAA;AAEF,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,WAC3B,YAAA,CAAa;AAAA,IACX,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,QAAA;AAAA,MACf,SAAA,EAAW,YAAA;AAAA,MACX,KAAA,EAAO,MAAA;AAAA,MACP,QAAA,EAAU,MAAA;AAAA,MACV,QAAA,EAAU,CAAA;AAAA,MACV,SAAA,EAAW,MAAA;AAAA,MACX,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,UAAA;AAAA,MACN,UAAA,EAAY,QAAA;AAAA,MACZ,cAAA,EAAgB,QAAA;AAAA,MAChB,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,CAAA,EAAG,CAAC,CAAA;AAAA,MAC3B,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW;AAAA,KAC5C;AAAA,IACA,KAAA,EAAO;AAAA,MACL,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,QAAA;AAAA,MACf,UAAA,EAAY,QAAA;AAAA,MACZ,SAAA,EAAW,QAAA;AAA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AA,EAAgB,+BAAA;AAAA,MAEhB,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,WAAW,OAAA,CAAQ,SAAA;AAAA,YACnB,aAAA,EAAW,IAAA;AAAA,YACX,SAAA,EAAW;AAAA;AAAA,SACb;AAAA,wBACA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,EAAA,EAAG,+BAAA;AAAA,YACH,OAAA,EAAQ,IAAA;AAAA,YACR,SAAA,EAAU,IAAA;AAAA,YAET,YAAE,uBAAuB;AAAA;AAAA,SAC5B;AAAA,wBACA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAQ,OAAA;AAAA,YACR,SAAA,EAAU,GAAA;AAAA,YACV,WAAW,OAAA,CAAQ,WAAA;AAAA,YAElB,YAAE,6BAA6B;AAAA;AAAA,SAClC;AAAA,4BACC,GAAA,EAAA,EAAI,SAAA,EAAW,QAAQ,OAAA,EACtB,QAAA,kBAAA,GAAA,CAAC,UAAO,OAAA,EAAQ,WAAA,EAAY,KAAA,EAAM,SAAA,EAAU,SAAS,MAAM,OAAA,IACxD,QAAA,EAAA,CAAA,CAAE,cAAc,GACnB,CAAA,EACF;AAAA;AAAA;AAAA,GACF,EACF,CAAA;AAEJ;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { createContext } from 'react';
2
2
 
3
- const LightspeedDrawerContext = createContext(undefined);
3
+ const LightspeedDrawerContext = createContext(void 0);
4
4
 
5
5
  export { LightspeedDrawerContext };
6
6
  //# sourceMappingURL=LightspeedDrawerContext.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedDrawerContext.esm.js","sources":["../../src/components/LightspeedDrawerContext.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext } from 'react';\n\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { FileContent } from '../types';\n\n/**\n * Type for LightspeedDrawerContext\n *\n * @public\n */\nexport interface LightspeedDrawerContextType {\n /**\n * Whether the chatbot is active\n */\n isChatbotActive: boolean;\n /**\n * Toggle the chatbot open/closed\n */\n toggleChatbot: () => void;\n /**\n * The current display mode\n */\n displayMode: ChatbotDisplayMode;\n /**\n * Set the display mode (overlay, docked, or fullscreen/embedded)\n */\n setDisplayMode: (mode: ChatbotDisplayMode) => void;\n /**\n * The drawer width (for docked mode)\n */\n drawerWidth: number;\n /**\n * The function for setting the drawer width\n */\n setDrawerWidth: React.Dispatch<React.SetStateAction<number>>;\n /**\n * The current conversation ID\n */\n currentConversationId?: string;\n /**\n * Set the current conversation ID and update the route if in embedded mode\n * Pass undefined to clear the conversation (example: for new chat)\n */\n setCurrentConversationId: (id: string | undefined) => void;\n /**\n * The message in the chat input box\n * Used to preserve input content when switching between display modes\n */\n draftMessage: string;\n /**\n * To save the input message as a draft when switching modes\n */\n setDraftMessage: (message: string) => void;\n /**\n * The file attachments in the chat input\n * Used to preserve file attachments when switching between display modes\n */\n draftFileContents: FileContent[];\n /**\n * To save file attachments as a draft when switching modes\n */\n setDraftFileContents: (files: FileContent[]) => void;\n /**\n * @internal After leaving fullscreen for overlay/docked, the next overlay/docked chat\n * mount should seed the thread from currentConversationId (or TEMP) instead of storage\n * lastOpened. Returns true at most once per handoff.\n */\n consumePendingOverlayThreadHandoff?: () => boolean;\n}\n\n/**\n * @public\n */\nexport const LightspeedDrawerContext = createContext<\n LightspeedDrawerContextType | undefined\n>(undefined);\n"],"names":[],"mappings":";;AA0Fa,MAAA,uBAAA,GAA0B,cAErC,SAAS;;;;"}
1
+ {"version":3,"file":"LightspeedDrawerContext.esm.js","sources":["../../src/components/LightspeedDrawerContext.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext } from 'react';\n\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { FileContent } from '../types';\n\n/**\n * Type for LightspeedDrawerContext\n *\n * @public\n */\nexport interface LightspeedDrawerContextType {\n /**\n * Whether the chatbot is active\n */\n isChatbotActive: boolean;\n /**\n * Toggle the chatbot open/closed\n */\n toggleChatbot: () => void;\n /**\n * The current display mode\n */\n displayMode: ChatbotDisplayMode;\n /**\n * Set the display mode (overlay, docked, or fullscreen/embedded)\n */\n setDisplayMode: (mode: ChatbotDisplayMode) => void;\n /**\n * The drawer width (for docked mode)\n */\n drawerWidth: number;\n /**\n * The function for setting the drawer width\n */\n setDrawerWidth: React.Dispatch<React.SetStateAction<number>>;\n /**\n * The current conversation ID\n */\n currentConversationId?: string;\n /**\n * Set the current conversation ID and update the route if in embedded mode\n * Pass undefined to clear the conversation (example: for new chat)\n */\n setCurrentConversationId: (id: string | undefined) => void;\n /**\n * The message in the chat input box\n * Used to preserve input content when switching between display modes\n */\n draftMessage: string;\n /**\n * To save the input message as a draft when switching modes\n */\n setDraftMessage: (message: string) => void;\n /**\n * The file attachments in the chat input\n * Used to preserve file attachments when switching between display modes\n */\n draftFileContents: FileContent[];\n /**\n * To save file attachments as a draft when switching modes\n */\n setDraftFileContents: (files: FileContent[]) => void;\n /**\n * @internal After leaving fullscreen for overlay/docked, the next overlay/docked chat\n * mount should seed the thread from currentConversationId (or TEMP) instead of storage\n * lastOpened. Returns true at most once per handoff.\n */\n consumePendingOverlayThreadHandoff?: () => boolean;\n}\n\n/**\n * @public\n */\nexport const LightspeedDrawerContext = createContext<\n LightspeedDrawerContextType | undefined\n>(undefined);\n"],"names":[],"mappings":";;AA0FO,MAAM,uBAAA,GAA0B,cAErC,MAAS;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedDrawerProvider.esm.js","sources":["../../src/components/LightspeedDrawerProvider.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PropsWithChildren } from 'react';\n\nimport { makeStyles } from '@mui/styles';\nimport { ChatbotModal } from '@patternfly/chatbot';\n\nimport { DOCKED_CONTENT_OFFSET } from '../const';\nimport { useLightspeedProviderState } from '../hooks/useLightspeedProviderState';\nimport { LightspeedChatContainer } from './LightspeedChatContainer';\nimport { LightspeedDrawerContext } from './LightspeedDrawerContext';\n\nconst useStyles = makeStyles(theme => ({\n chatbotModal: {\n boxShadow:\n '0 14px 20px -7px rgba(0, 0, 0, 0.22), 0 32px 50px 6px rgba(0, 0, 0, 0.16), 0 12px 60px 12px rgba(0, 0, 0, 0.14) !important',\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 5em)`,\n right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n maxWidth: 'min(30rem, calc(100vw - 32px)) !important',\n overflowX: 'hidden' as const,\n transition: 'margin-right 0.3s ease',\n 'body.docked-drawer-open &': {\n marginRight: DOCKED_CONTENT_OFFSET,\n },\n },\n}));\n\n/**\n * @public\n */\nexport const LightspeedDrawerProvider = ({ children }: PropsWithChildren) => {\n const classes = useStyles();\n const { contextValue, shouldRenderOverlayModal, closeChatbot } =\n useLightspeedProviderState();\n\n return (\n <LightspeedDrawerContext.Provider value={contextValue}>\n {children}\n {shouldRenderOverlayModal && (\n <ChatbotModal\n isOpen\n displayMode={contextValue.displayMode}\n disableFocusTrap\n onEscapePress={() => closeChatbot()}\n ouiaId=\"LightspeedChatbotModal\"\n aria-labelledby=\"lightspeed-chatpopup-modal\"\n className={classes.chatbotModal}\n >\n <LightspeedChatContainer />\n </ChatbotModal>\n )}\n </LightspeedDrawerContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,SACE,EAAA,4HAAA;AAAA,IACF,QAAQ,CAAQ,KAAA,EAAA,KAAA,EAAO,OAAU,GAAA,CAAC,KAAK,MAAM,CAAA,OAAA,CAAA;AAAA,IAC7C,OAAO,CAAQ,KAAA,EAAA,KAAA,EAAO,OAAU,GAAA,CAAC,KAAK,MAAM,CAAA,SAAA,CAAA;AAAA,IAC5C,QAAU,EAAA,2CAAA;AAAA,IACV,SAAW,EAAA,QAAA;AAAA,IACX,UAAY,EAAA,wBAAA;AAAA,IACZ,2BAA6B,EAAA;AAAA,MAC3B,WAAa,EAAA;AAAA;AACf;AAEJ,CAAE,CAAA,CAAA;AAKK,MAAM,wBAA2B,GAAA,CAAC,EAAE,QAAA,EAAkC,KAAA;AAC3E,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,YAAA,EAAc,wBAA0B,EAAA,YAAA,KAC9C,0BAA2B,EAAA;AAE7B,EAAA,uBACG,IAAA,CAAA,uBAAA,CAAwB,QAAxB,EAAA,EAAiC,OAAO,YACtC,EAAA,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,wBACC,oBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,MAAM,EAAA,IAAA;AAAA,QACN,aAAa,YAAa,CAAA,WAAA;AAAA,QAC1B,gBAAgB,EAAA,IAAA;AAAA,QAChB,aAAA,EAAe,MAAM,YAAa,EAAA;AAAA,QAClC,MAAO,EAAA,wBAAA;AAAA,QACP,iBAAgB,EAAA,4BAAA;AAAA,QAChB,WAAW,OAAQ,CAAA,YAAA;AAAA,QAEnB,8BAAC,uBAAwB,EAAA,EAAA;AAAA;AAAA;AAC3B,GAEJ,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LightspeedDrawerProvider.esm.js","sources":["../../src/components/LightspeedDrawerProvider.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PropsWithChildren } from 'react';\n\nimport { makeStyles } from '@mui/styles';\nimport { ChatbotModal } from '@patternfly/chatbot';\n\nimport { DOCKED_CONTENT_OFFSET } from '../const';\nimport { useLightspeedProviderState } from '../hooks/useLightspeedProviderState';\nimport { LightspeedChatContainer } from './LightspeedChatContainer';\nimport { LightspeedDrawerContext } from './LightspeedDrawerContext';\n\nconst useStyles = makeStyles(theme => ({\n chatbotModal: {\n boxShadow:\n '0 14px 20px -7px rgba(0, 0, 0, 0.22), 0 32px 50px 6px rgba(0, 0, 0, 0.16), 0 12px 60px 12px rgba(0, 0, 0, 0.14) !important',\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 5em)`,\n right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n maxWidth: 'min(30rem, calc(100vw - 32px)) !important',\n overflowX: 'hidden' as const,\n transition: 'margin-right 0.3s ease',\n 'body.docked-drawer-open &': {\n marginRight: DOCKED_CONTENT_OFFSET,\n },\n },\n}));\n\n/**\n * @public\n */\nexport const LightspeedDrawerProvider = ({ children }: PropsWithChildren) => {\n const classes = useStyles();\n const { contextValue, shouldRenderOverlayModal, closeChatbot } =\n useLightspeedProviderState();\n\n return (\n <LightspeedDrawerContext.Provider value={contextValue}>\n {children}\n {shouldRenderOverlayModal && (\n <ChatbotModal\n isOpen\n displayMode={contextValue.displayMode}\n disableFocusTrap\n onEscapePress={() => closeChatbot()}\n ouiaId=\"LightspeedChatbotModal\"\n aria-labelledby=\"lightspeed-chatpopup-modal\"\n className={classes.chatbotModal}\n >\n <LightspeedChatContainer />\n </ChatbotModal>\n )}\n </LightspeedDrawerContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,YAAA,EAAc;AAAA,IACZ,SAAA,EACE,4HAAA;AAAA,IACF,QAAQ,CAAA,KAAA,EAAQ,KAAA,EAAO,OAAA,GAAU,CAAC,KAAK,MAAM,CAAA,OAAA,CAAA;AAAA,IAC7C,OAAO,CAAA,KAAA,EAAQ,KAAA,EAAO,OAAA,GAAU,CAAC,KAAK,MAAM,CAAA,SAAA,CAAA;AAAA,IAC5C,QAAA,EAAU,2CAAA;AAAA,IACV,SAAA,EAAW,QAAA;AAAA,IACX,UAAA,EAAY,wBAAA;AAAA,IACZ,2BAAA,EAA6B;AAAA,MAC3B,WAAA,EAAa;AAAA;AACf;AAEJ,CAAA,CAAE,CAAA;AAKK,MAAM,wBAAA,GAA2B,CAAC,EAAE,QAAA,EAAS,KAAyB;AAC3E,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,EAAE,YAAA,EAAc,wBAAA,EAA0B,YAAA,KAC9C,0BAAA,EAA2B;AAE7B,EAAA,uBACE,IAAA,CAAC,uBAAA,CAAwB,QAAA,EAAxB,EAAiC,OAAO,YAAA,EACtC,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,wBAAA,oBACC,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,MAAA,EAAM,IAAA;AAAA,QACN,aAAa,YAAA,CAAa,WAAA;AAAA,QAC1B,gBAAA,EAAgB,IAAA;AAAA,QAChB,aAAA,EAAe,MAAM,YAAA,EAAa;AAAA,QAClC,MAAA,EAAO,wBAAA;AAAA,QACP,iBAAA,EAAgB,4BAAA;AAAA,QAChB,WAAW,OAAA,CAAQ,YAAA;AAAA,QAEnB,8BAAC,uBAAA,EAAA,EAAwB;AAAA;AAAA;AAC3B,GAAA,EAEJ,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedDrawerStateExposer.esm.js","sources":["../../src/components/LightspeedDrawerStateExposer.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';\n\n/**\n * @public\n * Partial Lightspeed drawer state exposed to the ApplicationDrawer\n */\nexport type DrawerState = {\n id: string;\n isDrawerOpen: boolean;\n drawerWidth: number;\n setDrawerWidth: (width: number) => void;\n closeDrawer: () => void;\n};\n\n/**\n * @public\n * Props for drawer state exposer components\n */\nexport type DrawerStateExposerProps = {\n /**\n * Callback called whenever the drawer state changes\n */\n onStateChange: (state: DrawerState) => void;\n};\n\n/**\n * @public\n * This exposes LightspeedDrawer's partial context to the ApplicationDrawer\n *\n * It reads the LightspeedDrawerContext and calls the onStateChange callback with the\n * partial state (id, isDrawerOpen, drawerWidth, setDrawerWidth).\n \n */\nexport const LightspeedDrawerStateExposer = ({\n onStateChange,\n}: DrawerStateExposerProps) => {\n const {\n displayMode,\n drawerWidth,\n setDrawerWidth,\n toggleChatbot,\n isChatbotActive,\n } = useLightspeedDrawerContext();\n\n const isDrawerOpen =\n displayMode === ChatbotDisplayMode.docked && isChatbotActive;\n\n const toggleChatbotRef = useRef(toggleChatbot);\n toggleChatbotRef.current = toggleChatbot;\n\n const closeDrawer = useCallback(() => {\n toggleChatbotRef.current();\n }, []);\n\n useEffect(() => {\n onStateChange({\n id: 'lightspeed',\n isDrawerOpen,\n drawerWidth,\n setDrawerWidth,\n closeDrawer,\n });\n }, [isDrawerOpen, drawerWidth, setDrawerWidth, closeDrawer, onStateChange]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;AAqDO,MAAM,+BAA+B,CAAC;AAAA,EAC3C;AACF,CAA+B,KAAA;AAC7B,EAAM,MAAA;AAAA,IACJ,WAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,MACE,0BAA2B,EAAA;AAE/B,EAAM,MAAA,YAAA,GACJ,WAAgB,KAAA,kBAAA,CAAmB,MAAU,IAAA,eAAA;AAE/C,EAAM,MAAA,gBAAA,GAAmB,OAAO,aAAa,CAAA;AAC7C,EAAA,gBAAA,CAAiB,OAAU,GAAA,aAAA;AAE3B,EAAM,MAAA,WAAA,GAAc,YAAY,MAAM;AACpC,IAAA,gBAAA,CAAiB,OAAQ,EAAA;AAAA,GAC3B,EAAG,EAAE,CAAA;AAEL,EAAA,SAAA,CAAU,MAAM;AACd,IAAc,aAAA,CAAA;AAAA,MACZ,EAAI,EAAA,YAAA;AAAA,MACJ,YAAA;AAAA,MACA,WAAA;AAAA,MACA,cAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,KACA,CAAC,YAAA,EAAc,aAAa,cAAgB,EAAA,WAAA,EAAa,aAAa,CAAC,CAAA;AAE1E,EAAO,OAAA,IAAA;AACT;;;;"}
1
+ {"version":3,"file":"LightspeedDrawerStateExposer.esm.js","sources":["../../src/components/LightspeedDrawerStateExposer.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';\n\n/**\n * @public\n * Partial Lightspeed drawer state exposed to the ApplicationDrawer\n */\nexport type DrawerState = {\n id: string;\n isDrawerOpen: boolean;\n drawerWidth: number;\n setDrawerWidth: (width: number) => void;\n closeDrawer: () => void;\n};\n\n/**\n * @public\n * Props for drawer state exposer components\n */\nexport type DrawerStateExposerProps = {\n /**\n * Callback called whenever the drawer state changes\n */\n onStateChange: (state: DrawerState) => void;\n};\n\n/**\n * @public\n * This exposes LightspeedDrawer's partial context to the ApplicationDrawer\n *\n * It reads the LightspeedDrawerContext and calls the onStateChange callback with the\n * partial state (id, isDrawerOpen, drawerWidth, setDrawerWidth).\n \n */\nexport const LightspeedDrawerStateExposer = ({\n onStateChange,\n}: DrawerStateExposerProps) => {\n const {\n displayMode,\n drawerWidth,\n setDrawerWidth,\n toggleChatbot,\n isChatbotActive,\n } = useLightspeedDrawerContext();\n\n const isDrawerOpen =\n displayMode === ChatbotDisplayMode.docked && isChatbotActive;\n\n const toggleChatbotRef = useRef(toggleChatbot);\n toggleChatbotRef.current = toggleChatbot;\n\n const closeDrawer = useCallback(() => {\n toggleChatbotRef.current();\n }, []);\n\n useEffect(() => {\n onStateChange({\n id: 'lightspeed',\n isDrawerOpen,\n drawerWidth,\n setDrawerWidth,\n closeDrawer,\n });\n }, [isDrawerOpen, drawerWidth, setDrawerWidth, closeDrawer, onStateChange]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;AAqDO,MAAM,+BAA+B,CAAC;AAAA,EAC3C;AACF,CAAA,KAA+B;AAC7B,EAAA,MAAM;AAAA,IACJ,WAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,MACE,0BAAA,EAA2B;AAE/B,EAAA,MAAM,YAAA,GACJ,WAAA,KAAgB,kBAAA,CAAmB,MAAA,IAAU,eAAA;AAE/C,EAAA,MAAM,gBAAA,GAAmB,OAAO,aAAa,CAAA;AAC7C,EAAA,gBAAA,CAAiB,OAAA,GAAU,aAAA;AAE3B,EAAA,MAAM,WAAA,GAAc,YAAY,MAAM;AACpC,IAAA,gBAAA,CAAiB,OAAA,EAAQ;AAAA,EAC3B,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,aAAA,CAAc;AAAA,MACZ,EAAA,EAAI,YAAA;AAAA,MACJ,YAAA;AAAA,MACA,WAAA;AAAA,MACA,cAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,EACH,GAAG,CAAC,YAAA,EAAc,aAAa,cAAA,EAAgB,WAAA,EAAa,aAAa,CAAC,CAAA;AAE1E,EAAA,OAAO,IAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedFAB.esm.js","sources":["../../src/components/LightspeedFAB.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Close from '@mui/icons-material/Close';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport { makeStyles } from '@mui/styles';\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { DOCKED_CONTENT_OFFSET } from '../const';\nimport { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';\nimport { LightspeedFABIcon } from './LightspeedIcon';\n\nconst useStyles = makeStyles(theme => ({\n fab: {\n opacity: '1 !important',\n backgroundColor: `${theme?.palette?.primary?.main ?? '#1976d2'} !important`,\n color: `${theme?.palette?.primary?.contrastText ?? '#fff'} !important`,\n boxShadow: `${\n theme?.shadows?.[6] ??\n '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)'\n } !important`,\n },\n 'fab-button': {\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n alignItems: 'end',\n zIndex: 200,\n display: 'flex',\n position: 'fixed',\n\n // When ApplicationDrawer is docked, match main content inset\n 'body.docked-drawer-open &': {\n transition: 'margin-right 0.3s ease',\n marginRight: DOCKED_CONTENT_OFFSET,\n },\n },\n}));\n\n/**\n * @public\n * Lightspeed Floating action button to open/close the lightspeed chatbot\n */\n\nexport const LightspeedFAB = () => {\n const { isChatbotActive, toggleChatbot, displayMode } =\n useLightspeedDrawerContext();\n const fabButton = useStyles();\n\n if (displayMode === ChatbotDisplayMode.embedded) {\n return null;\n }\n\n return (\n <div\n className={fabButton['fab-button']}\n id=\"lightspeed-fab\"\n data-testid=\"lightspeed-fab\"\n >\n <Tooltip\n title={isChatbotActive ? 'Close Lightspeed' : 'Open Lightspeed'}\n placement=\"left\"\n >\n <Fab\n color=\"primary\"\n variant=\"circular\"\n size=\"small\"\n onClick={toggleChatbot}\n aria-label={isChatbotActive ? 'lightspeed-close' : 'lightspeed-open'}\n className={fabButton.fab}\n sx={{ borderRadius: '100% !important' }}\n >\n {isChatbotActive ? <Close fontSize=\"small\" /> : <LightspeedFABIcon />}\n </Fab>\n </Tooltip>\n </div>\n );\n};\n"],"names":["Close"],"mappings":";;;;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,GAAK,EAAA;AAAA,IACH,OAAS,EAAA,cAAA;AAAA,IACT,iBAAiB,CAAG,EAAA,KAAA,EAAO,OAAS,EAAA,OAAA,EAAS,QAAQ,SAAS,CAAA,WAAA,CAAA;AAAA,IAC9D,OAAO,CAAG,EAAA,KAAA,EAAO,OAAS,EAAA,OAAA,EAAS,gBAAgB,MAAM,CAAA,WAAA,CAAA;AAAA,IACzD,WAAW,CACT,EAAA,KAAA,EAAO,OAAU,GAAA,CAAC,KAClB,wGACF,CAAA,WAAA;AAAA,GACF;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,QAAQ,CAAQ,KAAA,EAAA,KAAA,EAAO,OAAU,GAAA,CAAC,KAAK,MAAM,CAAA,SAAA,CAAA;AAAA,IAC7C,OAAO,CAAQ,KAAA,EAAA,KAAA,EAAO,OAAU,GAAA,CAAC,KAAK,MAAM,CAAA,SAAA,CAAA;AAAA,IAC5C,UAAY,EAAA,KAAA;AAAA,IACZ,MAAQ,EAAA,GAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,OAAA;AAAA;AAAA,IAGV,2BAA6B,EAAA;AAAA,MAC3B,UAAY,EAAA,wBAAA;AAAA,MACZ,WAAa,EAAA;AAAA;AACf;AAEJ,CAAE,CAAA,CAAA;AAOK,MAAM,gBAAgB,MAAM;AACjC,EAAA,MAAM,EAAE,eAAA,EAAiB,aAAe,EAAA,WAAA,KACtC,0BAA2B,EAAA;AAC7B,EAAA,MAAM,YAAY,SAAU,EAAA;AAE5B,EAAI,IAAA,WAAA,KAAgB,mBAAmB,QAAU,EAAA;AAC/C,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,UAAU,YAAY,CAAA;AAAA,MACjC,EAAG,EAAA,gBAAA;AAAA,MACH,aAAY,EAAA,gBAAA;AAAA,MAEZ,QAAA,kBAAA,GAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,kBAAkB,kBAAqB,GAAA,iBAAA;AAAA,UAC9C,SAAU,EAAA,MAAA;AAAA,UAEV,QAAA,kBAAA,GAAA;AAAA,YAAC,GAAA;AAAA,YAAA;AAAA,cACC,KAAM,EAAA,SAAA;AAAA,cACN,OAAQ,EAAA,UAAA;AAAA,cACR,IAAK,EAAA,OAAA;AAAA,cACL,OAAS,EAAA,aAAA;AAAA,cACT,YAAA,EAAY,kBAAkB,kBAAqB,GAAA,iBAAA;AAAA,cACnD,WAAW,SAAU,CAAA,GAAA;AAAA,cACrB,EAAA,EAAI,EAAE,YAAA,EAAc,iBAAkB,EAAA;AAAA,cAErC,4CAAmB,GAAA,CAAAA,SAAA,EAAA,EAAM,UAAS,OAAQ,EAAA,CAAA,uBAAM,iBAAkB,EAAA,EAAA;AAAA;AAAA;AACrE;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"LightspeedFAB.esm.js","sources":["../../src/components/LightspeedFAB.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Close from '@mui/icons-material/Close';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport { makeStyles } from '@mui/styles';\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { DOCKED_CONTENT_OFFSET } from '../const';\nimport { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';\nimport { LightspeedFABIcon } from './LightspeedIcon';\n\nconst useStyles = makeStyles(theme => ({\n fab: {\n opacity: '1 !important',\n backgroundColor: `${theme?.palette?.primary?.main ?? '#1976d2'} !important`,\n color: `${theme?.palette?.primary?.contrastText ?? '#fff'} !important`,\n boxShadow: `${\n theme?.shadows?.[6] ??\n '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)'\n } !important`,\n },\n 'fab-button': {\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n alignItems: 'end',\n zIndex: 200,\n display: 'flex',\n position: 'fixed',\n\n // When ApplicationDrawer is docked, match main content inset\n 'body.docked-drawer-open &': {\n transition: 'margin-right 0.3s ease',\n marginRight: DOCKED_CONTENT_OFFSET,\n },\n },\n}));\n\n/**\n * @public\n * Lightspeed Floating action button to open/close the lightspeed chatbot\n */\n\nexport const LightspeedFAB = () => {\n const { isChatbotActive, toggleChatbot, displayMode } =\n useLightspeedDrawerContext();\n const fabButton = useStyles();\n\n if (displayMode === ChatbotDisplayMode.embedded) {\n return null;\n }\n\n return (\n <div\n className={fabButton['fab-button']}\n id=\"lightspeed-fab\"\n data-testid=\"lightspeed-fab\"\n >\n <Tooltip\n title={isChatbotActive ? 'Close Lightspeed' : 'Open Lightspeed'}\n placement=\"left\"\n >\n <Fab\n color=\"primary\"\n variant=\"circular\"\n size=\"small\"\n onClick={toggleChatbot}\n aria-label={isChatbotActive ? 'lightspeed-close' : 'lightspeed-open'}\n className={fabButton.fab}\n sx={{ borderRadius: '100% !important' }}\n >\n {isChatbotActive ? <Close fontSize=\"small\" /> : <LightspeedFABIcon />}\n </Fab>\n </Tooltip>\n </div>\n );\n};\n"],"names":["Close"],"mappings":";;;;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,GAAA,EAAK;AAAA,IACH,OAAA,EAAS,cAAA;AAAA,IACT,iBAAiB,CAAA,EAAG,KAAA,EAAO,OAAA,EAAS,OAAA,EAAS,QAAQ,SAAS,CAAA,WAAA,CAAA;AAAA,IAC9D,OAAO,CAAA,EAAG,KAAA,EAAO,OAAA,EAAS,OAAA,EAAS,gBAAgB,MAAM,CAAA,WAAA,CAAA;AAAA,IACzD,WAAW,CAAA,EACT,KAAA,EAAO,OAAA,GAAU,CAAC,KAClB,wGACF,CAAA,WAAA;AAAA,GACF;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,QAAQ,CAAA,KAAA,EAAQ,KAAA,EAAO,OAAA,GAAU,CAAC,KAAK,MAAM,CAAA,SAAA,CAAA;AAAA,IAC7C,OAAO,CAAA,KAAA,EAAQ,KAAA,EAAO,OAAA,GAAU,CAAC,KAAK,MAAM,CAAA,SAAA,CAAA;AAAA,IAC5C,UAAA,EAAY,KAAA;AAAA,IACZ,MAAA,EAAQ,GAAA;AAAA,IACR,OAAA,EAAS,MAAA;AAAA,IACT,QAAA,EAAU,OAAA;AAAA;AAAA,IAGV,2BAAA,EAA6B;AAAA,MAC3B,UAAA,EAAY,wBAAA;AAAA,MACZ,WAAA,EAAa;AAAA;AACf;AAEJ,CAAA,CAAE,CAAA;AAOK,MAAM,gBAAgB,MAAM;AACjC,EAAA,MAAM,EAAE,eAAA,EAAiB,aAAA,EAAe,WAAA,KACtC,0BAAA,EAA2B;AAC7B,EAAA,MAAM,YAAY,SAAA,EAAU;AAE5B,EAAA,IAAI,WAAA,KAAgB,mBAAmB,QAAA,EAAU;AAC/C,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,UAAU,YAAY,CAAA;AAAA,MACjC,EAAA,EAAG,gBAAA;AAAA,MACH,aAAA,EAAY,gBAAA;AAAA,MAEZ,QAAA,kBAAA,GAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,kBAAkB,kBAAA,GAAqB,iBAAA;AAAA,UAC9C,SAAA,EAAU,MAAA;AAAA,UAEV,QAAA,kBAAA,GAAA;AAAA,YAAC,GAAA;AAAA,YAAA;AAAA,cACC,KAAA,EAAM,SAAA;AAAA,cACN,OAAA,EAAQ,UAAA;AAAA,cACR,IAAA,EAAK,OAAA;AAAA,cACL,OAAA,EAAS,aAAA;AAAA,cACT,YAAA,EAAY,kBAAkB,kBAAA,GAAqB,iBAAA;AAAA,cACnD,WAAW,SAAA,CAAU,GAAA;AAAA,cACrB,EAAA,EAAI,EAAE,YAAA,EAAc,iBAAA,EAAkB;AAAA,cAErC,4CAAkB,GAAA,CAACA,SAAA,EAAA,EAAM,UAAS,OAAA,EAAQ,CAAA,uBAAM,iBAAA,EAAA,EAAkB;AAAA;AAAA;AACrE;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedIcon.esm.js","sources":["../../src/components/LightspeedIcon.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useTheme } from '@mui/material/styles';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport logoDark from '../images/logo-black.svg';\nimport logo from '../images/logo-white.svg';\nimport roundedLogo from '../images/rounded-logo.svg';\n\n/**\n * @public\n * Lightspeed Icon\n */\nexport const LightspeedIcon = () => {\n const { t } = useTranslation();\n const theme = useTheme();\n const isDarkTheme = theme.palette.mode === 'dark';\n\n return (\n <img\n src={(isDarkTheme ? logo : logoDark) as any}\n alt={t('icon.lightspeed.alt')}\n style={{ height: '25px' }}\n />\n );\n};\n\n/**\n * @public\n * Lightspeed FAB Icon */\nexport const LightspeedFABIcon = () => {\n const { t } = useTranslation();\n\n return (\n <img\n data-testid=\"lightspeed-fab-icon\"\n src={roundedLogo as any}\n alt={t('icon.lightspeed.alt')}\n style={{\n width: '100%',\n height: '100%',\n display: 'block',\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAM,MAAA,WAAA,GAAc,KAAM,CAAA,OAAA,CAAQ,IAAS,KAAA,MAAA;AAE3C,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAM,cAAc,IAAO,GAAA,QAAA;AAAA,MAC3B,GAAA,EAAK,EAAE,qBAAqB,CAAA;AAAA,MAC5B,KAAA,EAAO,EAAE,MAAA,EAAQ,MAAO;AAAA;AAAA,GAC1B;AAEJ;AAKO,MAAM,oBAAoB,MAAM;AACrC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAY,EAAA,qBAAA;AAAA,MACZ,GAAK,EAAA,WAAA;AAAA,MACL,GAAA,EAAK,EAAE,qBAAqB,CAAA;AAAA,MAC5B,KAAO,EAAA;AAAA,QACL,KAAO,EAAA,MAAA;AAAA,QACP,MAAQ,EAAA,MAAA;AAAA,QACR,OAAS,EAAA;AAAA;AACX;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"LightspeedIcon.esm.js","sources":["../../src/components/LightspeedIcon.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useTheme } from '@mui/material/styles';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport logoDark from '../images/logo-black.svg';\nimport logo from '../images/logo-white.svg';\nimport roundedLogo from '../images/rounded-logo.svg';\n\n/**\n * @public\n * Lightspeed Icon\n */\nexport const LightspeedIcon = () => {\n const { t } = useTranslation();\n const theme = useTheme();\n const isDarkTheme = theme.palette.mode === 'dark';\n\n return (\n <img\n src={(isDarkTheme ? logo : logoDark) as any}\n alt={t('icon.lightspeed.alt')}\n style={{ height: '25px' }}\n />\n );\n};\n\n/**\n * @public\n * Lightspeed FAB Icon */\nexport const LightspeedFABIcon = () => {\n const { t } = useTranslation();\n\n return (\n <img\n data-testid=\"lightspeed-fab-icon\"\n src={roundedLogo as any}\n alt={t('icon.lightspeed.alt')}\n style={{\n width: '100%',\n height: '100%',\n display: 'block',\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BO,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,QAAQ,QAAA,EAAS;AACvB,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,OAAA,CAAQ,IAAA,KAAS,MAAA;AAE3C,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAM,cAAc,IAAA,GAAO,QAAA;AAAA,MAC3B,GAAA,EAAK,EAAE,qBAAqB,CAAA;AAAA,MAC5B,KAAA,EAAO,EAAE,MAAA,EAAQ,MAAA;AAAO;AAAA,GAC1B;AAEJ;AAKO,MAAM,oBAAoB,MAAM;AACrC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAE7B,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAY,qBAAA;AAAA,MACZ,GAAA,EAAK,WAAA;AAAA,MACL,GAAA,EAAK,EAAE,qBAAqB,CAAA;AAAA,MAC5B,KAAA,EAAO;AAAA,QACL,KAAA,EAAO,MAAA;AAAA,QACP,MAAA,EAAQ,MAAA;AAAA,QACR,OAAA,EAAS;AAAA;AACX;AAAA,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightspeedPage.esm.js","sources":["../../src/components/LightspeedPage.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Content, Header, Page } from '@backstage/core-components';\n\nimport { createStyles, makeStyles } from '@material-ui/core/styles';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport { LightspeedChatContainer } from './LightspeedChatContainer';\n\nconst useStyles = makeStyles(() =>\n createStyles({\n container: {\n padding: '0px',\n },\n }),\n);\n\n/**\n * Lightspeed Page - Routable fullscreen/embedded mode\n * @public\n */\nexport const LightspeedPage = () => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <Page themeId=\"tool\">\n <Header\n title={t('page.title')}\n style={{ display: 'none' }}\n pageTitleOverride={t('page.title')}\n />\n <Content className={classes.container}>\n <LightspeedChatContainer />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,MAC3B,YAAa,CAAA;AAAA,IACX,SAAW,EAAA;AAAA,MACT,OAAS,EAAA;AAAA;AACX,GACD;AACH,CAAA;AAMO,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EACE,uBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,YAAY,CAAA;AAAA,QACrB,KAAA,EAAO,EAAE,OAAA,EAAS,MAAO,EAAA;AAAA,QACzB,iBAAA,EAAmB,EAAE,YAAY;AAAA;AAAA,KACnC;AAAA,wBACC,OAAQ,EAAA,EAAA,SAAA,EAAW,QAAQ,SAC1B,EAAA,QAAA,kBAAA,GAAA,CAAC,2BAAwB,CAC3B,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LightspeedPage.esm.js","sources":["../../src/components/LightspeedPage.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Content, Header, Page } from '@backstage/core-components';\n\nimport { createStyles, makeStyles } from '@material-ui/core/styles';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport { LightspeedChatContainer } from './LightspeedChatContainer';\n\nconst useStyles = makeStyles(() =>\n createStyles({\n container: {\n padding: '0px',\n },\n }),\n);\n\n/**\n * Lightspeed Page - Routable fullscreen/embedded mode\n * @public\n */\nexport const LightspeedPage = () => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <Page themeId=\"tool\">\n <Header\n title={t('page.title')}\n style={{ display: 'none' }}\n pageTitleOverride={t('page.title')}\n />\n <Content className={classes.container}>\n <LightspeedChatContainer />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,MAC3B,YAAA,CAAa;AAAA,IACX,SAAA,EAAW;AAAA,MACT,OAAA,EAAS;AAAA;AACX,GACD;AACH,CAAA;AAMO,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAE7B,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,MAAA,EACZ,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,YAAY,CAAA;AAAA,QACrB,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,QACzB,iBAAA,EAAmB,EAAE,YAAY;AAAA;AAAA,KACnC;AAAA,wBACC,OAAA,EAAA,EAAQ,SAAA,EAAW,QAAQ,SAAA,EAC1B,QAAA,kBAAA,GAAA,CAAC,2BAAwB,CAAA,EAC3B;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -302,7 +302,7 @@ const toUiServer = (server, validationError) => ({
302
302
  toolCount: server.toolCount,
303
303
  hasToken: server.hasToken,
304
304
  hasUserToken: server.hasUserToken,
305
- validationError: server.status === "error" ? validationError : undefined
305
+ validationError: server.status === "error" ? validationError : void 0
306
306
  });
307
307
  const McpServersSettings = ({
308
308
  onClose,
@@ -372,7 +372,7 @@ const McpServersSettings = ({
372
372
  ...server,
373
373
  status: data.status,
374
374
  toolCount: data.toolCount,
375
- validationError: data.status === "error" ? data.validation?.error ?? "Validation failed" : undefined
375
+ validationError: data.status === "error" ? data.validation?.error ?? "Validation failed" : void 0
376
376
  } : server
377
377
  )
378
378
  );
@@ -674,7 +674,7 @@ const McpServersSettings = ({
674
674
  "div",
675
675
  {
676
676
  className: classes.root,
677
- style: backgroundColor ? { backgroundColor } : undefined,
677
+ style: backgroundColor ? { backgroundColor } : void 0,
678
678
  children: [
679
679
  /* @__PURE__ */ jsxs("div", { className: classes.headerRow, children: [
680
680
  /* @__PURE__ */ jsxs("div", { children: [