@inkeep/cxkit-primitives 0.0.0-dev-20250429201331 → 0.0.0-dev-20250502200738

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.
@@ -1,10 +1,10 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),b=require("react"),ie=require("react-textarea-autosize"),ba=require("@radix-ui/react-avatar"),ga=require("@radix-ui/react-checkbox"),Pa=require("@radix-ui/react-popover"),Aa=require("@radix-ui/react-tooltip"),_a=require("@radix-ui/react-scroll-area"),Fa=require("@radix-ui/react-select"),A=require("../atoms/dialog.cjs"),Ea=require("../atoms/avatars/ai.cjs"),ka=require("../atoms/avatars/user.cjs"),F=require("../atoms/icons/custom-icon.cjs"),x=require("../atoms/icons/built-in-icon-renderer.cjs"),Ia=require("../atoms/link.cjs"),ae=require("../atoms/markdown/index.cjs"),w=require("../providers/attachment-item-provider.cjs"),E=require("../providers/attachments-bar-provider.cjs"),B=require("../providers/source-item-provider.cjs"),C=require("../providers/config-provider.cjs"),O=require("../providers/conversation-provider.cjs"),V=require("../providers/chat-events-provider.cjs"),ne=require("../providers/feedback-provider.cjs"),q=require("../providers/message-attachments-provider.cjs"),P=require("../providers/message-provider.cjs"),be=require("../atoms/icons/checkbox-icon.cjs"),ee=require("../hooks/use-copy-to-clipboard.cjs"),U=require("../providers/feedback-item-provider.cjs"),Ma=require("../utils/get-message-metadata.cjs"),l=require("../utils/misc.cjs"),a=require("./factory.cjs"),g=require("./embedded-chat/chat-provider.cjs"),Sa=require("./tagline-logo-icon.cjs"),xa=require("../hooks/use-settle-action.cjs"),Ba=require("../hooks/use-container-size.cjs"),re=require("./embedded-chat/use-chat-action.cjs"),te=require("../providers/help-menu-provider.cjs"),_=require("../providers/chat-form-provider.cjs"),f=require("../providers/form-field-provider.cjs"),fa=require("react-hook-form"),Ta=require("../utils/highlight-emphasis.cjs"),ja=require("./modal/modal-provider.cjs"),ya=require("@inkeep/cxkit-color-mode"),se=require("../utils/compose-refs.cjs"),u=require("../utils/compose-event-handlers.cjs"),Ha=require("../hooks/use-scroll-to-bottom.cjs"),wa=require("../atoms/api/analytics/conversation.cjs"),La=require("../utils/transform-source/index.cjs"),Da=require("../hooks/use-debounce.cjs"),oe=require("../providers/hover-popover-provider.cjs"),Oa=require("./modal/widget-auto-focus.cjs");function L(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const de=L(ba),K=L(ga),T=L(Pa),j=L(Aa),R=L(_a),I=L(Fa),qa="__intro__",Ra=a.ikp("div",{_id:"aiChatWrapper"}),ge=b.forwardRef((t,e)=>{const{...i}=t,{isHidden:r,isMobile:s}=g.useChat(),[o,d]=Ba.useContainerSize(),c=se.useComposedRefs(e,o),m=d?.width?d.width>580:!0,h=ja.useModal();return n.jsx(Ra,{ref:c,"data-widget-md":l.dataAttr(m),"data-hidden":l.dataAttr(r),"data-in-modal":l.dataAttr(!!h),"data-mobile":l.dataAttr(s),...i})}),Wa=a.ikp("div",{_id:"aiChatConversationLoading"}),Pe=t=>{const{isLoadingConversation:e}=g.useChat();return e?n.jsx(Wa,{children:n.jsx("span",{children:"Loading..."}),...t}):null},Na=a.ikp("div",{_id:"aiChatRoot"}),Ae=t=>{const{isLoadingConversation:e,isHidden:i}=g.useChat(),{form:r}=_.useChatForm();return e||r?null:n.jsx(Na,{"data-hidden":l.dataAttr(i),...t})},Qa=a.ikp("div",{_id:"aiChatHeader"}),_e=a.ikp("div",{_id:"aiChatHeader__Toolbar"}),Fe=a.ikp("div",{_id:"aiChatHeader__ToolbarHeaderWrapper"}),$a=a.ikp("div",{_id:"aiChatHeader__ToolbarHeader"}),Ee=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=`Ask ${e.aiAssistantName||"AI"}`;return n.jsx($a,{...t,children:i})}),ke=a.ikp("div",{_id:"aiChatContent"}),Ie=a.ikp(R.Root,{_id:"aiChatContentScrollArea"}),Va=a.ikp(R.Viewport,{_id:"aiChatContentScrollArea__Viewport"}),Me=b.forwardRef(({children:t,...e},i)=>{const{containerRef:r}=Ha.useScrollToBottom(),s=se.useComposedRefs(i,r);return n.jsx(Va,{ref:s,children:n.jsx("div",{"data-part":"grid",style:{display:"grid"},children:t}),...e})}),Se=a.ikp(R.ScrollAreaScrollbar,{_id:"aiChatContentScrollArea__Scrollbar"}),xe=a.ikp(R.ScrollAreaThumb,{_id:"aiChatContentScrollArea__Thumb"}),Be=a.ikp(R.Corner,{_id:"aiChatContentScrollArea__Corner"}),Ua=a.ikp("div",{_id:"aiChatMessages"}),fe=t=>{const e=g.useChat(),{children:i,...r}=t;return n.jsx(Ua,{children:l.maybeRender(i,e),...r})},Ka=a.ikp("div",{_id:"aiChatDisclaimer"}),Te=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),[i,r]=b.useState(!1),s=Da.useDebounce(i,100);return e.disclaimerSettings?.isEnabled?n.jsx(oe.HoverPopoverProvider,{open:i,setOpen:r,children:n.jsx(T.Root,{open:s,onOpenChange:r,children:n.jsx(Ka,{...t})})}):null}),za=a.ikp("span",{_id:"aiChatDisclaimerLabel"}),je=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.disclaimerSettings;return n.jsx(za,{children:i?.label,...t})}),Ga=a.ikp(T.Trigger,{_id:"aiChatDisclaimerTrigger",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),ye=b.memo(t=>{const{setOpen:e}=oe.useHoverPopover(),i=()=>e(!0),r=()=>e(!1);return n.jsx(Ga,{onMouseEnter:i,onMouseLeave:r,...t})}),Ya=a.ikp(T.Content,{_id:"aiChatDisclaimerContent"}),He=t=>{const{setOpen:e}=oe.useHoverPopover(),i=()=>e(!0),r=()=>e(!1);return n.jsx(Ya,{onMouseEnter:i,onMouseLeave:r,side:"top",sideOffset:8,align:"end",alignOffset:-10,...t})},Ja=a.ikp(ae.Markdown,{_id:"aiChatDisclaimerText"}),we=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.aiAssistantName,s=e.disclaimerSettings?.tooltip||`Information provided by ${i||"this AI assistant"} is not guaranteed to be accurate or comprehensive.`;return n.jsx(Ja,{shouldOpenLinksInNewTab:!0,children:s,...t})}),Le=a.ikp(T.Arrow,{_id:"aiChatDisclaimerArrow"}),Xa=a.ikp("div",{_id:"aiChatExampleQuestions"}),De=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:i}=g.useChat();return!e.exampleQuestions?.length||i.length?null:n.jsx(Xa,{...t})},Za=a.ikp("h3",{_id:"aiChatExampleQuestionsLabel"}),Oe=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(Za,{children:e.exampleQuestionsLabel,...t})}),en=a.ikp("div",{_id:"aiChatExampleQuestionsList"}),qe=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.exampleQuestions,{children:r,...s}=t;return n.jsx(en,{children:l.maybeRender(r,i),...s})}),tn=a.ikp("div",{_id:"aiChatExampleQuestion"}),Re=b.forwardRef((t,e)=>{const{aiChatSettings:i}=C.useInkeepConfig(),r=i.isFirstExampleQuestionHighlighted;return n.jsx(tn,{ref:e,"data-highlight":l.dataAttr(r),...t})}),an=a.ikp("button",{_id:"aiChatExampleQuestionButton"}),We=t=>{const{question:e,onClick:i,...r}=t,{handleSubmit:s}=g.useChat();return n.jsx(an,{onClick:u.composeEventHandlers(i,()=>s(e)),children:e,...r})},nn=a.ikp("div",{_id:"aiChatWorkflows"}),Ne=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:i}=g.useChat();return!e.workflows?.length||i.length?null:n.jsx(nn,{...t})},rn=a.ikp("h3",{_id:"aiChatWorkflowsLabel"}),Qe=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(rn,{children:e.workflowsHeader,...t})}),sn=a.ikp("div",{_id:"aiChatWorkflowsList"}),$e=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.workflows,{children:r,...s}=t;return n.jsx(sn,{children:l.maybeRender(r,i),...s})}),on=a.ikp("button",{_id:"aiChatWorkflow"}),Ve=t=>{const{workflow:e,onClick:i,...r}=t,{handleWorkflow:s}=g.useChat();return n.jsx(on,{onClick:u.composeEventHandlers(i,()=>s(e)),children:e.displayName,...r})},dn=a.ikp("div",{_id:"aiChatMessageWrapper"}),ce=t=>{const{message:e,...i}=t;return e.role==="system"?null:n.jsx(P.MessageProvider,{message:e,children:n.jsx(dn,{"data-role":e.role,...i})})},Ue=b.memo(t=>{const{message:e,...i}=t,{aiChatSettings:r,baseSettings:s}=C.useInkeepConfig(),o=r.aiAssistantName,d=o?`Hi, I'm ${o}!`:"Hi!",c=r.chatSubjectName??s.organizationDisplayName,m=`${d}
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),g=require("react"),ie=require("react-textarea-autosize"),ba=require("@radix-ui/react-avatar"),ga=require("@radix-ui/react-checkbox"),Pa=require("@radix-ui/react-popover"),Aa=require("@radix-ui/react-tooltip"),_a=require("@radix-ui/react-scroll-area"),Fa=require("@radix-ui/react-select"),A=require("../atoms/dialog.cjs"),Ea=require("../atoms/avatars/ai.cjs"),ka=require("../atoms/avatars/user.cjs"),F=require("../atoms/icons/custom-icon.cjs"),x=require("../atoms/icons/built-in-icon-renderer.cjs"),Ia=require("../atoms/link.cjs"),ae=require("../atoms/markdown/index.cjs"),w=require("../providers/attachment-item-provider.cjs"),E=require("../providers/attachments-bar-provider.cjs"),B=require("../providers/source-item-provider.cjs"),C=require("../providers/config-provider.cjs"),O=require("../providers/conversation-provider.cjs"),V=require("../providers/chat-events-provider.cjs"),ne=require("../providers/feedback-provider.cjs"),q=require("../providers/message-attachments-provider.cjs"),P=require("../providers/message-provider.cjs"),be=require("../atoms/icons/checkbox-icon.cjs"),ee=require("../hooks/use-copy-to-clipboard.cjs"),U=require("../providers/feedback-item-provider.cjs"),Ma=require("../utils/get-message-metadata.cjs"),l=require("../utils/misc.cjs"),a=require("./factory.cjs"),v=require("./embedded-chat/chat-provider.cjs"),Sa=require("./tagline-logo-icon.cjs"),xa=require("../hooks/use-settle-action.cjs"),Ba=require("../hooks/use-container-size.cjs"),se=require("./embedded-chat/use-chat-action.cjs"),te=require("../providers/help-menu-provider.cjs"),_=require("../providers/chat-form-provider.cjs"),f=require("../providers/form-field-provider.cjs"),fa=require("react-hook-form"),Ta=require("../utils/highlight-emphasis.cjs"),ja=require("./modal/modal-provider.cjs"),ya=require("@inkeep/cxkit-color-mode"),re=require("../utils/compose-refs.cjs"),u=require("../utils/compose-event-handlers.cjs"),Ha=require("../hooks/use-scroll-to-bottom.cjs"),wa=require("../atoms/api/analytics/conversation.cjs"),La=require("../utils/transform-source/index.cjs"),Da=require("../hooks/use-debounce.cjs"),oe=require("../providers/hover-popover-provider.cjs"),Oa=require("./modal/widget-auto-focus.cjs");function L(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const de=L(ba),K=L(ga),T=L(Pa),j=L(Aa),R=L(_a),I=L(Fa),qa="__intro__",Ra=a.ikp("div",{_id:"aiChatWrapper"}),ge=g.forwardRef((t,e)=>{const{...i}=t,{isHidden:s,isMobile:r}=v.useChat(),[o,d]=Ba.useContainerSize(),c=re.useComposedRefs(e,o),m=d?.width?d.width>580:!0,h=ja.useModal();return n.jsx(Ra,{ref:c,"data-widget-md":l.dataAttr(m),"data-hidden":l.dataAttr(s),"data-in-modal":l.dataAttr(!!h),"data-mobile":l.dataAttr(r),...i})}),Wa=a.ikp("div",{_id:"aiChatConversationLoading"}),Pe=t=>{const{isLoadingConversation:e}=v.useChat();return e?n.jsx(Wa,{children:n.jsx("span",{children:"Loading..."}),...t}):null},Na=a.ikp("div",{_id:"aiChatRoot"}),Ae=t=>{const{isLoadingConversation:e,isHidden:i}=v.useChat(),{form:s}=_.useChatForm();return e||s?null:n.jsx(Na,{"data-hidden":l.dataAttr(i),...t})},Qa=a.ikp("div",{_id:"aiChatHeader"}),_e=a.ikp("div",{_id:"aiChatHeader__Toolbar"}),Fe=a.ikp("div",{_id:"aiChatHeader__ToolbarHeaderWrapper"}),$a=a.ikp("div",{_id:"aiChatHeader__ToolbarHeader"}),Ee=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=`Ask ${e.aiAssistantName||"AI"}`;return n.jsx($a,{...t,children:i})}),ke=a.ikp("div",{_id:"aiChatContent"}),Ie=a.ikp(R.Root,{_id:"aiChatContentScrollArea"}),Va=a.ikp(R.Viewport,{_id:"aiChatContentScrollArea__Viewport"}),Me=g.forwardRef(({children:t,...e},i)=>{const{containerRef:s}=Ha.useScrollToBottom(),r=re.useComposedRefs(i,s);return n.jsx(Va,{ref:r,children:n.jsx("div",{"data-part":"grid",style:{display:"grid"},children:t}),...e})}),Se=a.ikp(R.ScrollAreaScrollbar,{_id:"aiChatContentScrollArea__Scrollbar"}),xe=a.ikp(R.ScrollAreaThumb,{_id:"aiChatContentScrollArea__Thumb"}),Be=a.ikp(R.Corner,{_id:"aiChatContentScrollArea__Corner"}),Ua=a.ikp("div",{_id:"aiChatMessages"}),fe=t=>{const e=v.useChat(),{children:i,...s}=t;return n.jsx(Ua,{children:l.maybeRender(i,e),...s})},Ka=a.ikp("div",{_id:"aiChatDisclaimer"}),Te=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),[i,s]=g.useState(!1),r=Da.useDebounce(i,100);return e.disclaimerSettings?.isEnabled?n.jsx(oe.HoverPopoverProvider,{open:i,setOpen:s,children:n.jsx(T.Root,{open:r,onOpenChange:s,children:n.jsx(Ka,{...t})})}):null}),za=a.ikp("span",{_id:"aiChatDisclaimerLabel"}),je=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.disclaimerSettings;return n.jsx(za,{children:i?.label,...t})}),Ga=a.ikp(T.Trigger,{_id:"aiChatDisclaimerTrigger",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),ye=g.memo(t=>{const{setOpen:e}=oe.useHoverPopover(),i=()=>e(!0),s=()=>e(!1);return n.jsx(Ga,{onMouseEnter:i,onMouseLeave:s,...t})}),Ya=a.ikp(T.Content,{_id:"aiChatDisclaimerContent"}),He=t=>{const{setOpen:e}=oe.useHoverPopover(),i=()=>e(!0),s=()=>e(!1);return n.jsx(Ya,{onMouseEnter:i,onMouseLeave:s,side:"top",sideOffset:8,align:"end",alignOffset:-10,...t})},Ja=a.ikp(ae.Markdown,{_id:"aiChatDisclaimerText"}),we=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.aiAssistantName,r=e.disclaimerSettings?.tooltip||`Information provided by ${i||"this AI assistant"} is not guaranteed to be accurate or comprehensive.`;return n.jsx(Ja,{shouldOpenLinksInNewTab:!0,children:r,...t})}),Le=a.ikp(T.Arrow,{_id:"aiChatDisclaimerArrow"}),Xa=a.ikp("div",{_id:"aiChatExampleQuestions"}),De=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:i}=v.useChat();return!e.exampleQuestions?.length||i.length?null:n.jsx(Xa,{...t})},Za=a.ikp("h3",{_id:"aiChatExampleQuestionsLabel"}),Oe=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(Za,{children:e.exampleQuestionsLabel,...t})}),en=a.ikp("div",{_id:"aiChatExampleQuestionsList"}),qe=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.exampleQuestions,{children:s,...r}=t;return n.jsx(en,{children:l.maybeRender(s,i),...r})}),tn=a.ikp("div",{_id:"aiChatExampleQuestion"}),Re=g.forwardRef((t,e)=>{const{aiChatSettings:i}=C.useInkeepConfig(),s=i.isFirstExampleQuestionHighlighted;return n.jsx(tn,{ref:e,"data-highlight":l.dataAttr(s),...t})}),an=a.ikp("button",{_id:"aiChatExampleQuestionButton"}),We=t=>{const{question:e,onClick:i,...s}=t,{handleSubmit:r}=v.useChat();return n.jsx(an,{onClick:u.composeEventHandlers(i,()=>r(e)),children:e,...s})},nn=a.ikp("div",{_id:"aiChatWorkflows"}),Ne=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:i}=v.useChat();return!e.workflows?.length||i.length?null:n.jsx(nn,{...t})},sn=a.ikp("h3",{_id:"aiChatWorkflowsLabel"}),Qe=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(sn,{children:e.workflowsHeader,...t})}),rn=a.ikp("div",{_id:"aiChatWorkflowsList"}),$e=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.workflows,{children:s,...r}=t;return n.jsx(rn,{children:l.maybeRender(s,i),...r})}),on=a.ikp("button",{_id:"aiChatWorkflow"}),Ve=t=>{const{workflow:e,onClick:i,...s}=t,{handleWorkflow:r}=v.useChat();return n.jsx(on,{onClick:u.composeEventHandlers(i,()=>r(e)),children:e.displayName,...s})},dn=a.ikp("div",{_id:"aiChatMessageWrapper"}),ce=t=>{const{message:e,...i}=t;return e.role==="system"?null:n.jsx(P.MessageProvider,{message:e,children:n.jsx(dn,{"data-role":e.role,...i})})},Ue=g.memo(t=>{const{message:e,...i}=t,{aiChatSettings:s,baseSettings:r}=C.useInkeepConfig(),o=s.aiAssistantName,d=o?`Hi, I'm ${o}!`:"Hi!",c=s.chatSubjectName??r.organizationDisplayName,m=`${d}
2
2
 
3
3
  I'm an AI assistant trained on documentation, help articles, and other content.`,h=c?`
4
4
 
5
5
  Ask me anything about \`${c}\`.`:`
6
6
 
7
- Let me know how I can help.`,v={content:r.introMessage??`${m}${h}`,id:qa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:v,...i})}),cn=a.ikp("div",{_id:"aiChatMessageHeader"}),Ke=t=>{const{message:e}=P.useMessage();return n.jsx(cn,{"data-role":e.role,...t})},mn=a.ikp("div",{_id:"aiChatMessageLoading"}),ze=t=>{const{isLoading:e,isStreaming:i,messages:r}=g.useChat(),{message:s}=P.useMessage();return!(r.at(-1)?.id===s?.id)||s.role!=="assistant"||!e||i?null:n.jsx(mn,{children:"Thinking...",...t})},ln=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Ye=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=C.useInkeepConfig();return n.jsx(hn,{"data-username":l.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},un=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Je=b.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(un,{"data-role":i.role,children:l.getInitials(e.userProperties.name),...t}):null}),pe=a.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),Xe=b.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=C.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,h=ya.useColorModeValue(c,m),[p,v]=b.useState(h);b.useEffect(()=>{v(h)},[h]);const k=y=>{y==="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(ka.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,k),...i}):n.jsx(Ea.default,{"data-type":"icon","data-role":o.role,...t})}),Cn=a.ikp("span",{_id:"aiChatMessageName"}),Ze=t=>{const{message:e}=P.useMessage();return n.jsx(Cn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},pn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),et=t=>{const{message:e}=P.useMessage();return n.jsx(pn,{"data-role":e.role,...t})},vn=a.ikp("div",{_id:"aiChatMessageContent"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(vn,{"data-role":e.role,...t})},bn=a.ikp("div",{_id:"aiChatMessageAttachments"}),it=t=>{const{message:e}=P.useMessage(),i=e.metadata?.attributes?.attachments;return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(bn,{...t})})},gn=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),at=t=>{const{children:e,...i}=t,{message:r}=P.useMessage(),s=r.metadata?.attributes?.attachments;return s?n.jsx(gn,{children:l.maybeRender(e,s),...i}):null},Pn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),nt=t=>{const{attachment:e,onClick:i,...r}=t,{selectItem:s,onOpen:o}=q.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Pn,{onClick:u.composeEventHandlers(i,d),...r})})},An=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),rt=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(An,{iconSettings:i,...t}):null},_n=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),st=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(_n,{children:e.title,...t})},Fn=a.ikp(A.Root,{_id:"aiChatMessageAttachmentsPreview"}),ot=t=>{const{onOpenChange:e,...i}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(Fn,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},dt=a.ikp(A.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),ct=a.ikp(A.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),En=a.ikp(A.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),mt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(En,{children:e?.title||"Attachment",...t})},lt=a.ikp(A.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),kn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(kn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),ut=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:i,...r}=t,{message:s}=P.useMessage(),{logEvent:o}=V.useChatEvents(),d=l.getMessageContent(s),{conversation:c}=O.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(ae.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,h)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:h?.toString(),url:m}})},onCodeCopy:(m,h)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:h}})}})})},In=a.ikp("div",{_id:"aiChatMessageToolbar"}),Ct=t=>{const{isLoading:e,messages:i}=g.useChat(),{message:r}=P.useMessage();return i.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(In,{...t})},Mn=a.ikp("div",{_id:"aiChatMessageToolActions"}),pt=t=>{const{children:e,...i}=t,{message:r}=P.useMessage(),{messageButtons:s}=g.useChat(),o=s[r.id]||[];return n.jsx(Mn,{children:l.maybeRender(e,o),...i})},Sn=a.ikp("a",{_id:"aiChatMessageToolAction"}),xn=a.ikp("button",{_id:"aiChatMessageToolAction"}),vt=t=>{const{onClick:e,action:i,...r}=t,{handleAction:s}=re.useChatAction(i),o=()=>{s()},d=i.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),d]});return i.action.type==="open_link"?n.jsx(Sn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...r}):n.jsx(xn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...r})},Bn=a.ikp("button",{_id:"aiChatMessageAction"}),bt=t=>{const{action:e,onClick:i,className:r,...s}=t,{conversation:o}=O.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=g.useChat(),[h,p]=ee.useCopyToClipboard(),{feedback:v,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:W}=ne.useMessageFeedback(),{logEvent:Y}=V.useChatEvents(),[N,J]=xa.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:X}=he,ue=m.at(-1)?.id===d?.id,Z=d.role==="assistant";if(ue&&c||!Z||{copy:!1,upvote:X,downvote:X}[e])return null;const H={copy(){p(l.getMessageContent(d)),Y({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{J()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(F.CustomIcon,{iconKey:h?"messageCopied":"messageCopy"}),upvote:n.jsx(F.CustomIcon,{iconKey:N?"messageCopied":"thumbsUp"}),downvote:n.jsx(F.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":l.dataAttr(h)},upvote:{"data-upvoted":l.dataAttr(v[d.id]?.type==="positive")},downvote:{"data-downvoted":l.dataAttr(v[d.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":D[e],className:`${r} ${e}`,onClick:u.composeEventHandlers(i,H[e]),...s})},fn=a.ikp("div",{_id:"aiChatMessageSources"}),gt=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(fn,{...t})},Tn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Pt=t=>n.jsx(Tn,{children:"Sources",...t}),jn=a.ikp("div",{_id:"aiChatMessageSources__List"}),At=t=>{const{message:e}=P.useMessage(),{children:i,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(h=>{const p=La.transformInkeepSource(h,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:s}),v=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:v}});return n.jsx(jn,{children:l.maybeRender(i,m),...r})},yn=a.ikp(Ia.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),_t=t=>{const{source:e,onClick:i,...r}=t,{logEvent:s}=V.useChatEvents(),{conversation:o}=O.useInkeepConversation(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(B.SourceItemProvider,{source:e,children:n.jsx(yn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...r})})},Hn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Ft=t=>{const{source:e}=B.useSourceItem();return e.breadcrumbs?.length?n.jsx(Hn,{"data-type":e.type,...t}):null},wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Ln=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),Et=t=>{const{source:e}=B.useSourceItem();return n.jsx(Ln,{iconSettings:e.icon,"data-type":e.type,...t})},Dn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),kt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Dn,{"data-type":e.type,children:e.title,...t})},On=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),It=t=>{const{source:e}=B.useSourceItem();return n.jsx(On,{"data-type":e.type,...t})},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),Mt=t=>{const{source:e}=B.useSourceItem(),{children:i,...r}=t,s=b.useMemo(()=>e.description?Ta.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(qn,{"data-type":e.type,children:l.maybeRender(i,s),...r}):null},Rn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),St=t=>{const{part:e,...i}=t,{source:r}=B.useSourceItem();return typeof e=="string"?e:n.jsx(Rn,{"data-type":r.type,children:e.content,"data-highlighted":l.dataAttr(e.highlighted),...i})},Wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Wn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Bt=a.ikp("div",{_id:"aiChatFooter"}),ft=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Tt=a.ikp("div",{_id:"aiChatInput__Group"}),Nn=a.ikp("textarea",{_id:"aiChatInput"}),jt=b.forwardRef(({onChange:t,onKeyDown:e,...i},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:h}=g.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),v=se.useComposedRefs(r,h);return Oa.useWidgetAutoFocus("chat",h,m),n.jsx(Nn,{asChild:!0,ref:v,maxLength:99999,placeholder:p.placeholder,value:d,onChange:u.composeEventHandlers(t,s),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(ie,{})})}),Qn=a.ikp("button",{_id:"aiChatInput__SendButton"}),yt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:r}=g.useChat(),{aiChatSettings:s}=C.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Qn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!r||s.isViewOnly,...d})},Ht=a.ikp(F.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),$n=a.ikp("div",{_id:"aiChatAttachmentsBar"}),wt=t=>{const{selectedWorkflow:e}=g.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(E.AttachmentsBarProvider,{children:n.jsx($n,{...t})})},Vn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Lt=t=>{const{children:e,...i}=t,{messageAttachments:r}=g.useChat();return n.jsx(Vn,{children:l.maybeRender(e,r),...i})},Un=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Dt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Un,{...i})})},Kn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Kn,{iconSettings:i,...t}):null},zn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),qt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(zn,{children:e.title,...t})},Gn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Rt=t=>{const{onClick:e,...i}=t,{attachment:r}=w.useAttachmentItem(),{setMessageAttachments:s}=g.useChat(),o=()=>{s(d=>d.filter(c=>c.id!==r.id))};return n.jsx(Gn,{"aria-label":"Remove attachment",children:n.jsx(F.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,o),...i})},Wt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Nt=a.ikp(j.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Qt=a.ikp(j.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),me=a.ikp(j.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),$t=a.ikp(j.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."]})}),Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Vt=t=>{const{children:e,...i}=t,{selectedWorkflow:r}=g.useChat();return r?.supportedInputs?n.jsx(Yn,{children:l.maybeRender(e,r.supportedInputs),...i}):null},Jn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),Ut=t=>{const{input:e,onClick:i,...r}=t,{selectedWorkflow:s,messageAttachments:o,setMessageAttachments:d}=g.useChat(),{selectInput:c,onOpen:m}=E.useAttachmentsBar(),h=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(Jn,{children:e.displayName,onClick:u.composeEventHandlers(i,h),...r})},Xn=a.ikp(A.Root,{_id:"aiChatAttachmentsBar__Modal"}),Kt=t=>{const{onOpenChange:e,...i}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=E.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(Xn,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},zt=a.ikp(A.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Gt=a.ikp(A.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Zn=a.ikp(A.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Jt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Zn,{children:i,...t})},er=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Xt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(er,{children:i,...t}):null},tr=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Zt=t=>{const{children:e,...i}=t,{selectedInput:r}=E.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(tr,{asChild:!e,children:e||s,...i}):null},ei=a.ikp(A.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),ti=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),ir=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ii=t=>{const{onSubmit:e,...i}=t,{form:r}=E.useAttachmentsBar();return n.jsx(ir,{onSubmit:u.composeEventHandlers(e,r.onSubmit),...i})},ai=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),ar=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),ni=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(ar,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},nr=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ri=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=E.useAttachmentsBar();return n.jsx(nr,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":l.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:u.composeEventHandlers(e,r.onChange),...i})},rr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),si=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.title?n.jsx(rr,{"aria-live":"polite",children:e.errors.title,...t}):null},oi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),sr=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),di=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(sr,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},or=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ci=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=E.useAttachmentsBar();return n.jsx(or,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":l.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:u.composeEventHandlers(e,r.onChange),...i,children:n.jsx(ie,{maxRows:10})})},dr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),mi=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.content?n.jsx(dr,{"aria-live":"polite",children:e.errors.content,...t}):null},li=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),hi=a.ikp("div",{_id:"aiChatActionBar"}),ui=a.ikp("div",{_id:"aiChat__ChatActions"}),Ci=a.ikp("div",{_id:"aiChatTagline__Container"}),pi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),vi=a.ikp(Sa.default,{_id:"aiChatTagline__Logo"}),bi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),cr=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),z=t=>{const{action:e,onClick:i,className:r,...s}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:h}=g.useChat(),{conversation:p}=O.useInkeepConversation(),{aiChatSettings:v,baseSettings:k}=C.useInkeepConfig(),{logEvent:y}=V.useChatEvents(),[W,Y]=ee.useCopyToClipboard(),[N,J]=ee.useCopyToClipboard();if({help:!1,copy:m.length===0||!v.isCopyChatButtonVisible||c,share:m.length===0||!v.isShareButtonVisible||!p.id||!!h||c,clear:m.length===0||v.isViewOnly||c,stop:!c}[e])return null;const Z={help:()=>{},copy:()=>{const Q=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=l.getMessageContent(H),S=Ma.stringifyAttachments(H.metadata?.attributes?.attachments),$=S?`
7
+ Let me know how I can help.`,b={content:s.introMessage??`${m}${h}`,id:qa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),cn=a.ikp("div",{_id:"aiChatMessageHeader"}),Ke=t=>{const{message:e}=P.useMessage();return n.jsx(cn,{"data-role":e.role,...t})},mn=a.ikp("div",{_id:"aiChatMessageLoading"}),ze=t=>{const{isLoading:e,isStreaming:i,messages:s}=v.useChat(),{message:r}=P.useMessage();return!(s.at(-1)?.id===r?.id)||r.role!=="assistant"||!e||i?null:n.jsx(mn,{children:"Thinking...",...t})},ln=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Ye=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=C.useInkeepConfig();return n.jsx(hn,{"data-username":l.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},un=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Je=g.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(un,{"data-role":i.role,children:l.getInitials(e.userProperties.name),...t}):null}),pe=a.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),Xe=g.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:s,baseSettings:{userProperties:r}}=C.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=s??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,h=ya.useColorModeValue(c,m),[p,b]=g.useState(h);g.useEffect(()=>{b(h)},[h]);const k=y=>{y==="error"&&b(null)};return o.role==="user"?r.name?null:s.userAvatar?n.jsx(pe,{"data-type":"image","data-role":o.role,src:s.userAvatar,...t}):n.jsx(ka.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,k),...i}):n.jsx(Ea.default,{"data-type":"icon","data-role":o.role,...t})}),Cn=a.ikp("span",{_id:"aiChatMessageName"}),Ze=t=>{const{message:e}=P.useMessage();return n.jsx(Cn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},pn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),et=t=>{const{message:e}=P.useMessage(),{messageButtons:i}=v.useChat(),s=i[e.id]||[];return n.jsx(pn,{"data-role":e.role,"data-has-message-buttons":l.dataAttr(!!s.length),...t})},vn=a.ikp("div",{_id:"aiChatMessageContent"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(vn,{"data-role":e.role,...t})},bn=a.ikp("div",{_id:"aiChatMessageAttachments"}),it=t=>{const{message:e}=P.useMessage(),i=e.metadata?.attributes?.attachments;return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(bn,{...t})})},gn=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),at=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),r=s.metadata?.attributes?.attachments;return r?n.jsx(gn,{children:l.maybeRender(e,r),...i}):null},Pn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),nt=t=>{const{attachment:e,onClick:i,...s}=t,{selectItem:r,onOpen:o}=q.useMessageAttachments(),d=()=>{r(e),o()};return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Pn,{onClick:u.composeEventHandlers(i,d),...s})})},An=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),st=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(An,{iconSettings:i,...t}):null},_n=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),rt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(_n,{children:e.title,...t})},Fn=a.ikp(A.Root,{_id:"aiChatMessageAttachmentsPreview"}),ot=t=>{const{onOpenChange:e,...i}=t,{selectItem:s,isOpen:r,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),s(null))};return n.jsx(Fn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},dt=a.ikp(A.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),ct=a.ikp(A.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),En=a.ikp(A.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),mt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(En,{children:e?.title||"Attachment",...t})},lt=a.ikp(A.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),kn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(kn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),ut=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:i,...s}=t,{message:r}=P.useMessage(),{logEvent:o}=V.useChatEvents(),d=l.getMessageContent(r),{conversation:c}=O.useInkeepConversation();return r.role==="user"?n.jsx(ve,{"data-role":r.role,children:d,...s}):n.jsx(ve,{"data-role":r.role,...s,children:n.jsx(ae.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,h)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:h?.toString(),url:m}})},onCodeCopy:(m,h)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:h}})}})})},In=a.ikp("div",{_id:"aiChatMessageToolbar"}),Ct=t=>{const{isLoading:e,messages:i}=v.useChat(),{message:s}=P.useMessage();return i.at(-1)?.id===s?.id&&e||s.role==="user"?null:n.jsx(In,{...t})},Mn=a.ikp("div",{_id:"aiChatMessageToolActions"}),pt=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),{messageButtons:r}=v.useChat(),o=r[s.id]||[];return n.jsx(Mn,{children:l.maybeRender(e,o),...i})},Sn=a.ikp("a",{_id:"aiChatMessageToolAction"}),xn=a.ikp("button",{_id:"aiChatMessageToolAction"}),vt=t=>{const{onClick:e,action:i,...s}=t,{handleAction:r}=se.useChatAction(i),o=()=>{r()},d=i.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),d]});return i.action.type==="open_link"?n.jsx(Sn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s}):n.jsx(xn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s})},Bn=a.ikp("button",{_id:"aiChatMessageAction"}),bt=t=>{const{action:e,onClick:i,className:s,...r}=t,{conversation:o}=O.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=v.useChat(),[h,p]=ee.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:W}=ne.useMessageFeedback(),{logEvent:Y}=V.useChatEvents(),[N,J]=xa.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:X}=he,ue=m.at(-1)?.id===d?.id,Z=d.role==="assistant";if(ue&&c||!Z||{copy:!1,upvote:X,downvote:X}[e])return null;const H={copy(){p(l.getMessageContent(d)),Y({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{J()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(F.CustomIcon,{iconKey:h?"messageCopied":"messageCopy"}),upvote:n.jsx(F.CustomIcon,{iconKey:N?"messageCopied":"thumbsUp"}),downvote:n.jsx(F.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":l.dataAttr(h)},upvote:{"data-upvoted":l.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":l.dataAttr(b[d.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":D[e],className:`${s} ${e}`,onClick:u.composeEventHandlers(i,H[e]),...r})},fn=a.ikp("div",{_id:"aiChatMessageSources"}),gt=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(fn,{...t})},Tn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Pt=t=>n.jsx(Tn,{children:"Sources",...t}),jn=a.ikp("div",{_id:"aiChatMessageSources__List"}),At=t=>{const{message:e}=P.useMessage(),{children:i,...s}=t,{baseSettings:{transformSource:r,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(h=>{const p=La.transformInkeepSource(h,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:r}),b=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:b}});return n.jsx(jn,{children:l.maybeRender(i,m),...s})},yn=a.ikp(Ia.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),_t=t=>{const{source:e,onClick:i,...s}=t,{logEvent:r}=V.useChatEvents(),{conversation:o}=O.useInkeepConversation(),d=()=>{r({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(B.SourceItemProvider,{source:e,children:n.jsx(yn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...s})})},Hn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Ft=t=>{const{source:e}=B.useSourceItem();return e.breadcrumbs?.length?n.jsx(Hn,{"data-type":e.type,...t}):null},wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Ln=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),Et=t=>{const{source:e}=B.useSourceItem();return n.jsx(Ln,{iconSettings:e.icon,"data-type":e.type,...t})},Dn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),kt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Dn,{"data-type":e.type,children:e.title,...t})},On=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),It=t=>{const{source:e}=B.useSourceItem();return n.jsx(On,{"data-type":e.type,...t})},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),Mt=t=>{const{source:e}=B.useSourceItem(),{children:i,...s}=t,r=g.useMemo(()=>e.description?Ta.highlightEmphasis(e.description):[],[e.description]);return r.length?n.jsx(qn,{"data-type":e.type,children:l.maybeRender(i,r),...s}):null},Rn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),St=t=>{const{part:e,...i}=t,{source:s}=B.useSourceItem();return typeof e=="string"?e:n.jsx(Rn,{"data-type":s.type,children:e.content,"data-highlighted":l.dataAttr(e.highlighted),...i})},Wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Wn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Bt=a.ikp("div",{_id:"aiChatFooter"}),ft=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Tt=a.ikp("div",{_id:"aiChatInput__Group"}),Nn=a.ikp("textarea",{_id:"aiChatInput"}),jt=g.forwardRef(({onChange:t,onKeyDown:e,...i},s)=>{const{handleInputChange:r,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:h}=v.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),b=re.useComposedRefs(s,h);return Oa.useWidgetAutoFocus("chat",h,m),n.jsx(Nn,{asChild:!0,ref:b,maxLength:99999,placeholder:p.placeholder,value:d,onChange:u.composeEventHandlers(t,r),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(ie,{})})}),Qn=a.ikp("button",{_id:"aiChatInput__SendButton"}),yt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:s}=v.useChat(),{aiChatSettings:r}=C.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Qn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!s||r.isViewOnly,...d})},Ht=a.ikp(F.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),$n=a.ikp("div",{_id:"aiChatAttachmentsBar"}),wt=t=>{const{selectedWorkflow:e}=v.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(E.AttachmentsBarProvider,{children:n.jsx($n,{...t})})},Vn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Lt=t=>{const{children:e,...i}=t,{messageAttachments:s}=v.useChat();return n.jsx(Vn,{children:l.maybeRender(e,s),...i})},Un=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Dt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Un,{...i})})},Kn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Kn,{iconSettings:i,...t}):null},zn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),qt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(zn,{children:e.title,...t})},Gn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Rt=t=>{const{onClick:e,...i}=t,{attachment:s}=w.useAttachmentItem(),{setMessageAttachments:r}=v.useChat(),o=()=>{r(d=>d.filter(c=>c.id!==s.id))};return n.jsx(Gn,{"aria-label":"Remove attachment",children:n.jsx(F.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,o),...i})},Wt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Nt=a.ikp(j.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Qt=a.ikp(j.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),me=a.ikp(j.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),$t=a.ikp(j.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."]})}),Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Vt=t=>{const{children:e,...i}=t,{selectedWorkflow:s}=v.useChat();return s?.supportedInputs?n.jsx(Yn,{children:l.maybeRender(e,s.supportedInputs),...i}):null},Jn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),Ut=t=>{const{input:e,onClick:i,...s}=t,{selectedWorkflow:r,messageAttachments:o,setMessageAttachments:d}=v.useChat(),{selectInput:c,onOpen:m}=E.useAttachmentsBar(),h=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return r?e.onInvoke(r,e,d,[...o]):void 0;c(e),m()};return n.jsx(Jn,{children:e.displayName,onClick:u.composeEventHandlers(i,h),...s})},Xn=a.ikp(A.Root,{_id:"aiChatAttachmentsBar__Modal"}),Kt=t=>{const{onOpenChange:e,...i}=t,{selectInput:s,isOpen:r,onClose:o,selectedInput:d}=E.useAttachmentsBar(),c=m=>{m||(o(),s(null))};return n.jsx(Xn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},zt=a.ikp(A.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Gt=a.ikp(A.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Zn=a.ikp(A.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Jt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Zn,{children:i,...t})},es=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Xt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(es,{children:i,...t}):null},ts=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Zt=t=>{const{children:e,...i}=t,{selectedInput:s}=E.useAttachmentsBar(),r=s?.workflowModalProps?.modalHelpElement;return r?n.jsx(ts,{asChild:!e,children:e||r,...i}):null},ei=a.ikp(A.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),ti=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),is=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ii=t=>{const{onSubmit:e,...i}=t,{form:s}=E.useAttachmentsBar();return n.jsx(is,{onSubmit:u.composeEventHandlers(e,s.onSubmit),...i})},ai=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),as=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),ni=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(as,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},ns=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),si=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(ns,{name:"title",value:s.data.title,id:`${r?.id}-title`,"data-invalid":l.dataAttr(!!s.errors.title),"aria-invalid":!!s.errors.title,onChange:u.composeEventHandlers(e,s.onChange),...i})},ss=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ri=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.title?n.jsx(ss,{"aria-live":"polite",children:e.errors.title,...t}):null},oi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),rs=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),di=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(rs,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},os=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ci=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(os,{asChild:!0,rows:4,name:"content",value:s.data.content,id:`${r?.id}-content`,"data-invalid":l.dataAttr(!!s.errors.content),"aria-invalid":!!s.errors.content,onChange:u.composeEventHandlers(e,s.onChange),...i,children:n.jsx(ie,{maxRows:10})})},ds=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),mi=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.content?n.jsx(ds,{"aria-live":"polite",children:e.errors.content,...t}):null},li=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),hi=a.ikp("div",{_id:"aiChatActionBar"}),ui=a.ikp("div",{_id:"aiChat__ChatActions"}),Ci=a.ikp("div",{_id:"aiChatTagline__Container"}),pi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),vi=a.ikp(Sa.default,{_id:"aiChatTagline__Logo"}),bi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),cs=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),z=t=>{const{action:e,onClick:i,className:s,...r}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:h}=v.useChat(),{conversation:p}=O.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=C.useInkeepConfig(),{logEvent:y}=V.useChatEvents(),[W,Y]=ee.useCopyToClipboard(),[N,J]=ee.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!p.id||!!h||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const Z={help:()=>{},copy:()=>{const Q=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=l.getMessageContent(H),S=Ma.stringifyAttachments(H.metadata?.attributes?.attachments),$=S?`
8
8
 
9
9
  **Attachments**
10
10
 
@@ -14,4 +14,4 @@ ${M}${$}`}).join(`
14
14
 
15
15
  ---
16
16
 
17
- `);Y(Q)},share:async()=>{const Q={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:H,analyticsApiBaseUrl:D}=k,M=await wa.logConversation("",Q,H,D);if(M){const $=`${v.shareChatUrlBasePath}?${O.SHARE_QUERY_PARAM}=${M?.id}`;J($),y({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:$,conversation:M}})}},clear:o,stop:d},Ce={copy:W,share:N};return n.jsx(j.Tooltip,{delayDuration:0,open:Ce[e],children:n.jsx(cr,{"data-type":e,"data-copied":l.dataAttr(W||N),className:`${r} ${e}`,children:n.jsx(le,{action:e}),onClick:u.composeEventHandlers(i,Z[e]),...s})})},mr=a.ikp("span",{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...i}=t,{aiChatSettings:r}=C.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(mr,{children:o[e],...i})},lr=a.ikp(j.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),gi=t=>{const{action:e,children:i,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(lr,{sideOffset:5,...r,children:[n.jsx(j.Arrow,{}),i||s[e]]})},hr=a.ikp(T.Root,{_id:"aiChatHelpActions"}),Pi=t=>{const{children:e,...i}=t,{aiChatSettings:r}=C.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,h=te.useHelpMenuState();return n.jsx(te.HelpMenuProvider,{value:h,children:n.jsx(hr,{open:h.open,onOpenChange:h.setOpen,children:l.maybeRender(e,{pinned:c,unpinned:m}),...i})})},ur=a.ikp(z,{_id:"aiChatHelpAction",action:"help"}),Cr=a.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),Ai=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=re.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:u.composeEventHandlers(i,()=>{s(),o()}),...r};return d==="open_link"?n.jsx(Cr,{href:e.action.url,...c}):n.jsx(ur,{...c})},pr=a.ikp(T.Trigger,{_id:"aiChatHelpActions__Trigger"}),_i=b.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(z,{action:"help",...t,asChild:!0,children:n.jsx(pr,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),vr=a.ikp(T.Content,{_id:"aiChatHelpActions__Menu"}),Fi=t=>n.jsx(vr,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Ei=a.ikp(T.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),ki=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=re.useChatAction(e),{setOpen:d}=te.useHelpMenu(),c=()=>{s({onOpenForm:()=>d(!1)}),o()},m=e.action.type,h=a.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:u.composeEventHandlers(i,c)});return n.jsx(h,{...r})},br=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),Ii=t=>{const{action:e,...i}=t;return e.icon?n.jsx(br,{iconSettings:e.icon,...i}):null},gr=a.ikp(A.Root,{_id:"aiChatFeedbackModal"}),Mi=t=>{const{onOpenChange:e,...i}=t,{currentFeedback:r,setCurrentFeedback:s}=ne.useMessageFeedback();return n.jsx(gr,{open:r!==null,onOpenChange:u.composeEventHandlers(e,()=>s(null)),...i})},Si=a.ikp(A.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),xi=a.ikp(A.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),Bi=a.ikp(A.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),fi=a.ikp(A.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),Ti=a.ikp("div",{_id:"aiChatFeedbackModal__Body"}),Pr=a.ikp("form",{_id:"aiChatFeedbackForm"}),ji=t=>{const{onSubmit:e,...i}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:o}=ne.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,h=new FormData(m),p=Object.fromEntries(h.entries());s&&(r(s,p),o(null))};return n.jsx(Pr,{onSubmit:u.composeEventHandlers(e,d),...i})},Ar=a.ikp("div",{_id:"aiChatFeedbackItem"}),yi=t=>{const{name:e,...i}=t;return n.jsx(U.FeedbackItemProvider,{name:e,children:n.jsx(Ar,{...i})})},_r=a.ikp(K.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Hi=t=>{const{name:e,focusItem:i}=U.useFeedbackItem(),{onCheckedChange:r,...s}=t,o=d=>{d&&i?.current?.focus()};return n.jsx(_r,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(r,o),...s})},wi=a.ikp(K.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Fr=a.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Li=t=>{const{name:e}=U.useFeedbackItem(),i={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:i[e],...t})},Er=a.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Di=t=>{const{name:e,focusItem:i}=U.useFeedbackItem();return n.jsx(Er,{ref:i,name:`${e}:description`,...t})},Oi=a.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),kr=a.ikp("div",{_id:"aiChatForm__Wrapper"}),qi=t=>{const{form:e}=_.useChatForm();return e?n.jsx(kr,{...t}):null},Ir=a.ikp("form",{_id:"aiChatForm"}),Ri=t=>{const{onSubmit:e,...i}=t,{handleSubmit:r,isSuccess:s}=_.useChatForm();return s?null:n.jsx(Ir,{onSubmit:u.composeEventHandlers(e,r),...i})},Mr=a.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),Wi=t=>{const{onClick:e,...i}=t,{closeForm:r}=_.useChatForm();return n.jsx(Mr,{onClick:u.composeEventHandlers(e,r),...i})},Ni=a.ikp("div",{_id:"aiChatForm__Header"}),Sr=a.ikp("h2",{_id:"aiChatForm__Heading"}),Qi=t=>{const{form:e}=_.useChatForm();return e?.heading?n.jsx(Sr,{children:e.heading,...t}):null},xr=a.ikp("span",{_id:"aiChatForm__Description"}),$i=t=>{const{form:e}=_.useChatForm();return e?.description?n.jsx(xr,{children:e.description,...t}):null},Br=a.ikp("div",{_id:"aiChatForm__Content"}),Vi=t=>{const{children:e,...i}=t,{fields:r=[]}=_.useChatForm();return n.jsx(Br,{children:l.maybeRender(e,r),...i})},fr=a.ikp("div",{_id:"aiChatForm__Field"}),Ui=t=>{const{field:e,autoFocus:i,...r}=t,{control:s,errors:o}=_.useChatForm();return n.jsx(fa.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(f.FormFieldProvider,{"data-invalid":l.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:i,children:c&&n.jsx(fr,{"data-input-type":e.inputType,"data-hidden":l.dataAttr(e.isHidden),...r})})}})},Tr=a.ikp("label",{_id:"aiChatForm__FieldLabel"}),Ki=t=>{const{field:e}=f.useFormField();return n.jsx(Tr,{"data-required":l.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},jr=a.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),G=t=>{const{field:e,error:i,fieldProps:{onChange:r,onBlur:s,...o},autoFocus:d}=f.useFormField(),{onChange:c,onBlur:m,...h}=t;return n.jsx(jr,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":l.dataAttr(!!i),onChange:u.composeEventHandlers(c,r),onBlur:u.composeEventHandlers(m,s),...o,...h})},zi=a.ikp(G,{_id:"aiChatForm__FieldEmail",type:"email"}),yr=a.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Gi=t=>{const{field:e,error:i,fieldProps:{value:r,onChange:s,onBlur:o,...d},autoFocus:c}=f.useFormField(),{onChange:m,onBlur:h,...p}=t,v=k=>{const y=k.target.files;s(y)};return n.jsx(yr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":l.dataAttr(!!i),...p,...d,onChange:u.composeEventHandlers(m,v),onBlur:u.composeEventHandlers(h,o)})},Yi=a.ikp(G,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ie,{maxRows:8})}),Hr=a.ikp(K.Root,{_id:"aiChatForm__FieldCheckbox"}),Ji=t=>{const{field:e,error:i,fieldProps:r,autoFocus:s}=f.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(Hr,{id:e.name,name:e.name,autoFocus:s,"data-invalid":l.dataAttr(!!i),checked:r.value,onCheckedChange:u.composeEventHandlers(o,r.onChange),...d})},Xi=a.ikp(K.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),wr=a.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),Zi=t=>{const{field:e,error:i,fieldProps:r}=f.useFormField(),{onValueChange:s,...o}=t;return n.jsx(wr,{name:e.name,"data-invalid":l.dataAttr(!!i),value:r.value,onValueChange:u.composeEventHandlers(s,r.onChange),...o})},ea=a.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),Lr=a.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),ta=t=>{const{field:e}=f.useFormField();return n.jsx(Lr,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ia=a.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),aa=a.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),na=a.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),ra=a.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),sa=a.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),oa=a.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Dr=a.ikp("span",{_id:"aiChatForm__FieldError"}),da=t=>{const{error:e}=f.useFormField();return e?n.jsx(Dr,{children:e.message?.toString(),...t}):null},Or=a.ikp("span",{_id:"aiChatForm__Error"}),ca=t=>{const{formError:e}=_.useChatForm();return e?n.jsx(Or,{children:e.message,...t}):null},ma=a.ikp("div",{_id:"aiChatForm__Footer"}),qr=a.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),la=t=>{const{onClick:e,...i}=t,{closeForm:r}=_.useChatForm();return n.jsx(qr,{onClick:u.composeEventHandlers(e,r),...i})},Rr=a.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),ha=t=>{const{onClick:e,...i}=t,{isSubmitting:r}=_.useChatForm();return n.jsx(Rr,{disabled:r,...i})},Wr=a.ikp("div",{_id:"aiChatForm__Success"}),ua=t=>{const{isSuccess:e}=_.useChatForm();return e?n.jsx(Wr,{...t}):null},Nr=a.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),Ca=t=>{const{form:e}=_.useChatForm();return n.jsx(Nr,{children:e?.successView.heading,...t})},Qr=a.ikp(ae.Markdown,{_id:"aiChatForm__SuccessMessage"}),pa=t=>{const{form:e}=_.useChatForm();return n.jsx(Qr,{children:e?.successView.message,...t})},$r=a.ikp("button",{_id:"aiChatForm__SuccessButton"}),va=t=>{const{onClick:e,...i}=t,{form:r,closeForm:s}=_.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($r,{onClick:u.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[d,c]}),...i})};exports.Provider=g.ChatProvider;exports.ActionBar=hi;exports.Actions=ui;exports.AttachmentsBar=wt;exports.AttachmentsBarActions=Wt;exports.AttachmentsBarAttachment=Dt;exports.AttachmentsBarAttachmentDelete=Rt;exports.AttachmentsBarAttachmentIcon=Ot;exports.AttachmentsBarAttachmentTitle=qt;exports.AttachmentsBarForm=ii;exports.AttachmentsBarFormContent=oi;exports.AttachmentsBarFormContentError=mi;exports.AttachmentsBarFormContentInput=ci;exports.AttachmentsBarFormContentLabel=di;exports.AttachmentsBarFormSubmitButton=li;exports.AttachmentsBarFormTitle=ai;exports.AttachmentsBarFormTitleError=si;exports.AttachmentsBarFormTitleInput=ri;exports.AttachmentsBarFormTitleLabel=ni;exports.AttachmentsBarInfoTip=Nt;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Qt;exports.AttachmentsBarInfoTipText=$t;exports.AttachmentsBarInput=Ut;exports.AttachmentsBarInputs=Vt;exports.AttachmentsBarList=Lt;exports.AttachmentsBarModal=Kt;exports.AttachmentsBarModalBody=ti;exports.AttachmentsBarModalClose=ei;exports.AttachmentsBarModalContent=Gt;exports.AttachmentsBarModalDescription=Xt;exports.AttachmentsBarModalHeader=Yt;exports.AttachmentsBarModalHeading=Jt;exports.AttachmentsBarModalHelp=Zt;exports.AttachmentsBarModalOverlay=zt;exports.ChatAction=z;exports.ChatActionFeedback=gi;exports.ChatActionLabel=le;exports.ChatHelpAction=Ai;exports.Content=ke;exports.ContentScrollArea=Ie;exports.ContentScrollAreaCorner=Be;exports.ContentScrollAreaScrollbar=Se;exports.ContentScrollAreaThumb=xe;exports.ContentScrollAreaViewport=Me;exports.ConversationLoading=Pe;exports.Disclaimer=Te;exports.DisclaimerArrow=Le;exports.DisclaimerContent=He;exports.DisclaimerLabel=je;exports.DisclaimerText=we;exports.DisclaimerTrigger=ye;exports.EmbeddedChatPrimitiveActionBar=hi;exports.EmbeddedChatPrimitiveActions=ui;exports.EmbeddedChatPrimitiveAttachmentsBar=wt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=qt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ii;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=oi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=ai;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=ni;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=$t;exports.EmbeddedChatPrimitiveAttachmentsBarInput=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarList=Lt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=Jt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=zt;exports.EmbeddedChatPrimitiveChatAction=z;exports.EmbeddedChatPrimitiveChatActionFeedback=gi;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Ai;exports.EmbeddedChatPrimitiveContent=ke;exports.EmbeddedChatPrimitiveContentScrollArea=Ie;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Be;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=Se;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=xe;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Me;exports.EmbeddedChatPrimitiveConversationLoading=Pe;exports.EmbeddedChatPrimitiveDisclaimer=Te;exports.EmbeddedChatPrimitiveDisclaimerArrow=Le;exports.EmbeddedChatPrimitiveDisclaimerContent=He;exports.EmbeddedChatPrimitiveDisclaimerLabel=je;exports.EmbeddedChatPrimitiveDisclaimerText=we;exports.EmbeddedChatPrimitiveDisclaimerTrigger=ye;exports.EmbeddedChatPrimitiveExampleQuestion=Re;exports.EmbeddedChatPrimitiveExampleQuestionButton=We;exports.EmbeddedChatPrimitiveExampleQuestions=De;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=Oe;exports.EmbeddedChatPrimitiveExampleQuestionsList=qe;exports.EmbeddedChatPrimitiveFeedbackForm=ji;exports.EmbeddedChatPrimitiveFeedbackItem=yi;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Hi;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=wi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Di;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Li;exports.EmbeddedChatPrimitiveFeedbackModal=Mi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Ti;exports.EmbeddedChatPrimitiveFeedbackModalClose=fi;exports.EmbeddedChatPrimitiveFeedbackModalContent=xi;exports.EmbeddedChatPrimitiveFeedbackModalHeader=Bi;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Si;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Oi;exports.EmbeddedChatPrimitiveFooter=Bt;exports.EmbeddedChatPrimitiveForm=Ri;exports.EmbeddedChatPrimitiveFormCancel=la;exports.EmbeddedChatPrimitiveFormClose=Wi;exports.EmbeddedChatPrimitiveFormContent=Vi;exports.EmbeddedChatPrimitiveFormDescription=$i;exports.EmbeddedChatPrimitiveFormError=ca;exports.EmbeddedChatPrimitiveFormField=Ui;exports.EmbeddedChatPrimitiveFormFieldCheckbox=Ji;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=Xi;exports.EmbeddedChatPrimitiveFormFieldEmail=zi;exports.EmbeddedChatPrimitiveFormFieldError=da;exports.EmbeddedChatPrimitiveFormFieldFile=Gi;exports.EmbeddedChatPrimitiveFormFieldLabel=Ki;exports.EmbeddedChatPrimitiveFormFieldSelect=Zi;exports.EmbeddedChatPrimitiveFormFieldSelectContent=aa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ia;exports.EmbeddedChatPrimitiveFormFieldSelectItem=ra;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=oa;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=sa;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=ea;exports.EmbeddedChatPrimitiveFormFieldSelectValue=ta;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=na;exports.EmbeddedChatPrimitiveFormFieldText=G;exports.EmbeddedChatPrimitiveFormFieldTextArea=Yi;exports.EmbeddedChatPrimitiveFormFooter=ma;exports.EmbeddedChatPrimitiveFormHeader=Ni;exports.EmbeddedChatPrimitiveFormHeading=Qi;exports.EmbeddedChatPrimitiveFormSubmit=ha;exports.EmbeddedChatPrimitiveFormSuccess=ua;exports.EmbeddedChatPrimitiveFormSuccessButton=va;exports.EmbeddedChatPrimitiveFormSuccessHeading=Ca;exports.EmbeddedChatPrimitiveFormSuccessMessage=pa;exports.EmbeddedChatPrimitiveFormWrapper=qi;exports.EmbeddedChatPrimitiveHeaderToolbar=_e;exports.EmbeddedChatPrimitiveHelpActions=Pi;exports.EmbeddedChatPrimitiveHelpActionsMenu=Fi;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Ei;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=ki;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=Ii;exports.EmbeddedChatPrimitiveHelpActionsTrigger=_i;exports.EmbeddedChatPrimitiveInput=jt;exports.EmbeddedChatPrimitiveInputFieldset=ft;exports.EmbeddedChatPrimitiveInputGroup=Tt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=Ue;exports.EmbeddedChatPrimitiveMessage=ut;exports.EmbeddedChatPrimitiveMessageAction=bt;exports.EmbeddedChatPrimitiveMessageAttachments=it;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=st;exports.EmbeddedChatPrimitiveMessageAttachmentsList=at;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=mt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=dt;exports.EmbeddedChatPrimitiveMessageAvatar=Ge;exports.EmbeddedChatPrimitiveMessageAvatarContent=Ye;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Je;exports.EmbeddedChatPrimitiveMessageAvatarImage=Xe;exports.EmbeddedChatPrimitiveMessageContent=tt;exports.EmbeddedChatPrimitiveMessageContentWrapper=et;exports.EmbeddedChatPrimitiveMessageHeader=Ke;exports.EmbeddedChatPrimitiveMessageLoading=ze;exports.EmbeddedChatPrimitiveMessageName=Ze;exports.EmbeddedChatPrimitiveMessageSourceItem=_t;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=Mt;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=St;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=Et;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=xt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=It;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=kt;exports.EmbeddedChatPrimitiveMessageSources=gt;exports.EmbeddedChatPrimitiveMessageSourcesHeader=Pt;exports.EmbeddedChatPrimitiveMessageSourcesList=At;exports.EmbeddedChatPrimitiveMessageToolAction=vt;exports.EmbeddedChatPrimitiveMessageToolActions=pt;exports.EmbeddedChatPrimitiveMessageToolbar=Ct;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=fe;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=yt;exports.EmbeddedChatPrimitiveSendButtonIcon=Ht;exports.EmbeddedChatPrimitiveTaglineBrandName=bi;exports.EmbeddedChatPrimitiveTaglineContainer=Ci;exports.EmbeddedChatPrimitiveTaglineLogo=vi;exports.EmbeddedChatPrimitiveTaglineText=pi;exports.EmbeddedChatPrimitiveToolbarHeader=Ee;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ve;exports.EmbeddedChatPrimitiveWorkflows=Ne;exports.EmbeddedChatPrimitiveWorkflowsLabel=Qe;exports.EmbeddedChatPrimitiveWorkflowsList=$e;exports.EmbeddedChatPrimitiveWrapper=ge;exports.ExampleQuestion=Re;exports.ExampleQuestionButton=We;exports.ExampleQuestions=De;exports.ExampleQuestionsLabel=Oe;exports.ExampleQuestionsList=qe;exports.FeedbackForm=ji;exports.FeedbackItem=yi;exports.FeedbackItemCheckbox=Hi;exports.FeedbackItemCheckboxIndicator=wi;exports.FeedbackItemDescription=Di;exports.FeedbackItemLabel=Li;exports.FeedbackModal=Mi;exports.FeedbackModalBody=Ti;exports.FeedbackModalClose=fi;exports.FeedbackModalContent=xi;exports.FeedbackModalHeader=Bi;exports.FeedbackModalOverlay=Si;exports.FeedbackSubmitButton=Oi;exports.Footer=Bt;exports.Form=Ri;exports.FormCancel=la;exports.FormClose=Wi;exports.FormContent=Vi;exports.FormDescription=$i;exports.FormError=ca;exports.FormField=Ui;exports.FormFieldCheckbox=Ji;exports.FormFieldCheckboxIndicator=Xi;exports.FormFieldEmail=zi;exports.FormFieldError=da;exports.FormFieldFile=Gi;exports.FormFieldLabel=Ki;exports.FormFieldSelect=Zi;exports.FormFieldSelectContent=aa;exports.FormFieldSelectIcon=ia;exports.FormFieldSelectItem=ra;exports.FormFieldSelectItemIndicator=oa;exports.FormFieldSelectItemText=sa;exports.FormFieldSelectTrigger=ea;exports.FormFieldSelectValue=ta;exports.FormFieldSelectViewport=na;exports.FormFieldText=G;exports.FormFieldTextArea=Yi;exports.FormFooter=ma;exports.FormHeader=Ni;exports.FormHeading=Qi;exports.FormSubmit=ha;exports.FormSuccess=ua;exports.FormSuccessButton=va;exports.FormSuccessHeading=Ca;exports.FormSuccessMessage=pa;exports.FormWrapper=qi;exports.Header=Qa;exports.HeaderToolbar=_e;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=Pi;exports.HelpActionsMenu=Fi;exports.HelpActionsMenuArrow=Ei;exports.HelpActionsMenuItem=ki;exports.HelpActionsMenuItemIcon=Ii;exports.HelpActionsTrigger=_i;exports.Input=jt;exports.InputFieldset=ft;exports.InputGroup=Tt;exports.IntroMessageWrapper=Ue;exports.Message=ut;exports.MessageAction=bt;exports.MessageAttachments=it;exports.MessageAttachmentsItem=nt;exports.MessageAttachmentsItemIcon=rt;exports.MessageAttachmentsItemTitle=st;exports.MessageAttachmentsList=at;exports.MessageAttachmentsPreview=ot;exports.MessageAttachmentsPreviewBody=ht;exports.MessageAttachmentsPreviewClose=lt;exports.MessageAttachmentsPreviewContent=ct;exports.MessageAttachmentsPreviewHeader=mt;exports.MessageAttachmentsPreviewOverlay=dt;exports.MessageAvatar=Ge;exports.MessageAvatarContent=Ye;exports.MessageAvatarFallback=Je;exports.MessageAvatarImage=Xe;exports.MessageContent=tt;exports.MessageContentWrapper=et;exports.MessageHeader=Ke;exports.MessageLoading=ze;exports.MessageName=Ze;exports.MessageSourceItem=_t;exports.MessageSourceItemBreadcrumbIcon=wn;exports.MessageSourceItemBreadcrumbs=Ft;exports.MessageSourceItemDescription=Mt;exports.MessageSourceItemDescriptionPart=St;exports.MessageSourceItemIcon=Et;exports.MessageSourceItemIndicator=xt;exports.MessageSourceItemTag=It;exports.MessageSourceItemTitle=kt;exports.MessageSources=gt;exports.MessageSourcesHeader=Pt;exports.MessageSourcesList=At;exports.MessageToolAction=vt;exports.MessageToolActions=pt;exports.MessageToolbar=Ct;exports.MessageWrapper=ce;exports.Messages=fe;exports.Root=Ae;exports.SendButton=yt;exports.SendButtonIcon=Ht;exports.TaglineBrandName=bi;exports.TaglineContainer=Ci;exports.TaglineLogo=vi;exports.TaglineText=pi;exports.ToolbarHeader=Ee;exports.Workflow=Ve;exports.Workflows=Ne;exports.WorkflowsLabel=Qe;exports.WorkflowsList=$e;exports.Wrapper=ge;
17
+ `);Y(Q)},share:async()=>{const Q={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:H,analyticsApiBaseUrl:D}=k,M=await wa.logConversation("",Q,H,D);if(M){const $=`${b.shareChatUrlBasePath}?${O.SHARE_QUERY_PARAM}=${M?.id}`;J($),y({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:$,conversation:M}})}},clear:o,stop:d},Ce={copy:W,share:N};return n.jsx(j.Tooltip,{delayDuration:0,open:Ce[e],children:n.jsx(cs,{"data-type":e,"data-copied":l.dataAttr(W||N),className:`${s} ${e}`,children:n.jsx(le,{action:e}),onClick:u.composeEventHandlers(i,Z[e]),...r})})},ms=a.ikp("span",{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...i}=t,{aiChatSettings:s}=C.useInkeepConfig(),r=s.toolbarButtonLabels??{},o={help:r.getHelp??"Get Help",copy:r.copyChat??"Copy",share:r.share??"Share",clear:r.clear??"Clear",stop:r.stop??"Stop"};return n.jsx(ms,{children:o[e],...i})},ls=a.ikp(j.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),gi=t=>{const{action:e,children:i,...s}=t,r={copy:"Copied!",share:"Link copied!"};return n.jsxs(ls,{sideOffset:5,...s,children:[n.jsx(j.Arrow,{}),i||r[e]]})},hs=a.ikp(T.Root,{_id:"aiChatHelpActions"}),Pi=t=>{const{children:e,...i}=t,{aiChatSettings:s}=C.useInkeepConfig(),{getHelpOptions:r}=s;if(!r||(r??[]).length===0)return null;const{_pinned:o,_unpinned:d}=r.reduce((p,b)=>{const k=b.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[k]:[...p[k],b]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,h=te.useHelpMenuState();return n.jsx(te.HelpMenuProvider,{value:h,children:n.jsx(hs,{open:h.open,onOpenChange:h.setOpen,children:l.maybeRender(e,{pinned:c,unpinned:m}),...i})})},us=a.ikp(z,{_id:"aiChatHelpAction",action:"help"}),Cs=a.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),Ai=t=>{const{action:e,onClick:i,...s}=t,{handleAction:r,logHelpAction:o}=se.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:u.composeEventHandlers(i,()=>{r(),o()}),...s};return d==="open_link"?n.jsx(Cs,{href:e.action.url,...c}):n.jsx(us,{...c})},ps=a.ikp(T.Trigger,{_id:"aiChatHelpActions__Trigger"}),_i=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(z,{action:"help",...t,asChild:!0,children:n.jsx(ps,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),vs=a.ikp(T.Content,{_id:"aiChatHelpActions__Menu"}),Fi=t=>n.jsx(vs,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Ei=a.ikp(T.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),ki=t=>{const{action:e,onClick:i,...s}=t,{handleAction:r,logHelpAction:o}=se.useChatAction(e),{setOpen:d}=te.useHelpMenu(),c=()=>{r({onOpenForm:()=>d(!1)}),o()},m=e.action.type,h=a.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:u.composeEventHandlers(i,c)});return n.jsx(h,{...s})},bs=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),Ii=t=>{const{action:e,...i}=t;return e.icon?n.jsx(bs,{iconSettings:e.icon,...i}):null},gs=a.ikp(A.Root,{_id:"aiChatFeedbackModal"}),Mi=t=>{const{onOpenChange:e,...i}=t,{currentFeedback:s,setCurrentFeedback:r}=ne.useMessageFeedback();return n.jsx(gs,{open:s!==null,onOpenChange:u.composeEventHandlers(e,()=>r(null)),...i})},Si=a.ikp(A.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),xi=a.ikp(A.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),Bi=a.ikp(A.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),fi=a.ikp(A.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),Ti=a.ikp("div",{_id:"aiChatFeedbackModal__Body"}),Ps=a.ikp("form",{_id:"aiChatFeedbackForm"}),ji=t=>{const{onSubmit:e,...i}=t,{submitNegativeFeedback:s,currentFeedback:r,setCurrentFeedback:o}=ne.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,h=new FormData(m),p=Object.fromEntries(h.entries());r&&(s(r,p),o(null))};return n.jsx(Ps,{onSubmit:u.composeEventHandlers(e,d),...i})},As=a.ikp("div",{_id:"aiChatFeedbackItem"}),yi=t=>{const{name:e,...i}=t;return n.jsx(U.FeedbackItemProvider,{name:e,children:n.jsx(As,{...i})})},_s=a.ikp(K.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Hi=t=>{const{name:e,focusItem:i}=U.useFeedbackItem(),{onCheckedChange:s,...r}=t,o=d=>{d&&i?.current?.focus()};return n.jsx(_s,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(s,o),...r})},wi=a.ikp(K.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Fs=a.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Li=t=>{const{name:e}=U.useFeedbackItem(),i={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(Fs,{htmlFor:`feedback-${e}`,children:i[e],...t})},Es=a.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Di=t=>{const{name:e,focusItem:i}=U.useFeedbackItem();return n.jsx(Es,{ref:i,name:`${e}:description`,...t})},Oi=a.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),ks=a.ikp("div",{_id:"aiChatForm__Wrapper"}),qi=t=>{const{form:e}=_.useChatForm();return e?n.jsx(ks,{...t}):null},Is=a.ikp("form",{_id:"aiChatForm"}),Ri=t=>{const{onSubmit:e,...i}=t,{handleSubmit:s,isSuccess:r}=_.useChatForm();return r?null:n.jsx(Is,{onSubmit:u.composeEventHandlers(e,s),...i})},Ms=a.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),Wi=t=>{const{onClick:e,...i}=t,{closeForm:s}=_.useChatForm();return n.jsx(Ms,{onClick:u.composeEventHandlers(e,s),...i})},Ni=a.ikp("div",{_id:"aiChatForm__Header"}),Ss=a.ikp("h2",{_id:"aiChatForm__Heading"}),Qi=t=>{const{form:e}=_.useChatForm();return e?.heading?n.jsx(Ss,{children:e.heading,...t}):null},xs=a.ikp("span",{_id:"aiChatForm__Description"}),$i=t=>{const{form:e}=_.useChatForm();return e?.description?n.jsx(xs,{children:e.description,...t}):null},Bs=a.ikp("div",{_id:"aiChatForm__Content"}),Vi=t=>{const{children:e,...i}=t,{fields:s=[]}=_.useChatForm();return n.jsx(Bs,{children:l.maybeRender(e,s),...i})},fs=a.ikp("div",{_id:"aiChatForm__Field"}),Ui=t=>{const{field:e,autoFocus:i,...s}=t,{control:r,errors:o}=_.useChatForm();return n.jsx(fa.Controller,{name:e.name,control:r,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(f.FormFieldProvider,{"data-invalid":l.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:i,children:c&&n.jsx(fs,{"data-input-type":e.inputType,"data-hidden":l.dataAttr(e.isHidden),...s})})}})},Ts=a.ikp("label",{_id:"aiChatForm__FieldLabel"}),Ki=t=>{const{field:e}=f.useFormField();return n.jsx(Ts,{"data-required":l.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},js=a.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),G=t=>{const{field:e,error:i,fieldProps:{onChange:s,onBlur:r,...o},autoFocus:d}=f.useFormField(),{onChange:c,onBlur:m,...h}=t;return n.jsx(js,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":l.dataAttr(!!i),onChange:u.composeEventHandlers(c,s),onBlur:u.composeEventHandlers(m,r),...o,...h})},zi=a.ikp(G,{_id:"aiChatForm__FieldEmail",type:"email"}),ys=a.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Gi=t=>{const{field:e,error:i,fieldProps:{value:s,onChange:r,onBlur:o,...d},autoFocus:c}=f.useFormField(),{onChange:m,onBlur:h,...p}=t,b=k=>{const y=k.target.files;r(y)};return n.jsx(ys,{id:e.name,autoFocus:c,"data-value":s,"data-invalid":l.dataAttr(!!i),...p,...d,onChange:u.composeEventHandlers(m,b),onBlur:u.composeEventHandlers(h,o)})},Yi=a.ikp(G,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ie,{maxRows:8})}),Hs=a.ikp(K.Root,{_id:"aiChatForm__FieldCheckbox"}),Ji=t=>{const{field:e,error:i,fieldProps:s,autoFocus:r}=f.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(Hs,{id:e.name,name:e.name,autoFocus:r,"data-invalid":l.dataAttr(!!i),checked:s.value,onCheckedChange:u.composeEventHandlers(o,s.onChange),...d})},Xi=a.ikp(K.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),ws=a.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),Zi=t=>{const{field:e,error:i,fieldProps:s}=f.useFormField(),{onValueChange:r,...o}=t;return n.jsx(ws,{name:e.name,"data-invalid":l.dataAttr(!!i),value:s.value,onValueChange:u.composeEventHandlers(r,s.onChange),...o})},ea=a.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),Ls=a.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),ta=t=>{const{field:e}=f.useFormField();return n.jsx(Ls,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ia=a.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),aa=a.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),na=a.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),sa=a.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ra=a.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),oa=a.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Ds=a.ikp("span",{_id:"aiChatForm__FieldError"}),da=t=>{const{error:e}=f.useFormField();return e?n.jsx(Ds,{children:e.message?.toString(),...t}):null},Os=a.ikp("span",{_id:"aiChatForm__Error"}),ca=t=>{const{formError:e}=_.useChatForm();return e?n.jsx(Os,{children:e.message,...t}):null},ma=a.ikp("div",{_id:"aiChatForm__Footer"}),qs=a.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),la=t=>{const{onClick:e,...i}=t,{closeForm:s}=_.useChatForm();return n.jsx(qs,{onClick:u.composeEventHandlers(e,s),...i})},Rs=a.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),ha=t=>{const{onClick:e,...i}=t,{isSubmitting:s}=_.useChatForm();return n.jsx(Rs,{disabled:s,...i})},Ws=a.ikp("div",{_id:"aiChatForm__Success"}),ua=t=>{const{isSuccess:e}=_.useChatForm();return e?n.jsx(Ws,{...t}):null},Ns=a.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),Ca=t=>{const{form:e}=_.useChatForm();return n.jsx(Ns,{children:e?.successView.heading,...t})},Qs=a.ikp(ae.Markdown,{_id:"aiChatForm__SuccessMessage"}),pa=t=>{const{form:e}=_.useChatForm();return n.jsx(Qs,{children:e?.successView.message,...t})},$s=a.ikp("button",{_id:"aiChatForm__SuccessButton"}),va=t=>{const{onClick:e,...i}=t,{form:s,closeForm:r}=_.useChatForm(),o=s?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx($s,{onClick:u.composeEventHandlers(e,r),children:n.jsxs(n.Fragment,{children:[d,c]}),...i})};exports.Provider=v.ChatProvider;exports.ActionBar=hi;exports.Actions=ui;exports.AttachmentsBar=wt;exports.AttachmentsBarActions=Wt;exports.AttachmentsBarAttachment=Dt;exports.AttachmentsBarAttachmentDelete=Rt;exports.AttachmentsBarAttachmentIcon=Ot;exports.AttachmentsBarAttachmentTitle=qt;exports.AttachmentsBarForm=ii;exports.AttachmentsBarFormContent=oi;exports.AttachmentsBarFormContentError=mi;exports.AttachmentsBarFormContentInput=ci;exports.AttachmentsBarFormContentLabel=di;exports.AttachmentsBarFormSubmitButton=li;exports.AttachmentsBarFormTitle=ai;exports.AttachmentsBarFormTitleError=ri;exports.AttachmentsBarFormTitleInput=si;exports.AttachmentsBarFormTitleLabel=ni;exports.AttachmentsBarInfoTip=Nt;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Qt;exports.AttachmentsBarInfoTipText=$t;exports.AttachmentsBarInput=Ut;exports.AttachmentsBarInputs=Vt;exports.AttachmentsBarList=Lt;exports.AttachmentsBarModal=Kt;exports.AttachmentsBarModalBody=ti;exports.AttachmentsBarModalClose=ei;exports.AttachmentsBarModalContent=Gt;exports.AttachmentsBarModalDescription=Xt;exports.AttachmentsBarModalHeader=Yt;exports.AttachmentsBarModalHeading=Jt;exports.AttachmentsBarModalHelp=Zt;exports.AttachmentsBarModalOverlay=zt;exports.ChatAction=z;exports.ChatActionFeedback=gi;exports.ChatActionLabel=le;exports.ChatHelpAction=Ai;exports.Content=ke;exports.ContentScrollArea=Ie;exports.ContentScrollAreaCorner=Be;exports.ContentScrollAreaScrollbar=Se;exports.ContentScrollAreaThumb=xe;exports.ContentScrollAreaViewport=Me;exports.ConversationLoading=Pe;exports.Disclaimer=Te;exports.DisclaimerArrow=Le;exports.DisclaimerContent=He;exports.DisclaimerLabel=je;exports.DisclaimerText=we;exports.DisclaimerTrigger=ye;exports.EmbeddedChatPrimitiveActionBar=hi;exports.EmbeddedChatPrimitiveActions=ui;exports.EmbeddedChatPrimitiveAttachmentsBar=wt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=qt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ii;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=oi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=ai;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=ni;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=$t;exports.EmbeddedChatPrimitiveAttachmentsBarInput=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarList=Lt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=Jt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=zt;exports.EmbeddedChatPrimitiveChatAction=z;exports.EmbeddedChatPrimitiveChatActionFeedback=gi;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Ai;exports.EmbeddedChatPrimitiveContent=ke;exports.EmbeddedChatPrimitiveContentScrollArea=Ie;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Be;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=Se;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=xe;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Me;exports.EmbeddedChatPrimitiveConversationLoading=Pe;exports.EmbeddedChatPrimitiveDisclaimer=Te;exports.EmbeddedChatPrimitiveDisclaimerArrow=Le;exports.EmbeddedChatPrimitiveDisclaimerContent=He;exports.EmbeddedChatPrimitiveDisclaimerLabel=je;exports.EmbeddedChatPrimitiveDisclaimerText=we;exports.EmbeddedChatPrimitiveDisclaimerTrigger=ye;exports.EmbeddedChatPrimitiveExampleQuestion=Re;exports.EmbeddedChatPrimitiveExampleQuestionButton=We;exports.EmbeddedChatPrimitiveExampleQuestions=De;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=Oe;exports.EmbeddedChatPrimitiveExampleQuestionsList=qe;exports.EmbeddedChatPrimitiveFeedbackForm=ji;exports.EmbeddedChatPrimitiveFeedbackItem=yi;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Hi;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=wi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Di;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Li;exports.EmbeddedChatPrimitiveFeedbackModal=Mi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Ti;exports.EmbeddedChatPrimitiveFeedbackModalClose=fi;exports.EmbeddedChatPrimitiveFeedbackModalContent=xi;exports.EmbeddedChatPrimitiveFeedbackModalHeader=Bi;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Si;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Oi;exports.EmbeddedChatPrimitiveFooter=Bt;exports.EmbeddedChatPrimitiveForm=Ri;exports.EmbeddedChatPrimitiveFormCancel=la;exports.EmbeddedChatPrimitiveFormClose=Wi;exports.EmbeddedChatPrimitiveFormContent=Vi;exports.EmbeddedChatPrimitiveFormDescription=$i;exports.EmbeddedChatPrimitiveFormError=ca;exports.EmbeddedChatPrimitiveFormField=Ui;exports.EmbeddedChatPrimitiveFormFieldCheckbox=Ji;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=Xi;exports.EmbeddedChatPrimitiveFormFieldEmail=zi;exports.EmbeddedChatPrimitiveFormFieldError=da;exports.EmbeddedChatPrimitiveFormFieldFile=Gi;exports.EmbeddedChatPrimitiveFormFieldLabel=Ki;exports.EmbeddedChatPrimitiveFormFieldSelect=Zi;exports.EmbeddedChatPrimitiveFormFieldSelectContent=aa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ia;exports.EmbeddedChatPrimitiveFormFieldSelectItem=sa;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=oa;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ra;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=ea;exports.EmbeddedChatPrimitiveFormFieldSelectValue=ta;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=na;exports.EmbeddedChatPrimitiveFormFieldText=G;exports.EmbeddedChatPrimitiveFormFieldTextArea=Yi;exports.EmbeddedChatPrimitiveFormFooter=ma;exports.EmbeddedChatPrimitiveFormHeader=Ni;exports.EmbeddedChatPrimitiveFormHeading=Qi;exports.EmbeddedChatPrimitiveFormSubmit=ha;exports.EmbeddedChatPrimitiveFormSuccess=ua;exports.EmbeddedChatPrimitiveFormSuccessButton=va;exports.EmbeddedChatPrimitiveFormSuccessHeading=Ca;exports.EmbeddedChatPrimitiveFormSuccessMessage=pa;exports.EmbeddedChatPrimitiveFormWrapper=qi;exports.EmbeddedChatPrimitiveHeaderToolbar=_e;exports.EmbeddedChatPrimitiveHelpActions=Pi;exports.EmbeddedChatPrimitiveHelpActionsMenu=Fi;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Ei;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=ki;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=Ii;exports.EmbeddedChatPrimitiveHelpActionsTrigger=_i;exports.EmbeddedChatPrimitiveInput=jt;exports.EmbeddedChatPrimitiveInputFieldset=ft;exports.EmbeddedChatPrimitiveInputGroup=Tt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=Ue;exports.EmbeddedChatPrimitiveMessage=ut;exports.EmbeddedChatPrimitiveMessageAction=bt;exports.EmbeddedChatPrimitiveMessageAttachments=it;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=at;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=mt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=dt;exports.EmbeddedChatPrimitiveMessageAvatar=Ge;exports.EmbeddedChatPrimitiveMessageAvatarContent=Ye;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Je;exports.EmbeddedChatPrimitiveMessageAvatarImage=Xe;exports.EmbeddedChatPrimitiveMessageContent=tt;exports.EmbeddedChatPrimitiveMessageContentWrapper=et;exports.EmbeddedChatPrimitiveMessageHeader=Ke;exports.EmbeddedChatPrimitiveMessageLoading=ze;exports.EmbeddedChatPrimitiveMessageName=Ze;exports.EmbeddedChatPrimitiveMessageSourceItem=_t;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=Mt;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=St;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=Et;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=xt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=It;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=kt;exports.EmbeddedChatPrimitiveMessageSources=gt;exports.EmbeddedChatPrimitiveMessageSourcesHeader=Pt;exports.EmbeddedChatPrimitiveMessageSourcesList=At;exports.EmbeddedChatPrimitiveMessageToolAction=vt;exports.EmbeddedChatPrimitiveMessageToolActions=pt;exports.EmbeddedChatPrimitiveMessageToolbar=Ct;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=fe;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=yt;exports.EmbeddedChatPrimitiveSendButtonIcon=Ht;exports.EmbeddedChatPrimitiveTaglineBrandName=bi;exports.EmbeddedChatPrimitiveTaglineContainer=Ci;exports.EmbeddedChatPrimitiveTaglineLogo=vi;exports.EmbeddedChatPrimitiveTaglineText=pi;exports.EmbeddedChatPrimitiveToolbarHeader=Ee;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ve;exports.EmbeddedChatPrimitiveWorkflows=Ne;exports.EmbeddedChatPrimitiveWorkflowsLabel=Qe;exports.EmbeddedChatPrimitiveWorkflowsList=$e;exports.EmbeddedChatPrimitiveWrapper=ge;exports.ExampleQuestion=Re;exports.ExampleQuestionButton=We;exports.ExampleQuestions=De;exports.ExampleQuestionsLabel=Oe;exports.ExampleQuestionsList=qe;exports.FeedbackForm=ji;exports.FeedbackItem=yi;exports.FeedbackItemCheckbox=Hi;exports.FeedbackItemCheckboxIndicator=wi;exports.FeedbackItemDescription=Di;exports.FeedbackItemLabel=Li;exports.FeedbackModal=Mi;exports.FeedbackModalBody=Ti;exports.FeedbackModalClose=fi;exports.FeedbackModalContent=xi;exports.FeedbackModalHeader=Bi;exports.FeedbackModalOverlay=Si;exports.FeedbackSubmitButton=Oi;exports.Footer=Bt;exports.Form=Ri;exports.FormCancel=la;exports.FormClose=Wi;exports.FormContent=Vi;exports.FormDescription=$i;exports.FormError=ca;exports.FormField=Ui;exports.FormFieldCheckbox=Ji;exports.FormFieldCheckboxIndicator=Xi;exports.FormFieldEmail=zi;exports.FormFieldError=da;exports.FormFieldFile=Gi;exports.FormFieldLabel=Ki;exports.FormFieldSelect=Zi;exports.FormFieldSelectContent=aa;exports.FormFieldSelectIcon=ia;exports.FormFieldSelectItem=sa;exports.FormFieldSelectItemIndicator=oa;exports.FormFieldSelectItemText=ra;exports.FormFieldSelectTrigger=ea;exports.FormFieldSelectValue=ta;exports.FormFieldSelectViewport=na;exports.FormFieldText=G;exports.FormFieldTextArea=Yi;exports.FormFooter=ma;exports.FormHeader=Ni;exports.FormHeading=Qi;exports.FormSubmit=ha;exports.FormSuccess=ua;exports.FormSuccessButton=va;exports.FormSuccessHeading=Ca;exports.FormSuccessMessage=pa;exports.FormWrapper=qi;exports.Header=Qa;exports.HeaderToolbar=_e;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=Pi;exports.HelpActionsMenu=Fi;exports.HelpActionsMenuArrow=Ei;exports.HelpActionsMenuItem=ki;exports.HelpActionsMenuItemIcon=Ii;exports.HelpActionsTrigger=_i;exports.Input=jt;exports.InputFieldset=ft;exports.InputGroup=Tt;exports.IntroMessageWrapper=Ue;exports.Message=ut;exports.MessageAction=bt;exports.MessageAttachments=it;exports.MessageAttachmentsItem=nt;exports.MessageAttachmentsItemIcon=st;exports.MessageAttachmentsItemTitle=rt;exports.MessageAttachmentsList=at;exports.MessageAttachmentsPreview=ot;exports.MessageAttachmentsPreviewBody=ht;exports.MessageAttachmentsPreviewClose=lt;exports.MessageAttachmentsPreviewContent=ct;exports.MessageAttachmentsPreviewHeader=mt;exports.MessageAttachmentsPreviewOverlay=dt;exports.MessageAvatar=Ge;exports.MessageAvatarContent=Ye;exports.MessageAvatarFallback=Je;exports.MessageAvatarImage=Xe;exports.MessageContent=tt;exports.MessageContentWrapper=et;exports.MessageHeader=Ke;exports.MessageLoading=ze;exports.MessageName=Ze;exports.MessageSourceItem=_t;exports.MessageSourceItemBreadcrumbIcon=wn;exports.MessageSourceItemBreadcrumbs=Ft;exports.MessageSourceItemDescription=Mt;exports.MessageSourceItemDescriptionPart=St;exports.MessageSourceItemIcon=Et;exports.MessageSourceItemIndicator=xt;exports.MessageSourceItemTag=It;exports.MessageSourceItemTitle=kt;exports.MessageSources=gt;exports.MessageSourcesHeader=Pt;exports.MessageSourcesList=At;exports.MessageToolAction=vt;exports.MessageToolActions=pt;exports.MessageToolbar=Ct;exports.MessageWrapper=ce;exports.Messages=fe;exports.Root=Ae;exports.SendButton=yt;exports.SendButtonIcon=Ht;exports.TaglineBrandName=bi;exports.TaglineContainer=Ci;exports.TaglineLogo=vi;exports.TaglineText=pi;exports.ToolbarHeader=Ee;exports.Workflow=Ve;exports.Workflows=Ne;exports.WorkflowsLabel=Qe;exports.WorkflowsList=$e;exports.Wrapper=ge;
@@ -28,7 +28,7 @@ import { CheckboxIcon as Ae } from "../atoms/icons/checkbox-icon.js";
28
28
  import { useCopyToClipboard as X } from "../hooks/use-copy-to-clipboard.js";
29
29
  import { FeedbackItemProvider as Le, useFeedbackItem as de } from "../providers/feedback-item-provider.js";
30
30
  import { stringifyAttachments as xe } from "../utils/get-message-metadata.js";
31
- import { dataAttr as v, maybeRender as M, getInitials as De, getMessageContent as me } from "../utils/misc.js";
31
+ import { dataAttr as p, maybeRender as M, getInitials as De, getMessageContent as me } from "../utils/misc.js";
32
32
  import { ikp as i } from "./factory.js";
33
33
  import { useChat as g } from "./embedded-chat/chat-provider.js";
34
34
  import { ChatProvider as ir } from "./embedded-chat/chat-provider.js";
@@ -59,10 +59,10 @@ const et = "__intro__", tt = i("div", {
59
59
  tt,
60
60
  {
61
61
  ref: d,
62
- "data-widget-md": v(m),
63
- "data-hidden": v(s),
64
- "data-in-modal": v(!!l),
65
- "data-mobile": v(o),
62
+ "data-widget-md": p(m),
63
+ "data-hidden": p(s),
64
+ "data-in-modal": p(!!l),
65
+ "data-mobile": p(o),
66
66
  ...a
67
67
  }
68
68
  );
@@ -75,7 +75,7 @@ const et = "__intro__", tt = i("div", {
75
75
  _id: "aiChatRoot"
76
76
  }), Za = (t) => {
77
77
  const { isLoadingConversation: e, isHidden: a } = g(), { form: s } = _();
78
- return e || s ? null : /* @__PURE__ */ n(at, { "data-hidden": v(a), ...t });
78
+ return e || s ? null : /* @__PURE__ */ n(at, { "data-hidden": p(a), ...t });
79
79
  }, en = i("div", {
80
80
  _id: "aiChatHeader"
81
81
  }), tn = i("div", {
@@ -202,7 +202,7 @@ const et = "__intro__", tt = i("div", {
202
202
  _id: "aiChatExampleQuestion"
203
203
  }), Pn = V((t, e) => {
204
204
  const { aiChatSettings: a } = u(), s = a.isFirstExampleQuestionHighlighted;
205
- return /* @__PURE__ */ n(pt, { ref: e, "data-highlight": v(s), ...t });
205
+ return /* @__PURE__ */ n(pt, { ref: e, "data-highlight": p(s), ...t });
206
206
  }), vt = i("button", {
207
207
  _id: "aiChatExampleQuestionButton"
208
208
  }), Fn = (t) => {
@@ -257,14 +257,14 @@ const et = "__intro__", tt = i("div", {
257
257
 
258
258
  Ask me anything about \`${d}\`.` : `
259
259
 
260
- Let me know how I can help.`, p = {
260
+ Let me know how I can help.`, v = {
261
261
  content: s.introMessage ?? `${m}${l}`,
262
262
  id: et,
263
263
  ...e,
264
264
  role: "assistant",
265
265
  links: []
266
266
  };
267
- return /* @__PURE__ */ n(Ft, { message: p, ...a });
267
+ return /* @__PURE__ */ n(Ft, { message: v, ...a });
268
268
  }
269
269
  ), Mt = i("div", {
270
270
  _id: "aiChatMessageHeader"
@@ -288,7 +288,7 @@ const et = "__intro__", tt = i("div", {
288
288
  return /* @__PURE__ */ n(
289
289
  Et,
290
290
  {
291
- "data-username": v(e.role === "user" && !!a.userProperties.name),
291
+ "data-username": p(e.role === "user" && !!a.userProperties.name),
292
292
  "data-role": e.role,
293
293
  ...t
294
294
  }
@@ -314,12 +314,12 @@ const et = "__intro__", tt = i("div", {
314
314
  const { onLoadingStatusChange: e, ...a } = t, {
315
315
  aiChatSettings: s,
316
316
  baseSettings: { userProperties: o }
317
- } = u(), { message: r } = b(), { aiAssistantAvatar: c } = s ?? {}, d = typeof c == "string" ? c : c?.light, m = (typeof c == "string" ? c : c?.dark) ?? d, l = je(d, m), [C, p] = be(l);
317
+ } = u(), { message: r } = b(), { aiAssistantAvatar: c } = s ?? {}, d = typeof c == "string" ? c : c?.light, m = (typeof c == "string" ? c : c?.dark) ?? d, l = je(d, m), [C, v] = be(l);
318
318
  Ie(() => {
319
- p(l);
319
+ v(l);
320
320
  }, [l]);
321
321
  const I = (y) => {
322
- y === "error" && p(null);
322
+ y === "error" && v(null);
323
323
  };
324
324
  return r.role === "user" ? o.name ? null : s.userAvatar ? /* @__PURE__ */ n(
325
325
  ve,
@@ -372,8 +372,15 @@ const et = "__intro__", tt = i("div", {
372
372
  }, Bt = i("div", {
373
373
  _id: "aiChatMessageContentWrapper"
374
374
  }), xn = (t) => {
375
- const { message: e } = b();
376
- return /* @__PURE__ */ n(Bt, { "data-role": e.role, ...t });
375
+ const { message: e } = b(), { messageButtons: a } = g(), s = a[e.id] || [];
376
+ return /* @__PURE__ */ n(
377
+ Bt,
378
+ {
379
+ "data-role": e.role,
380
+ "data-has-message-buttons": p(!!s.length),
381
+ ...t
382
+ }
383
+ );
377
384
  }, Tt = i("div", {
378
385
  _id: "aiChatMessageContent"
379
386
  }), Dn = (t) => {
@@ -525,7 +532,7 @@ const et = "__intro__", tt = i("div", {
525
532
  }, Vt = i("button", {
526
533
  _id: "aiChatMessageAction"
527
534
  }), Xn = (t) => {
528
- const { action: e, onClick: a, className: s, ...o } = t, { conversation: r } = K(), { message: c } = b(), { isStreaming: d, messages: m } = g(), [l, C] = X(), { feedback: p, submitPositiveFeedback: I, setCurrentFeedback: y, currentFeedback: W } = ce(), { logEvent: G } = q(), [N, z] = We(), {
535
+ const { action: e, onClick: a, className: s, ...o } = t, { conversation: r } = K(), { message: c } = b(), { isStreaming: d, messages: m } = g(), [l, C] = X(), { feedback: v, submitPositiveFeedback: I, setCurrentFeedback: y, currentFeedback: W } = ce(), { logEvent: G } = q(), [N, z] = We(), {
529
536
  baseSettings: { privacyPreferences: ue }
530
537
  } = u(), { optOutAllAnalytics: Y } = ue, Ce = m.at(-1)?.id === c?.id, J = c.role === "assistant";
531
538
  if (Ce && d || !J || {
@@ -559,12 +566,12 @@ const et = "__intro__", tt = i("div", {
559
566
  upvote: /* @__PURE__ */ n(A, { iconKey: N ? "messageCopied" : "thumbsUp" }),
560
567
  downvote: /* @__PURE__ */ n(A, { iconKey: "thumbsDown" })
561
568
  }, S = {
562
- copy: { "data-copied": v(l) },
569
+ copy: { "data-copied": p(l) },
563
570
  upvote: {
564
- "data-upvoted": v(p[c.id]?.type === "positive")
571
+ "data-upvoted": p(v[c.id]?.type === "positive")
565
572
  },
566
573
  downvote: {
567
- "data-downvoted": v(p[c.id]?.type === "negative"),
574
+ "data-downvoted": p(v[c.id]?.type === "negative"),
568
575
  "data-state": W === null ? "closed" : "open"
569
576
  }
570
577
  };
@@ -601,8 +608,8 @@ const et = "__intro__", tt = i("div", {
601
608
  organizationDisplayName: r,
602
609
  tabs: d,
603
610
  transformSource: o
604
- }), p = C.shouldOpenInNewTab !== void 0 ? C.shouldOpenInNewTab : c;
605
- return { ...C, isExternal: p };
611
+ }), v = C.shouldOpenInNewTab !== void 0 ? C.shouldOpenInNewTab : c;
612
+ return { ...C, isExternal: v };
606
613
  });
607
614
  return /* @__PURE__ */ n(qt, { children: M(a, m), ...s });
608
615
  }, jt = i(ke, {
@@ -672,7 +679,7 @@ const et = "__intro__", tt = i("div", {
672
679
  {
673
680
  "data-type": s.type,
674
681
  children: e.content,
675
- "data-highlighted": v(e.highlighted),
682
+ "data-highlighted": p(e.highlighted),
676
683
  ...a
677
684
  }
678
685
  );
@@ -696,7 +703,7 @@ const et = "__intro__", tt = i("div", {
696
703
  }), ti = i("textarea", {
697
704
  _id: "aiChatInput"
698
705
  }), Cs = V(({ onChange: t, onKeyDown: e, ...a }, s) => {
699
- const { handleInputChange: o, handleInputKeyDown: r, input: c, error: d, shouldAutoFocusInput: m, inputRef: l } = g(), { aiChatSettings: C } = u(), p = he(
706
+ const { handleInputChange: o, handleInputKeyDown: r, input: c, error: d, shouldAutoFocusInput: m, inputRef: l } = g(), { aiChatSettings: C } = u(), v = he(
700
707
  s,
701
708
  l
702
709
  );
@@ -704,7 +711,7 @@ const et = "__intro__", tt = i("div", {
704
711
  ti,
705
712
  {
706
713
  asChild: !0,
707
- ref: p,
714
+ ref: v,
708
715
  maxLength: 99999,
709
716
  placeholder: C.placeholder,
710
717
  value: c,
@@ -894,7 +901,7 @@ const et = "__intro__", tt = i("div", {
894
901
  name: "title",
895
902
  value: s.data.title,
896
903
  id: `${o?.id}-title`,
897
- "data-invalid": v(!!s.errors.title),
904
+ "data-invalid": p(!!s.errors.title),
898
905
  "aria-invalid": !!s.errors.title,
899
906
  onChange: h(e, s.onChange),
900
907
  ...a
@@ -939,7 +946,7 @@ const et = "__intro__", tt = i("div", {
939
946
  name: "content",
940
947
  value: s.data.content,
941
948
  id: `${o?.id}-content`,
942
- "data-invalid": v(!!s.errors.content),
949
+ "data-invalid": p(!!s.errors.content),
943
950
  "aria-invalid": !!s.errors.content,
944
951
  onChange: h(e, s.onChange),
945
952
  ...a,
@@ -982,12 +989,12 @@ const et = "__intro__", tt = i("div", {
982
989
  }), Mi = i(B.Trigger, {
983
990
  _id: "aiChat__ChatAction"
984
991
  }), Fe = (t) => {
985
- const { action: e, onClick: a, className: s, ...o } = t, { clear: r, stop: c, isLoading: d, messages: m, selectedWorkflow: l } = g(), { conversation: C } = K(), { aiChatSettings: p, baseSettings: I } = u(), { logEvent: y } = q(), [W, G] = X(), [N, z] = X();
992
+ const { action: e, onClick: a, className: s, ...o } = t, { clear: r, stop: c, isLoading: d, messages: m, selectedWorkflow: l } = g(), { conversation: C } = K(), { aiChatSettings: v, baseSettings: I } = u(), { logEvent: y } = q(), [W, G] = X(), [N, z] = X();
986
993
  if ({
987
994
  help: !1,
988
- copy: m.length === 0 || !p.isCopyChatButtonVisible || d,
989
- share: m.length === 0 || !p.isShareButtonVisible || !C.id || !!l || d,
990
- clear: m.length === 0 || p.isViewOnly || d,
995
+ copy: m.length === 0 || !v.isCopyChatButtonVisible || d,
996
+ share: m.length === 0 || !v.isShareButtonVisible || !C.id || !!l || d,
997
+ clear: m.length === 0 || v.isViewOnly || d,
991
998
  stop: !d
992
999
  }[e]) return null;
993
1000
  const J = {
@@ -1030,7 +1037,7 @@ ${E}${$}`;
1030
1037
  x
1031
1038
  );
