@carbon/ai-chat 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/carbon-chat-docs.js +1 -1
- package/dist/docs/carbon-chat.html +1 -1
- package/dist/es/AppContainer.js +7 -7
- package/dist/es/Avatar.js +90 -0
- package/dist/es/BodyAndFooterPanelComponent.js +118 -0
- package/dist/es/BrandingOverlay.js +108 -0
- package/dist/es/Carousel.js +2 -2
- package/dist/es/CatastrophicError.js +153 -0
- package/dist/es/Chat.js +2288 -0
- package/dist/es/Disclaimer.js +213 -0
- package/dist/es/GenesysMessengerServiceDesk.js +2 -2
- package/dist/es/HomeScreenContainer.js +180 -0
- package/dist/es/HumanAgentServiceImpl.js +2 -2
- package/dist/es/IFrameComponent.js +91 -0
- package/dist/es/IFramePanel.js +75 -0
- package/dist/es/InlineError.js +41 -0
- package/dist/es/Input.js +537 -0
- package/dist/es/MessageTypeComponent.js +6492 -0
- package/dist/es/NiceDFOServiceDesk.js +2 -2
- package/dist/es/PDFViewerContainer.js +2 -2
- package/dist/es/ReactPlayer.js +2 -2
- package/dist/es/RichText.js +24801 -0
- package/dist/es/SFServiceDesk.js +2 -2
- package/dist/es/SearchResultBody.js +142 -0
- package/dist/es/ServiceDeskImpl.js +2 -2
- package/dist/es/TourContainer.js +429 -0
- package/dist/es/VideoComponent.js +241 -0
- package/dist/es/ViewSourcePanel.js +85 -0
- package/dist/es/ZendeskServiceDesk.js +2 -2
- package/dist/es/_node-resolve_empty.js +2 -2
- package/dist/es/aiChatEntry.js +2 -2
- package/dist/es/ar-dz.js +2 -2
- package/dist/es/ar-kw.js +2 -2
- package/dist/es/ar-ly.js +2 -2
- package/dist/es/ar-ma.js +2 -2
- package/dist/es/ar-sa.js +2 -2
- package/dist/es/ar-tn.js +2 -2
- package/dist/es/ar.js +2 -2
- package/dist/es/ar2.js +2 -2
- package/dist/es/cds-aichat-code.js +103 -0
- package/dist/es/cds-aichat-container.js +3 -3
- package/dist/es/cds-aichat-custom-element.js +2 -2
- package/dist/es/common.js +15342 -0
- package/dist/es/cs.js +2 -2
- package/dist/es/cs2.js +2 -2
- package/dist/es/customElement.js +2 -2
- package/dist/es/de-at.js +2 -2
- package/dist/es/de-ch.js +2 -2
- package/dist/es/de.js +2 -2
- package/dist/es/de2.js +2 -2
- package/dist/es/decode.js +561 -0
- package/dist/es/en-au.js +2 -2
- package/dist/es/en-ca.js +2 -2
- package/dist/es/en-gb.js +2 -2
- package/dist/es/en-ie.js +2 -2
- package/dist/es/en-il.js +2 -2
- package/dist/es/en-nz.js +2 -2
- package/dist/es/es-do.js +2 -2
- package/dist/es/es-us.js +2 -2
- package/dist/es/es.js +2 -2
- package/dist/es/es2.js +2 -2
- package/dist/es/export.carbon.js +2 -2
- package/dist/es/export.js +3 -3
- package/dist/es/export.legacy.carbon.js +2 -2
- package/dist/es/export.legacy.js +3 -3
- package/dist/es/fr-ca.js +2 -2
- package/dist/es/fr-ch.js +2 -2
- package/dist/es/fr.js +2 -2
- package/dist/es/fr2.js +2 -2
- package/dist/es/it-ch.js +2 -2
- package/dist/es/it.js +2 -2
- package/dist/es/it2.js +2 -2
- package/dist/es/ja.js +2 -2
- package/dist/es/ja2.js +2 -2
- package/dist/es/ko.js +2 -2
- package/dist/es/ko2.js +2 -2
- package/dist/es/markdown.js +9323 -0
- package/dist/es/markdown.worker.js +66 -0
- package/dist/es/mockServiceDesk.js +2 -2
- package/dist/es/moduleFederationPluginUtils.js +159 -0
- package/dist/es/nl.js +2 -2
- package/dist/es/nl2.js +2 -2
- package/dist/es/pt-br.js +2 -2
- package/dist/es/pt-br2.js +2 -2
- package/dist/es/pt.js +2 -2
- package/dist/es/scriptRender.js +2 -2
- package/dist/es/tokenTree.js +143 -0
- package/dist/es/useCounter.js +37 -0
- package/dist/es/useWindowSize.js +30 -0
- package/dist/es/zh-cn.js +2 -2
- package/dist/es/zh-tw.js +2 -2
- package/dist/es/zh-tw2.js +2 -2
- package/dist/es/zh.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* (C) Copyright IBM Corp. 2017, 2025. All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
7
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
12
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
13
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
|
+
* the License.
|
|
15
|
+
*
|
|
16
|
+
* @carbon/ai-chat 0.3.2
|
|
17
|
+
*
|
|
18
|
+
* Built: Jul 9 2025 11:10 am -04:00
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { AISkeletonText, SkeletonText as SkeletonText$1, AISkeletonPlaceholder, SkeletonPlaceholder as SkeletonPlaceholder$1, Tile, unstable__AiSkeletonPlaceholder } from '@carbon/react';
|
|
24
|
+
import { Z as cx, ak as VisuallyHidden, bG as lazyMediaPlayer, _ as useLanguagePack, bl as useAriaAnnouncer, b9 as usePrevious, bH as RESPONSE_TYPE_TIMEOUT_MS, bn as getResponsiveElementPaddingValue, bk as getURLHostName } from './AppContainer.js';
|
|
25
|
+
import React__default, { useState, useRef, useCallback, useEffect, Suspense } from 'react';
|
|
26
|
+
import { I as InlineError } from './InlineError.js';
|
|
27
|
+
import Music from '@carbon/icons-react/es/Music.js';
|
|
28
|
+
import { useSelector } from 'react-redux';
|
|
29
|
+
import { j as MessageResponseTypes } from './customElement.js';
|
|
30
|
+
|
|
31
|
+
function SkeletonText(props) {
|
|
32
|
+
const useAITheme = useSelector((state) => state.theme.useAITheme);
|
|
33
|
+
return useAITheme ? React__default.createElement(AISkeletonText, { ...props }) : React__default.createElement(SkeletonText$1, { ...props });
|
|
34
|
+
}
|
|
35
|
+
function SkeletonPlaceholder(props) {
|
|
36
|
+
const useAITheme = useSelector((state) => state.theme.useAITheme);
|
|
37
|
+
return useAITheme ? React__default.createElement(AISkeletonPlaceholder, { ...props }) : React__default.createElement(SkeletonPlaceholder$1, { ...props });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This component renders the Textual part of the cards - more specifically Title, description, favicon URL
|
|
42
|
+
* or default fallback icon. In the case of Iframes, this also renders the URL part. Also renders a launch icon in
|
|
43
|
+
* the case of text-only cards
|
|
44
|
+
*/
|
|
45
|
+
function TextHolderTile({ title, description, displayURL, urlHostName, hideTitle }) {
|
|
46
|
+
return (React__default.createElement("div", { className: "WACTextHolderTile" },
|
|
47
|
+
React__default.createElement("div", { className: cx('WACTextHolderTile__Wrapper', 'WACWidget__textEllipsis', {
|
|
48
|
+
WACTextHolderTile__IconMargin: !displayURL,
|
|
49
|
+
}) },
|
|
50
|
+
!hideTitle && title && React__default.createElement("div", { className: "WACTextHolderTile__Title" }, title),
|
|
51
|
+
description && (React__default.createElement("div", { className: cx('WACTextHolderTile__Description', { WACTextHolderTile__DescriptionMargin: title }) }, description)),
|
|
52
|
+
displayURL && (React__default.createElement(React__default.Fragment, null,
|
|
53
|
+
React__default.createElement(VisuallyHidden, null, urlHostName),
|
|
54
|
+
React__default.createElement("div", { className: cx('WACTextHolderTile__Url', 'WACWidget__textEllipsis', {
|
|
55
|
+
WACTextHolderTile__UrlMargin: title || description,
|
|
56
|
+
}), "aria-hidden": true }, displayURL))))));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// https://reactjs.org/docs/code-splitting.html#reactlazy
|
|
60
|
+
const ReactPlayerComponent = lazyMediaPlayer();
|
|
61
|
+
/**
|
|
62
|
+
* This component uses the React player library to handle rendering video/audio files, as well as handling third-party
|
|
63
|
+
* embeddable video/audio services. Learn more: https://github.com/cookpete/react-player
|
|
64
|
+
*
|
|
65
|
+
* Note: We force media files to render using a video element for accessibility purposes since the audio element doesn't
|
|
66
|
+
* support WebVTT for captioning/transcripts, but the video element does.
|
|
67
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio#accessibility_concerns
|
|
68
|
+
*/
|
|
69
|
+
function MediaPlayerComponent({ type, source, title, description, ariaLabel, isMixcloud, baseHeight, doAutoScroll, playing, onPlay, onPause, hideIconAndTitle, needsAnnouncement, }) {
|
|
70
|
+
const [skeletonHidden, setSkeletonHidden] = useState(false);
|
|
71
|
+
const [errorLoading, setErrorLoading] = useState(false);
|
|
72
|
+
const { errors_audioSource, errors_videoSource } = useLanguagePack();
|
|
73
|
+
const ariaAnnouncer = useAriaAnnouncer();
|
|
74
|
+
const rootElementRef = useRef();
|
|
75
|
+
const paddingTop = isMixcloud ? '120px' : getResponsiveElementPaddingValue(baseHeight);
|
|
76
|
+
const isAudio = type === MessageResponseTypes.AUDIO;
|
|
77
|
+
const errorMessage = isAudio ? errors_audioSource : errors_videoSource;
|
|
78
|
+
const prevSource = usePrevious(source);
|
|
79
|
+
// This ref is for merely saving the initial value of shouldAnnounce prop.
|
|
80
|
+
const shouldAnnounceRef = useRef(needsAnnouncement);
|
|
81
|
+
/**
|
|
82
|
+
* Upon an error, update the error loading flag in order to render an inline error.
|
|
83
|
+
*/
|
|
84
|
+
const handleError = useCallback(() => {
|
|
85
|
+
setErrorLoading(true);
|
|
86
|
+
setSkeletonHidden(true);
|
|
87
|
+
}, []);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (source !== prevSource && skeletonHidden) {
|
|
90
|
+
setSkeletonHidden(false);
|
|
91
|
+
}
|
|
92
|
+
}, [prevSource, skeletonHidden, source]);
|
|
93
|
+
// This effect sets a timeout that auto error handles after 10 seconds of waiting for the React player to ready.
|
|
94
|
+
// Once the player has loaded, the skeleton will be hidden, and we can clear the timeout.
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
let errorTimeout = null;
|
|
97
|
+
if (!skeletonHidden) {
|
|
98
|
+
errorTimeout = setTimeout(handleError, RESPONSE_TYPE_TIMEOUT_MS);
|
|
99
|
+
}
|
|
100
|
+
return () => {
|
|
101
|
+
clearTimeout(errorTimeout);
|
|
102
|
+
};
|
|
103
|
+
}, [skeletonHidden, handleError]);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (skeletonHidden && shouldAnnounceRef.current) {
|
|
106
|
+
ariaAnnouncer(rootElementRef.current);
|
|
107
|
+
}
|
|
108
|
+
}, [ariaAnnouncer, skeletonHidden]);
|
|
109
|
+
/**
|
|
110
|
+
* Once the video player is finished loading, remove the skeleton.
|
|
111
|
+
*/
|
|
112
|
+
const handleReady = useCallback(() => {
|
|
113
|
+
if (!skeletonHidden) {
|
|
114
|
+
setSkeletonHidden(true);
|
|
115
|
+
doAutoScroll?.();
|
|
116
|
+
}
|
|
117
|
+
}, [doAutoScroll, skeletonHidden]);
|
|
118
|
+
/**
|
|
119
|
+
* Renders a media player skeleton. This is rendered until the react-player has loaded the provided url.
|
|
120
|
+
*/
|
|
121
|
+
function renderMediaPlayerSkeleton() {
|
|
122
|
+
return (React__default.createElement(Tile, { className: "WACMediaPlayer__Skeleton" },
|
|
123
|
+
React__default.createElement("div", { className: "WACMediaPlayer__SkeletonContainer", style: { paddingTop } },
|
|
124
|
+
React__default.createElement(SkeletonPlaceholder, { className: "WACMediaPlayer__SkeletonPlayer" })),
|
|
125
|
+
(title || description) && (React__default.createElement("div", { className: "WACMediaPlayer__SkeletonTextContainer" },
|
|
126
|
+
React__default.createElement(SkeletonText, { paragraph: true, lineCount: 2 })))));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Render a media player background that adds letterboxes to urls utilizing iframes that may not have them included
|
|
130
|
+
* already. If an audio file is being played, we should display a music icon in the center since audio files will be
|
|
131
|
+
* loaded using a video element and a 16:9 blank video element with controls playing audio would look weird.
|
|
132
|
+
*/
|
|
133
|
+
function renderMediaPlayerBackground() {
|
|
134
|
+
return (React__default.createElement("div", { className: cx('WACMediaPlayer__Background', {
|
|
135
|
+
'WACMediaPlayer__Background--audio': isAudio,
|
|
136
|
+
}) }, isAudio && React__default.createElement(Music, { size: 32, className: "WACMediaPlayer__MusicIcon" })));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* If the dynamically imported react-player component is in suspense, we don't need to display some loading indicator
|
|
140
|
+
* since the media player skeleton handles that for us and the media player is hidden with `display: none` until the
|
|
141
|
+
* react-player has loaded the url.
|
|
142
|
+
*/
|
|
143
|
+
function renderSuspenseFallback() {
|
|
144
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
145
|
+
}
|
|
146
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
147
|
+
!skeletonHidden && renderMediaPlayerSkeleton(),
|
|
148
|
+
React__default.createElement("div", { className: "WACMediaPlayer__Root", ref: rootElementRef },
|
|
149
|
+
errorLoading && React__default.createElement(InlineError, { text: errorMessage }),
|
|
150
|
+
!errorLoading && (React__default.createElement(Tile, { className: cx('WACMediaPlayer', { WAC__hidden: !skeletonHidden }) },
|
|
151
|
+
React__default.createElement("div", { className: "WACMediaPlayer__Wrapper", style: { paddingTop } },
|
|
152
|
+
renderMediaPlayerBackground(),
|
|
153
|
+
React__default.createElement(Suspense, { fallback: renderSuspenseFallback() },
|
|
154
|
+
React__default.createElement(ReactPlayerComponent, { className: "WACMediaPlayer__Player", url: source, controls: true, width: "100%", height: "100%", config: {
|
|
155
|
+
file: {
|
|
156
|
+
forceVideo: true,
|
|
157
|
+
attributes: {
|
|
158
|
+
controlsList: 'nodownload',
|
|
159
|
+
'aria-label': ariaLabel || description || title,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
}, playsinline: true, playing: playing, onPlay: onPlay, onPause: onPause, onReady: handleReady, onError: handleError, pip: true }))),
|
|
163
|
+
(title || description) && (React__default.createElement(TextHolderTile, { title: title, description: description, hideTitle: hideIconAndTitle })))))));
|
|
164
|
+
}
|
|
165
|
+
const MediaPlayerExport = React__default.memo(MediaPlayerComponent);
|
|
166
|
+
|
|
167
|
+
function Image(props) {
|
|
168
|
+
const { imageError, title, description, displayURL, hideIconAndTitle, needsAnnouncement, renderIcon, inline } = props;
|
|
169
|
+
const ariaAnnouncer = useAriaAnnouncer();
|
|
170
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
171
|
+
const [isError, setIsError] = useState(false);
|
|
172
|
+
const rootRef = useRef();
|
|
173
|
+
// This ref is for merely saving the initial value of shouldAnnounce prop.
|
|
174
|
+
const needsAnnouncementRef = useRef(needsAnnouncement);
|
|
175
|
+
const hasText = Boolean(title || description || displayURL);
|
|
176
|
+
const Icon = renderIcon;
|
|
177
|
+
// This effect announces the contents of this response type once the image has loaded.
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (isLoaded && needsAnnouncementRef.current) {
|
|
180
|
+
ariaAnnouncer(rootRef.current);
|
|
181
|
+
}
|
|
182
|
+
}, [ariaAnnouncer, isLoaded]);
|
|
183
|
+
if (isError) {
|
|
184
|
+
return React__default.createElement(InlineError, { text: imageError });
|
|
185
|
+
}
|
|
186
|
+
if (inline) {
|
|
187
|
+
return (React__default.createElement(ImageOnly, { ...props, setIsError: setIsError, setIsLoaded: setIsLoaded, isError: isError, isLoaded: isLoaded }));
|
|
188
|
+
}
|
|
189
|
+
return (React__default.createElement(Tile, { ref: rootRef, className: cx('WACImage', {
|
|
190
|
+
WACImage__TextAndIcon: hasText && Boolean(renderIcon),
|
|
191
|
+
WACImage__IconOnly: !hideIconAndTitle && !title && !description && Boolean(renderIcon),
|
|
192
|
+
}) },
|
|
193
|
+
React__default.createElement("div", { className: "WACImage__ImageWrapper" },
|
|
194
|
+
React__default.createElement(ImageOnly, { ...props, setIsError: setIsError, setIsLoaded: setIsLoaded, isError: isError, isLoaded: isLoaded })),
|
|
195
|
+
hasText && (React__default.createElement(TextHolderTile, { title: title, description: description, displayURL: displayURL, urlHostName: displayURL && getURLHostName(displayURL), hideTitle: hideIconAndTitle })),
|
|
196
|
+
Boolean(Icon) && (React__default.createElement(Icon, { className: cx('WACImage__Icon', 'WACDirectionHasReversibleSVG', { 'WACImage__Icon--link': displayURL }) }))));
|
|
197
|
+
}
|
|
198
|
+
function ImageOnly({ source, title, description, altText, displayURL, preventInlineError, onImageLoad, useAITheme, isLoaded, isError, setIsLoaded, setIsError, className, inline, }) {
|
|
199
|
+
const [isImageHidden, setIsImageHidden] = useState(false);
|
|
200
|
+
const imageAlt = altText || title || description || '';
|
|
201
|
+
const hasText = Boolean(title || description || displayURL);
|
|
202
|
+
/**
|
|
203
|
+
* Upon an error, update the error loading flag in order to render an inline error.
|
|
204
|
+
*/
|
|
205
|
+
const handleError = useCallback(() => {
|
|
206
|
+
if (preventInlineError && hasText) {
|
|
207
|
+
setIsImageHidden(true);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
setIsError(true);
|
|
211
|
+
}
|
|
212
|
+
}, [preventInlineError, hasText, setIsError]);
|
|
213
|
+
// This effect sets a timeout that auto error handles after 10 seconds of waiting for the image to load. Once the
|
|
214
|
+
// image has loaded, the skeleton will be hidden, and we can clear the timeout.
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
let errorTimeout = null;
|
|
217
|
+
if (!isLoaded) {
|
|
218
|
+
errorTimeout = setTimeout(handleError, RESPONSE_TYPE_TIMEOUT_MS);
|
|
219
|
+
}
|
|
220
|
+
return () => {
|
|
221
|
+
clearTimeout(errorTimeout);
|
|
222
|
+
};
|
|
223
|
+
}, [isLoaded, handleError]);
|
|
224
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
225
|
+
!isLoaded && !isImageHidden && !inline && source && (React__default.createElement(React__default.Fragment, null, useAITheme ? (React__default.createElement(unstable__AiSkeletonPlaceholder, { className: "WACImage__Skeleton" })) : (React__default.createElement(SkeletonPlaceholder$1, { className: "WACImage__Skeleton" })))),
|
|
226
|
+
!isError && !isImageHidden && source && (React__default.createElement("img", { className: cx('WACImage__Image', {
|
|
227
|
+
[className]: className,
|
|
228
|
+
'WACImage__Image--loaded': isLoaded,
|
|
229
|
+
}), src: source, alt: imageAlt, onLoad: () => {
|
|
230
|
+
onImageLoad?.();
|
|
231
|
+
setIsLoaded(true);
|
|
232
|
+
}, onError: handleError }))));
|
|
233
|
+
}
|
|
234
|
+
const ImageExport = React__default.memo(Image);
|
|
235
|
+
|
|
236
|
+
function VideoComponent({ ...props }) {
|
|
237
|
+
return React__default.createElement(MediaPlayerExport, { type: MessageResponseTypes.VIDEO, ...props });
|
|
238
|
+
}
|
|
239
|
+
const VideoComponentExport = React__default.memo(VideoComponent);
|
|
240
|
+
|
|
241
|
+
export { ImageExport as I, MediaPlayerExport as M, SkeletonText as S, VideoComponentExport as V, SkeletonPlaceholder as a };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* (C) Copyright IBM Corp. 2017, 2025. All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
7
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
12
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
13
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
|
+
* the License.
|
|
15
|
+
*
|
|
16
|
+
* @carbon/ai-chat 0.3.2
|
|
17
|
+
*
|
|
18
|
+
* Built: Jul 9 2025 11:10 am -04:00
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import React__default, { forwardRef } from 'react';
|
|
24
|
+
import { useSelector } from 'react-redux';
|
|
25
|
+
import { _ as useLanguagePack, a0 as useServiceManager, bT as BasePanelComponentExport, w as actions } from './AppContainer.js';
|
|
26
|
+
import { a as SearchResultBodyWithCitationHighlightedExport, S as SearchResultBodyExport } from './SearchResultBody.js';
|
|
27
|
+
import './customElement.js';
|
|
28
|
+
import 'react-intl';
|
|
29
|
+
import '@carbon/react';
|
|
30
|
+
import '@carbon/icons-react/es/AiLaunch.js';
|
|
31
|
+
import '@carbon/icons-react/es/ArrowUpLeft.js';
|
|
32
|
+
import '@carbon/icons-react/es/ChatLaunch.js';
|
|
33
|
+
import '@carbon/icons-react/es/Close.js';
|
|
34
|
+
import '@carbon/icons-react/es/Information.js';
|
|
35
|
+
import '@carbon/icons-react/es/Home.js';
|
|
36
|
+
import '@carbon/web-components/es-custom/components/slug/index.js';
|
|
37
|
+
import '@carbon/icons-react/es/CloseLarge.js';
|
|
38
|
+
import '@carbon/icons-react/es/DownToBottom.js';
|
|
39
|
+
import '@carbon/icons-react/es/Menu.js';
|
|
40
|
+
import '@carbon/icons-react/es/Restart.js';
|
|
41
|
+
import '@carbon/icons-react/es/SidePanelClose.js';
|
|
42
|
+
import '@carbon/icons-react/es/SubtractLarge.js';
|
|
43
|
+
import '@carbon/web-components/es-custom/components/ai-label/defs.js';
|
|
44
|
+
import '@carbon/web-components/es-custom/components/popover/defs.js';
|
|
45
|
+
import '@carbon/web-components/es-custom/components/skeleton-icon/index.js';
|
|
46
|
+
import 'lit';
|
|
47
|
+
import 'lit/decorators.js';
|
|
48
|
+
import '@carbon/web-components/es-custom/components/button/index.js';
|
|
49
|
+
import '@carbon/web-components/es-custom/components/overflow-menu/index.js';
|
|
50
|
+
import '@carbon/icons-react/es/ChevronDown.js';
|
|
51
|
+
import '@carbon/icons-react/es/ChevronUp.js';
|
|
52
|
+
import 'react-dom';
|
|
53
|
+
import '@carbon/web-components/es-custom/components/ai-label/ai-label-action-button.js';
|
|
54
|
+
import '@carbon/web-components/es-custom/components/ai-label/ai-label.js';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* This panel is used to show the text of a conversational search citation.
|
|
58
|
+
*/
|
|
59
|
+
function ViewSourcePanel(props, ref) {
|
|
60
|
+
const languagePack = useLanguagePack();
|
|
61
|
+
const { store } = useServiceManager();
|
|
62
|
+
const { isOpen, citationItem, relatedSearchResult } = useSelector((state) => state.viewSourcePanelState);
|
|
63
|
+
let content;
|
|
64
|
+
if (citationItem && 'text' in citationItem) {
|
|
65
|
+
// If text is in the citation item then this is a conversational search source that is being shown.
|
|
66
|
+
if (relatedSearchResult) {
|
|
67
|
+
// If there is a related search result than show the search result body with the citation text highlighted.
|
|
68
|
+
content = (React__default.createElement(SearchResultBodyWithCitationHighlightedExport, { relatedSearchResult: relatedSearchResult, citationItem: citationItem }));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// If there is no related search result than show the citation text.
|
|
72
|
+
content = citationItem.text;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// If the citation is not for a conversational search response then it must be for a legacy search result so we
|
|
77
|
+
// should show the search result body.
|
|
78
|
+
content = React__default.createElement(SearchResultBodyExport, { searchResult: citationItem });
|
|
79
|
+
}
|
|
80
|
+
return (React__default.createElement(BasePanelComponentExport, { ...props, ref: ref, className: "WACViewSourcePanel", isOpen: isOpen, onClickBack: () => store.dispatch(actions.setViewSourcePanelIsOpen(false)), title: citationItem?.title, labelBackButton: languagePack.general_ariaCloseInformationOverlay, eventName: "Search citation panel opened", eventDescription: "A user has opened the search citation panel" },
|
|
81
|
+
React__default.createElement("div", { className: "WACViewSourcePanel__Content" }, content)));
|
|
82
|
+
}
|
|
83
|
+
const ViewSourcePanelExport = forwardRef(ViewSourcePanel);
|
|
84
|
+
|
|
85
|
+
export { ViewSourcePanelExport as ViewSourcePanel };
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/aiChatEntry.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/ar-dz.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/ar-kw.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/ar-ly.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/ar-ma.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/ar-sa.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/ar-tn.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/ar.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
package/dist/es/ar2.js
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* (C) Copyright IBM Corp. 2017, 2025. All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
7
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
12
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
13
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
|
+
* the License.
|
|
15
|
+
*
|
|
16
|
+
* @carbon/ai-chat 0.3.2
|
|
17
|
+
*
|
|
18
|
+
* Built: Jul 2 2025 2:29 pm -04:00
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { _ as __decorate, c as carbonElement } from './customElement.js';
|
|
24
|
+
import { LitElement, css, unsafeCSS, html } from 'lit';
|
|
25
|
+
import { property } from 'lit/decorators.js';
|
|
26
|
+
import { t as throttle } from './RichText.js';
|
|
27
|
+
import 'react';
|
|
28
|
+
import './AppContainer.js';
|
|
29
|
+
import 'react-intl';
|
|
30
|
+
import '@carbon/react';
|
|
31
|
+
import 'react-redux';
|
|
32
|
+
import '@carbon/icons-react/es/AiLaunch.js';
|
|
33
|
+
import '@carbon/icons-react/es/ArrowUpLeft.js';
|
|
34
|
+
import '@carbon/icons-react/es/ChatLaunch.js';
|
|
35
|
+
import '@carbon/icons-react/es/Close.js';
|
|
36
|
+
import '@carbon/icons-react/es/Information.js';
|
|
37
|
+
import '@carbon/icons-react/es/Home.js';
|
|
38
|
+
import '@carbon/web-components/es-custom/components/slug/index.js';
|
|
39
|
+
import '@carbon/icons-react/es/CloseLarge.js';
|
|
40
|
+
import '@carbon/icons-react/es/DownToBottom.js';
|
|
41
|
+
import '@carbon/icons-react/es/Menu.js';
|
|
42
|
+
import '@carbon/icons-react/es/Restart.js';
|
|
43
|
+
import '@carbon/icons-react/es/SidePanelClose.js';
|
|
44
|
+
import '@carbon/icons-react/es/SubtractLarge.js';
|
|
45
|
+
import '@carbon/web-components/es-custom/components/ai-label/defs.js';
|
|
46
|
+
import '@carbon/web-components/es-custom/components/popover/defs.js';
|
|
47
|
+
import '@carbon/web-components/es-custom/components/skeleton-icon/index.js';
|
|
48
|
+
import '@carbon/web-components/es-custom/components/button/index.js';
|
|
49
|
+
import '@carbon/web-components/es-custom/components/overflow-menu/index.js';
|
|
50
|
+
import '@carbon/icons-react/es/ChevronDown.js';
|
|
51
|
+
import '@carbon/icons-react/es/ChevronUp.js';
|
|
52
|
+
import 'react-dom';
|
|
53
|
+
import '@carbon/web-components/es-custom/components/ai-label/ai-label-action-button.js';
|
|
54
|
+
import '@carbon/web-components/es-custom/components/ai-label/ai-label.js';
|
|
55
|
+
import 'lit/directives/repeat.js';
|
|
56
|
+
import 'lit/directives/unsafe-html.js';
|
|
57
|
+
|
|
58
|
+
var css_248z = ":host-context(.cds--g100) pre code.hljs,:host-context(.cds--g90) pre code.hljs{display:block;overflow-x:auto;padding:1em}:host-context(.cds--g100) code.hljs,:host-context(.cds--g90) code.hljs{padding:3px 5px}:host-context(.cds--g100) .hljs,:host-context(.cds--g90) .hljs{background:#2b2b2b;color:#f8f8f2}:host-context(.cds--g100) .hljs-comment,:host-context(.cds--g100) .hljs-quote,:host-context(.cds--g90) .hljs-comment,:host-context(.cds--g90) .hljs-quote{color:#d4d0ab}:host-context(.cds--g100) .hljs-deletion,:host-context(.cds--g100) .hljs-name,:host-context(.cds--g100) .hljs-regexp,:host-context(.cds--g100) .hljs-selector-class,:host-context(.cds--g100) .hljs-selector-id,:host-context(.cds--g100) .hljs-tag,:host-context(.cds--g100) .hljs-template-variable,:host-context(.cds--g100) .hljs-variable,:host-context(.cds--g90) .hljs-deletion,:host-context(.cds--g90) .hljs-name,:host-context(.cds--g90) .hljs-regexp,:host-context(.cds--g90) .hljs-selector-class,:host-context(.cds--g90) .hljs-selector-id,:host-context(.cds--g90) .hljs-tag,:host-context(.cds--g90) .hljs-template-variable,:host-context(.cds--g90) .hljs-variable{color:#ffa07a}:host-context(.cds--g100) .hljs-built_in,:host-context(.cds--g100) .hljs-link,:host-context(.cds--g100) .hljs-literal,:host-context(.cds--g100) .hljs-meta,:host-context(.cds--g100) .hljs-number,:host-context(.cds--g100) .hljs-params,:host-context(.cds--g100) .hljs-type,:host-context(.cds--g90) .hljs-built_in,:host-context(.cds--g90) .hljs-link,:host-context(.cds--g90) .hljs-literal,:host-context(.cds--g90) .hljs-meta,:host-context(.cds--g90) .hljs-number,:host-context(.cds--g90) .hljs-params,:host-context(.cds--g90) .hljs-type{color:#f5ab35}:host-context(.cds--g100) .hljs-attribute,:host-context(.cds--g90) .hljs-attribute{color:gold}:host-context(.cds--g100) .hljs-addition,:host-context(.cds--g100) .hljs-bullet,:host-context(.cds--g100) .hljs-string,:host-context(.cds--g100) .hljs-symbol,:host-context(.cds--g90) .hljs-addition,:host-context(.cds--g90) .hljs-bullet,:host-context(.cds--g90) .hljs-string,:host-context(.cds--g90) .hljs-symbol{color:#abe338}:host-context(.cds--g100) .hljs-section,:host-context(.cds--g100) .hljs-title,:host-context(.cds--g90) .hljs-section,:host-context(.cds--g90) .hljs-title{color:#00e0e0}:host-context(.cds--g100) .hljs-keyword,:host-context(.cds--g100) .hljs-selector-tag,:host-context(.cds--g90) .hljs-keyword,:host-context(.cds--g90) .hljs-selector-tag{color:#dcc6e0}:host-context(.cds--g100) .hljs-emphasis,:host-context(.cds--g90) .hljs-emphasis{font-style:italic}:host-context(.cds--g100) .hljs-strong,:host-context(.cds--g90) .hljs-strong{font-weight:700}@media screen and (-ms-high-contrast:active){:host-context(.cds--g100) .hljs-addition,:host-context(.cds--g100) .hljs-attribute,:host-context(.cds--g100) .hljs-built_in,:host-context(.cds--g100) .hljs-bullet,:host-context(.cds--g100) .hljs-comment,:host-context(.cds--g100) .hljs-link,:host-context(.cds--g100) .hljs-literal,:host-context(.cds--g100) .hljs-meta,:host-context(.cds--g100) .hljs-number,:host-context(.cds--g100) .hljs-params,:host-context(.cds--g100) .hljs-quote,:host-context(.cds--g100) .hljs-string,:host-context(.cds--g100) .hljs-symbol,:host-context(.cds--g100) .hljs-type,:host-context(.cds--g90) .hljs-addition,:host-context(.cds--g90) .hljs-attribute,:host-context(.cds--g90) .hljs-built_in,:host-context(.cds--g90) .hljs-bullet,:host-context(.cds--g90) .hljs-comment,:host-context(.cds--g90) .hljs-link,:host-context(.cds--g90) .hljs-literal,:host-context(.cds--g90) .hljs-meta,:host-context(.cds--g90) .hljs-number,:host-context(.cds--g90) .hljs-params,:host-context(.cds--g90) .hljs-quote,:host-context(.cds--g90) .hljs-string,:host-context(.cds--g90) .hljs-symbol,:host-context(.cds--g90) .hljs-type{color:highlight}:host-context(.cds--g100) .hljs-keyword,:host-context(.cds--g100) .hljs-selector-tag,:host-context(.cds--g90) .hljs-keyword,:host-context(.cds--g90) .hljs-selector-tag{font-weight:700}}:host-context(.cds--g10) pre code.hljs,:host-context(.cds--white) pre code.hljs{display:block;overflow-x:auto;padding:1em}:host-context(.cds--g10) code.hljs,:host-context(.cds--white) code.hljs{padding:3px 5px}:host-context(.cds--g10) .hljs,:host-context(.cds--white) .hljs{background:#fefefe;color:#545454}:host-context(.cds--g10) .hljs-comment,:host-context(.cds--g10) .hljs-quote,:host-context(.cds--white) .hljs-comment,:host-context(.cds--white) .hljs-quote{color:#696969}:host-context(.cds--g10) .hljs-deletion,:host-context(.cds--g10) .hljs-name,:host-context(.cds--g10) .hljs-regexp,:host-context(.cds--g10) .hljs-selector-class,:host-context(.cds--g10) .hljs-selector-id,:host-context(.cds--g10) .hljs-tag,:host-context(.cds--g10) .hljs-template-variable,:host-context(.cds--g10) .hljs-variable,:host-context(.cds--white) .hljs-deletion,:host-context(.cds--white) .hljs-name,:host-context(.cds--white) .hljs-regexp,:host-context(.cds--white) .hljs-selector-class,:host-context(.cds--white) .hljs-selector-id,:host-context(.cds--white) .hljs-tag,:host-context(.cds--white) .hljs-template-variable,:host-context(.cds--white) .hljs-variable{color:#d91e18}:host-context(.cds--g10) .hljs-built_in,:host-context(.cds--g10) .hljs-link,:host-context(.cds--g10) .hljs-literal,:host-context(.cds--g10) .hljs-meta,:host-context(.cds--g10) .hljs-number,:host-context(.cds--g10) .hljs-params,:host-context(.cds--g10) .hljs-type,:host-context(.cds--white) .hljs-built_in,:host-context(.cds--white) .hljs-link,:host-context(.cds--white) .hljs-literal,:host-context(.cds--white) .hljs-meta,:host-context(.cds--white) .hljs-number,:host-context(.cds--white) .hljs-params,:host-context(.cds--white) .hljs-type{color:#aa5d00}:host-context(.cds--g10) .hljs-attribute,:host-context(.cds--white) .hljs-attribute{color:#aa5d00}:host-context(.cds--g10) .hljs-addition,:host-context(.cds--g10) .hljs-bullet,:host-context(.cds--g10) .hljs-string,:host-context(.cds--g10) .hljs-symbol,:host-context(.cds--white) .hljs-addition,:host-context(.cds--white) .hljs-bullet,:host-context(.cds--white) .hljs-string,:host-context(.cds--white) .hljs-symbol{color:green}:host-context(.cds--g10) .hljs-section,:host-context(.cds--g10) .hljs-title,:host-context(.cds--white) .hljs-section,:host-context(.cds--white) .hljs-title{color:#007faa}:host-context(.cds--g10) .hljs-keyword,:host-context(.cds--g10) .hljs-selector-tag,:host-context(.cds--white) .hljs-keyword,:host-context(.cds--white) .hljs-selector-tag{color:#7928a1}:host-context(.cds--g10) .hljs-emphasis,:host-context(.cds--white) .hljs-emphasis{font-style:italic}:host-context(.cds--g10) .hljs-strong,:host-context(.cds--white) .hljs-strong{font-weight:700}@media screen and (-ms-high-contrast:active){:host-context(.cds--g10) .hljs-addition,:host-context(.cds--g10) .hljs-attribute,:host-context(.cds--g10) .hljs-built_in,:host-context(.cds--g10) .hljs-bullet,:host-context(.cds--g10) .hljs-comment,:host-context(.cds--g10) .hljs-link,:host-context(.cds--g10) .hljs-literal,:host-context(.cds--g10) .hljs-meta,:host-context(.cds--g10) .hljs-number,:host-context(.cds--g10) .hljs-params,:host-context(.cds--g10) .hljs-quote,:host-context(.cds--g10) .hljs-string,:host-context(.cds--g10) .hljs-symbol,:host-context(.cds--g10) .hljs-type,:host-context(.cds--white) .hljs-addition,:host-context(.cds--white) .hljs-attribute,:host-context(.cds--white) .hljs-built_in,:host-context(.cds--white) .hljs-bullet,:host-context(.cds--white) .hljs-comment,:host-context(.cds--white) .hljs-link,:host-context(.cds--white) .hljs-literal,:host-context(.cds--white) .hljs-meta,:host-context(.cds--white) .hljs-number,:host-context(.cds--white) .hljs-params,:host-context(.cds--white) .hljs-quote,:host-context(.cds--white) .hljs-string,:host-context(.cds--white) .hljs-symbol,:host-context(.cds--white) .hljs-type{color:highlight}:host-context(.cds--g10) .hljs-keyword,:host-context(.cds--g10) .hljs-selector-tag,:host-context(.cds--white) .hljs-keyword,:host-context(.cds--white) .hljs-selector-tag{font-weight:700}}pre{font-family:var(--cds-code-02-font-family,\"IBM Plex Mono\",system-ui,-apple-system,BlinkMacSystemFont,\".SFNSText-Regular\",monospace);font-size:var(--cds-code-02-font-size,14px);font-weight:var(--cds-code-02-font-weight,400);line-height:var(--cds-code-02-line-height,1.42857);letter-spacing:var(--cds-code-02-letter-spacing,.32px);border:1px solid var(--cds-chat-bubble-border,#e0e0e0);background-color:var(--cds-layer-02,#fff);overflow:auto hidden;padding:16px;white-space:pre-wrap}";
|
|
59
|
+
|
|
60
|
+
let CDSChatCodeElement = class CDSChatCodeElement extends LitElement {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(...arguments);
|
|
63
|
+
this.language = '';
|
|
64
|
+
this.content = '';
|
|
65
|
+
this.throttledHighlight = throttle(async () => {
|
|
66
|
+
try {
|
|
67
|
+
const { default: hljs } = await import('./common.js');
|
|
68
|
+
const codeEl = this.renderRoot.querySelector('code');
|
|
69
|
+
let content = '';
|
|
70
|
+
if (this.language && hljs.getLanguage(this.language)) {
|
|
71
|
+
content = hljs.highlight(this.content, { language: this.language }).value;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
content = hljs.highlightAuto(this.content).value;
|
|
75
|
+
}
|
|
76
|
+
if (codeEl) {
|
|
77
|
+
codeEl.innerHTML = content;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.warn(`Language "${this.language}" could not be loaded.`);
|
|
82
|
+
}
|
|
83
|
+
}, 100); // adjust delay as needed
|
|
84
|
+
}
|
|
85
|
+
static { this.styles = css `
|
|
86
|
+
${unsafeCSS(css_248z)}
|
|
87
|
+
`; }
|
|
88
|
+
updated() {
|
|
89
|
+
this.throttledHighlight();
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
return html `<pre><code class="language-${this.language}"></code></pre>`;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ type: String })
|
|
97
|
+
], CDSChatCodeElement.prototype, "language", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ type: String })
|
|
100
|
+
], CDSChatCodeElement.prototype, "content", void 0);
|
|
101
|
+
CDSChatCodeElement = __decorate([
|
|
102
|
+
carbonElement(`cds-aichat-code`)
|
|
103
|
+
], CDSChatCodeElement);
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
@@ -156,7 +156,7 @@ let ChatContainer = class ChatContainer extends LitElement {
|
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
addWriteableElementSlots() {
|
|
159
|
-
const writeableElementSlots = [
|
|
159
|
+
const writeableElementSlots = [];
|
|
160
160
|
Object.keys(this._instance.writeableElements).forEach(writeableElementKey => {
|
|
161
161
|
writeableElementSlots.push(writeableElementKey);
|
|
162
162
|
});
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
14
14
|
* the License.
|
|
15
15
|
*
|
|
16
|
-
* @carbon/ai-chat 0.3.
|
|
16
|
+
* @carbon/ai-chat 0.3.3
|
|
17
17
|
*
|
|
18
|
-
* Built:
|
|
18
|
+
* Built: Jul 11 2025 1:09 pm -04:00
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
*/
|