@inkeep/cxkit-primitives 0.5.35 → 0.5.37

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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  Ask me anything about \`${c}\`.`:`
6
6
 
7
- Let me know how I can help.`,v={content:r.introMessage??`${m}${l}`,id:Na,...e,role:"assistant",links:[]};return n.jsx(ce,{message:v,...a})}),hn=i.ikp("div",{_id:"aiChatMessageHeader"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(hn,{"data-role":e.role,...t})},Cn=i.ikp("div",{_id:"aiChatMessageLoading"}),Ye=t=>{const{isLoading:e,isStreaming:a,messages:r}=b.useChat(),{message:s}=P.useMessage();return!(r.at(-1)?.id===s?.id)||s.role!=="assistant"||!e||a?null:n.jsx(Cn,{children:"Thinking...",...t})},un=i.ikp("div",{_id:"aiChatMessageAvatar"}),Je=t=>{const{message:e}=P.useMessage();return n.jsx(un,{"data-role":e.role,...t})},pn=i.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Xe=t=>{const{message:e}=P.useMessage(),{baseSettings:a}=u.useInkeepConfig();return n.jsx(pn,{"data-username":h.dataAttr(e.role==="user"&&!!a.userProperties.name),"data-role":e.role,...t})},vn=i.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Ze=g.memo(t=>{const{baseSettings:e}=u.useInkeepConfig(),{message:a}=P.useMessage();return e.userProperties.name?n.jsx(vn,{"data-role":a.role,children:h.getInitials(e.userProperties.name),...t}):null}),pe=i.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),et=g.memo(t=>{const{onLoadingStatusChange:e,...a}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=u.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=qa.useColorModeValue(c,m),[p,v]=g.useState(l);g.useEffect(()=>{v(l)},[l]);const k=j=>{j==="error"&&v(null)};return o.role==="user"?s.name?null:r.userAvatar?n.jsx(pe,{"data-type":"image","data-role":o.role,src:r.userAvatar,...t}):n.jsx(Ba.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":o.role,onLoadingStatusChange:C.composeEventHandlers(e,k),...a}):n.jsx(fa.default,{"data-type":"icon","data-role":o.role,...t})}),bn=i.ikp("span",{_id:"aiChatMessageName"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(bn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},gn=i.ikp("div",{_id:"aiChatMessageContentWrapper"}),it=t=>{const{message:e}=P.useMessage();return n.jsx(gn,{"data-role":e.role,...t})},Pn=i.ikp("div",{_id:"aiChatMessageContent"}),at=t=>{const{message:e}=P.useMessage();return n.jsx(Pn,{"data-role":e.role,...t})},_n=i.ikp("div",{_id:"aiChatMessageAttachments"}),nt=t=>{const{message:e}=P.useMessage(),a=e.metadata?.attributes?.attachments;return e.role!=="user"||!a?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(_n,{...t})})},An=i.ikp("div",{_id:"aiChatMessageAttachments__List"}),rt=t=>{const{children:e,...a}=t,{message:r}=P.useMessage(),s=r.metadata?.attributes?.attachments;return s?n.jsx(An,{children:h.maybeRender(e,s),...a}):null},En=i.ikp("div",{_id:"aiChatMessageAttachments__Item"}),st=t=>{const{attachment:e,onClick:a,...r}=t,{selectItem:s,onOpen:o}=q.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(H.AttachmentItemProvider,{attachment:e,children:n.jsx(En,{onClick:C.composeEventHandlers(a,d),...r})})},Fn=i.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),ot=t=>{const{attachment:e}=H.useAttachmentItem(),a=e.contentType?.attachmentIcon;return a?n.jsx(Fn,{iconSettings:a,...t}):null},kn=i.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),dt=t=>{const{attachment:e}=H.useAttachmentItem();return n.jsx(kn,{children:e.title,...t})},In=i.ikp(_.Root,{_id:"aiChatMessageAttachmentsPreview"}),ct=t=>{const{onOpenChange:e,...a}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(In,{open:s&&d!==null,onOpenChange:C.composeEventHandlers(e,c),...a})},mt=i.ikp(_.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),lt=i.ikp(_.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),Mn=i.ikp(_.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Mn,{children:e?.title||"Attachment",...t})},Ct=i.ikp(_.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Sn=i.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ut=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Sn,{children:e?.content,...t})},ve=i.ikp("div",{_id:"aiChatMessage"}),pt=t=>{const{aiChatSettings:e}=u.useInkeepConfig(),{componentStyles:a,...r}=t,{message:s}=P.useMessage(),{logEvent:o}=Q.useChatEvents(),d=h.getMessageContent(s),{conversation:c}=D.useInkeepConversation();return s.role==="user"?n.jsx(ve,{"data-role":s.role,children:d,...r}):n.jsx(ve,{"data-role":s.role,...r,children:n.jsx(ne.Markdown,{children:d,componentStyles:a,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,l)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:m}})},onCodeCopy:(m,l)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:l}})}})})},xn=i.ikp("div",{_id:"aiChatMessageActions"}),vt=t=>{const{isLoading:e,messages:a}=b.useChat(),{message:r}=P.useMessage();return a.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(xn,{...t})},fn=i.ikp("div",{_id:"aiChatMessageToolActions"}),bt=t=>{const{children:e,...a}=t,{message:r}=P.useMessage(),{messageToolCalls:s}=b.useChat(),o=s[r.id]||[];return n.jsx(fn,{children:h.maybeRender(e,o),...a})},gt=t=>{const{onClick:e,action:a,...r}=t,{handleAction:s}=se.useChatAction(a),o=()=>{s()},d=a.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[a.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:a.icon}),d]}),m=a.action.type,l=i.ikp(m==="open_link"?"a":"button",{_id:"aiChatMessageToolAction",children:c,"data-type":a.action.type,...m==="open_link"&&{href:a.action.url,target:"_blank",rel:"noopener"},onClick:C.composeEventHandlers(e,o)});return n.jsx(l,{...r})},Bn=i.ikp("button",{_id:"aiChatMessageAction"}),Pt=t=>{const{action:e,onClick:a,className:r,...s}=t,{conversation:o}=D.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=b.useChat(),[l,p]=te.useCopyToClipboard(),{feedback:v,submitPositiveFeedback:k,setCurrentFeedback:j,currentFeedback:R}=re.useMessageFeedback(),{logEvent:J}=Q.useChatEvents(),[W,X]=Ha.useSettleAction(),{baseSettings:{privacyPreferences:he}}=u.useInkeepConfig(),{optOutAllAnalytics:Z}=he,Ce=m.at(-1)?.id===d?.id,ee=d.role==="assistant";if(Ce&&c||!ee||{copy:!1,upvote:Z,downvote:Z}[e])return null;const y={copy(){p(h.getMessageContent(d)),J({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{X()})},downvote(){j(d.id)}},L={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(E.CustomIcon,{iconKey:l?"messageCopied":"messageCopy"}),upvote:n.jsx(E.CustomIcon,{iconKey:W?"messageCopied":"thumbsUp"}),downvote:n.jsx(E.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":h.dataAttr(l)},upvote:{"data-upvoted":h.dataAttr(v[d.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(v[d.id]?.type==="negative"),"data-state":R===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":L[e],className:`${r} ${e}`,onClick:C.composeEventHandlers(a,y[e]),...s})},Tn=i.ikp("div",{_id:"aiChatMessageSources"}),_t=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(Tn,{...t})},jn=i.ikp("div",{_id:"aiChatMessageSources__Header"}),At=t=>n.jsx(jn,{children:"Sources",...t}),yn=i.ikp("div",{_id:"aiChatMessageSources__List"}),Et=t=>{const{message:e}=P.useMessage(),{children:a,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=u.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(l=>{const p=Wa.transformInkeepSource(l,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:s}),v=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:v}});return n.jsx(yn,{children:h.maybeRender(a,m),...r})},Hn=i.ikp(Ta.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),Ft=t=>{const{source:e,onClick:a,...r}=t,{logEvent:s}=Q.useChatEvents(),{conversation:o}=D.useInkeepConversation(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(f.SourceItemProvider,{source:e,children:n.jsx(Hn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:C.composeEventHandlers(a,d),...r})})},wn=i.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),kt=t=>{const{source:e}=f.useSourceItem();return e.breadcrumbs?.length?n.jsx(wn,{"data-type":e.type,...t}):null},Ln=i.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Dn=i.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),It=t=>{const{source:e}=f.useSourceItem();return n.jsx(Dn,{iconSettings:e.icon,"data-type":e.type,...t})},qn=i.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),Mt=t=>{const{source:e}=f.useSourceItem();return n.jsx(qn,{"data-type":e.type,children:e.title,...t})},On=i.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),St=t=>{const{source:e}=f.useSourceItem();return n.jsx(On,{"data-type":e.type,...t})},Rn=i.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),xt=t=>{const{source:e}=f.useSourceItem(),{children:a,...r}=t,s=g.useMemo(()=>e.description?Da.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(Rn,{"data-type":e.type,children:h.maybeRender(a,s),...r}):null},Wn=i.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),ft=t=>{const{part:e,...a}=t,{source:r}=f.useSourceItem();return typeof e=="string"?e:n.jsx(Wn,{"data-type":r.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...a})},Nn=i.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),Bt=t=>{const{source:e}=f.useSourceItem();return n.jsx(Nn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Tt=i.ikp("div",{_id:"aiChatFooter"}),jt=i.ikp("div",{_id:"aiChatInput__Fieldset"}),yt=i.ikp("div",{_id:"aiChatInput__Group"}),$n=i.ikp("textarea",{_id:"aiChatInput"}),Ht=g.forwardRef(({onChange:t,onKeyDown:e,...a},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:l}=b.useChat(),{aiChatSettings:p}=u.useInkeepConfig(),v=oe.useComposedRefs(r,l),k=ge.useModal();return g.useEffect(()=>{requestAnimationFrame(()=>{m&&l?.current&&(l.current.focus(),l.current.selectionStart=l.current.value.length)})},[m,l,k?.isOpen]),n.jsx($n,{asChild:!0,ref:v,maxLength:99999,placeholder:p.placeholder,value:d,onChange:C.composeEventHandlers(t,s),onKeyDown:C.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...a,children:n.jsx(ae,{})})}),Qn=i.ikp("button",{_id:"aiChatInput__SendButton"}),wt=t=>{const{handleSubmit:e,isSubmitDisabled:a,error:r}=b.useChat(),{aiChatSettings:s}=u.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Qn,{onClick:C.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:a||!!r||s.isViewOnly,...d})},Lt=i.ikp(E.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),Vn=i.ikp("div",{_id:"aiChatAttachmentsBar"}),Dt=t=>{const{selectedWorkflow:e}=b.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(F.AttachmentsBarProvider,{children:n.jsx(Vn,{...t})})},Un=i.ikp("div",{_id:"aiChatAttachmentsBar__List"}),qt=t=>{const{children:e,...a}=t,{messageAttachments:r}=b.useChat();return n.jsx(Un,{children:h.maybeRender(e,r),...a})},Kn=i.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Ot=t=>{const{attachment:e,...a}=t;return n.jsx(H.AttachmentItemProvider,{attachment:e,children:n.jsx(Kn,{...a})})},zn=i.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Rt=t=>{const{attachment:e}=H.useAttachmentItem(),a=e.contentType?.attachmentIcon;return a?n.jsx(zn,{iconSettings:a,...t}):null},Gn=i.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),Wt=t=>{const{attachment:e}=H.useAttachmentItem();return n.jsx(Gn,{children:e.title,...t})},Yn=i.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Nt=t=>{const{onClick:e,...a}=t,{attachment:r}=H.useAttachmentItem(),{setMessageAttachments:s}=b.useChat(),o=()=>{s(d=>d.filter(c=>c.id!==r.id))};return n.jsx(Yn,{"aria-label":"Remove attachment",children:n.jsx(E.CustomIcon,{iconKey:"close"}),onClick:C.composeEventHandlers(e,o),...a})},$t=i.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Qt=i.ikp(T.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Vt=i.ikp(T.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(E.CustomIcon,{iconKey:"info"})}),me=i.ikp(T.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Ut=i.ikp(T.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Jn=i.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Kt=t=>{const{children:e,...a}=t,{selectedWorkflow:r}=b.useChat();return r?.supportedInputs?n.jsx(Jn,{children:h.maybeRender(e,r.supportedInputs),...a}):null},Xn=i.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),zt=t=>{const{input:e,onClick:a,...r}=t,{selectedWorkflow:s,messageAttachments:o,setMessageAttachments:d}=b.useChat(),{selectInput:c,onOpen:m}=F.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(Xn,{children:e.displayName,onClick:C.composeEventHandlers(a,l),...r})},Gt=i.ikp(xa.IoAdd,{_id:"aiChatAttachmentsBar__InputIcon"}),Zn=i.ikp(_.Root,{_id:"aiChatAttachmentsBar__Modal"}),Yt=t=>{const{onOpenChange:e,...a}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=F.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(Zn,{open:s&&d!==null,onOpenChange:C.composeEventHandlers(e,c),...a})},Jt=i.ikp(_.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Xt=i.ikp(_.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Zt=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),er=i.ikp(_.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),ei=t=>{const{selectedInput:e}=F.useAttachmentsBar(),a=`Add ${e?.displayName}`;return n.jsx(er,{children:a,...t})},tr=i.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),ti=t=>{const{selectedInput:e}=F.useAttachmentsBar(),a=e?.workflowModalProps?.modalHelpText;return a?n.jsx(tr,{children:a,...t}):null},ir=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),ii=t=>{const{children:e,...a}=t,{selectedInput:r}=F.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(ir,{asChild:!e,children:e||s,...a}):null},ai=i.ikp(_.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),ni=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),ar=i.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ri=t=>{const{onSubmit:e,...a}=t,{form:r}=F.useAttachmentsBar();return n.jsx(ar,{onSubmit:C.composeEventHandlers(e,r.onSubmit),...a})},si=i.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),nr=i.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),oi=t=>{const{form:e,selectedInput:a}=F.useAttachmentsBar();return n.jsx(nr,{htmlFor:`${a?.id}-title`,children:e.labels.title,...t})},rr=i.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),di=t=>{const{onChange:e,...a}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(rr,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":h.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:C.composeEventHandlers(e,r.onChange),...a})},sr=i.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ci=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.title?n.jsx(sr,{"aria-live":"polite",children:e.errors.title,...t}):null},mi=i.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),or=i.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),li=t=>{const{form:e,selectedInput:a}=F.useAttachmentsBar();return n.jsx(or,{htmlFor:`${a?.id}-content`,children:e.labels.content,...t})},dr=i.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),hi=t=>{const{onChange:e,...a}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(dr,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":h.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:C.composeEventHandlers(e,r.onChange),...a,children:n.jsx(ae,{maxRows:10})})},cr=i.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),Ci=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.content?n.jsx(cr,{"aria-live":"polite",children:e.errors.content,...t}):null},ui=i.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),pi=i.ikp("div",{_id:"aiChatActionBar"}),vi=i.ikp("div",{_id:"aiChat__ChatActions"}),bi=i.ikp("div",{_id:"aiChatTagline__Container"}),gi=i.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),Pi=i.ikp(ya.default,{_id:"aiChatTagline__Logo"}),_i=i.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),mr=i.ikp("div",{_id:"aiChat__ChatAction"}),G=t=>{const{action:e,onClick:a,className:r,...s}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:l}=b.useChat(),{conversation:p}=D.useInkeepConversation(),{aiChatSettings:v,baseSettings:k}=u.useInkeepConfig(),{logEvent:j}=Q.useChatEvents(),[R,J]=te.useCopyToClipboard(),[W,X]=te.useCopyToClipboard();if({help:!1,copy:m.length===0||!v.isCopyChatButtonVisible||c,share:m.length===0||!v.isShareButtonVisible||!p.id||!!l||c,clear:m.length===0||v.isViewOnly||c,stop:!c}[e])return null;const ee={help:()=>{},copy:()=>{const N=m.map(y=>{const L=`**${y.role==="assistant"?"AI Assistant":"User"}**`,M=h.getMessageContent(y),S=ja.stringifyAttachments(y.metadata?.attributes?.attachments),$=S?`
7
+ Let me know how I can help.`,v={content:r.introMessage??`${m}${l}`,id:Na,...e,role:"assistant",links:[]};return n.jsx(ce,{message:v,...a})}),hn=i.ikp("div",{_id:"aiChatMessageHeader"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(hn,{"data-role":e.role,...t})},Cn=i.ikp("div",{_id:"aiChatMessageLoading"}),Ye=t=>{const{isLoading:e,isStreaming:a,messages:r}=b.useChat(),{message:s}=P.useMessage();return!(r.at(-1)?.id===s?.id)||s.role!=="assistant"||!e||a?null:n.jsx(Cn,{children:"Thinking...",...t})},un=i.ikp("div",{_id:"aiChatMessageAvatar"}),Je=t=>{const{message:e}=P.useMessage();return n.jsx(un,{"data-role":e.role,...t})},pn=i.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Xe=t=>{const{message:e}=P.useMessage(),{baseSettings:a}=u.useInkeepConfig();return n.jsx(pn,{"data-username":h.dataAttr(e.role==="user"&&!!a.userProperties.name),"data-role":e.role,...t})},vn=i.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Ze=g.memo(t=>{const{baseSettings:e}=u.useInkeepConfig(),{message:a}=P.useMessage();return e.userProperties.name?n.jsx(vn,{"data-role":a.role,children:h.getInitials(e.userProperties.name),...t}):null}),pe=i.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),et=g.memo(t=>{const{onLoadingStatusChange:e,...a}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=u.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=qa.useColorModeValue(c,m),[p,v]=g.useState(l);g.useEffect(()=>{v(l)},[l]);const k=j=>{j==="error"&&v(null)};return o.role==="user"?s.name?null:r.userAvatar?n.jsx(pe,{"data-type":"image","data-role":o.role,src:r.userAvatar,...t}):n.jsx(Ba.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":o.role,onLoadingStatusChange:C.composeEventHandlers(e,k),...a}):n.jsx(fa.default,{"data-type":"icon","data-role":o.role,...t})}),bn=i.ikp("span",{_id:"aiChatMessageName"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(bn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},gn=i.ikp("div",{_id:"aiChatMessageContentWrapper"}),it=t=>{const{message:e}=P.useMessage();return n.jsx(gn,{"data-role":e.role,...t})},Pn=i.ikp("div",{_id:"aiChatMessageContent"}),at=t=>{const{message:e}=P.useMessage();return n.jsx(Pn,{"data-role":e.role,...t})},_n=i.ikp("div",{_id:"aiChatMessageAttachments"}),nt=t=>{const{message:e}=P.useMessage(),a=e.metadata?.attributes?.attachments;return e.role!=="user"||!a?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(_n,{...t})})},An=i.ikp("div",{_id:"aiChatMessageAttachments__List"}),rt=t=>{const{children:e,...a}=t,{message:r}=P.useMessage(),s=r.metadata?.attributes?.attachments;return s?n.jsx(An,{children:h.maybeRender(e,s),...a}):null},En=i.ikp("div",{_id:"aiChatMessageAttachments__Item"}),st=t=>{const{attachment:e,onClick:a,...r}=t,{selectItem:s,onOpen:o}=q.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(H.AttachmentItemProvider,{attachment:e,children:n.jsx(En,{onClick:C.composeEventHandlers(a,d),...r})})},Fn=i.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),ot=t=>{const{attachment:e}=H.useAttachmentItem(),a=e.contentType?.attachmentIcon;return a?n.jsx(Fn,{iconSettings:a,...t}):null},kn=i.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),dt=t=>{const{attachment:e}=H.useAttachmentItem();return n.jsx(kn,{children:e.title,...t})},In=i.ikp(_.Root,{_id:"aiChatMessageAttachmentsPreview"}),ct=t=>{const{onOpenChange:e,...a}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(In,{open:s&&d!==null,onOpenChange:C.composeEventHandlers(e,c),...a})},mt=i.ikp(_.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),lt=i.ikp(_.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),Mn=i.ikp(_.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Mn,{children:e?.title||"Attachment",...t})},Ct=i.ikp(_.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Sn=i.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ut=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Sn,{children:e?.content,...t})},ve=i.ikp("div",{_id:"aiChatMessage"}),pt=t=>{const{aiChatSettings:e}=u.useInkeepConfig(),{componentStyles:a,...r}=t,{message:s}=P.useMessage(),{logEvent:o}=Q.useChatEvents(),d=h.getMessageContent(s),{conversation:c}=D.useInkeepConversation();return s.role==="user"?n.jsx(ve,{"data-role":s.role,children:d,...r}):n.jsx(ve,{"data-role":s.role,...r,children:n.jsx(ne.Markdown,{children:d,componentStyles:a,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,l)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:m}})},onCodeCopy:(m,l)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:l}})}})})},xn=i.ikp("div",{_id:"aiChatMessageToolbar"}),vt=t=>{const{isLoading:e,messages:a}=b.useChat(),{message:r}=P.useMessage();return a.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(xn,{...t})},fn=i.ikp("div",{_id:"aiChatMessageToolActions"}),bt=t=>{const{children:e,...a}=t,{message:r}=P.useMessage(),{messageButtons:s}=b.useChat(),o=s[r.id]||[];return n.jsx(fn,{children:h.maybeRender(e,o),...a})},gt=t=>{const{onClick:e,action:a,...r}=t,{handleAction:s}=se.useChatAction(a),o=()=>{s()},d=a.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[a.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:a.icon}),d]}),m=a.action.type,l=i.ikp(m==="open_link"?"a":"button",{_id:"aiChatMessageToolAction",children:c,"data-type":a.action.type,...m==="open_link"&&{href:a.action.url,target:"_blank",rel:"noopener"},onClick:C.composeEventHandlers(e,o)});return n.jsx(l,{...r})},Bn=i.ikp("button",{_id:"aiChatMessageAction"}),Pt=t=>{const{action:e,onClick:a,className:r,...s}=t,{conversation:o}=D.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=b.useChat(),[l,p]=te.useCopyToClipboard(),{feedback:v,submitPositiveFeedback:k,setCurrentFeedback:j,currentFeedback:R}=re.useMessageFeedback(),{logEvent:J}=Q.useChatEvents(),[W,X]=Ha.useSettleAction(),{baseSettings:{privacyPreferences:he}}=u.useInkeepConfig(),{optOutAllAnalytics:Z}=he,Ce=m.at(-1)?.id===d?.id,ee=d.role==="assistant";if(Ce&&c||!ee||{copy:!1,upvote:Z,downvote:Z}[e])return null;const y={copy(){p(h.getMessageContent(d)),J({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{X()})},downvote(){j(d.id)}},L={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(E.CustomIcon,{iconKey:l?"messageCopied":"messageCopy"}),upvote:n.jsx(E.CustomIcon,{iconKey:W?"messageCopied":"thumbsUp"}),downvote:n.jsx(E.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":h.dataAttr(l)},upvote:{"data-upvoted":h.dataAttr(v[d.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(v[d.id]?.type==="negative"),"data-state":R===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":L[e],className:`${r} ${e}`,onClick:C.composeEventHandlers(a,y[e]),...s})},Tn=i.ikp("div",{_id:"aiChatMessageSources"}),_t=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(Tn,{...t})},jn=i.ikp("div",{_id:"aiChatMessageSources__Header"}),At=t=>n.jsx(jn,{children:"Sources",...t}),yn=i.ikp("div",{_id:"aiChatMessageSources__List"}),Et=t=>{const{message:e}=P.useMessage(),{children:a,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=u.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(l=>{const p=Wa.transformInkeepSource(l,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:s}),v=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:v}});return n.jsx(yn,{children:h.maybeRender(a,m),...r})},Hn=i.ikp(Ta.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),Ft=t=>{const{source:e,onClick:a,...r}=t,{logEvent:s}=Q.useChatEvents(),{conversation:o}=D.useInkeepConversation(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(f.SourceItemProvider,{source:e,children:n.jsx(Hn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:C.composeEventHandlers(a,d),...r})})},wn=i.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),kt=t=>{const{source:e}=f.useSourceItem();return e.breadcrumbs?.length?n.jsx(wn,{"data-type":e.type,...t}):null},Ln=i.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Dn=i.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),It=t=>{const{source:e}=f.useSourceItem();return n.jsx(Dn,{iconSettings:e.icon,"data-type":e.type,...t})},qn=i.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),Mt=t=>{const{source:e}=f.useSourceItem();return n.jsx(qn,{"data-type":e.type,children:e.title,...t})},On=i.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),St=t=>{const{source:e}=f.useSourceItem();return n.jsx(On,{"data-type":e.type,...t})},Rn=i.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),xt=t=>{const{source:e}=f.useSourceItem(),{children:a,...r}=t,s=g.useMemo(()=>e.description?Da.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(Rn,{"data-type":e.type,children:h.maybeRender(a,s),...r}):null},Wn=i.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),ft=t=>{const{part:e,...a}=t,{source:r}=f.useSourceItem();return typeof e=="string"?e:n.jsx(Wn,{"data-type":r.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...a})},Nn=i.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),Bt=t=>{const{source:e}=f.useSourceItem();return n.jsx(Nn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Tt=i.ikp("div",{_id:"aiChatFooter"}),jt=i.ikp("div",{_id:"aiChatInput__Fieldset"}),yt=i.ikp("div",{_id:"aiChatInput__Group"}),$n=i.ikp("textarea",{_id:"aiChatInput"}),Ht=g.forwardRef(({onChange:t,onKeyDown:e,...a},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:l}=b.useChat(),{aiChatSettings:p}=u.useInkeepConfig(),v=oe.useComposedRefs(r,l),k=ge.useModal();return g.useEffect(()=>{requestAnimationFrame(()=>{m&&l?.current&&(l.current.focus(),l.current.selectionStart=l.current.value.length)})},[m,l,k?.isOpen]),n.jsx($n,{asChild:!0,ref:v,maxLength:99999,placeholder:p.placeholder,value:d,onChange:C.composeEventHandlers(t,s),onKeyDown:C.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...a,children:n.jsx(ae,{})})}),Qn=i.ikp("button",{_id:"aiChatInput__SendButton"}),wt=t=>{const{handleSubmit:e,isSubmitDisabled:a,error:r}=b.useChat(),{aiChatSettings:s}=u.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Qn,{onClick:C.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:a||!!r||s.isViewOnly,...d})},Lt=i.ikp(E.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),Vn=i.ikp("div",{_id:"aiChatAttachmentsBar"}),Dt=t=>{const{selectedWorkflow:e}=b.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(F.AttachmentsBarProvider,{children:n.jsx(Vn,{...t})})},Un=i.ikp("div",{_id:"aiChatAttachmentsBar__List"}),qt=t=>{const{children:e,...a}=t,{messageAttachments:r}=b.useChat();return n.jsx(Un,{children:h.maybeRender(e,r),...a})},Kn=i.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Ot=t=>{const{attachment:e,...a}=t;return n.jsx(H.AttachmentItemProvider,{attachment:e,children:n.jsx(Kn,{...a})})},zn=i.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Rt=t=>{const{attachment:e}=H.useAttachmentItem(),a=e.contentType?.attachmentIcon;return a?n.jsx(zn,{iconSettings:a,...t}):null},Gn=i.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),Wt=t=>{const{attachment:e}=H.useAttachmentItem();return n.jsx(Gn,{children:e.title,...t})},Yn=i.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Nt=t=>{const{onClick:e,...a}=t,{attachment:r}=H.useAttachmentItem(),{setMessageAttachments:s}=b.useChat(),o=()=>{s(d=>d.filter(c=>c.id!==r.id))};return n.jsx(Yn,{"aria-label":"Remove attachment",children:n.jsx(E.CustomIcon,{iconKey:"close"}),onClick:C.composeEventHandlers(e,o),...a})},$t=i.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Qt=i.ikp(T.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Vt=i.ikp(T.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(E.CustomIcon,{iconKey:"info"})}),me=i.ikp(T.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Ut=i.ikp(T.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Jn=i.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Kt=t=>{const{children:e,...a}=t,{selectedWorkflow:r}=b.useChat();return r?.supportedInputs?n.jsx(Jn,{children:h.maybeRender(e,r.supportedInputs),...a}):null},Xn=i.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),zt=t=>{const{input:e,onClick:a,...r}=t,{selectedWorkflow:s,messageAttachments:o,setMessageAttachments:d}=b.useChat(),{selectInput:c,onOpen:m}=F.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(Xn,{children:e.displayName,onClick:C.composeEventHandlers(a,l),...r})},Gt=i.ikp(xa.IoAdd,{_id:"aiChatAttachmentsBar__InputIcon"}),Zn=i.ikp(_.Root,{_id:"aiChatAttachmentsBar__Modal"}),Yt=t=>{const{onOpenChange:e,...a}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=F.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(Zn,{open:s&&d!==null,onOpenChange:C.composeEventHandlers(e,c),...a})},Jt=i.ikp(_.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Xt=i.ikp(_.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Zt=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),er=i.ikp(_.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),ei=t=>{const{selectedInput:e}=F.useAttachmentsBar(),a=`Add ${e?.displayName}`;return n.jsx(er,{children:a,...t})},tr=i.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),ti=t=>{const{selectedInput:e}=F.useAttachmentsBar(),a=e?.workflowModalProps?.modalHelpText;return a?n.jsx(tr,{children:a,...t}):null},ir=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),ii=t=>{const{children:e,...a}=t,{selectedInput:r}=F.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(ir,{asChild:!e,children:e||s,...a}):null},ai=i.ikp(_.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),ni=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),ar=i.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ri=t=>{const{onSubmit:e,...a}=t,{form:r}=F.useAttachmentsBar();return n.jsx(ar,{onSubmit:C.composeEventHandlers(e,r.onSubmit),...a})},si=i.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),nr=i.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),oi=t=>{const{form:e,selectedInput:a}=F.useAttachmentsBar();return n.jsx(nr,{htmlFor:`${a?.id}-title`,children:e.labels.title,...t})},rr=i.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),di=t=>{const{onChange:e,...a}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(rr,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":h.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:C.composeEventHandlers(e,r.onChange),...a})},sr=i.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ci=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.title?n.jsx(sr,{"aria-live":"polite",children:e.errors.title,...t}):null},mi=i.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),or=i.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),li=t=>{const{form:e,selectedInput:a}=F.useAttachmentsBar();return n.jsx(or,{htmlFor:`${a?.id}-content`,children:e.labels.content,...t})},dr=i.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),hi=t=>{const{onChange:e,...a}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(dr,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":h.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:C.composeEventHandlers(e,r.onChange),...a,children:n.jsx(ae,{maxRows:10})})},cr=i.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),Ci=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.content?n.jsx(cr,{"aria-live":"polite",children:e.errors.content,...t}):null},ui=i.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),pi=i.ikp("div",{_id:"aiChatActionBar"}),vi=i.ikp("div",{_id:"aiChat__ChatActions"}),bi=i.ikp("div",{_id:"aiChatTagline__Container"}),gi=i.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),Pi=i.ikp(ya.default,{_id:"aiChatTagline__Logo"}),_i=i.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),mr=i.ikp("div",{_id:"aiChat__ChatAction"}),G=t=>{const{action:e,onClick:a,className:r,...s}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:l}=b.useChat(),{conversation:p}=D.useInkeepConversation(),{aiChatSettings:v,baseSettings:k}=u.useInkeepConfig(),{logEvent:j}=Q.useChatEvents(),[R,J]=te.useCopyToClipboard(),[W,X]=te.useCopyToClipboard();if({help:!1,copy:m.length===0||!v.isCopyChatButtonVisible||c,share:m.length===0||!v.isShareButtonVisible||!p.id||!!l||c,clear:m.length===0||v.isViewOnly||c,stop:!c}[e])return null;const ee={help:()=>{},copy:()=>{const N=m.map(y=>{const L=`**${y.role==="assistant"?"AI Assistant":"User"}**`,M=h.getMessageContent(y),S=ja.stringifyAttachments(y.metadata?.attributes?.attachments),$=S?`
8
8
 
9
9
  **Attachments**
10
10
 
@@ -14,4 +14,4 @@ ${M}${$}`}).join(`
14
14
 
15
15
  ---
16
16
 
17
- `);J(N)},share:async()=>{const N={visibility:"public",tags:[],userProperties:{},messages:p.messages.map(S=>({...S,id:Date.now().toString()+S.id,conversationId:void 0}))},{apiKey:y,analyticsApiBaseUrl:L}=k,M=await Ra.logConversation("",N,y,L);if(M){const $=`${v.shareChatUrlBasePath}?${D.SHARE_QUERY_PARAM}=${M?.id}`;X($),j({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:$,conversation:M}})}},clear:o,stop:d},ue={copy:R,share:W};return n.jsx(T.Tooltip,{delayDuration:0,open:ue[e],children:n.jsx(mr,{"data-type":e,"data-copied":h.dataAttr(R||W),className:`${r} ${e}`,children:n.jsx(le,{action:e}),onClick:C.composeEventHandlers(a,ee[e]),...s})})},lr=i.ikp(T.Trigger,{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...a}=t,{aiChatSettings:r}=u.useInkeepConfig(),s=r.toolbarButtonLabels??{},o={help:s.getHelp??"Get Help",copy:s.copyChat??"Copy",share:s.share??"Share",clear:s.clear??"Clear",stop:s.stop??"Stop"};return n.jsx(lr,{children:o[e],...a})},hr=i.ikp(T.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),Ai=t=>{const{action:e,children:a,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(hr,{sideOffset:5,...r,children:[n.jsx(T.Arrow,{}),a||s[e]]})},Cr=i.ikp(K.Root,{_id:"aiChatHelpActions"}),Ei=t=>{const{children:e,...a}=t,{aiChatSettings:r}=u.useInkeepConfig(),{getHelpOptions:s}=r;if(!s||(s??[]).length===0)return null;const{_pinned:o,_unpinned:d}=s.reduce((p,v)=>{const k=v.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[k]:[...p[k],v]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,l=ie.useHelpMenuState();return n.jsx(ie.HelpMenuProvider,{value:l,children:n.jsx(Cr,{open:l.open,onOpenChange:l.setOpen,children:h.maybeRender(e,{pinned:c,unpinned:m}),...a})})},ur=i.ikp(G,{_id:"aiChatHelpAction",action:"help"}),pr=i.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),Fi=t=>{const{action:e,onClick:a,...r}=t,{handleAction:s,logHelpAction:o}=se.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:C.composeEventHandlers(a,()=>{s(),o()}),...r};return d==="open_link"?n.jsx(pr,{href:e.action.url,...c}):n.jsx(ur,{...c})},vr=i.ikp(K.Trigger,{_id:"aiChatHelpActions__Trigger"}),ki=g.memo(t=>{const{aiChatSettings:e}=u.useInkeepConfig();return n.jsx(G,{action:"help",...t,asChild:!0,children:n.jsx(vr,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),br=i.ikp(K.Content,{_id:"aiChatHelpActions__Menu"}),Ii=t=>n.jsx(br,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Mi=i.ikp(K.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),Si=t=>{const{action:e,onClick:a,...r}=t,{handleAction:s,logHelpAction:o}=se.useChatAction(e),{setOpen:d}=ie.useHelpMenu(),c=()=>{s({onOpenForm:()=>d(!1)}),o()},m=e.action.type,l=i.ikp(m==="open_link"?"a":"button",{_id:"aiChatHelpActions__MenuItem",children:e.name,"aria-label":e.name,"data-name":e.name,"data-type":e.action.type,...m==="open_link"&&{href:e.action.url,target:"_blank",rel:"noopener"},onClick:C.composeEventHandlers(a,c)});return n.jsx(l,{...r})},gr=i.ikp(x.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),xi=t=>{const{action:e,...a}=t;return e.icon?n.jsx(gr,{iconSettings:e.icon,...a}):null},Pr=i.ikp(_.Root,{_id:"aiChatFeedbackModal"}),fi=t=>{const{onOpenChange:e,...a}=t,{currentFeedback:r,setCurrentFeedback:s}=re.useMessageFeedback();return n.jsx(Pr,{open:r!==null,onOpenChange:C.composeEventHandlers(e,()=>s(null)),...a})},Bi=i.ikp(_.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),Ti=i.ikp(_.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),ji=i.ikp(_.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),yi=i.ikp(_.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Hi=i.ikp("div",{_id:"aiChatFeedbackModal__Body"}),_r=i.ikp("form",{_id:"aiChatFeedbackForm"}),wi=t=>{const{onSubmit:e,...a}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:o}=re.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,l=new FormData(m),p=Object.fromEntries(l.entries());s&&(r(s,p),o(null))};return n.jsx(_r,{onSubmit:C.composeEventHandlers(e,d),...a})},Ar=i.ikp("div",{_id:"aiChatFeedbackItem"}),Li=t=>{const{name:e,...a}=t;return n.jsx(V.FeedbackItemProvider,{name:e,children:n.jsx(Ar,{...a})})},Er=i.ikp(U.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Di=t=>{const{name:e,focusItem:a}=V.useFeedbackItem(),{onCheckedChange:r,...s}=t,o=d=>{d&&a?.current?.focus()};return n.jsx(Er,{id:`feedback-${e}`,name:e,onCheckedChange:C.composeEventHandlers(r,o),...s})},qi=i.ikp(U.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Fr=i.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Oi=t=>{const{name:e}=V.useFeedbackItem(),a={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(Fr,{htmlFor:`feedback-${e}`,children:a[e],...t})},kr=i.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Ri=t=>{const{name:e,focusItem:a}=V.useFeedbackItem();return n.jsx(kr,{ref:a,name:`${e}:description`,...t})},Wi=i.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),Ir=i.ikp("div",{_id:"aiChatForm__Wrapper"}),Ni=t=>{const{form:e}=A.useChatForm();return e?n.jsx(Ir,{...t}):null},Mr=i.ikp("form",{_id:"aiChatForm"}),$i=t=>{const{onSubmit:e,...a}=t,{handleSubmit:r,isSuccess:s}=A.useChatForm();return s?null:n.jsx(Mr,{onSubmit:C.composeEventHandlers(e,r),...a})},Sr=i.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Qi=t=>{const{onClick:e,...a}=t,{closeForm:r}=A.useChatForm();return n.jsx(Sr,{onClick:C.composeEventHandlers(e,r),...a})},Vi=i.ikp("div",{_id:"aiChatForm__Header"}),xr=i.ikp("h2",{_id:"aiChatForm__Heading"}),Ui=t=>{const{form:e}=A.useChatForm();return e?.heading?n.jsx(xr,{children:e.heading,...t}):null},fr=i.ikp("span",{_id:"aiChatForm__Description"}),Ki=t=>{const{form:e}=A.useChatForm();return e?.description?n.jsx(fr,{children:e.description,...t}):null},Br=i.ikp("div",{_id:"aiChatForm__Content"}),zi=t=>{const{children:e,...a}=t,{fields:r=[]}=A.useChatForm();return n.jsx(Br,{children:h.maybeRender(e,r),...a})},Tr=i.ikp("div",{_id:"aiChatForm__Field"}),Gi=t=>{const{field:e,autoFocus:a,...r}=t,{control:s,errors:o}=A.useChatForm();return n.jsx(La.Controller,{name:e.name,control:s,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const c=d.value!==void 0||e.inputType==="file";return n.jsx(B.FormFieldProvider,{"data-invalid":h.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:a,children:c&&n.jsx(Tr,{"data-input-type":e.inputType,"data-hidden":h.dataAttr(e.isHidden),...r})})}})},jr=i.ikp("label",{_id:"aiChatForm__FieldLabel"}),Yi=t=>{const{field:e}=B.useFormField();return n.jsx(jr,{"data-required":h.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},yr=i.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),Y=t=>{const{field:e,error:a,fieldProps:{onChange:r,onBlur:s,...o},autoFocus:d}=B.useFormField(),{onChange:c,onBlur:m,...l}=t;return n.jsx(yr,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":h.dataAttr(!!a),onChange:C.composeEventHandlers(c,r),onBlur:C.composeEventHandlers(m,s),...o,...l})},Ji=i.ikp(Y,{_id:"aiChatForm__FieldEmail",type:"email"}),Hr=i.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Xi=t=>{const{field:e,error:a,fieldProps:{value:r,onChange:s,onBlur:o,...d},autoFocus:c}=B.useFormField(),{onChange:m,onBlur:l,...p}=t,v=k=>{const j=k.target.files;s(j)};return n.jsx(Hr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":h.dataAttr(!!a),...p,...d,onChange:C.composeEventHandlers(m,v),onBlur:C.composeEventHandlers(l,o)})},Zi=i.ikp(Y,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ae,{maxRows:8})}),wr=i.ikp(U.Root,{_id:"aiChatForm__FieldCheckbox"}),ea=t=>{const{field:e,error:a,fieldProps:r,autoFocus:s}=B.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(wr,{id:e.name,name:e.name,autoFocus:s,"data-invalid":h.dataAttr(!!a),checked:r.value,onCheckedChange:C.composeEventHandlers(o,r.onChange),...d})},ta=i.ikp(U.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Lr=i.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),ia=t=>{const{field:e,error:a,fieldProps:r}=B.useFormField(),{onValueChange:s,...o}=t;return n.jsx(Lr,{name:e.name,"data-invalid":h.dataAttr(!!a),value:r.value,onValueChange:C.composeEventHandlers(s,r.onChange),...o})},aa=i.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),Dr=i.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),na=t=>{const{field:e}=B.useFormField();return n.jsx(Dr,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ra=i.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),sa=i.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),oa=i.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),da=i.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ca=i.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),ma=i.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),qr=i.ikp("span",{_id:"aiChatForm__FieldError"}),la=t=>{const{error:e}=B.useFormField();return e?n.jsx(qr,{children:e.message?.toString(),...t}):null},Or=i.ikp("span",{_id:"aiChatForm__Error"}),ha=t=>{const{formError:e}=A.useChatForm();return e?n.jsx(Or,{children:e.message,...t}):null},Ca=i.ikp("div",{_id:"aiChatForm__Footer"}),Rr=i.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),ua=t=>{const{onClick:e,...a}=t,{closeForm:r}=A.useChatForm();return n.jsx(Rr,{onClick:C.composeEventHandlers(e,r),...a})},Wr=i.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),pa=t=>{const{onClick:e,...a}=t,{isSubmitting:r}=A.useChatForm();return n.jsx(Wr,{disabled:r,...a})},Nr=i.ikp("div",{_id:"aiChatForm__Success"}),va=t=>{const{isSuccess:e}=A.useChatForm();return e?n.jsx(Nr,{...t}):null},$r=i.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),ba=t=>{const{form:e}=A.useChatForm();return n.jsx($r,{children:e?.successView.heading,...t})},Qr=i.ikp(ne.Markdown,{_id:"aiChatForm__SuccessMessage"}),ga=t=>{const{form:e}=A.useChatForm();return n.jsx(Qr,{children:e?.successView.message,...t})},Vr=i.ikp("button",{_id:"aiChatForm__SuccessButton"}),Pa=t=>{const{onClick:e,...a}=t,{form:r,closeForm:s}=A.useChatForm(),o=r?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx(Vr,{onClick:C.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[d,c]}),...a})};exports.Provider=b.ChatProvider;exports.ActionBar=pi;exports.Actions=vi;exports.AttachmentsBar=Dt;exports.AttachmentsBarActions=$t;exports.AttachmentsBarAttachment=Ot;exports.AttachmentsBarAttachmentDelete=Nt;exports.AttachmentsBarAttachmentIcon=Rt;exports.AttachmentsBarAttachmentTitle=Wt;exports.AttachmentsBarForm=ri;exports.AttachmentsBarFormContent=mi;exports.AttachmentsBarFormContentError=Ci;exports.AttachmentsBarFormContentInput=hi;exports.AttachmentsBarFormContentLabel=li;exports.AttachmentsBarFormSubmitButton=ui;exports.AttachmentsBarFormTitle=si;exports.AttachmentsBarFormTitleError=ci;exports.AttachmentsBarFormTitleInput=di;exports.AttachmentsBarFormTitleLabel=oi;exports.AttachmentsBarInfoTip=Qt;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Vt;exports.AttachmentsBarInfoTipText=Ut;exports.AttachmentsBarInput=zt;exports.AttachmentsBarInputIcon=Gt;exports.AttachmentsBarInputs=Kt;exports.AttachmentsBarList=qt;exports.AttachmentsBarModal=Yt;exports.AttachmentsBarModalBody=ni;exports.AttachmentsBarModalClose=ai;exports.AttachmentsBarModalContent=Xt;exports.AttachmentsBarModalDescription=ti;exports.AttachmentsBarModalHeader=Zt;exports.AttachmentsBarModalHeading=ei;exports.AttachmentsBarModalHelp=ii;exports.AttachmentsBarModalOverlay=Jt;exports.ChatAction=G;exports.ChatActionFeedback=Ai;exports.ChatActionLabel=le;exports.ChatHelpAction=Fi;exports.Content=Ie;exports.ContentScrollArea=Me;exports.ContentScrollAreaCorner=Be;exports.ContentScrollAreaScrollbar=xe;exports.ContentScrollAreaThumb=fe;exports.ContentScrollAreaViewport=Se;exports.ConversationLoading=_e;exports.Disclaimer=je;exports.DisclaimerArrow=De;exports.DisclaimerContent=we;exports.DisclaimerLabel=ye;exports.DisclaimerText=Le;exports.DisclaimerTrigger=He;exports.EmbeddedChatPrimitiveActionBar=pi;exports.EmbeddedChatPrimitiveActions=vi;exports.EmbeddedChatPrimitiveAttachmentsBar=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=$t;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=Ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=hi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=ui;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=oi;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInput=zt;exports.EmbeddedChatPrimitiveAttachmentsBarInputIcon=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarList=qt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ni;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ai;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=ii;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=Jt;exports.EmbeddedChatPrimitiveChatAction=G;exports.EmbeddedChatPrimitiveChatActionFeedback=Ai;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Fi;exports.EmbeddedChatPrimitiveContent=Ie;exports.EmbeddedChatPrimitiveContentScrollArea=Me;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Be;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=xe;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=fe;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Se;exports.EmbeddedChatPrimitiveConversationLoading=_e;exports.EmbeddedChatPrimitiveDisclaimer=je;exports.EmbeddedChatPrimitiveDisclaimerArrow=De;exports.EmbeddedChatPrimitiveDisclaimerContent=we;exports.EmbeddedChatPrimitiveDisclaimerLabel=ye;exports.EmbeddedChatPrimitiveDisclaimerText=Le;exports.EmbeddedChatPrimitiveDisclaimerTrigger=He;exports.EmbeddedChatPrimitiveExampleQuestion=We;exports.EmbeddedChatPrimitiveExampleQuestionButton=Ne;exports.EmbeddedChatPrimitiveExampleQuestions=qe;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=Oe;exports.EmbeddedChatPrimitiveExampleQuestionsList=Re;exports.EmbeddedChatPrimitiveFeedbackForm=wi;exports.EmbeddedChatPrimitiveFeedbackItem=Li;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Di;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=qi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Ri;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Oi;exports.EmbeddedChatPrimitiveFeedbackModal=fi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Hi;exports.EmbeddedChatPrimitiveFeedbackModalClose=yi;exports.EmbeddedChatPrimitiveFeedbackModalContent=Ti;exports.EmbeddedChatPrimitiveFeedbackModalHeader=ji;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Bi;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Wi;exports.EmbeddedChatPrimitiveFooter=Tt;exports.EmbeddedChatPrimitiveForm=$i;exports.EmbeddedChatPrimitiveFormCancel=ua;exports.EmbeddedChatPrimitiveFormClose=Qi;exports.EmbeddedChatPrimitiveFormContent=zi;exports.EmbeddedChatPrimitiveFormDescription=Ki;exports.EmbeddedChatPrimitiveFormError=ha;exports.EmbeddedChatPrimitiveFormField=Gi;exports.EmbeddedChatPrimitiveFormFieldCheckbox=ea;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=ta;exports.EmbeddedChatPrimitiveFormFieldEmail=Ji;exports.EmbeddedChatPrimitiveFormFieldError=la;exports.EmbeddedChatPrimitiveFormFieldFile=Xi;exports.EmbeddedChatPrimitiveFormFieldLabel=Yi;exports.EmbeddedChatPrimitiveFormFieldSelect=ia;exports.EmbeddedChatPrimitiveFormFieldSelectContent=sa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ra;exports.EmbeddedChatPrimitiveFormFieldSelectItem=da;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=ma;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ca;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=aa;exports.EmbeddedChatPrimitiveFormFieldSelectValue=na;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=oa;exports.EmbeddedChatPrimitiveFormFieldText=Y;exports.EmbeddedChatPrimitiveFormFieldTextArea=Zi;exports.EmbeddedChatPrimitiveFormFooter=Ca;exports.EmbeddedChatPrimitiveFormHeader=Vi;exports.EmbeddedChatPrimitiveFormHeading=Ui;exports.EmbeddedChatPrimitiveFormSubmit=pa;exports.EmbeddedChatPrimitiveFormSuccess=va;exports.EmbeddedChatPrimitiveFormSuccessButton=Pa;exports.EmbeddedChatPrimitiveFormSuccessHeading=ba;exports.EmbeddedChatPrimitiveFormSuccessMessage=ga;exports.EmbeddedChatPrimitiveFormWrapper=Ni;exports.EmbeddedChatPrimitiveHeaderToolbar=Ee;exports.EmbeddedChatPrimitiveHelpActions=Ei;exports.EmbeddedChatPrimitiveHelpActionsMenu=Ii;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Mi;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=Si;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=xi;exports.EmbeddedChatPrimitiveHelpActionsTrigger=ki;exports.EmbeddedChatPrimitiveInput=Ht;exports.EmbeddedChatPrimitiveInputFieldset=jt;exports.EmbeddedChatPrimitiveInputGroup=yt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=ze;exports.EmbeddedChatPrimitiveMessage=pt;exports.EmbeddedChatPrimitiveMessageAction=Pt;exports.EmbeddedChatPrimitiveMessageActions=vt;exports.EmbeddedChatPrimitiveMessageAttachments=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=dt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=ut;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=Ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=mt;exports.EmbeddedChatPrimitiveMessageAvatar=Je;exports.EmbeddedChatPrimitiveMessageAvatarContent=Xe;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Ze;exports.EmbeddedChatPrimitiveMessageAvatarImage=et;exports.EmbeddedChatPrimitiveMessageContent=at;exports.EmbeddedChatPrimitiveMessageContentWrapper=it;exports.EmbeddedChatPrimitiveMessageHeader=Ge;exports.EmbeddedChatPrimitiveMessageLoading=Ye;exports.EmbeddedChatPrimitiveMessageName=tt;exports.EmbeddedChatPrimitiveMessageSourceItem=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=kt;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=xt;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=ft;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=It;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=Bt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=St;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=Mt;exports.EmbeddedChatPrimitiveMessageSources=_t;exports.EmbeddedChatPrimitiveMessageSourcesHeader=At;exports.EmbeddedChatPrimitiveMessageSourcesList=Et;exports.EmbeddedChatPrimitiveMessageToolAction=gt;exports.EmbeddedChatPrimitiveMessageToolActions=bt;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=Te;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=wt;exports.EmbeddedChatPrimitiveSendButtonIcon=Lt;exports.EmbeddedChatPrimitiveTaglineBrandName=_i;exports.EmbeddedChatPrimitiveTaglineContainer=bi;exports.EmbeddedChatPrimitiveTaglineLogo=Pi;exports.EmbeddedChatPrimitiveTaglineText=gi;exports.EmbeddedChatPrimitiveToolbarHeader=ke;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ue;exports.EmbeddedChatPrimitiveWorkflowIcon=Ke;exports.EmbeddedChatPrimitiveWorkflows=$e;exports.EmbeddedChatPrimitiveWorkflowsLabel=Qe;exports.EmbeddedChatPrimitiveWorkflowsList=Ve;exports.EmbeddedChatPrimitiveWrapper=Pe;exports.ExampleQuestion=We;exports.ExampleQuestionButton=Ne;exports.ExampleQuestions=qe;exports.ExampleQuestionsLabel=Oe;exports.ExampleQuestionsList=Re;exports.FeedbackForm=wi;exports.FeedbackItem=Li;exports.FeedbackItemCheckbox=Di;exports.FeedbackItemCheckboxIndicator=qi;exports.FeedbackItemDescription=Ri;exports.FeedbackItemLabel=Oi;exports.FeedbackModal=fi;exports.FeedbackModalBody=Hi;exports.FeedbackModalClose=yi;exports.FeedbackModalContent=Ti;exports.FeedbackModalHeader=ji;exports.FeedbackModalOverlay=Bi;exports.FeedbackSubmitButton=Wi;exports.Footer=Tt;exports.Form=$i;exports.FormCancel=ua;exports.FormClose=Qi;exports.FormContent=zi;exports.FormDescription=Ki;exports.FormError=ha;exports.FormField=Gi;exports.FormFieldCheckbox=ea;exports.FormFieldCheckboxIndicator=ta;exports.FormFieldEmail=Ji;exports.FormFieldError=la;exports.FormFieldFile=Xi;exports.FormFieldLabel=Yi;exports.FormFieldSelect=ia;exports.FormFieldSelectContent=sa;exports.FormFieldSelectIcon=ra;exports.FormFieldSelectItem=da;exports.FormFieldSelectItemIndicator=ma;exports.FormFieldSelectItemText=ca;exports.FormFieldSelectTrigger=aa;exports.FormFieldSelectValue=na;exports.FormFieldSelectViewport=oa;exports.FormFieldText=Y;exports.FormFieldTextArea=Zi;exports.FormFooter=Ca;exports.FormHeader=Vi;exports.FormHeading=Ui;exports.FormSubmit=pa;exports.FormSuccess=va;exports.FormSuccessButton=Pa;exports.FormSuccessHeading=ba;exports.FormSuccessMessage=ga;exports.FormWrapper=Ni;exports.Header=Ua;exports.HeaderToolbar=Ee;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=Ei;exports.HelpActionsMenu=Ii;exports.HelpActionsMenuArrow=Mi;exports.HelpActionsMenuItem=Si;exports.HelpActionsMenuItemIcon=xi;exports.HelpActionsTrigger=ki;exports.Input=Ht;exports.InputFieldset=jt;exports.InputGroup=yt;exports.IntroMessageWrapper=ze;exports.Message=pt;exports.MessageAction=Pt;exports.MessageActions=vt;exports.MessageAttachments=nt;exports.MessageAttachmentsItem=st;exports.MessageAttachmentsItemIcon=ot;exports.MessageAttachmentsItemTitle=dt;exports.MessageAttachmentsList=rt;exports.MessageAttachmentsPreview=ct;exports.MessageAttachmentsPreviewBody=ut;exports.MessageAttachmentsPreviewClose=Ct;exports.MessageAttachmentsPreviewContent=lt;exports.MessageAttachmentsPreviewHeader=ht;exports.MessageAttachmentsPreviewOverlay=mt;exports.MessageAvatar=Je;exports.MessageAvatarContent=Xe;exports.MessageAvatarFallback=Ze;exports.MessageAvatarImage=et;exports.MessageContent=at;exports.MessageContentWrapper=it;exports.MessageHeader=Ge;exports.MessageLoading=Ye;exports.MessageName=tt;exports.MessageSourceItem=Ft;exports.MessageSourceItemBreadcrumbIcon=Ln;exports.MessageSourceItemBreadcrumbs=kt;exports.MessageSourceItemDescription=xt;exports.MessageSourceItemDescriptionPart=ft;exports.MessageSourceItemIcon=It;exports.MessageSourceItemIndicator=Bt;exports.MessageSourceItemTag=St;exports.MessageSourceItemTitle=Mt;exports.MessageSources=_t;exports.MessageSourcesHeader=At;exports.MessageSourcesList=Et;exports.MessageToolAction=gt;exports.MessageToolActions=bt;exports.MessageWrapper=ce;exports.Messages=Te;exports.Root=Ae;exports.SendButton=wt;exports.SendButtonIcon=Lt;exports.TaglineBrandName=_i;exports.TaglineContainer=bi;exports.TaglineLogo=Pi;exports.TaglineText=gi;exports.ToolbarHeader=ke;exports.Workflow=Ue;exports.WorkflowIcon=Ke;exports.Workflows=$e;exports.WorkflowsLabel=Qe;exports.WorkflowsList=Ve;exports.Wrapper=Pe;
17
+ `);J(N)},share:async()=>{const N={visibility:"public",tags:[],userProperties:{},messages:p.messages.map(S=>({...S,createdAt:void 0,updatedAt:void 0,id:Date.now().toString()+S.id,conversationId:void 0}))},{apiKey:y,analyticsApiBaseUrl:L}=k,M=await Ra.logConversation("",N,y,L);if(M){const $=`${v.shareChatUrlBasePath}?${D.SHARE_QUERY_PARAM}=${M?.id}`;X($),j({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:$,conversation:M}})}},clear:o,stop:d},ue={copy:R,share:W};return n.jsx(T.Tooltip,{delayDuration:0,open:ue[e],children:n.jsx(mr,{"data-type":e,"data-copied":h.dataAttr(R||W),className:`${r} ${e}`,children:n.jsx(le,{action:e}),onClick:C.composeEventHandlers(a,ee[e]),...s})})},lr=i.ikp(T.Trigger,{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...a}=t,{aiChatSettings:r}=u.useInkeepConfig(),s=r.toolbarButtonLabels??{},o={help:s.getHelp??"Get Help",copy:s.copyChat??"Copy",share:s.share??"Share",clear:s.clear??"Clear",stop:s.stop??"Stop"};return n.jsx(lr,{children:o[e],...a})},hr=i.ikp(T.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),Ai=t=>{const{action:e,children:a,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(hr,{sideOffset:5,...r,children:[n.jsx(T.Arrow,{}),a||s[e]]})},Cr=i.ikp(K.Root,{_id:"aiChatHelpActions"}),Ei=t=>{const{children:e,...a}=t,{aiChatSettings:r}=u.useInkeepConfig(),{getHelpOptions:s}=r;if(!s||(s??[]).length===0)return null;const{_pinned:o,_unpinned:d}=s.reduce((p,v)=>{const k=v.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[k]:[...p[k],v]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,l=ie.useHelpMenuState();return n.jsx(ie.HelpMenuProvider,{value:l,children:n.jsx(Cr,{open:l.open,onOpenChange:l.setOpen,children:h.maybeRender(e,{pinned:c,unpinned:m}),...a})})},ur=i.ikp(G,{_id:"aiChatHelpAction",action:"help"}),pr=i.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),Fi=t=>{const{action:e,onClick:a,...r}=t,{handleAction:s,logHelpAction:o}=se.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:C.composeEventHandlers(a,()=>{s(),o()}),...r};return d==="open_link"?n.jsx(pr,{href:e.action.url,...c}):n.jsx(ur,{...c})},vr=i.ikp(K.Trigger,{_id:"aiChatHelpActions__Trigger"}),ki=g.memo(t=>{const{aiChatSettings:e}=u.useInkeepConfig();return n.jsx(G,{action:"help",...t,asChild:!0,children:n.jsx(vr,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),br=i.ikp(K.Content,{_id:"aiChatHelpActions__Menu"}),Ii=t=>n.jsx(br,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Mi=i.ikp(K.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),Si=t=>{const{action:e,onClick:a,...r}=t,{handleAction:s,logHelpAction:o}=se.useChatAction(e),{setOpen:d}=ie.useHelpMenu(),c=()=>{s({onOpenForm:()=>d(!1)}),o()},m=e.action.type,l=i.ikp(m==="open_link"?"a":"button",{_id:"aiChatHelpActions__MenuItem",children:e.name,"aria-label":e.name,"data-name":e.name,"data-type":e.action.type,...m==="open_link"&&{href:e.action.url,target:"_blank",rel:"noopener"},onClick:C.composeEventHandlers(a,c)});return n.jsx(l,{...r})},gr=i.ikp(x.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),xi=t=>{const{action:e,...a}=t;return e.icon?n.jsx(gr,{iconSettings:e.icon,...a}):null},Pr=i.ikp(_.Root,{_id:"aiChatFeedbackModal"}),fi=t=>{const{onOpenChange:e,...a}=t,{currentFeedback:r,setCurrentFeedback:s}=re.useMessageFeedback();return n.jsx(Pr,{open:r!==null,onOpenChange:C.composeEventHandlers(e,()=>s(null)),...a})},Bi=i.ikp(_.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),Ti=i.ikp(_.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),ji=i.ikp(_.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),yi=i.ikp(_.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Hi=i.ikp("div",{_id:"aiChatFeedbackModal__Body"}),_r=i.ikp("form",{_id:"aiChatFeedbackForm"}),wi=t=>{const{onSubmit:e,...a}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:o}=re.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,l=new FormData(m),p=Object.fromEntries(l.entries());s&&(r(s,p),o(null))};return n.jsx(_r,{onSubmit:C.composeEventHandlers(e,d),...a})},Ar=i.ikp("div",{_id:"aiChatFeedbackItem"}),Li=t=>{const{name:e,...a}=t;return n.jsx(V.FeedbackItemProvider,{name:e,children:n.jsx(Ar,{...a})})},Er=i.ikp(U.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Di=t=>{const{name:e,focusItem:a}=V.useFeedbackItem(),{onCheckedChange:r,...s}=t,o=d=>{d&&a?.current?.focus()};return n.jsx(Er,{id:`feedback-${e}`,name:e,onCheckedChange:C.composeEventHandlers(r,o),...s})},qi=i.ikp(U.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Fr=i.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Oi=t=>{const{name:e}=V.useFeedbackItem(),a={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(Fr,{htmlFor:`feedback-${e}`,children:a[e],...t})},kr=i.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Ri=t=>{const{name:e,focusItem:a}=V.useFeedbackItem();return n.jsx(kr,{ref:a,name:`${e}:description`,...t})},Wi=i.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),Ir=i.ikp("div",{_id:"aiChatForm__Wrapper"}),Ni=t=>{const{form:e}=A.useChatForm();return e?n.jsx(Ir,{...t}):null},Mr=i.ikp("form",{_id:"aiChatForm"}),$i=t=>{const{onSubmit:e,...a}=t,{handleSubmit:r,isSuccess:s}=A.useChatForm();return s?null:n.jsx(Mr,{onSubmit:C.composeEventHandlers(e,r),...a})},Sr=i.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Qi=t=>{const{onClick:e,...a}=t,{closeForm:r}=A.useChatForm();return n.jsx(Sr,{onClick:C.composeEventHandlers(e,r),...a})},Vi=i.ikp("div",{_id:"aiChatForm__Header"}),xr=i.ikp("h2",{_id:"aiChatForm__Heading"}),Ui=t=>{const{form:e}=A.useChatForm();return e?.heading?n.jsx(xr,{children:e.heading,...t}):null},fr=i.ikp("span",{_id:"aiChatForm__Description"}),Ki=t=>{const{form:e}=A.useChatForm();return e?.description?n.jsx(fr,{children:e.description,...t}):null},Br=i.ikp("div",{_id:"aiChatForm__Content"}),zi=t=>{const{children:e,...a}=t,{fields:r=[]}=A.useChatForm();return n.jsx(Br,{children:h.maybeRender(e,r),...a})},Tr=i.ikp("div",{_id:"aiChatForm__Field"}),Gi=t=>{const{field:e,autoFocus:a,...r}=t,{control:s,errors:o}=A.useChatForm();return n.jsx(La.Controller,{name:e.name,control:s,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const c=d.value!==void 0||e.inputType==="file";return n.jsx(B.FormFieldProvider,{"data-invalid":h.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:a,children:c&&n.jsx(Tr,{"data-input-type":e.inputType,"data-hidden":h.dataAttr(e.isHidden),...r})})}})},jr=i.ikp("label",{_id:"aiChatForm__FieldLabel"}),Yi=t=>{const{field:e}=B.useFormField();return n.jsx(jr,{"data-required":h.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},yr=i.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),Y=t=>{const{field:e,error:a,fieldProps:{onChange:r,onBlur:s,...o},autoFocus:d}=B.useFormField(),{onChange:c,onBlur:m,...l}=t;return n.jsx(yr,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":h.dataAttr(!!a),onChange:C.composeEventHandlers(c,r),onBlur:C.composeEventHandlers(m,s),...o,...l})},Ji=i.ikp(Y,{_id:"aiChatForm__FieldEmail",type:"email"}),Hr=i.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Xi=t=>{const{field:e,error:a,fieldProps:{value:r,onChange:s,onBlur:o,...d},autoFocus:c}=B.useFormField(),{onChange:m,onBlur:l,...p}=t,v=k=>{const j=k.target.files;s(j)};return n.jsx(Hr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":h.dataAttr(!!a),...p,...d,onChange:C.composeEventHandlers(m,v),onBlur:C.composeEventHandlers(l,o)})},Zi=i.ikp(Y,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ae,{maxRows:8})}),wr=i.ikp(U.Root,{_id:"aiChatForm__FieldCheckbox"}),ea=t=>{const{field:e,error:a,fieldProps:r,autoFocus:s}=B.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(wr,{id:e.name,name:e.name,autoFocus:s,"data-invalid":h.dataAttr(!!a),checked:r.value,onCheckedChange:C.composeEventHandlers(o,r.onChange),...d})},ta=i.ikp(U.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Lr=i.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),ia=t=>{const{field:e,error:a,fieldProps:r}=B.useFormField(),{onValueChange:s,...o}=t;return n.jsx(Lr,{name:e.name,"data-invalid":h.dataAttr(!!a),value:r.value,onValueChange:C.composeEventHandlers(s,r.onChange),...o})},aa=i.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),Dr=i.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),na=t=>{const{field:e}=B.useFormField();return n.jsx(Dr,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ra=i.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),sa=i.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),oa=i.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),da=i.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ca=i.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),ma=i.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),qr=i.ikp("span",{_id:"aiChatForm__FieldError"}),la=t=>{const{error:e}=B.useFormField();return e?n.jsx(qr,{children:e.message?.toString(),...t}):null},Or=i.ikp("span",{_id:"aiChatForm__Error"}),ha=t=>{const{formError:e}=A.useChatForm();return e?n.jsx(Or,{children:e.message,...t}):null},Ca=i.ikp("div",{_id:"aiChatForm__Footer"}),Rr=i.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),ua=t=>{const{onClick:e,...a}=t,{closeForm:r}=A.useChatForm();return n.jsx(Rr,{onClick:C.composeEventHandlers(e,r),...a})},Wr=i.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),pa=t=>{const{onClick:e,...a}=t,{isSubmitting:r}=A.useChatForm();return n.jsx(Wr,{disabled:r,...a})},Nr=i.ikp("div",{_id:"aiChatForm__Success"}),va=t=>{const{isSuccess:e}=A.useChatForm();return e?n.jsx(Nr,{...t}):null},$r=i.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),ba=t=>{const{form:e}=A.useChatForm();return n.jsx($r,{children:e?.successView.heading,...t})},Qr=i.ikp(ne.Markdown,{_id:"aiChatForm__SuccessMessage"}),ga=t=>{const{form:e}=A.useChatForm();return n.jsx(Qr,{children:e?.successView.message,...t})},Vr=i.ikp("button",{_id:"aiChatForm__SuccessButton"}),Pa=t=>{const{onClick:e,...a}=t,{form:r,closeForm:s}=A.useChatForm(),o=r?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx(Vr,{onClick:C.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[d,c]}),...a})};exports.Provider=b.ChatProvider;exports.ActionBar=pi;exports.Actions=vi;exports.AttachmentsBar=Dt;exports.AttachmentsBarActions=$t;exports.AttachmentsBarAttachment=Ot;exports.AttachmentsBarAttachmentDelete=Nt;exports.AttachmentsBarAttachmentIcon=Rt;exports.AttachmentsBarAttachmentTitle=Wt;exports.AttachmentsBarForm=ri;exports.AttachmentsBarFormContent=mi;exports.AttachmentsBarFormContentError=Ci;exports.AttachmentsBarFormContentInput=hi;exports.AttachmentsBarFormContentLabel=li;exports.AttachmentsBarFormSubmitButton=ui;exports.AttachmentsBarFormTitle=si;exports.AttachmentsBarFormTitleError=ci;exports.AttachmentsBarFormTitleInput=di;exports.AttachmentsBarFormTitleLabel=oi;exports.AttachmentsBarInfoTip=Qt;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Vt;exports.AttachmentsBarInfoTipText=Ut;exports.AttachmentsBarInput=zt;exports.AttachmentsBarInputIcon=Gt;exports.AttachmentsBarInputs=Kt;exports.AttachmentsBarList=qt;exports.AttachmentsBarModal=Yt;exports.AttachmentsBarModalBody=ni;exports.AttachmentsBarModalClose=ai;exports.AttachmentsBarModalContent=Xt;exports.AttachmentsBarModalDescription=ti;exports.AttachmentsBarModalHeader=Zt;exports.AttachmentsBarModalHeading=ei;exports.AttachmentsBarModalHelp=ii;exports.AttachmentsBarModalOverlay=Jt;exports.ChatAction=G;exports.ChatActionFeedback=Ai;exports.ChatActionLabel=le;exports.ChatHelpAction=Fi;exports.Content=Ie;exports.ContentScrollArea=Me;exports.ContentScrollAreaCorner=Be;exports.ContentScrollAreaScrollbar=xe;exports.ContentScrollAreaThumb=fe;exports.ContentScrollAreaViewport=Se;exports.ConversationLoading=_e;exports.Disclaimer=je;exports.DisclaimerArrow=De;exports.DisclaimerContent=we;exports.DisclaimerLabel=ye;exports.DisclaimerText=Le;exports.DisclaimerTrigger=He;exports.EmbeddedChatPrimitiveActionBar=pi;exports.EmbeddedChatPrimitiveActions=vi;exports.EmbeddedChatPrimitiveAttachmentsBar=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=$t;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=Ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=hi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=ui;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=oi;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInput=zt;exports.EmbeddedChatPrimitiveAttachmentsBarInputIcon=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarList=qt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ni;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ai;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=ii;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=Jt;exports.EmbeddedChatPrimitiveChatAction=G;exports.EmbeddedChatPrimitiveChatActionFeedback=Ai;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Fi;exports.EmbeddedChatPrimitiveContent=Ie;exports.EmbeddedChatPrimitiveContentScrollArea=Me;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Be;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=xe;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=fe;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Se;exports.EmbeddedChatPrimitiveConversationLoading=_e;exports.EmbeddedChatPrimitiveDisclaimer=je;exports.EmbeddedChatPrimitiveDisclaimerArrow=De;exports.EmbeddedChatPrimitiveDisclaimerContent=we;exports.EmbeddedChatPrimitiveDisclaimerLabel=ye;exports.EmbeddedChatPrimitiveDisclaimerText=Le;exports.EmbeddedChatPrimitiveDisclaimerTrigger=He;exports.EmbeddedChatPrimitiveExampleQuestion=We;exports.EmbeddedChatPrimitiveExampleQuestionButton=Ne;exports.EmbeddedChatPrimitiveExampleQuestions=qe;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=Oe;exports.EmbeddedChatPrimitiveExampleQuestionsList=Re;exports.EmbeddedChatPrimitiveFeedbackForm=wi;exports.EmbeddedChatPrimitiveFeedbackItem=Li;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Di;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=qi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Ri;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Oi;exports.EmbeddedChatPrimitiveFeedbackModal=fi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Hi;exports.EmbeddedChatPrimitiveFeedbackModalClose=yi;exports.EmbeddedChatPrimitiveFeedbackModalContent=Ti;exports.EmbeddedChatPrimitiveFeedbackModalHeader=ji;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Bi;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Wi;exports.EmbeddedChatPrimitiveFooter=Tt;exports.EmbeddedChatPrimitiveForm=$i;exports.EmbeddedChatPrimitiveFormCancel=ua;exports.EmbeddedChatPrimitiveFormClose=Qi;exports.EmbeddedChatPrimitiveFormContent=zi;exports.EmbeddedChatPrimitiveFormDescription=Ki;exports.EmbeddedChatPrimitiveFormError=ha;exports.EmbeddedChatPrimitiveFormField=Gi;exports.EmbeddedChatPrimitiveFormFieldCheckbox=ea;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=ta;exports.EmbeddedChatPrimitiveFormFieldEmail=Ji;exports.EmbeddedChatPrimitiveFormFieldError=la;exports.EmbeddedChatPrimitiveFormFieldFile=Xi;exports.EmbeddedChatPrimitiveFormFieldLabel=Yi;exports.EmbeddedChatPrimitiveFormFieldSelect=ia;exports.EmbeddedChatPrimitiveFormFieldSelectContent=sa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ra;exports.EmbeddedChatPrimitiveFormFieldSelectItem=da;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=ma;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ca;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=aa;exports.EmbeddedChatPrimitiveFormFieldSelectValue=na;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=oa;exports.EmbeddedChatPrimitiveFormFieldText=Y;exports.EmbeddedChatPrimitiveFormFieldTextArea=Zi;exports.EmbeddedChatPrimitiveFormFooter=Ca;exports.EmbeddedChatPrimitiveFormHeader=Vi;exports.EmbeddedChatPrimitiveFormHeading=Ui;exports.EmbeddedChatPrimitiveFormSubmit=pa;exports.EmbeddedChatPrimitiveFormSuccess=va;exports.EmbeddedChatPrimitiveFormSuccessButton=Pa;exports.EmbeddedChatPrimitiveFormSuccessHeading=ba;exports.EmbeddedChatPrimitiveFormSuccessMessage=ga;exports.EmbeddedChatPrimitiveFormWrapper=Ni;exports.EmbeddedChatPrimitiveHeaderToolbar=Ee;exports.EmbeddedChatPrimitiveHelpActions=Ei;exports.EmbeddedChatPrimitiveHelpActionsMenu=Ii;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Mi;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=Si;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=xi;exports.EmbeddedChatPrimitiveHelpActionsTrigger=ki;exports.EmbeddedChatPrimitiveInput=Ht;exports.EmbeddedChatPrimitiveInputFieldset=jt;exports.EmbeddedChatPrimitiveInputGroup=yt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=ze;exports.EmbeddedChatPrimitiveMessage=pt;exports.EmbeddedChatPrimitiveMessageAction=Pt;exports.EmbeddedChatPrimitiveMessageAttachments=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=dt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=ut;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=Ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=mt;exports.EmbeddedChatPrimitiveMessageAvatar=Je;exports.EmbeddedChatPrimitiveMessageAvatarContent=Xe;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Ze;exports.EmbeddedChatPrimitiveMessageAvatarImage=et;exports.EmbeddedChatPrimitiveMessageContent=at;exports.EmbeddedChatPrimitiveMessageContentWrapper=it;exports.EmbeddedChatPrimitiveMessageHeader=Ge;exports.EmbeddedChatPrimitiveMessageLoading=Ye;exports.EmbeddedChatPrimitiveMessageName=tt;exports.EmbeddedChatPrimitiveMessageSourceItem=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=kt;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=xt;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=ft;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=It;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=Bt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=St;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=Mt;exports.EmbeddedChatPrimitiveMessageSources=_t;exports.EmbeddedChatPrimitiveMessageSourcesHeader=At;exports.EmbeddedChatPrimitiveMessageSourcesList=Et;exports.EmbeddedChatPrimitiveMessageToolAction=gt;exports.EmbeddedChatPrimitiveMessageToolActions=bt;exports.EmbeddedChatPrimitiveMessageToolbar=vt;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=Te;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=wt;exports.EmbeddedChatPrimitiveSendButtonIcon=Lt;exports.EmbeddedChatPrimitiveTaglineBrandName=_i;exports.EmbeddedChatPrimitiveTaglineContainer=bi;exports.EmbeddedChatPrimitiveTaglineLogo=Pi;exports.EmbeddedChatPrimitiveTaglineText=gi;exports.EmbeddedChatPrimitiveToolbarHeader=ke;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ue;exports.EmbeddedChatPrimitiveWorkflowIcon=Ke;exports.EmbeddedChatPrimitiveWorkflows=$e;exports.EmbeddedChatPrimitiveWorkflowsLabel=Qe;exports.EmbeddedChatPrimitiveWorkflowsList=Ve;exports.EmbeddedChatPrimitiveWrapper=Pe;exports.ExampleQuestion=We;exports.ExampleQuestionButton=Ne;exports.ExampleQuestions=qe;exports.ExampleQuestionsLabel=Oe;exports.ExampleQuestionsList=Re;exports.FeedbackForm=wi;exports.FeedbackItem=Li;exports.FeedbackItemCheckbox=Di;exports.FeedbackItemCheckboxIndicator=qi;exports.FeedbackItemDescription=Ri;exports.FeedbackItemLabel=Oi;exports.FeedbackModal=fi;exports.FeedbackModalBody=Hi;exports.FeedbackModalClose=yi;exports.FeedbackModalContent=Ti;exports.FeedbackModalHeader=ji;exports.FeedbackModalOverlay=Bi;exports.FeedbackSubmitButton=Wi;exports.Footer=Tt;exports.Form=$i;exports.FormCancel=ua;exports.FormClose=Qi;exports.FormContent=zi;exports.FormDescription=Ki;exports.FormError=ha;exports.FormField=Gi;exports.FormFieldCheckbox=ea;exports.FormFieldCheckboxIndicator=ta;exports.FormFieldEmail=Ji;exports.FormFieldError=la;exports.FormFieldFile=Xi;exports.FormFieldLabel=Yi;exports.FormFieldSelect=ia;exports.FormFieldSelectContent=sa;exports.FormFieldSelectIcon=ra;exports.FormFieldSelectItem=da;exports.FormFieldSelectItemIndicator=ma;exports.FormFieldSelectItemText=ca;exports.FormFieldSelectTrigger=aa;exports.FormFieldSelectValue=na;exports.FormFieldSelectViewport=oa;exports.FormFieldText=Y;exports.FormFieldTextArea=Zi;exports.FormFooter=Ca;exports.FormHeader=Vi;exports.FormHeading=Ui;exports.FormSubmit=pa;exports.FormSuccess=va;exports.FormSuccessButton=Pa;exports.FormSuccessHeading=ba;exports.FormSuccessMessage=ga;exports.FormWrapper=Ni;exports.Header=Ua;exports.HeaderToolbar=Ee;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=Ei;exports.HelpActionsMenu=Ii;exports.HelpActionsMenuArrow=Mi;exports.HelpActionsMenuItem=Si;exports.HelpActionsMenuItemIcon=xi;exports.HelpActionsTrigger=ki;exports.Input=Ht;exports.InputFieldset=jt;exports.InputGroup=yt;exports.IntroMessageWrapper=ze;exports.Message=pt;exports.MessageAction=Pt;exports.MessageAttachments=nt;exports.MessageAttachmentsItem=st;exports.MessageAttachmentsItemIcon=ot;exports.MessageAttachmentsItemTitle=dt;exports.MessageAttachmentsList=rt;exports.MessageAttachmentsPreview=ct;exports.MessageAttachmentsPreviewBody=ut;exports.MessageAttachmentsPreviewClose=Ct;exports.MessageAttachmentsPreviewContent=lt;exports.MessageAttachmentsPreviewHeader=ht;exports.MessageAttachmentsPreviewOverlay=mt;exports.MessageAvatar=Je;exports.MessageAvatarContent=Xe;exports.MessageAvatarFallback=Ze;exports.MessageAvatarImage=et;exports.MessageContent=at;exports.MessageContentWrapper=it;exports.MessageHeader=Ge;exports.MessageLoading=Ye;exports.MessageName=tt;exports.MessageSourceItem=Ft;exports.MessageSourceItemBreadcrumbIcon=Ln;exports.MessageSourceItemBreadcrumbs=kt;exports.MessageSourceItemDescription=xt;exports.MessageSourceItemDescriptionPart=ft;exports.MessageSourceItemIcon=It;exports.MessageSourceItemIndicator=Bt;exports.MessageSourceItemTag=St;exports.MessageSourceItemTitle=Mt;exports.MessageSources=_t;exports.MessageSourcesHeader=At;exports.MessageSourcesList=Et;exports.MessageToolAction=gt;exports.MessageToolActions=bt;exports.MessageToolbar=vt;exports.MessageWrapper=ce;exports.Messages=Te;exports.Root=Ae;exports.SendButton=wt;exports.SendButtonIcon=Lt;exports.TaglineBrandName=_i;exports.TaglineContainer=bi;exports.TaglineLogo=Pi;exports.TaglineText=gi;exports.ToolbarHeader=ke;exports.Workflow=Ue;exports.WorkflowIcon=Ke;exports.Workflows=$e;exports.WorkflowsLabel=Qe;exports.WorkflowsList=Ve;exports.Wrapper=Pe;
@@ -467,14 +467,14 @@ const Ze = "__intro__", et = i("div", {
467
467
  }
468
468
  ) });
