@inkeep/agents-ui 0.0.0-dev-20260401193828 → 0.0.0-dev-20260402200940

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 (71) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +78 -77
  3. package/dist/primitives/atoms/dialog.cjs +1 -1
  4. package/dist/primitives/atoms/dialog.js +110 -106
  5. package/dist/primitives/atoms/file-upload.cjs +1 -0
  6. package/dist/primitives/atoms/file-upload.d.ts +35 -0
  7. package/dist/primitives/atoms/file-upload.js +45 -0
  8. package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -1
  9. package/dist/primitives/atoms/icons/built-in-icons.d.ts +8 -1
  10. package/dist/primitives/atoms/icons/built-in-icons.js +86 -79
  11. package/dist/primitives/atoms/icons/collections/pi.cjs +1 -1
  12. package/dist/primitives/atoms/icons/collections/pi.d.ts +6 -0
  13. package/dist/primitives/atoms/icons/collections/pi.js +103 -13
  14. package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -1
  15. package/dist/primitives/atoms/icons/inkeep-default-icons.js +9 -1
  16. package/dist/primitives/components/embedded-chat/file-upload-input.cjs +1 -0
  17. package/dist/primitives/components/embedded-chat/file-upload-input.d.ts +68 -0
  18. package/dist/primitives/components/embedded-chat/file-upload-input.js +328 -0
  19. package/dist/primitives/components/embedded-chat/image-preview-modal.cjs +1 -0
  20. package/dist/primitives/components/embedded-chat/image-preview-modal.d.ts +15 -0
  21. package/dist/primitives/components/embedded-chat/image-preview-modal.js +71 -0
  22. package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +3 -3
  23. package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +6 -0
  24. package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +282 -237
  25. package/dist/primitives/components/embedded-chat.cjs +5 -5
  26. package/dist/primitives/components/embedded-chat.d.ts +6 -5
  27. package/dist/primitives/components/embedded-chat.js +934 -907
  28. package/dist/primitives/components/embedded-search.d.ts +1 -1
  29. package/dist/primitives/hooks/index.cjs +1 -1
  30. package/dist/primitives/hooks/index.js +15 -14
  31. package/dist/primitives/hooks/use-input-notification.cjs +1 -0
  32. package/dist/primitives/hooks/use-input-notification.d.ts +9 -0
  33. package/dist/primitives/hooks/use-input-notification.js +18 -0
  34. package/dist/primitives/hooks/use-scrolling-fades.cjs +1 -1
  35. package/dist/primitives/hooks/use-scrolling-fades.d.ts +1 -0
  36. package/dist/primitives/hooks/use-scrolling-fades.js +21 -5
  37. package/dist/primitives/index.cjs +1 -1
  38. package/dist/primitives/index.js +69 -68
  39. package/dist/primitives/providers/base-events-provider.cjs +1 -1
  40. package/dist/primitives/providers/base-events-provider.js +1 -1
  41. package/dist/primitives/providers/image-preview-provider.cjs +1 -0
  42. package/dist/primitives/providers/image-preview-provider.d.ts +15 -0
  43. package/dist/primitives/providers/image-preview-provider.js +23 -0
  44. package/dist/primitives/utils/component-ids.cjs +1 -1
  45. package/dist/primitives/utils/component-ids.d.ts +54 -0
  46. package/dist/primitives/utils/component-ids.js +37 -10
  47. package/dist/react/embedded-chat.cjs +1 -1
  48. package/dist/react/embedded-chat.js +305 -260
  49. package/dist/react/index.cjs +1 -1
  50. package/dist/react/index.js +78 -77
  51. package/dist/styled/components/chat-history.cjs +1 -1
  52. package/dist/styled/components/chat-history.d.ts +1 -1
  53. package/dist/styled/components/chat-history.js +31 -29
  54. package/dist/styled/components/embedded-chat/file-upload-input.cjs +1 -0
  55. package/dist/styled/components/embedded-chat/file-upload-input.d.ts +20 -0
  56. package/dist/styled/components/embedded-chat/file-upload-input.js +300 -0
  57. package/dist/styled/components/embedded-chat/image-preview-modal.cjs +1 -0
  58. package/dist/styled/components/embedded-chat/image-preview-modal.d.ts +11 -0
  59. package/dist/styled/components/embedded-chat/image-preview-modal.js +77 -0
  60. package/dist/styled/components/embedded-chat.cjs +1 -1
  61. package/dist/styled/components/embedded-chat.d.ts +2 -0
  62. package/dist/styled/components/embedded-chat.js +479 -449
  63. package/dist/styled/components/message.cjs +1 -1
  64. package/dist/styled/components/message.js +89 -88
  65. package/dist/styled/index.cjs +1 -1
  66. package/dist/styled/index.js +77 -76
  67. package/dist/styled/inkeep.css.cjs +253 -7
  68. package/dist/styled/inkeep.css.js +253 -7
  69. package/dist/types/icons/built-in.d.ts +1 -1
  70. package/dist/types/icons/custom.d.ts +8 -0
  71. package/package.json +7 -6