1032
1039
  if (E) {
1033
- const $ = `${p.shareChatUrlBasePath}?${ye}=${E?.id}`;
1040
+ const $ = `${v.shareChatUrlBasePath}?${ye}=${E?.id}`;
1034
1041
  z($), y({
1035
1042
  eventName: "chat_share_button_clicked",
1036
1043
  properties: {
@@ -1052,7 +1059,7 @@ ${E}${$}`;
1052
1059
  Mi,
1053
1060
  {
1054
1061
  "data-type": e,
1055
- "data-copied": v(W || N),
1062
+ "data-copied": p(W || N),
1056
1063
  className: `${s} ${e}`,
1057
1064
  children: /* @__PURE__ */ n(fi, { action: e }),
1058
1065
  onClick: h(a, J[e]),
@@ -1088,9 +1095,9 @@ ${E}${$}`;
1088
1095
  if (!o || (o ?? []).length === 0)
1089
1096
  return null;
1090
1097
  const { _pinned: r, _unpinned: c } = o.reduce(
1091
- (C, p) => {
1092
- const I = p.isPinnedToToolbar ? "_pinned" : "_unpinned";
1093
- return { ...C, [I]: [...C[I], p] };
1098
+ (C, v) => {
1099
+ const I = v.isPinnedToToolbar ? "_pinned" : "_unpinned";
1100
+ return { ...C, [I]: [...C[I], v] };
1094
1101
  },
1095
1102
  { _pinned: [], _unpinned: [] }
1096
1103
  ), d = c.length === 1 ? [...r, c[0]] : r, m = c.length === 1 ? [] : c, l = Re();
@@ -1298,7 +1305,7 @@ ${E}${$}`;
1298
1305
  return /* @__PURE__ */ n(
1299
1306
  Ve,
1300
1307
  {
1301
- "data-invalid": v(!!r[e.name]),
1308
+ "data-invalid": p(!!r[e.name]),
1302
1309
  field: e,
1303
1310
  fieldProps: c,
1304
1311
  autoFocus: a,
@@ -1306,7 +1313,7 @@ ${E}${$}`;
1306
1313
  Ki,
1307
1314
  {
1308
1315
  "data-input-type": e.inputType,
1309
- "data-hidden": v(e.isHidden),
1316
+ "data-hidden": p(e.isHidden),
1310
1317
  ...s
1311
1318
  }
1312
1319
  )
@@ -1322,7 +1329,7 @@ ${E}${$}`;
1322
1329
  return /* @__PURE__ */ n(
1323
1330
  qi,
1324
1331
  {
1325
- "data-required": v(e.isRequired),
1332
+ "data-required": p(e.isRequired),
1326
1333
  htmlFor: e.name,
1327
1334
  children: e.label,
1328
1335
  ...t
@@ -1344,7 +1351,7 @@ ${E}${$}`;
1344
1351
  id: e.name,
1345
1352
  autoFocus: c,
1346
1353
  placeholder: "placeholder" in e ? e.placeholder : void 0,
1347
- "data-invalid": v(!!a),
1354
+ "data-invalid": p(!!a),
1348
1355
  onChange: h(d, s),
1349
1356
  onBlur: h(m, o),
1350
1357
  ...r,
@@ -1364,7 +1371,7 @@ ${E}${$}`;
1364
1371
  error: a,
1365
1372
  fieldProps: { value: s, onChange: o, onBlur: r, ...c },
1366
1373
  autoFocus: d
1367
- } = L(), { onChange: m, onBlur: l, ...C } = t, p = (I) => {
1374
+ } = L(), { onChange: m, onBlur: l, ...C } = t, v = (I) => {
1368
1375
  const y = I.target.files;
1369
1376
  o(y);
1370
1377
  };
@@ -1374,10 +1381,10 @@ ${E}${$}`;
1374
1381
  id: e.name,
1375
1382
  autoFocus: d,
1376
1383
  "data-value": s,
1377
- "data-invalid": v(!!a),
1384
+ "data-invalid": p(!!a),
1378
1385
  ...C,
1379
1386
  ...c,
1380
- onChange: h(m, p),
1387
+ onChange: h(m, v),
1381
1388
  onBlur: h(l, r)
1382
1389
  }
1383
1390
  );
@@ -1396,7 +1403,7 @@ ${E}${$}`;
1396
1403
  id: e.name,
1397
1404
  name: e.name,
1398
1405
  autoFocus: o,
1399
- "data-invalid": v(!!a),
1406
+ "data-invalid": p(!!a),
1400
1407
  checked: s.value,
1401
1408
  onCheckedChange: h(r, s.onChange),
1402
1409
  ...c
@@ -1413,7 +1420,7 @@ ${E}${$}`;
1413
1420
  Yi,
1414
1421
  {
1415
1422
  name: e.name,
1416
- "data-invalid": v(!!a),
1423
+ "data-invalid": p(!!a),
1417
1424
  value: s.value,
1418
1425
  onValueChange: h(o, s.onChange),
1419
1426
  ...r
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),t=require("react"),B=require("../atoms/api/analytics/events.cjs"),f=require("./config-provider.cjs"),b=require("./user-provider.cjs"),p=t.createContext(void 0),x=({children:e})=>{const{baseSettings:n,componentType:r}=f.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:E,env:m}=n,{userProperties:v}=b.useUser(),u=t.useMemo(()=>({widgetLibraryVersion:"0.5.73",componentType:r,tags:a}),[r,a]),d=!E.optOutAllAnalytics&&m!=="development",g={logEvent:t.useCallback(async s=>{const o={...u,...s.properties},l={eventName:s.eventName,properties:o,userProperties:v},P=["modal_opened","modal_closed"].includes(s.eventName);if(d&&!P){if("conversation"in o&&!o.conversation?.id)return;B.logEvent(l,i,c)}n.onEvent?.(l)},[d,n,i,c,v,u])};return y.jsx(p.Provider,{value:g,children:e})},q=()=>{const e=t.useContext(p);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=x;exports.useBaseEvents=q;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),t=require("react"),B=require("../atoms/api/analytics/events.cjs"),f=require("./config-provider.cjs"),b=require("./user-provider.cjs"),p=t.createContext(void 0),x=({children:e})=>{const{baseSettings:n,componentType:r}=f.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:E,env:m}=n,{userProperties:v}=b.useUser(),u=t.useMemo(()=>({widgetLibraryVersion:"0.5.75",componentType:r,tags:a}),[r,a]),d=!E.optOutAllAnalytics&&m!=="development",g={logEvent:t.useCallback(async s=>{const o={...u,...s.properties},l={eventName:s.eventName,properties:o,userProperties:v},P=["modal_opened","modal_closed"].includes(s.eventName);if(d&&!P){if("conversation"in o&&!o.conversation?.id)return;B.logEvent(l,i,c)}n.onEvent?.(l)},[d,n,i,c,v,u])};return y.jsx(p.Provider,{value:g,children:e})},q=()=>{const e=t.useContext(p);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=x;exports.useBaseEvents=q;
@@ -7,7 +7,7 @@ import { useUser as w } from "./user-provider.js";
7
7
  const l = B(void 0), _ = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: s } = b(), { apiKey: r, analyticsApiBaseUrl: i, tags: a, privacyPreferences: u, env: d } = t, { userProperties: c } = w(), v = y(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.73",
10
+ widgetLibraryVersion: "0.5.75",
11
11
  componentType: s,
12
12
  tags: a
13
13
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.0.0-dev-20250429201331",
3
+ "version": "0.0.0-dev-20250502200738",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -60,9 +60,9 @@
60
60
  "remark-gfm": "^4.0.1",
61
61
  "unist-util-visit": "^5.0.0",
62
62
  "use-sync-external-store": "^1.4.0",
63
- "@inkeep/cxkit-color-mode": "0.0.0-dev-20250429201331",
64
- "@inkeep/cxkit-theme": "0.0.0-dev-20250429201331",
65
- "@inkeep/cxkit-types": "0.0.0-dev-20250429201331"
63
+ "@inkeep/cxkit-color-mode": "0.0.0-dev-20250502200738",
64
+ "@inkeep/cxkit-theme": "0.0.0-dev-20250502200738",
65
+ "@inkeep/cxkit-types": "0.0.0-dev-20250502200738"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@biomejs/biome": "1.9.4",