469
469
  }, Wt = i("div", {
470
- _id: "aiChatMessageActions"
470
+ _id: "aiChatMessageToolbar"
471
471
  }), qn = (t) => {
472
472
  const { isLoading: e, messages: a } = g(), { message: s } = _();
473
473
  return a.at(-1)?.id === s?.id && e || s.role === "user" ? null : /* @__PURE__ */ n(Wt, { ...t });
474
474
  }, Nt = i("div", {
475
475
  _id: "aiChatMessageToolActions"
476
476
  }), jn = (t) => {
477
- const { children: e, ...a } = t, { message: s } = _(), { messageToolCalls: r } = g(), o = r[s.id] || [];
477
+ const { children: e, ...a } = t, { message: s } = _(), { messageButtons: r } = g(), o = r[s.id] || [];
478
478
  return /* @__PURE__ */ n(Nt, { children: I(e, o), ...a });
479
479
  }, Gn = (t) => {
480
480
  const { onClick: e, action: a, ...s } = t, { handleAction: r } = he(a), o = () => {
@@ -996,6 +996,8 @@ ${S}${R}`;
996
996
  userProperties: {},
997
997
  messages: C.messages.map((E) => ({
998
998
  ...E,
999
+ createdAt: void 0,
1000
+ updatedAt: void 0,
999
1001
  id: Date.now().toString() + E.id,
1000
1002
  conversationId: void 0
1001
1003
  }))
@@ -1656,7 +1658,6 @@ export {
1656
1658
  In as EmbeddedChatPrimitiveIntroMessageWrapper,
1657
1659
  Kn as EmbeddedChatPrimitiveMessage,
1658
1660
  zn as EmbeddedChatPrimitiveMessageAction,
1659
- qn as EmbeddedChatPrimitiveMessageActions,
1660
1661
  Ln as EmbeddedChatPrimitiveMessageAttachments,
1661
1662
  Dn as EmbeddedChatPrimitiveMessageAttachmentsItem,
1662
1663
  On as EmbeddedChatPrimitiveMessageAttachmentsItemIcon,
@@ -1690,6 +1691,7 @@ export {
1690
1691
  Xn as EmbeddedChatPrimitiveMessageSourcesList,
1691
1692
  Gn as EmbeddedChatPrimitiveMessageToolAction,
1692
1693
  jn as EmbeddedChatPrimitiveMessageToolActions,
1694
+ qn as EmbeddedChatPrimitiveMessageToolbar,
1693
1695
  Pt as EmbeddedChatPrimitiveMessageWrapper,
1694
1696
  on as EmbeddedChatPrimitiveMessages,
1695
1697
  za as EmbeddedChatPrimitiveRoot,
@@ -1774,7 +1776,6 @@ export {
1774
1776
  In as IntroMessageWrapper,
1775
1777
  Kn as Message,
1776
1778
  zn as MessageAction,
1777
- qn as MessageActions,
1778
1779
  Ln as MessageAttachments,
1779
1780
  Dn as MessageAttachmentsItem,
1780
1781
  On as MessageAttachmentsItemIcon,
@@ -1809,6 +1810,7 @@ export {
1809
1810
  Xn as MessageSourcesList,
1810
1811
  Gn as MessageToolAction,
1811
1812
  jn as MessageToolActions,
1813
+ qn as MessageToolbar,
1812
1814
  Pt as MessageWrapper,
1813
1815
  on as Messages,
1814
1816
  Zr as Provider,
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={type:"object",properties:{aiAnnotations:{type:"object",properties:{answerConfidence:{anyOf:[{type:"string",const:"very_confident",description:"Very confident"},{type:"string",const:"somewhat_confident",description:"Somewhat confident"},{type:"string",const:"not_confident",description:"Not confident"},{type:"string",const:"no_sources",description:"No Sources"},{type:"string",const:"other",description:"Other"}]}},required:["answerConfidence"],additionalProperties:!0}},required:["aiAnnotations"],additionalProperties:!1,$schema:"http://json-schema.org/draft-07/schema#"};exports.escalationSchema=e;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={type:"object",properties:{aiAnnotations:{type:"object",properties:{answerConfidence:{anyOf:[{type:"string",const:"very_confident",description:"Very confident"},{type:"string",const:"somewhat_confident",description:"Somewhat confident"},{type:"string",const:"not_confident",description:"Not confident"},{type:"string",const:"no_sources",description:"No Sources"},{type:"string",const:"other",description:"Other"}]}},required:["answerConfidence"],additionalProperties:!0}},required:["aiAnnotations"],additionalProperties:!1};exports.escalationSchema=e;
@@ -40,8 +40,7 @@ const e = {
40
40
  }
41
41
  },
42
42
  required: ["aiAnnotations"],
43
- additionalProperties: !1,
44
- $schema: "http://json-schema.org/draft-07/schema#"
43
+ additionalProperties: !1
45
44
  };
46
45
  export {
47
46
  e as escalationSchema
package/dist/index.d.cts CHANGED
@@ -133,7 +133,7 @@ export declare const aiChatComponentIds: {
133
133
  aiChatMessageAttachmentsPreview__Close: "aiChatMessageAttachmentsPreview__Close";
134
134
  aiChatMessageAttachmentsPreview__Body: "aiChatMessageAttachmentsPreview__Body";
135
135
  aiChatMessage: "aiChatMessage";
136
- aiChatMessageActions: "aiChatMessageActions";
136
+ aiChatMessageToolbar: "aiChatMessageToolbar";
137
137
  aiChatMessageToolActions: "aiChatMessageToolActions";
138
138
  aiChatMessageToolAction: "aiChatMessageToolAction";
139
139
  aiChatMessageAction: "aiChatMessageAction";
@@ -629,7 +629,7 @@ export declare const componentIDs: {
629
629
  aiChatMessageAttachmentsPreview__Close: "aiChatMessageAttachmentsPreview__Close";
630
630
  aiChatMessageAttachmentsPreview__Body: "aiChatMessageAttachmentsPreview__Body";
631
631
  aiChatMessage: "aiChatMessage";
632
- aiChatMessageActions: "aiChatMessageActions";
632
+ aiChatMessageToolbar: "aiChatMessageToolbar";
633
633
  aiChatMessageToolActions: "aiChatMessageToolActions";
634
634
  aiChatMessageToolAction: "aiChatMessageToolAction";
635
635
  aiChatMessageAction: "aiChatMessageAction";
@@ -826,78 +826,6 @@ declare const defaultInkeepAIChatSettings: {
826
826
  copyChat: string;
827
827
  };
828
828
  prompts: never[];
829
- tools: {
830
- type: "function";
831
- function: {
832
- name: string;
833
- description: string;
834
- parameters: {
835
- type: string;
836
- properties: {
837
- links: {
838
- anyOf: ({
839
- type: string;
840
- items: {
841
- type: string;
842
- properties: {
843
- label: {
844
- type: string[];
845
- };
846
- url: {
847
- type: string;
848
- };
849
- title: {
850
- type: string[];
851
- };
852
- description: {
853
- type: string[];
854
- };
855
- type: {
856
- anyOf: ({
857
- anyOf: ({
858
- type: string;
859
- enum: string[];
860
- } | {
861
- type: string;
862
- enum?: undefined;
863
- })[];
864
- type?: undefined;
865
- } | {
866
- type: string;
867
- anyOf?: undefined;
868
- })[];
869
- };
870
- breadcrumbs: {
871
- anyOf: ({
872
- type: string;
873
- items: {
874
- type: string;
875
- };
876
- } | {
877
- type: string;
878
- items?: undefined;
879
- })[];
880
- };
881
- };
882
- required: string[];
883
- additionalProperties: boolean;
884
- };
885
- } | {
886
- type: string;
887
- items?: undefined;
888
- })[];
889
- };
890
- text: {
891
- type: string;
892
- };
893
- };
894
- required: string[];
895
- additionalProperties: boolean;
896
- $schema: string;
897
- };
898
- };
899
- }[];
900
- onToolCall: (_toolCall: any) => undefined;
901
829
  };
902
830
 
903
831
  declare type DefaultInkeepBaseSettings = typeof defaultInkeepBaseSettings;
@@ -1250,7 +1178,7 @@ export declare namespace EmbeddedChatPrimitive {
1250
1178
  EmbeddedChatPrimitiveMessageAttachmentsPreviewBody,
1251
1179
  EmbeddedChatPrimitiveMessageProps,
1252
1180
  EmbeddedChatPrimitiveMessage,
1253
- EmbeddedChatPrimitiveMessageActions,
1181
+ EmbeddedChatPrimitiveMessageToolbar,
1254
1182
  EmbeddedChatPrimitiveMessageToolActionsProps,
1255
1183
  EmbeddedChatPrimitiveMessageToolActions,
1256
1184
  EmbeddedChatPrimitiveMessageToolActionProps,
@@ -1441,7 +1369,7 @@ export declare namespace EmbeddedChatPrimitive {
1441
1369
  EmbeddedChatPrimitiveMessageAttachmentsPreviewClose as MessageAttachmentsPreviewClose,
1442
1370
  EmbeddedChatPrimitiveMessageAttachmentsPreviewBody as MessageAttachmentsPreviewBody,
1443
1371
  EmbeddedChatPrimitiveMessage as Message,
1444
- EmbeddedChatPrimitiveMessageActions as MessageActions,
1372
+ EmbeddedChatPrimitiveMessageToolbar as MessageToolbar,
1445
1373
  EmbeddedChatPrimitiveMessageToolActions as MessageToolActions,
1446
1374
  EmbeddedChatPrimitiveMessageToolAction as MessageToolAction,
1447
1375
  EmbeddedChatPrimitiveMessageAction as MessageAction,
@@ -1873,8 +1801,6 @@ declare interface EmbeddedChatPrimitiveMessageActionProps extends ComponentProps
1873
1801
  action: MessageAction;
1874
1802
  }
1875
1803
 
1876
- declare const EmbeddedChatPrimitiveMessageActions: (props: ComponentPropsWithRef<typeof PrimitiveMessageActions>) => JSX.Element | null;
1877
-
1878
1804
  declare const EmbeddedChatPrimitiveMessageAttachments: (props: ComponentPropsWithRef<typeof PrimitiveMessageAttachments>) => JSX.Element | null;
1879
1805
 
1880
1806
  declare const EmbeddedChatPrimitiveMessageAttachmentsItem: (props: EmbeddedChatPrimitiveMessageAttachmentsItemProps) => JSX.Element;
@@ -1987,6 +1913,8 @@ declare interface EmbeddedChatPrimitiveMessageToolActionsProps extends Omit<Comp
1987
1913
  children: React.ReactNode | ((actions: ToolCallAction[]) => React.ReactNode);
1988
1914
  }
1989
1915
 
1916
+ declare const EmbeddedChatPrimitiveMessageToolbar: (props: ComponentPropsWithRef<typeof PrimitiveMessageToolbar>) => JSX.Element | null;
1917
+
1990
1918
  declare const EmbeddedChatPrimitiveMessageWrapper: (props: EmbeddedChatPrimitiveMessageWrapperProps) => JSX.Element | null;
1991
1919
 
1992
1920
  declare interface EmbeddedChatPrimitiveMessageWrapperProps extends ComponentPropsWithRef<typeof PrimitiveMessageWrapper> {
@@ -3147,8 +3075,6 @@ declare const PrimitiveMessage: ForwardRefExoticComponent< PolymorphicProps & Om
3147
3075
 
3148
3076
  declare const PrimitiveMessageAction: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id"> & Partial<Pick< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id">>>;
3149
3077
 
3150
- declare const PrimitiveMessageActions: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3151
-
3152
3078
  declare const PrimitiveMessageAttachments: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3153
3079
 
3154
3080
  declare const PrimitiveMessageAttachmentsItem: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
@@ -3221,6 +3147,8 @@ declare const PrimitiveMessageSources: ForwardRefExoticComponent< PolymorphicPro
3221
3147
 
3222
3148
  declare const PrimitiveMessageSourcesHeader: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3223
3149
 
3150
+ declare const PrimitiveMessageToolbar: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3151
+
3224
3152
  declare const PrimitiveMessageWrapper: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3225
3153
 
3226
3154
  declare const PrimitiveModal: (props: PrimitiveModalProps) => JSX.Element;
@@ -3665,7 +3593,7 @@ declare const useInkeepChat: () => {
3665
3593
  messageAttachments: MessageAttachment[];
3666
3594
  setMessageAttachments: Dispatch<SetStateAction<MessageAttachment[]>>;
3667
3595
  addAttachment: (attachment: MessageAttachment) => void;
3668
- messageToolCalls: Record<string, ToolCallAction[]>;
3596
+ messageButtons: Record<string, ToolCallAction[]>;
3669
3597
  isEmpty: boolean;
3670
3598
  inputRef: RefObject<HTMLTextAreaElement | null>;
3671
3599
  isMobile: boolean;
package/dist/index.d.ts CHANGED
@@ -133,7 +133,7 @@ export declare const aiChatComponentIds: {
133
133
  aiChatMessageAttachmentsPreview__Close: "aiChatMessageAttachmentsPreview__Close";
134
134
  aiChatMessageAttachmentsPreview__Body: "aiChatMessageAttachmentsPreview__Body";
135
135
  aiChatMessage: "aiChatMessage";
136
- aiChatMessageActions: "aiChatMessageActions";
136
+ aiChatMessageToolbar: "aiChatMessageToolbar";
137
137
  aiChatMessageToolActions: "aiChatMessageToolActions";
138
138
  aiChatMessageToolAction: "aiChatMessageToolAction";
139
139
  aiChatMessageAction: "aiChatMessageAction";
@@ -629,7 +629,7 @@ export declare const componentIDs: {
629
629
  aiChatMessageAttachmentsPreview__Close: "aiChatMessageAttachmentsPreview__Close";
630
630
  aiChatMessageAttachmentsPreview__Body: "aiChatMessageAttachmentsPreview__Body";
631
631
  aiChatMessage: "aiChatMessage";
632
- aiChatMessageActions: "aiChatMessageActions";
632
+ aiChatMessageToolbar: "aiChatMessageToolbar";
633
633
  aiChatMessageToolActions: "aiChatMessageToolActions";
634
634
  aiChatMessageToolAction: "aiChatMessageToolAction";
635
635
  aiChatMessageAction: "aiChatMessageAction";
@@ -826,78 +826,6 @@ declare const defaultInkeepAIChatSettings: {
826
826
  copyChat: string;
827
827
  };
828
828
  prompts: never[];
829
- tools: {
830
- type: "function";
831
- function: {
832
- name: string;
833
- description: string;
834
- parameters: {
835
- type: string;
836
- properties: {
837
- links: {
838
- anyOf: ({
839
- type: string;
840
- items: {
841
- type: string;
842
- properties: {
843
- label: {
844
- type: string[];
845
- };
846
- url: {
847
- type: string;
848
- };
849
- title: {
850
- type: string[];
851
- };
852
- description: {
853
- type: string[];
854
- };
855
- type: {
856
- anyOf: ({
857
- anyOf: ({
858
- type: string;
859
- enum: string[];
860
- } | {
861
- type: string;
862
- enum?: undefined;
863
- })[];
864
- type?: undefined;
865
- } | {
866
- type: string;
867
- anyOf?: undefined;
868
- })[];
869
- };
870
- breadcrumbs: {
871
- anyOf: ({
872
- type: string;
873
- items: {
874
- type: string;
875
- };
876
- } | {
877
- type: string;
878
- items?: undefined;
879
- })[];
880
- };
881
- };
882
- required: string[];
883
- additionalProperties: boolean;
884
- };
885
- } | {
886
- type: string;
887
- items?: undefined;
888
- })[];
889
- };
890
- text: {
891
- type: string;
892
- };
893
- };
894
- required: string[];
895
- additionalProperties: boolean;
896
- $schema: string;
897
- };
898
- };
899
- }[];
900
- onToolCall: (_toolCall: any) => undefined;
901
829
  };
902
830
 
903
831
  declare type DefaultInkeepBaseSettings = typeof defaultInkeepBaseSettings;
@@ -1250,7 +1178,7 @@ export declare namespace EmbeddedChatPrimitive {
1250
1178
  EmbeddedChatPrimitiveMessageAttachmentsPreviewBody,
1251
1179
  EmbeddedChatPrimitiveMessageProps,
1252
1180
  EmbeddedChatPrimitiveMessage,
1253
- EmbeddedChatPrimitiveMessageActions,
1181
+ EmbeddedChatPrimitiveMessageToolbar,
1254
1182
  EmbeddedChatPrimitiveMessageToolActionsProps,
1255
1183
  EmbeddedChatPrimitiveMessageToolActions,
1256
1184
  EmbeddedChatPrimitiveMessageToolActionProps,
@@ -1441,7 +1369,7 @@ export declare namespace EmbeddedChatPrimitive {
1441
1369
  EmbeddedChatPrimitiveMessageAttachmentsPreviewClose as MessageAttachmentsPreviewClose,
1442
1370
  EmbeddedChatPrimitiveMessageAttachmentsPreviewBody as MessageAttachmentsPreviewBody,
1443
1371
  EmbeddedChatPrimitiveMessage as Message,
1444
- EmbeddedChatPrimitiveMessageActions as MessageActions,
1372
+ EmbeddedChatPrimitiveMessageToolbar as MessageToolbar,
1445
1373
  EmbeddedChatPrimitiveMessageToolActions as MessageToolActions,
1446
1374
  EmbeddedChatPrimitiveMessageToolAction as MessageToolAction,
1447
1375
  EmbeddedChatPrimitiveMessageAction as MessageAction,
@@ -1873,8 +1801,6 @@ declare interface EmbeddedChatPrimitiveMessageActionProps extends ComponentProps
1873
1801
  action: MessageAction;
1874
1802
  }
1875
1803
 
1876
- declare const EmbeddedChatPrimitiveMessageActions: (props: ComponentPropsWithRef<typeof PrimitiveMessageActions>) => JSX.Element | null;
1877
-
1878
1804
  declare const EmbeddedChatPrimitiveMessageAttachments: (props: ComponentPropsWithRef<typeof PrimitiveMessageAttachments>) => JSX.Element | null;
1879
1805
 
1880
1806
  declare const EmbeddedChatPrimitiveMessageAttachmentsItem: (props: EmbeddedChatPrimitiveMessageAttachmentsItemProps) => JSX.Element;
@@ -1987,6 +1913,8 @@ declare interface EmbeddedChatPrimitiveMessageToolActionsProps extends Omit<Comp
1987
1913
  children: React.ReactNode | ((actions: ToolCallAction[]) => React.ReactNode);
1988
1914
  }
1989
1915
 
1916
+ declare const EmbeddedChatPrimitiveMessageToolbar: (props: ComponentPropsWithRef<typeof PrimitiveMessageToolbar>) => JSX.Element | null;
1917
+
1990
1918
  declare const EmbeddedChatPrimitiveMessageWrapper: (props: EmbeddedChatPrimitiveMessageWrapperProps) => JSX.Element | null;
1991
1919
 
1992
1920
  declare interface EmbeddedChatPrimitiveMessageWrapperProps extends ComponentPropsWithRef<typeof PrimitiveMessageWrapper> {
@@ -3147,8 +3075,6 @@ declare const PrimitiveMessage: ForwardRefExoticComponent< PolymorphicProps & Om
3147
3075
 
3148
3076
  declare const PrimitiveMessageAction: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id"> & Partial<Pick< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id">>>;
3149
3077
 
3150
- declare const PrimitiveMessageActions: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3151
-
3152
3078
  declare const PrimitiveMessageAttachments: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3153
3079
 
3154
3080
  declare const PrimitiveMessageAttachmentsItem: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
@@ -3221,6 +3147,8 @@ declare const PrimitiveMessageSources: ForwardRefExoticComponent< PolymorphicPro
3221
3147
 
3222
3148
  declare const PrimitiveMessageSourcesHeader: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3223
3149
 
3150
+ declare const PrimitiveMessageToolbar: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3151
+
3224
3152
  declare const PrimitiveMessageWrapper: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3225
3153
 
3226
3154
  declare const PrimitiveModal: (props: PrimitiveModalProps) => JSX.Element;
@@ -3665,7 +3593,7 @@ declare const useInkeepChat: () => {
3665
3593
  messageAttachments: MessageAttachment[];
3666
3594
  setMessageAttachments: Dispatch<SetStateAction<MessageAttachment[]>>;
3667
3595
  addAttachment: (attachment: MessageAttachment) => void;
3668
- messageToolCalls: Record<string, ToolCallAction[]>;
3596
+ messageButtons: Record<string, ToolCallAction[]>;
3669
3597
  isEmpty: boolean;
3670
3598
  inputRef: RefObject<HTMLTextAreaElement | null>;
3671
3599
  isMobile: boolean;
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),b=require("./user-provider.cjs"),p=t.createContext(void 0),f=({children:e})=>{const{baseSettings:s,componentType:n}=B.useInkeepConfig(),{apiKey:o,analyticsApiBaseUrl:r,tags:i,privacyPreferences:d,env:E}=s,{userProperties:c}=b.useUser(),a=t.useMemo(()=>({widgetLibraryVersion:"0.5.35",componentType:n,tags:i}),[n,i]),u=!d.optOutAllAnalytics&&E!=="development",g={logEvent:t.useCallback(async v=>{const m={...a,...v.properties},l={eventName:v.eventName,properties:m,userProperties:c};u&&y.logEvent(l,o,r),s.onEvent?.(l)},[u,s,o,r,c,a])};return P.jsx(p.Provider,{value:g,children:e})},x=()=>{const e=t.useContext(p);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=f;exports.useBaseEvents=x;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),b=require("./user-provider.cjs"),p=t.createContext(void 0),f=({children:e})=>{const{baseSettings:s,componentType:n}=B.useInkeepConfig(),{apiKey:o,analyticsApiBaseUrl:r,tags:i,privacyPreferences:d,env:E}=s,{userProperties:c}=b.useUser(),a=t.useMemo(()=>({widgetLibraryVersion:"0.5.37",componentType:n,tags:i}),[n,i]),u=!d.optOutAllAnalytics&&E!=="development",g={logEvent:t.useCallback(async v=>{const m={...a,...v.properties},l={eventName:v.eventName,properties:m,userProperties:c};u&&y.logEvent(l,o,r),s.onEvent?.(l)},[u,s,o,r,c,a])};return P.jsx(p.Provider,{value:g,children:e})},x=()=>{const e=t.useContext(p);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=f;exports.useBaseEvents=x;