@@ -74,6 +74,8 @@ export declare const aiChatComponentIds: {
74
74
  aiChatMessageName: "aiChatMessageName";
75
75
  aiChatMessageContentWrapper: "aiChatMessageContentWrapper";
76
76
  aiChatMessageContent: "aiChatMessageContent";
77
+ aiChatMessage__Files: "aiChatMessage__Files";
78
+ aiChatMessage__File: "aiChatMessage__File";
77
79
  aiChatMessageAttachments: "aiChatMessageAttachments";
78
80
  aiChatMessageAttachments__List: "aiChatMessageAttachments__List";
79
81
  aiChatMessageAttachments__Item: "aiChatMessageAttachments__Item";
@@ -109,6 +111,24 @@ export declare const aiChatComponentIds: {
109
111
  aiChatInput: "aiChatInput";
110
112
  aiChatInput__SendButton: "aiChatInput__SendButton";
111
113
  aiChatInput__SendButtonIcon: "aiChatInput__SendButtonIcon";
114
+ aiChatInput__FileUploadButton: "aiChatInput__FileUploadButton";
115
+ aiChatInput__FileUploadButtonIcon: "aiChatInput__FileUploadButtonIcon";
116
+ aiChatInput__FileInput: "aiChatInput__FileInput";
117
+ aiChatInput__FileList: "aiChatInput__FileList";
118
+ aiChatInput__FileItem: "aiChatInput__FileItem";
119
+ aiChatInput__FilePreviewTrigger: "aiChatInput__FilePreviewTrigger";
120
+ aiChatInput__FileContent: "aiChatInput__FileContent";
121
+ aiChatInput__FileThumbnail: "aiChatInput__FileThumbnail";
122
+ aiChatInput__FileName: "aiChatInput__FileName";
123
+ aiChatInput__FileRemove: "aiChatInput__FileRemove";
124
+ aiChatInput__FileRemoveIcon: "aiChatInput__FileRemoveIcon";
125
+ aiChatInput__DropZone: "aiChatInput__DropZone";
126
+ aiChatInput__Notification: "aiChatInput__Notification";
127
+ aiChatInput__NotificationContent: "aiChatInput__NotificationContent";
128
+ aiChatInput__NotificationHeader: "aiChatInput__NotificationHeader";
129
+ aiChatInput__NotificationTitle: "aiChatInput__NotificationTitle";
130
+ aiChatInput__NotificationMessage: "aiChatInput__NotificationMessage";
131
+ aiChatInput__NotificationClose: "aiChatInput__NotificationClose";
112
132
  aiChatAttachmentsBar: "aiChatAttachmentsBar";
113
133
  aiChatAttachmentsBar__List: "aiChatAttachmentsBar__List";
114
134
  aiChatAttachmentsBar__Attachment: "aiChatAttachmentsBar__Attachment";
@@ -164,6 +184,13 @@ export declare const aiChatComponentIds: {
164
184
  aiChatFeedbackModal__Header: "aiChatFeedbackModal__Header";
165
185
  aiChatFeedbackModal__Close: "aiChatFeedbackModal__Close";
166
186
  aiChatFeedbackModal__Body: "aiChatFeedbackModal__Body";
187
+ aiChatImagePreviewModal: "aiChatImagePreviewModal";
188
+ aiChatImagePreviewModal__Overlay: "aiChatImagePreviewModal__Overlay";
189
+ aiChatImagePreviewModal__Content: "aiChatImagePreviewModal__Content";
190
+ aiChatImagePreviewModal__Image: "aiChatImagePreviewModal__Image";
191
+ aiChatImagePreviewModal__Footer: "aiChatImagePreviewModal__Footer";
192
+ aiChatImagePreviewModal__FileName: "aiChatImagePreviewModal__FileName";
193
+ aiChatImagePreviewModal__Close: "aiChatImagePreviewModal__Close";
167
194
  aiChatFeedbackForm: "aiChatFeedbackForm";
168
195
  aiChatFeedbackItem: "aiChatFeedbackItem";
169
196
  aiChatFeedbackItem__Checkbox: "aiChatFeedbackItem__Checkbox";
@@ -491,6 +518,8 @@ export declare const componentIDs: {
491
518
  aiChatMessageName: "aiChatMessageName";
492
519
  aiChatMessageContentWrapper: "aiChatMessageContentWrapper";
493
520
  aiChatMessageContent: "aiChatMessageContent";
521
+ aiChatMessage__Files: "aiChatMessage__Files";
522
+ aiChatMessage__File: "aiChatMessage__File";
494
523
  aiChatMessageAttachments: "aiChatMessageAttachments";
495
524
  aiChatMessageAttachments__List: "aiChatMessageAttachments__List";
496
525
  aiChatMessageAttachments__Item: "aiChatMessageAttachments__Item";
@@ -526,6 +555,24 @@ export declare const componentIDs: {
526
555
  aiChatInput: "aiChatInput";
527
556
  aiChatInput__SendButton: "aiChatInput__SendButton";
528
557
  aiChatInput__SendButtonIcon: "aiChatInput__SendButtonIcon";
558
+ aiChatInput__FileUploadButton: "aiChatInput__FileUploadButton";
559
+ aiChatInput__FileUploadButtonIcon: "aiChatInput__FileUploadButtonIcon";
560
+ aiChatInput__FileInput: "aiChatInput__FileInput";
561
+ aiChatInput__FileList: "aiChatInput__FileList";
562
+ aiChatInput__FileItem: "aiChatInput__FileItem";
563
+ aiChatInput__FilePreviewTrigger: "aiChatInput__FilePreviewTrigger";
564
+ aiChatInput__FileContent: "aiChatInput__FileContent";
565
+ aiChatInput__FileThumbnail: "aiChatInput__FileThumbnail";
566
+ aiChatInput__FileName: "aiChatInput__FileName";
567
+ aiChatInput__FileRemove: "aiChatInput__FileRemove";
568
+ aiChatInput__FileRemoveIcon: "aiChatInput__FileRemoveIcon";
569
+ aiChatInput__DropZone: "aiChatInput__DropZone";
570
+ aiChatInput__Notification: "aiChatInput__Notification";
571
+ aiChatInput__NotificationContent: "aiChatInput__NotificationContent";
572
+ aiChatInput__NotificationHeader: "aiChatInput__NotificationHeader";
573
+ aiChatInput__NotificationTitle: "aiChatInput__NotificationTitle";
574
+ aiChatInput__NotificationMessage: "aiChatInput__NotificationMessage";
575
+ aiChatInput__NotificationClose: "aiChatInput__NotificationClose";
529
576
  aiChatAttachmentsBar: "aiChatAttachmentsBar";
530
577
  aiChatAttachmentsBar__List: "aiChatAttachmentsBar__List";
531
578
  aiChatAttachmentsBar__Attachment: "aiChatAttachmentsBar__Attachment";
@@ -581,6 +628,13 @@ export declare const componentIDs: {
581
628
  aiChatFeedbackModal__Header: "aiChatFeedbackModal__Header";
582
629
  aiChatFeedbackModal__Close: "aiChatFeedbackModal__Close";
583
630
  aiChatFeedbackModal__Body: "aiChatFeedbackModal__Body";
631
+ aiChatImagePreviewModal: "aiChatImagePreviewModal";
632
+ aiChatImagePreviewModal__Overlay: "aiChatImagePreviewModal__Overlay";
633
+ aiChatImagePreviewModal__Content: "aiChatImagePreviewModal__Content";
634
+ aiChatImagePreviewModal__Image: "aiChatImagePreviewModal__Image";
635
+ aiChatImagePreviewModal__Footer: "aiChatImagePreviewModal__Footer";
636
+ aiChatImagePreviewModal__FileName: "aiChatImagePreviewModal__FileName";
637
+ aiChatImagePreviewModal__Close: "aiChatImagePreviewModal__Close";
584
638
  aiChatFeedbackForm: "aiChatFeedbackForm";
585
639
  aiChatFeedbackItem: "aiChatFeedbackItem";
586
640
  aiChatFeedbackItem__Checkbox: "aiChatFeedbackItem__Checkbox";
@@ -74,6 +74,8 @@ const a = {
74
74
  aiChatMessageName: "aiChatMessageName",
75
75
  aiChatMessageContentWrapper: "aiChatMessageContentWrapper",
76
76
  aiChatMessageContent: "aiChatMessageContent",
77
+ aiChatMessage__Files: "aiChatMessage__Files",
78
+ aiChatMessage__File: "aiChatMessage__File",
77
79
  aiChatMessageAttachments: "aiChatMessageAttachments",
78
80
  aiChatMessageAttachments__List: "aiChatMessageAttachments__List",
79
81
  aiChatMessageAttachments__Item: "aiChatMessageAttachments__Item",
@@ -109,6 +111,24 @@ const a = {
109
111
  aiChatInput: "aiChatInput",
110
112
  aiChatInput__SendButton: "aiChatInput__SendButton",
111
113
  aiChatInput__SendButtonIcon: "aiChatInput__SendButtonIcon",
114
+ aiChatInput__FileUploadButton: "aiChatInput__FileUploadButton",
115
+ aiChatInput__FileUploadButtonIcon: "aiChatInput__FileUploadButtonIcon",
116
+ aiChatInput__FileInput: "aiChatInput__FileInput",
117
+ aiChatInput__FileList: "aiChatInput__FileList",
118
+ aiChatInput__FileItem: "aiChatInput__FileItem",
119
+ aiChatInput__FilePreviewTrigger: "aiChatInput__FilePreviewTrigger",
120
+ aiChatInput__FileContent: "aiChatInput__FileContent",
121
+ aiChatInput__FileThumbnail: "aiChatInput__FileThumbnail",
122
+ aiChatInput__FileName: "aiChatInput__FileName",
123
+ aiChatInput__FileRemove: "aiChatInput__FileRemove",
124
+ aiChatInput__FileRemoveIcon: "aiChatInput__FileRemoveIcon",
125
+ aiChatInput__DropZone: "aiChatInput__DropZone",
126
+ aiChatInput__Notification: "aiChatInput__Notification",
127
+ aiChatInput__NotificationContent: "aiChatInput__NotificationContent",
128
+ aiChatInput__NotificationHeader: "aiChatInput__NotificationHeader",
129
+ aiChatInput__NotificationTitle: "aiChatInput__NotificationTitle",
130
+ aiChatInput__NotificationMessage: "aiChatInput__NotificationMessage",
131
+ aiChatInput__NotificationClose: "aiChatInput__NotificationClose",
112
132
  aiChatAttachmentsBar: "aiChatAttachmentsBar",
113
133
  aiChatAttachmentsBar__List: "aiChatAttachmentsBar__List",
114
134
  aiChatAttachmentsBar__Attachment: "aiChatAttachmentsBar__Attachment",
@@ -164,6 +184,13 @@ const a = {
164
184
  aiChatFeedbackModal__Header: "aiChatFeedbackModal__Header",
165
185
  aiChatFeedbackModal__Close: "aiChatFeedbackModal__Close",
166
186
  aiChatFeedbackModal__Body: "aiChatFeedbackModal__Body",
187
+ aiChatImagePreviewModal: "aiChatImagePreviewModal",
188
+ aiChatImagePreviewModal__Overlay: "aiChatImagePreviewModal__Overlay",
189
+ aiChatImagePreviewModal__Content: "aiChatImagePreviewModal__Content",
190
+ aiChatImagePreviewModal__Image: "aiChatImagePreviewModal__Image",
191
+ aiChatImagePreviewModal__Footer: "aiChatImagePreviewModal__Footer",
192
+ aiChatImagePreviewModal__FileName: "aiChatImagePreviewModal__FileName",
193
+ aiChatImagePreviewModal__Close: "aiChatImagePreviewModal__Close",
167
194
  aiChatFeedbackForm: "aiChatFeedbackForm",
168
195
  aiChatFeedbackItem: "aiChatFeedbackItem",
169
196
  aiChatFeedbackItem__Checkbox: "aiChatFeedbackItem__Checkbox",
@@ -278,14 +305,14 @@ const a = {
278
305
  modal__Overlay: "modal__Overlay",
279
306
  modal__Content: "modal__Content",
280
307
  modal__Close: "modal__Close"
281
- }, r = {
308
+ }, o = {
282
309
  chatButton__Text: "chatButton__Text",
283
310
  chatButton__Button: "chatButton__Button",
284
311
  chatButton__Container: "chatButton__Container",
285
312
  chatButton__AvatarImage: "chatButton__AvatarImage",
286
313
  chatButton__AvatarContent: "chatButton__AvatarContent",
287
314
  chatButton__CloseIcon: "chatButton__CloseIcon"
288
- }, o = {
315
+ }, r = {
289
316
  searchBar__Container: "searchBar__Container",
290
317
  searchBar__Button: "searchBar__Button",
291
318
  searchBar__ContentWrapper: "searchBar__ContentWrapper",
@@ -300,11 +327,11 @@ const a = {
300
327
  sidebarChat__Resizer: "sidebarChat__Resizer",
301
328
  sidebarChat__CloseButton: "sidebarChat__CloseButton",
302
329
  sidebarChat__Header: "sidebarChat__Header"
303
- }, s = {
330
+ }, n = {
304
331
  chatBubble__Root: "chatBubble__Root",
305
332
  chatBubble__CloseButton: "chatBubble__CloseButton",
306
333
  chatBubble__Header: "chatBubble__Header"
307
- }, n = {
334
+ }, s = {
308
335
  dataSummary__Group: "dataSummary__Group",
309
336
  dataSummary__Toggle: "dataSummary__Toggle",
310
337
  dataSummary__ToggleText: "dataSummary__ToggleText",
@@ -337,23 +364,23 @@ const a = {
337
364
  ...e,
338
365
  ..._,
339
366
  ...i,
340
- ...r,
341
367
  ...o,
368
+ ...r,
342
369
  ...a,
343
370
  ...h,
344
- ...s,
345
371
  ...n,
372
+ ...s,
346
373
  ...C
347
374
  };
348
375
  export {
349
- s as ChatBubbleComponentIds,
350
- n as DataSummaryComponentIds,
351
- o as SearchBarComponentIds,
376
+ n as ChatBubbleComponentIds,
377
+ s as DataSummaryComponentIds,
378
+ r as SearchBarComponentIds,
352
379
  h as SidebarChatComponentIds,
353
380
  e as aiChatComponentIds,
354
381
  C as aiChatHistoryComponentIds,
355
382
  _ as aiSearchComponentIds,
356
- r as chatButtonComponentIds,
383
+ o as chatButtonComponentIds,
357
384
  c as componentIDs,
358
385
  t as markDownComponentIds,
359
386
  a as miscellanousComponentIds,
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("react"),t=require("../styled/components/embedded-chat.cjs"),i=require("../styled/components/chat-history.cjs"),F=require("../styled/components/modal.cjs"),T=require("../styled/components/shadow.cjs"),C=require("../styled/components/message.cjs"),B=require("../primitives/providers/chat-history-provider.cjs"),g=require("../primitives/providers/config-provider.cjs"),y=require("../primitives/providers/root-provider.cjs"),S=require("../primitives/providers/widget-provider.cjs"),I=require("../primitives/components/embedded-chat/chat-provider.cjs"),H=require("../primitives/components/modal/modal-provider.cjs"),u=require("../primitives/utils/misc.cjs"),p=require("../primitives/atoms/portal-with-theme.cjs"),E=require("../primitives/atoms/error-boundary.cjs"),v=require("./modal.cjs"),w=require("./widget-toggle.cjs");function f(r){const{baseSettings:s,aiChatSettings:n}=r;return e.jsx(E.ErrorBoundary,{children:e.jsx(T.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(y.RootProvider,{config:{baseSettings:s,aiChatSettings:n},componentType:g.WebWidgetInteractionType.EmbeddedChat,children:e.jsx(M,{...r})})})})}function A(r){const{children:s,onToggleView:n,isHidden:o,shouldAutoFocusInput:a=!n}=r;return e.jsx(t.Provider,{isHidden:o,shouldAutoFocusInput:a,children:s})}function M(r){return e.jsx(A,{...r,children:e.jsx(k,{...r})})}function k(r){const{onToggleView:s,variant:n,header:o=L}=r,a=H.useModal(),d=S.useWidget(),l=a&&!d?v.ModalContent:j.Fragment;return e.jsx(l,{children:e.jsxs(t.Wrapper,{variant:n??(s?"no-shadow":"container-with-shadow"),"data-composite":u.dataAttr(!!r.onToggleView||a?.isOpen),children:[e.jsx(R,{}),e.jsxs(t.Root,{children:[o&&e.jsx(o,{...r}),e.jsx(P,{}),e.jsx(N,{})]}),e.jsx($,{}),e.jsx(G,{})]})})}const L=r=>{const{onToggleView:s,askAILabel:n,searchLabel:o}=r,{aiChatSettings:a}=g.useInkeepConfig(),d=a.isChatHistoryButtonVisible,l=!!s||d;return e.jsx(t.Header,{"data-show-toolbar":u.dataAttr(l),children:l?e.jsxs(t.HeaderToolbar,{"data-show-widget-toggle":u.dataAttr(!!s),children:[e.jsx(t.HeaderToolbarWrapper,{children:d&&e.jsx(t.ChatHistoryTrigger,{})}),s&&e.jsx(w.WidgetToggle,{onToggleView:s,askAILabel:n,searchLabel:o,view:"chat"}),e.jsx(F.Close,{})]}):e.jsx(F.Close,{})})};function P(){const{isSessionLoading:r}=I.useChat();return e.jsx(t.Content,{children:e.jsxs(t.ContentScrollArea,{children:[e.jsx(t.ContentScrollAreaViewport,{children:r?e.jsx(t.MessagesSessionLoading,{}):e.jsx(D,{})}),e.jsx(t.ContentScrollAreaScrollbar,{children:e.jsx(t.ContentScrollAreaThumb,{})}),e.jsx(t.ContentScrollAreaCorner,{})]})})}function D(){const{aiChatSettings:{components:r}}=g.useInkeepConfig();return e.jsx(t.Messages,{children:({messages:s,isLoading:n,isStreaming:o})=>{const a=s.at(-1),d=(c,x)=>{const m=r?.[c];if(!m)return console.warn(`Component "${c}" not found in components config`),null;try{if(typeof m=="function"&&m.length<=1)return j.createElement(m,x);const h=m(x,document.createElement("div"),null);return j.isValidElement(h)||typeof h=="string"?h:null}catch(h){return console.error(`🔍 [renderComponent] Error rendering component "${c}":`,h),null}},l=c=>e.jsx(t.Markdown,{text:c});return e.jsxs(e.Fragment,{children:[e.jsx(W,{}),s.map(c=>{const x=a?.id===c.id;return e.jsxs(t.MessageWrapper,{message:c,children:[e.jsx(b,{}),e.jsxs(t.MessageContentWrapper,{children:[e.jsx(t.MessageContent,{children:r?.IkpMessage?e.jsx(t.DynamicComponent,{name:"IkpMessage",props:{message:c,renderComponent:d,renderMarkdown:l},componentDef:r.IkpMessage}):e.jsxs(e.Fragment,{children:[e.jsx(C.EmbeddedChatMessagePart,{isLast:x}),(!o||!x)&&e.jsx(V,{})]})}),e.jsx(q,{}),e.jsx(_,{})]})]},c.id)}),n&&a?.parts.length&&e.jsxs(t.MessageWrapper,{message:{id:"___loader___",role:"assistant",parts:[{type:"text",text:"Thinking..."}]},children:[e.jsx(b,{}),e.jsx(t.MessageLoading,{})]})]})}})}function W(){return e.jsxs(t.IntroMessageWrapper,{children:[e.jsxs(t.MessageHeader,{children:[e.jsx(t.MessageAvatar,{children:e.jsx(t.MessageAvatarContent,{children:e.jsx(t.MessageAvatarImage,{})})}),e.jsx(t.MessageName,{})]}),e.jsxs(t.MessageContentWrapper,{children:[e.jsx(t.MessageContent,{children:e.jsx(C.EmbeddedChatMessagePart,{isLast:!1})}),e.jsxs(t.Disclaimer,{children:[e.jsx(t.DisclaimerLabel,{}),e.jsx(t.DisclaimerTrigger,{}),e.jsxs(t.DisclaimerContent,{children:[e.jsx(t.DisclaimerText,{}),e.jsx(t.DisclaimerArrow,{})]})]}),e.jsxs(t.ExampleQuestions,{children:[e.jsx(t.ExampleQuestionsLabel,{}),e.jsx(t.ExampleQuestionsList,{children:r=>r.map(s=>e.jsx(t.ExampleQuestion,{children:e.jsx(t.ExampleQuestionButton,{question:s})},typeof s=="object"?s.label:s))})]})]})]})}function b(){return e.jsxs(t.MessageHeader,{children:[e.jsx(t.MessageAvatar,{children:e.jsx(t.MessageAvatarContent,{children:e.jsx(t.MessageAvatarImage,{})})}),e.jsx(t.MessageName,{})]})}function q(){return e.jsxs(t.MessageAttachments,{children:[e.jsx(t.MessageAttachmentsList,{children:r=>r.map(s=>e.jsxs(t.MessageAttachmentsItem,{attachment:s,children:[e.jsx(t.MessageAttachmentsItemIcon,{}),e.jsx(t.MessageAttachmentsItemTitle,{})]},s.id))}),e.jsx(t.MessageAttachmentsPreview,{children:e.jsx(p.PortalWithTheme,{children:e.jsx(t.MessageAttachmentsPreviewOverlay,{children:e.jsxs(t.MessageAttachmentsPreviewContent,{children:[e.jsx(t.MessageAttachmentsPreviewHeader,{}),e.jsx(t.MessageAttachmentsPreviewClose,{}),e.jsx(t.MessageAttachmentsPreviewBody,{})]})})})})]})}function _(){return e.jsxs(t.MessageToolbar,{children:[e.jsx(t.MessageCustomActions,{children:r=>r.map((s,n)=>e.jsx(t.MessageCustomAction,{action:s},`action-${n}`))}),e.jsx(t.MessageAction,{action:"copy"}),e.jsx(t.MessageAction,{action:"upvote"}),e.jsx(t.MessageAction,{action:"downvote"})]})}function V(){return e.jsxs(t.MessageSources,{children:[e.jsx(t.MessageSourcesHeader,{}),e.jsx(t.MessageSourcesList,{children:r=>r.map((s,n)=>e.jsxs(t.MessageSourceItem,{href:s.url,source:s,children:[e.jsx(t.MessageSourceItemBreadcrumbs,{children:s.breadcrumbs?.map(o=>e.jsxs(j.Fragment,{children:[o,e.jsx(t.MessageSourceItemBreadcrumbIcon,{})]},o))}),e.jsx(t.MessageSourceItemIcon,{}),e.jsx(t.MessageSourceItemTitle,{}),e.jsx(t.MessageSourceItemTag,{}),e.jsx(t.MessageSourceItemDescription,{children:o=>o.map((a,d)=>e.jsx(t.MessageSourceItemDescriptionPart,{part:a},`part-${d}`))}),e.jsx(t.MessageSourceItemIndicator,{})]},n))})]})}function N(){return e.jsxs(t.Footer,{children:[e.jsx(O,{}),e.jsx(Q,{})]})}function O(){return e.jsxs(t.InputFieldset,{children:[e.jsxs(t.InputGroup,{children:[e.jsx(t.Input,{}),e.jsx(t.SendButton,{children:e.jsx(t.SendButtonIcon,{})})]}),e.jsxs(t.AttachmentsBar,{children:[e.jsx(t.AttachmentsBarList,{children:r=>r.map(s=>e.jsxs(t.AttachmentsBarAttachment,{attachment:s,children:[e.jsx(t.AttachmentsBarAttachmentIcon,{}),e.jsx(t.AttachmentsBarAttachmentTitle,{}),e.jsx(t.AttachmentsBarAttachmentDelete,{})]},s.id))}),e.jsxs(t.AttachmentsBarActions,{children:[e.jsxs(t.AttachmentsBarInfoTip,{children:[e.jsx(t.AttachmentsBarInfoTipIcon,{}),e.jsx(t.AttachmentsBarInfoTipText,{})]}),e.jsx(t.AttachmentsBarInputs,{children:r=>r.map(s=>e.jsx(t.AttachmentsBarInput,{input:s,children:s.displayName},s.id))})]}),e.jsx(p.PortalWithTheme,{children:e.jsx(t.AttachmentsBarModal,{children:e.jsx(t.AttachmentsBarModalOverlay,{children:e.jsxs(t.AttachmentsBarModalContent,{children:[e.jsxs(t.AttachmentsBarModalHeader,{children:[e.jsx(t.AttachmentsBarModalHeading,{}),e.jsx(t.AttachmentsBarModalDescription,{}),e.jsx(t.AttachmentsBarModalHelp,{})]}),e.jsx(t.AttachmentsBarModalClose,{}),e.jsx(t.AttachmentsBarModalBody,{children:e.jsxs(t.AttachmentsBarForm,{children:[e.jsxs(t.AttachmentsBarFormTitle,{children:[e.jsx(t.AttachmentsBarFormTitleLabel,{}),e.jsx(t.AttachmentsBarFormTitleInput,{}),e.jsx(t.AttachmentsBarFormTitleError,{})]}),e.jsxs(t.AttachmentsBarFormContent,{children:[e.jsx(t.AttachmentsBarFormContentLabel,{}),e.jsx(t.AttachmentsBarFormContentInput,{}),e.jsx(t.AttachmentsBarFormContentError,{})]}),e.jsx(t.AttachmentsBarFormSubmitButton,{})]})})]})})})})]})]})}function Q(){return e.jsxs(t.ActionBar,{children:[e.jsxs(t.TaglineContainer,{children:[e.jsx(t.TaglineText,{}),e.jsx(t.TaglineLogo,{}),e.jsx(t.TaglineBrandName,{})]}),e.jsxs(t.Actions,{children:[e.jsx(t.HelpActions,{children:({pinned:r,unpinned:s})=>e.jsxs(e.Fragment,{children:[r.map(n=>e.jsx(t.HelpAction,{action:n},n.name)),s.length>0&&e.jsx(t.HelpActionsTrigger,{}),e.jsxs(t.HelpActionsMenu,{children:[e.jsx(t.HelpActionsMenuArrow,{}),s.map(n=>e.jsxs(t.HelpActionsMenuItem,{action:n,children:[e.jsx(t.HelpActionsMenuItemIcon,{action:n}),n.name]},n.name))]})]})}),e.jsxs(t.ChatAction,{action:"copy",children:[e.jsx(t.ChatActionLabel,{action:"copy"}),e.jsx(t.ChatActionFeedback,{action:"copy"})]}),e.jsx(t.ChatAction,{action:"clear"}),e.jsx(t.ChatAction,{action:"stop"})]})]})}function R(){const{sessions:r}=B.useChatHistory(),{conversationId:s}=I.useChat();return e.jsxs(i.EmbeddedChatHistoryRoot,{children:[e.jsxs(i.EmbeddedChatHistoryHeader,{children:[e.jsxs(i.EmbeddedChatHistoryBackButton,{children:[e.jsx(i.EmbeddedChatHistoryBackButtonIcon,{iconKey:"backToChat"}),"Back to chat"]}),e.jsx(i.EmbeddedChatHistoryTitle,{}),e.jsx(F.Close,{})]}),e.jsxs(i.EmbeddedChatHistoryList,{children:[r.map(n=>e.jsxs(i.EmbeddedChatHistoryItem,{sessionId:n.id,"data-active":u.dataAttr(n.id===s),children:[e.jsx(i.EmbeddedChatHistoryItemTitle,{children:n.title}),e.jsx(i.EmbeddedChatHistoryItemDate,{children:i.formatSessionDate(n.updatedAt)})]},n.id)),e.jsx(i.EmbeddedChatHistoryEmptyState,{}),e.jsx(i.EmbeddedChatHistoryLoadingState,{})]}),e.jsx(i.EmbeddedChatHistoryFooter,{children:e.jsx(i.EmbeddedChatHistoryNewConversationButton,{})})]})}function $(){return e.jsx(p.PortalWithTheme,{children:e.jsx(t.FeedbackModal,{children:e.jsx(t.FeedbackModalOverlay,{children:e.jsxs(t.FeedbackModalContent,{children:[e.jsx(t.FeedbackModalHeader,{}),e.jsx(t.FeedbackModalClose,{}),e.jsx(t.FeedbackModalBody,{children:e.jsxs(t.FeedbackForm,{children:[e.jsxs(t.FeedbackItem,{name:"unrelated_response",children:[e.jsx(t.FeedbackItemCheckbox,{children:e.jsx(t.FeedbackItemCheckboxIndicator,{})}),e.jsx(t.FeedbackItemLabel,{}),e.jsx(t.FeedbackItemDescription,{})]}),e.jsxs(t.FeedbackItem,{name:"inaccurate_statement",children:[e.jsx(t.FeedbackItemCheckbox,{children:e.jsx(t.FeedbackItemCheckboxIndicator,{})}),e.jsx(t.FeedbackItemLabel,{}),e.jsx(t.FeedbackItemDescription,{})]}),e.jsxs(t.FeedbackItem,{name:"inaccurate_code_snippet",children:[e.jsx(t.FeedbackItemCheckbox,{children:e.jsx(t.FeedbackItemCheckboxIndicator,{})}),e.jsx(t.FeedbackItemLabel,{}),e.jsx(t.FeedbackItemDescription,{})]}),e.jsxs(t.FeedbackItem,{name:"irrelevant_citations",children:[e.jsx(t.FeedbackItemCheckbox,{children:e.jsx(t.FeedbackItemCheckboxIndicator,{})}),e.jsx(t.FeedbackItemLabel,{})]}),e.jsx(t.FeedbackSubmitButton,{})]})})]})})})})}function G(){return e.jsxs(t.FormWrapper,{children:[e.jsx(t.FormClose,{}),e.jsxs(t.Form,{children:[e.jsxs(t.FormHeader,{children:[e.jsx(t.FormHeading,{}),e.jsx(t.FormDescription,{})]}),e.jsx(t.FormContent,{children:r=>e.jsxs(e.Fragment,{children:[r.map((s,n)=>e.jsxs(t.FormField,{field:s,autoFocus:n===0,children:[e.jsx(t.FormFieldLabel,{}),s.inputType==="text"&&e.jsx(t.FormFieldText,{}),s.inputType==="email"&&e.jsx(t.FormFieldEmail,{}),s.inputType==="file"&&e.jsx(t.FormFieldFile,{}),s.inputType==="textarea"&&e.jsx(t.FormFieldTextArea,{}),s.inputType==="checkbox"&&e.jsx(t.FormFieldCheckbox,{children:e.jsx(t.FormFieldCheckboxIndicator,{})}),s.inputType==="select"&&e.jsxs(t.FormFieldSelect,{children:[e.jsxs(t.FormFieldSelectTrigger,{children:[e.jsx(t.FormFieldSelectValue,{}),e.jsx(t.FormFieldSelectIcon,{})]}),e.jsx(t.FormFieldSelectContent,{children:e.jsx(t.FormFieldSelectViewport,{children:s.items.map(o=>e.jsxs(t.FormFieldSelectItem,{value:o.value,children:[e.jsx(t.FormFieldSelectItemText,{children:o.label}),e.jsx(t.FormFieldSelectItemIndicator,{})]},o.value))})})]}),s.inputType==="combobox"&&e.jsxs(t.FormFieldCombobox,{children:[e.jsxs(t.FormFieldComboboxControl,{children:["multiple"in s&&s.multiple&&e.jsx(t.FormFieldComboboxSelectedTags,{}),e.jsx(t.FormFieldComboboxInput,{}),e.jsx(t.FormFieldComboboxTrigger,{})]}),e.jsx(t.FormFieldComboboxPositioner,{children:e.jsx(t.FormFieldComboboxContent,{children:e.jsx(t.FormFieldComboboxList,{children:e.jsx(t.FormFieldComboboxListItems,{children:o=>o.length===0?e.jsx(t.FormFieldComboboxListEmpty,{}):o.map(a=>e.jsxs(t.FormFieldComboboxItem,{item:a,children:[e.jsx(t.FormFieldComboboxItemText,{children:a.label}),e.jsx(t.FormFieldComboboxItemIndicator,{})]},a.value))})})})})]}),e.jsx(t.FormFieldDescription,{}),e.jsx(t.FormFieldError,{})]},s.name)),e.jsx(t.FormError,{})]})}),e.jsxs(t.FormFooter,{children:[e.jsx(t.FormCancel,{}),e.jsx(t.FormSubmit,{})]})]}),e.jsxs(t.FormSuccess,{children:[e.jsx(t.FormSuccessHeading,{}),e.jsx(t.FormSuccessMessage,{}),e.jsx(t.FormSuccessButton,{})]})]})}exports.InkeepEmbeddedChat=f;exports.InkeepEmbeddedChatImpl=M;exports.InkeepEmbeddedChatImplContent=k;exports.InkeepEmbeddedChatProvider=A;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),t=require("../styled/components/embedded-chat.cjs"),d=require("../styled/components/chat-history.cjs"),g=require("../styled/components/modal.cjs"),v=require("../styled/components/shadow.cjs"),M=require("../styled/components/message.cjs"),B=require("../primitives/providers/chat-history-provider.cjs"),C=require("../primitives/providers/config-provider.cjs"),S=require("../primitives/providers/root-provider.cjs"),w=require("../primitives/providers/widget-provider.cjs"),A=require("../primitives/components/embedded-chat/chat-provider.cjs"),H=require("../primitives/components/modal/modal-provider.cjs"),p=require("../primitives/utils/misc.cjs"),F=require("../primitives/atoms/portal-with-theme.cjs"),P=require("../primitives/atoms/error-boundary.cjs"),f=require("./modal.cjs"),L=require("../primitives/providers/image-preview-provider.cjs"),D=require("./widget-toggle.cjs"),E=require("../primitives/components/embedded-chat/file-upload-input.cjs"),o=require("../styled/components/embedded-chat/file-upload-input.cjs"),x=require("../styled/components/embedded-chat/image-preview-modal.cjs");function q(r){const{baseSettings:s,aiChatSettings:n}=r;return e.jsx(P.ErrorBoundary,{children:e.jsx(v.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(S.RootProvider,{config:{baseSettings:s,aiChatSettings:n},componentType:C.WebWidgetInteractionType.EmbeddedChat,children:e.jsx(y,{...r})})})})}function T(r){const{children:s,onToggleView:n,isHidden:a,shouldAutoFocusInput:i=!n}=r;return e.jsx(t.Provider,{isHidden:a,shouldAutoFocusInput:i,children:s})}function y(r){return e.jsx(T,{...r,children:e.jsx(k,{...r})})}function k(r){const{onToggleView:s,variant:n,header:a=W}=r,i=H.useModal(),l=w.useWidget(),m=i&&!l?f.ModalContent:b.Fragment;return e.jsx(L.ImagePreviewProvider,{children:e.jsx(m,{children:e.jsxs(t.Wrapper,{variant:n??(s?"no-shadow":"container-with-shadow"),"data-composite":p.dataAttr(!!r.onToggleView||i?.isOpen),children:[e.jsx(z,{}),e.jsxs(t.Root,{children:[a&&e.jsx(a,{...r}),e.jsx(N,{}),e.jsx(G,{})]}),e.jsx(J,{}),e.jsx($,{}),e.jsx(X,{})]})})})}const W=r=>{const{onToggleView:s,askAILabel:n,searchLabel:a}=r,{aiChatSettings:i}=C.useInkeepConfig(),l=i.isChatHistoryButtonVisible,m=!!s||l;return e.jsx(t.Header,{"data-show-toolbar":p.dataAttr(m),children:m?e.jsxs(t.HeaderToolbar,{"data-show-widget-toggle":p.dataAttr(!!s),children:[e.jsx(t.HeaderToolbarWrapper,{children:l&&e.jsx(t.ChatHistoryTrigger,{})}),s&&e.jsx(D.WidgetToggle,{onToggleView:s,askAILabel:n,searchLabel:a,view:"chat"}),e.jsx(g.Close,{})]}):e.jsx(g.Close,{})})};function N(){const{isSessionLoading:r}=A.useChat();return e.jsx(t.Content,{children:e.jsxs(t.ContentScrollArea,{children:[e.jsx(t.ContentScrollAreaViewport,{children:r?e.jsx(t.MessagesSessionLoading,{}):e.jsx(_,{})}),e.jsx(t.ContentScrollAreaScrollbar,{children:e.jsx(t.ContentScrollAreaThumb,{})}),e.jsx(t.ContentScrollAreaCorner,{})]})})}function _(){const{aiChatSettings:{components:r}}=C.useInkeepConfig();return e.jsx(t.Messages,{children:({messages:s,isLoading:n,isStreaming:a})=>{const i=s.at(-1),l=(c,h)=>{const j=r?.[c];if(!j)return console.warn(`Component "${c}" not found in components config`),null;try{if(typeof j=="function"&&j.length<=1)return b.createElement(j,h);const u=j(h,document.createElement("div"),null);return b.isValidElement(u)||typeof u=="string"?u:null}catch(u){return console.error(`🔍 [renderComponent] Error rendering component "${c}":`,u),null}},m=c=>e.jsx(t.Markdown,{text:c});return e.jsxs(e.Fragment,{children:[e.jsx(V,{}),s.map(c=>{const h=i?.id===c.id;return e.jsxs(t.MessageWrapper,{message:c,children:[e.jsx(I,{}),e.jsxs(t.MessageContentWrapper,{children:[e.jsx(t.MessageContent,{children:r?.IkpMessage?e.jsx(t.DynamicComponent,{name:"IkpMessage",props:{message:c,renderComponent:l,renderMarkdown:m},componentDef:r.IkpMessage}):e.jsxs(e.Fragment,{children:[e.jsx(M.EmbeddedChatMessagePart,{isLast:h}),(!a||!h)&&e.jsx(U,{})]})}),e.jsx(O,{}),e.jsx(R,{}),e.jsx(Q,{})]})]},c.id)}),n&&i?.parts.length&&e.jsxs(t.MessageWrapper,{message:{id:"___loader___",role:"assistant",parts:[{type:"text",text:"Thinking..."}]},children:[e.jsx(I,{}),e.jsx(t.MessageLoading,{})]})]})}})}function V(){return e.jsxs(t.IntroMessageWrapper,{children:[e.jsxs(t.MessageHeader,{children:[e.jsx(t.MessageAvatar,{children:e.jsx(t.MessageAvatarContent,{children:e.jsx(t.MessageAvatarImage,{})})}),e.jsx(t.MessageName,{})]}),e.jsxs(t.MessageContentWrapper,{children:[e.jsx(t.MessageContent,{children:e.jsx(M.EmbeddedChatMessagePart,{isLast:!1})}),e.jsxs(t.Disclaimer,{children:[e.jsx(t.DisclaimerLabel,{}),e.jsx(t.DisclaimerTrigger,{}),e.jsxs(t.DisclaimerContent,{children:[e.jsx(t.DisclaimerText,{}),e.jsx(t.DisclaimerArrow,{})]})]}),e.jsxs(t.ExampleQuestions,{children:[e.jsx(t.ExampleQuestionsLabel,{}),e.jsx(t.ExampleQuestionsList,{children:r=>r.map(s=>e.jsx(t.ExampleQuestion,{children:e.jsx(t.ExampleQuestionButton,{question:s})},typeof s=="object"?s.label:s))})]})]})]})}function I(){return e.jsxs(t.MessageHeader,{children:[e.jsx(t.MessageAvatar,{children:e.jsx(t.MessageAvatarContent,{children:e.jsx(t.MessageAvatarImage,{})})}),e.jsx(t.MessageName,{})]})}function $(){return e.jsx(F.PortalWithTheme,{children:e.jsx(x.EmbeddedChatImagePreviewModal,{children:e.jsx(x.EmbeddedChatImagePreviewModalOverlay,{children:e.jsxs(x.EmbeddedChatImagePreviewModalContent,{children:[e.jsx(x.EmbeddedChatImagePreviewModalClose,{}),e.jsx(x.EmbeddedChatImagePreviewModalImage,{}),e.jsx(x.EmbeddedChatImagePreviewModalFooter,{children:e.jsx(x.EmbeddedChatImagePreviewModalFileName,{})})]})})})})}function O(){return e.jsx(o.EmbeddedChatMessageFiles,{children:r=>r.map((s,n)=>{const a=s.url,i=s.mediaType??"",l=i.split("/").pop(),m=s.filename??(l?`untitled.${l}`:"untitled"),c=E.isImageMimeType(i);return e.jsxs(o.EmbeddedChatMessageFile,{url:a,name:m,mediaType:i,children:[c?e.jsx(o.EmbeddedChatFileThumbnail,{}):e.jsx(o.EmbeddedChatFileTypeIcon,{}),e.jsx(o.EmbeddedChatFileName,{})]},a||n)})})}function R(){return e.jsxs(t.MessageAttachments,{children:[e.jsx(t.MessageAttachmentsList,{children:r=>r.map(s=>e.jsxs(t.MessageAttachmentsItem,{attachment:s,children:[e.jsx(t.MessageAttachmentsItemIcon,{}),e.jsx(t.MessageAttachmentsItemTitle,{})]},s.id))}),e.jsx(t.MessageAttachmentsPreview,{children:e.jsx(F.PortalWithTheme,{children:e.jsx(t.MessageAttachmentsPreviewOverlay,{children:e.jsxs(t.MessageAttachmentsPreviewContent,{children:[e.jsx(t.MessageAttachmentsPreviewHeader,{}),e.jsx(t.MessageAttachmentsPreviewClose,{}),e.jsx(t.MessageAttachmentsPreviewBody,{})]})})})})]})}function Q(){return e.jsxs(t.MessageToolbar,{children:[e.jsx(t.MessageCustomActions,{children:r=>r.map((s,n)=>e.jsx(t.MessageCustomAction,{action:s},`action-${n}`))}),e.jsx(t.MessageAction,{action:"copy"}),e.jsx(t.MessageAction,{action:"upvote"}),e.jsx(t.MessageAction,{action:"downvote"})]})}function U(){return e.jsxs(t.MessageSources,{children:[e.jsx(t.MessageSourcesHeader,{}),e.jsx(t.MessageSourcesList,{children:r=>r.map((s,n)=>e.jsxs(t.MessageSourceItem,{href:s.url,source:s,children:[e.jsx(t.MessageSourceItemBreadcrumbs,{children:s.breadcrumbs?.map(a=>e.jsxs(b.Fragment,{children:[a,e.jsx(t.MessageSourceItemBreadcrumbIcon,{})]},a))}),e.jsx(t.MessageSourceItemIcon,{}),e.jsx(t.MessageSourceItemTitle,{}),e.jsx(t.MessageSourceItemTag,{}),e.jsx(t.MessageSourceItemDescription,{children:a=>a.map((i,l)=>e.jsx(t.MessageSourceItemDescriptionPart,{part:i},`part-${l}`))}),e.jsx(t.MessageSourceItemIndicator,{})]},n))})]})}function G(){return e.jsxs(t.Footer,{children:[e.jsx(o.EmbeddedChatInputNotification,{children:e.jsxs(o.EmbeddedChatInputNotificationContent,{children:[e.jsxs(o.EmbeddedChatInputNotificationHeader,{children:[e.jsx(o.EmbeddedChatInputNotificationTitle,{}),e.jsx(o.EmbeddedChatInputNotificationClose,{})]}),e.jsx(o.EmbeddedChatInputNotificationMessage,{})]})}),e.jsx(K,{}),e.jsx(Z,{})]})}function K(){return e.jsxs(t.InputFieldset,{children:[e.jsx(o.EmbeddedChatFileInput,{}),e.jsx(o.EmbeddedChatDropZone,{children:"Drop files here to add to chat"}),e.jsx(o.EmbeddedChatFileList,{children:r=>r.map((s,n)=>{const a=E.isImageMimeType(s.type);return e.jsxs(o.EmbeddedChatFileItem,{file:s,children:[a?e.jsxs(o.EmbeddedChatFilePreviewTrigger,{children:[e.jsx(o.EmbeddedChatFileThumbnail,{}),e.jsx(o.EmbeddedChatFileName,{})]}):e.jsxs(o.EmbeddedChatFileContent,{children:[e.jsx(o.EmbeddedChatFileTypeIcon,{}),e.jsx(o.EmbeddedChatFileName,{})]}),e.jsx(o.EmbeddedChatFileRemove,{})]},`${s.name}-${s.lastModified}-${n}`)})}),e.jsxs(t.InputGroup,{children:[e.jsx(o.EmbeddedChatFileUploadButton,{}),e.jsx(t.Input,{}),e.jsx(t.SendButton,{children:e.jsx(t.SendButtonIcon,{})})]}),e.jsxs(t.AttachmentsBar,{children:[e.jsx(t.AttachmentsBarList,{children:r=>r.map(s=>e.jsxs(t.AttachmentsBarAttachment,{attachment:s,children:[e.jsx(t.AttachmentsBarAttachmentIcon,{}),e.jsx(t.AttachmentsBarAttachmentTitle,{}),e.jsx(t.AttachmentsBarAttachmentDelete,{})]},s.id))}),e.jsxs(t.AttachmentsBarActions,{children:[e.jsxs(t.AttachmentsBarInfoTip,{children:[e.jsx(t.AttachmentsBarInfoTipIcon,{}),e.jsx(t.AttachmentsBarInfoTipText,{})]}),e.jsx(t.AttachmentsBarInputs,{children:r=>r.map(s=>e.jsx(t.AttachmentsBarInput,{input:s,children:s.displayName},s.id))})]}),e.jsx(F.PortalWithTheme,{children:e.jsx(t.AttachmentsBarModal,{children:e.jsx(t.AttachmentsBarModalOverlay,{children:e.jsxs(t.AttachmentsBarModalContent,{children:[e.jsxs(t.AttachmentsBarModalHeader,{children:[e.jsx(t.AttachmentsBarModalHeading,{}),e.jsx(t.AttachmentsBarModalDescription,{}),e.jsx(t.AttachmentsBarModalHelp,{})]}),e.jsx(t.AttachmentsBarModalClose,{}),e.jsx(t.AttachmentsBarModalBody,{children:e.jsxs(t.AttachmentsBarForm,{children:[e.jsxs(t.AttachmentsBarFormTitle,{children:[e.jsx(t.AttachmentsBarFormTitleLabel,{}),e.jsx(t.AttachmentsBarFormTitleInput,{}),e.jsx(t.AttachmentsBarFormTitleError,{})]}),e.jsxs(t.AttachmentsBarFormContent,{children:[e.jsx(t.AttachmentsBarFormContentLabel,{}),e.jsx(t.AttachmentsBarFormContentInput,{}),e.jsx(t.AttachmentsBarFormContentError,{})]}),e.jsx(t.AttachmentsBarFormSubmitButton,{})]})})]})})})})]})]})}function Z(){return e.jsxs(t.ActionBar,{children:[e.jsxs(t.TaglineContainer,{children:[e.jsx(t.TaglineText,{}),e.jsx(t.TaglineLogo,{}),e.jsx(t.TaglineBrandName,{})]}),e.jsxs(t.Actions,{children:[e.jsx(t.HelpActions,{children:({pinned:r,unpinned:s})=>e.jsxs(e.Fragment,{children:[r.map(n=>e.jsx(t.HelpAction,{action:n},n.name)),s.length>0&&e.jsx(t.HelpActionsTrigger,{}),e.jsxs(t.HelpActionsMenu,{children:[e.jsx(t.HelpActionsMenuArrow,{}),s.map(n=>e.jsxs(t.HelpActionsMenuItem,{action:n,children:[e.jsx(t.HelpActionsMenuItemIcon,{action:n}),n.name]},n.name))]})]})}),e.jsxs(t.ChatAction,{action:"copy",children:[e.jsx(t.ChatActionLabel,{action:"copy"}),e.jsx(t.ChatActionFeedback,{action:"copy"})]}),e.jsx(t.ChatAction,{action:"clear"}),e.jsx(t.ChatAction,{action:"stop"})]})]})}function z(){const{sessions:r}=B.useChatHistory(),{conversationId:s}=A.useChat();return e.jsxs(d.EmbeddedChatHistoryRoot,{children:[e.jsxs(d.EmbeddedChatHistoryHeader,{children:[e.jsxs(d.EmbeddedChatHistoryBackButton,{children:[e.jsx(d.EmbeddedChatHistoryBackButtonIcon,{iconKey:"backToChat"}),"Back to chat"]}),e.jsx(d.EmbeddedChatHistoryTitle,{}),e.jsx(g.Close,{})]}),e.jsxs(d.EmbeddedChatHistoryList,{children:[r.map(n=>e.jsxs(d.EmbeddedChatHistoryItem,{sessionId:n.id,"data-active":p.dataAttr(n.id===s),children:[e.jsx(d.EmbeddedChatHistoryItemTitle,{children:n.title}),e.jsx(d.EmbeddedChatHistoryItemDate,{children:d.formatSessionDate(n.updatedAt)})]},n.id)),e.jsx(d.EmbeddedChatHistoryEmptyState,{}),e.jsx(d.EmbeddedChatHistoryLoadingState,{})]}),e.jsx(d.EmbeddedChatHistoryFooter,{children:e.jsx(d.EmbeddedChatHistoryNewConversationButton,{})})]})}function J(){return e.jsx(F.PortalWithTheme,{children:e.jsx(t.FeedbackModal,{children:e.jsx(t.FeedbackModalOverlay,{children:e.jsxs(t.FeedbackModalContent,{children:[e.jsx(t.FeedbackModalHeader,{}),e.jsx(t.FeedbackModalClose,{}),e.jsx(t.FeedbackModalBody,{children:e.jsxs(t.FeedbackForm,{children:[e.jsxs(t.FeedbackItem,{name:"unrelated_response",children:[e.jsx(t.FeedbackItemCheckbox,{children:e.jsx(t.FeedbackItemCheckboxIndicator,{})}),e.jsx(t.FeedbackItemLabel,{}),e.jsx(t.FeedbackItemDescription,{})]}),e.jsxs(t.FeedbackItem,{name:"inaccurate_statement",children:[e.jsx(t.FeedbackItemCheckbox,{children:e.jsx(t.FeedbackItemCheckboxIndicator,{})}),e.jsx(t.FeedbackItemLabel,{}),e.jsx(t.FeedbackItemDescription,{})]}),e.jsxs(t.FeedbackItem,{name:"inaccurate_code_snippet",children:[e.jsx(t.FeedbackItemCheckbox,{children:e.jsx(t.FeedbackItemCheckboxIndicator,{})}),e.jsx(t.FeedbackItemLabel,{}),e.jsx(t.FeedbackItemDescription,{})]}),e.jsxs(t.FeedbackItem,{name:"irrelevant_citations",children:[e.jsx(t.FeedbackItemCheckbox,{children:e.jsx(t.FeedbackItemCheckboxIndicator,{})}),e.jsx(t.FeedbackItemLabel,{})]}),e.jsx(t.FeedbackSubmitButton,{})]})})]})})})})}function X(){return e.jsxs(t.FormWrapper,{children:[e.jsx(t.FormClose,{}),e.jsxs(t.Form,{children:[e.jsxs(t.FormHeader,{children:[e.jsx(t.FormHeading,{}),e.jsx(t.FormDescription,{})]}),e.jsx(t.FormContent,{children:r=>e.jsxs(e.Fragment,{children:[r.map((s,n)=>e.jsxs(t.FormField,{field:s,autoFocus:n===0,children:[e.jsx(t.FormFieldLabel,{}),s.inputType==="text"&&e.jsx(t.FormFieldText,{}),s.inputType==="email"&&e.jsx(t.FormFieldEmail,{}),s.inputType==="file"&&e.jsx(t.FormFieldFile,{}),s.inputType==="textarea"&&e.jsx(t.FormFieldTextArea,{}),s.inputType==="checkbox"&&e.jsx(t.FormFieldCheckbox,{children:e.jsx(t.FormFieldCheckboxIndicator,{})}),s.inputType==="select"&&e.jsxs(t.FormFieldSelect,{children:[e.jsxs(t.FormFieldSelectTrigger,{children:[e.jsx(t.FormFieldSelectValue,{}),e.jsx(t.FormFieldSelectIcon,{})]}),e.jsx(t.FormFieldSelectContent,{children:e.jsx(t.FormFieldSelectViewport,{children:s.items.map(a=>e.jsxs(t.FormFieldSelectItem,{value:a.value,children:[e.jsx(t.FormFieldSelectItemText,{children:a.label}),e.jsx(t.FormFieldSelectItemIndicator,{})]},a.value))})})]}),s.inputType==="combobox"&&e.jsxs(t.FormFieldCombobox,{children:[e.jsxs(t.FormFieldComboboxControl,{children:["multiple"in s&&s.multiple&&e.jsx(t.FormFieldComboboxSelectedTags,{}),e.jsx(t.FormFieldComboboxInput,{}),e.jsx(t.FormFieldComboboxTrigger,{})]}),e.jsx(t.FormFieldComboboxPositioner,{children:e.jsx(t.FormFieldComboboxContent,{children:e.jsx(t.FormFieldComboboxList,{children:e.jsx(t.FormFieldComboboxListItems,{children:a=>a.length===0?e.jsx(t.FormFieldComboboxListEmpty,{}):a.map(i=>e.jsxs(t.FormFieldComboboxItem,{item:i,children:[e.jsx(t.FormFieldComboboxItemText,{children:i.label}),e.jsx(t.FormFieldComboboxItemIndicator,{})]},i.value))})})})})]}),e.jsx(t.FormFieldDescription,{}),e.jsx(t.FormFieldError,{})]},s.name)),e.jsx(t.FormError,{})]})}),e.jsxs(t.FormFooter,{children:[e.jsx(t.FormCancel,{}),e.jsx(t.FormSubmit,{})]})]}),e.jsxs(t.FormSuccess,{children:[e.jsx(t.FormSuccessHeading,{}),e.jsx(t.FormSuccessMessage,{}),e.jsx(t.FormSuccessButton,{})]})]})}exports.InkeepEmbeddedChat=q;exports.InkeepEmbeddedChatImpl=y;exports.InkeepEmbeddedChatImplContent=k;exports.InkeepEmbeddedChatProvider=T;