@inkeep/cxkit-primitives 0.5.22 → 0.5.24

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"),g=require("react"),ne=require("react-textarea-autosize"),_a=require("@radix-ui/react-avatar"),Aa=require("@radix-ui/react-checkbox"),ka=require("@radix-ui/react-popover"),Fa=require("@radix-ui/react-tooltip"),Ea=require("@radix-ui/react-hover-card"),Ia=require("@radix-ui/react-scroll-area"),Ma=require("@radix-ui/react-select"),_=require("../atoms/dialog.cjs"),Sa=require("../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/hi2/index.cjs"),fa=require("../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.cjs"),Ba=require("../atoms/avatars/ai.cjs"),xa=require("../atoms/avatars/user.cjs"),k=require("../atoms/icons/custom-icon.cjs"),f=require("../atoms/icons/built-in-icon-renderer.cjs"),Ta=require("../atoms/link.cjs"),$=require("../atoms/markdown/index.cjs"),H=require("../providers/attachment-item-provider.cjs"),F=require("../providers/attachments-bar-provider.cjs"),B=require("../providers/source-item-provider.cjs"),C=require("../providers/config-provider.cjs"),D=require("../providers/conversation-provider.cjs"),V=require("../providers/chat-events-provider.cjs"),re=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"),ie=require("../hooks/use-copy-to-clipboard.cjs"),U=require("../providers/feedback-item-provider.cjs"),ja=require("../utils/get-message-metadata.cjs"),h=require("../utils/misc.cjs"),i=require("./factory.cjs"),b=require("./embedded-chat/chat-provider.cjs"),ya=require("./tagline-logo-icon.cjs"),Ha=require("../hooks/use-settle-action.cjs"),wa=require("../hooks/use-container-size.cjs"),se=require("./embedded-chat/use-chat-action.cjs"),ae=require("../providers/help-menu-provider.cjs"),A=require("../providers/chat-form-provider.cjs"),x=require("../providers/form-field-provider.cjs"),La=require("react-hook-form"),Da=require("../utils/highlight-emphasis.cjs"),ge=require("./modal/modal-provider.cjs"),qa=require("@inkeep/cxkit-color-mode"),oe=require("../utils/compose-refs.cjs"),u=require("../utils/compose-event-handlers.cjs"),Ra=require("../hooks/use-scroll-to-bottom.cjs"),Wa=require("../atoms/api/analytics/conversation.cjs"),Oa=require("../utils/transform-source/index.cjs");function w(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const de=w(_a),K=w(Aa),z=w(ka),T=w(Fa),G=w(Ea),R=w(Ia),I=w(Ma),Qa="__intro__",Na=i.ikp("div",{_id:"aiChatWrapper"}),Pe=g.forwardRef((t,e)=>{const{...a}=t,{isHidden:r,isMobile:s}=b.useChat(),[d,o]=wa.useContainerSize(),c=oe.useComposedRefs(e,d),m=o?.width?o.width>580:!0,l=ge.useModal();return n.jsx(Na,{ref:c,"data-widget-md":h.dataAttr(m),"data-hidden":h.dataAttr(r),"data-in-modal":h.dataAttr(!!l),"data-mobile":h.dataAttr(s),...a})}),$a=i.ikp("div",{_id:"aiChatConversationLoading"}),_e=t=>{const{isLoadingConversation:e}=b.useChat();return e?n.jsx($a,{children:n.jsx("span",{children:"Loading..."}),...t}):null},Va=i.ikp("div",{_id:"aiChatRoot"}),Ae=t=>{const{isLoadingConversation:e,isHidden:a}=b.useChat(),{form:r}=A.useChatForm();return e||r?null:n.jsx(Va,{"data-hidden":h.dataAttr(a),...t})},Ua=i.ikp("div",{_id:"aiChatHeader"}),ke=i.ikp("div",{_id:"aiChatHeader__Toolbar"}),Fe=i.ikp("div",{_id:"aiChatHeader__ToolbarHeaderWrapper"}),Ka=i.ikp("div",{_id:"aiChatHeader__ToolbarHeader"}),Ee=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=`Ask ${e.aiAssistantName||"AI"}`;return n.jsx(Ka,{...t,children:a})}),Ie=i.ikp("div",{_id:"aiChatContent"}),Me=i.ikp(R.Root,{_id:"aiChatContentScrollArea"}),za=i.ikp(R.Viewport,{_id:"aiChatContentScrollArea__Viewport"}),Se=g.forwardRef(({children:t,...e},a)=>{const{containerRef:r}=Ra.useScrollToBottom(),s=oe.useComposedRefs(a,r);return n.jsx(za,{ref:s,children:n.jsx("div",{"data-part":"grid",style:{display:"grid"},children:t}),...e})}),fe=i.ikp(R.ScrollAreaScrollbar,{_id:"aiChatContentScrollArea__Scrollbar"}),Be=i.ikp(R.ScrollAreaThumb,{_id:"aiChatContentScrollArea__Thumb"}),xe=i.ikp(R.Corner,{_id:"aiChatContentScrollArea__Corner"}),Ga=i.ikp("div",{_id:"aiChatMessages"}),Te=t=>{const e=b.useChat(),{children:a,...r}=t;return n.jsx(Ga,{children:h.maybeRender(a,e),...r})},Ya=i.ikp("div",{_id:"aiChatDisclaimer"}),je=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return e.disclaimerSettings?.isEnabled?n.jsx(G.Root,{openDelay:100,children:n.jsx(Ya,{...t})}):null}),Ja=i.ikp("span",{_id:"aiChatDisclaimerLabel"}),ye=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=e.disclaimerSettings;return n.jsx(Ja,{children:a?.label,...t})}),He=i.ikp(G.Trigger,{_id:"aiChatDisclaimerTrigger",children:n.jsx(k.CustomIcon,{iconKey:"info"})}),Xa=i.ikp(G.Content,{_id:"aiChatDisclaimerContent"}),we=t=>n.jsx(Xa,{side:"top",sideOffset:8,align:"end",alignOffset:-10,...t});i.ikp($.Markdown,{_id:"aiChatDisclaimerText"});const Le=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=e.aiAssistantName,s=e.disclaimerSettings?.tooltip||`Information provided by ${a||"this AI assistant"} is not guaranteed to be accurate or comprehensive.`;return n.jsx($.Markdown,{shouldOpenLinksInNewTab:!0,children:s,...t})}),De=i.ikp(G.Arrow,{_id:"aiChatDisclaimerArrow"}),Za=i.ikp("div",{_id:"aiChatQuickQuestions"}),qe=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:a}=b.useChat();return!e.exampleQuestions?.length||a.length?null:n.jsx(Za,{...t})},en=i.ikp("h3",{_id:"aiChatQuickQuestionsLabel"}),Re=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(en,{children:e.exampleQuestionsLabel,...t})}),tn=i.ikp("div",{_id:"aiChatQuickQuestionsList"}),We=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=e.exampleQuestions,{children:r,...s}=t;return n.jsx(tn,{children:h.maybeRender(r,a),...s})}),an=i.ikp("div",{_id:"aiChatQuickQuestion"}),Oe=g.forwardRef((t,e)=>{const{aiChatSettings:a}=C.useInkeepConfig(),r=a.isFirstExampleQuestionHighlighted;return n.jsx(an,{ref:e,"data-highlight":h.dataAttr(r),...t})}),nn=i.ikp("button",{_id:"aiChatQuickQuestionButton"}),Qe=t=>{const{question:e,onClick:a,...r}=t,{handleSubmit:s}=b.useChat();return n.jsx(nn,{onClick:u.composeEventHandlers(a,()=>s(e)),children:e,...r})},rn=i.ikp("div",{_id:"aiChatWorkflows"}),Ne=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:a}=b.useChat();return!e.workflows?.length||a.length?null:n.jsx(rn,{...t})},sn=i.ikp("h3",{_id:"aiChatWorkflowsLabel"}),$e=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(sn,{children:e.workflowsHeader,...t})}),on=i.ikp("div",{_id:"aiChatWorkflowsList"}),Ve=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=e.workflows,{children:r,...s}=t;return n.jsx(on,{children:h.maybeRender(r,a),...s})}),dn=i.ikp("button",{_id:"aiChatWorkflow"}),Ue=t=>{const{workflow:e,onClick:a,...r}=t,{handleWorkflow:s}=b.useChat();return n.jsx(dn,{onClick:u.composeEventHandlers(a,()=>s(e)),children:e.displayName,...r})},cn=i.ikp(Sa.HiMiniBolt,{_id:"aiChatWorkflow__Icon"}),Ke=t=>n.jsx(cn,{...t}),mn=i.ikp("div",{_id:"aiChatMessageWrapper"}),ce=t=>{const{message:e,...a}=t;return e.role==="system"?null:n.jsx(P.MessageProvider,{message:e,children:n.jsx(mn,{"data-role":e.role,...a})})},ze=g.memo(t=>{const{message:e,...a}=t,{aiChatSettings:r,baseSettings:s}=C.useInkeepConfig(),d=r.aiAssistantName,o=d?`Hi, I'm ${d}!`:"Hi!",c=r.chatSubjectName??s.organizationDisplayName,m=`${o}
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),g=require("react"),ne=require("react-textarea-autosize"),_a=require("@radix-ui/react-avatar"),Aa=require("@radix-ui/react-checkbox"),ka=require("@radix-ui/react-popover"),Fa=require("@radix-ui/react-tooltip"),Ea=require("@radix-ui/react-hover-card"),Ia=require("@radix-ui/react-scroll-area"),Ma=require("@radix-ui/react-select"),_=require("../atoms/dialog.cjs"),Sa=require("../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/hi2/index.cjs"),fa=require("../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.cjs"),Ba=require("../atoms/avatars/ai.cjs"),xa=require("../atoms/avatars/user.cjs"),k=require("../atoms/icons/custom-icon.cjs"),f=require("../atoms/icons/built-in-icon-renderer.cjs"),Ta=require("../atoms/link.cjs"),$=require("../atoms/markdown/index.cjs"),H=require("../providers/attachment-item-provider.cjs"),F=require("../providers/attachments-bar-provider.cjs"),B=require("../providers/source-item-provider.cjs"),C=require("../providers/config-provider.cjs"),D=require("../providers/conversation-provider.cjs"),V=require("../providers/chat-events-provider.cjs"),re=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"),ie=require("../hooks/use-copy-to-clipboard.cjs"),U=require("../providers/feedback-item-provider.cjs"),ja=require("../utils/get-message-metadata.cjs"),h=require("../utils/misc.cjs"),i=require("./factory.cjs"),b=require("./embedded-chat/chat-provider.cjs"),ya=require("./tagline-logo-icon.cjs"),Ha=require("../hooks/use-settle-action.cjs"),wa=require("../hooks/use-container-size.cjs"),se=require("./embedded-chat/use-chat-action.cjs"),ae=require("../providers/help-menu-provider.cjs"),A=require("../providers/chat-form-provider.cjs"),x=require("../providers/form-field-provider.cjs"),La=require("react-hook-form"),Da=require("../utils/highlight-emphasis.cjs"),ge=require("./modal/modal-provider.cjs"),qa=require("@inkeep/cxkit-color-mode"),oe=require("../utils/compose-refs.cjs"),u=require("../utils/compose-event-handlers.cjs"),Oa=require("../hooks/use-scroll-to-bottom.cjs"),Ra=require("../atoms/api/analytics/conversation.cjs"),Wa=require("../utils/transform-source/index.cjs");function w(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const de=w(_a),K=w(Aa),z=w(ka),T=w(Fa),G=w(Ea),O=w(Ia),I=w(Ma),Qa="__intro__",Na=i.ikp("div",{_id:"aiChatWrapper"}),Pe=g.forwardRef((t,e)=>{const{...a}=t,{isHidden:r,isMobile:s}=b.useChat(),[d,o]=wa.useContainerSize(),c=oe.useComposedRefs(e,d),m=o?.width?o.width>580:!0,l=ge.useModal();return n.jsx(Na,{ref:c,"data-widget-md":h.dataAttr(m),"data-hidden":h.dataAttr(r),"data-in-modal":h.dataAttr(!!l),"data-mobile":h.dataAttr(s),...a})}),$a=i.ikp("div",{_id:"aiChatConversationLoading"}),_e=t=>{const{isLoadingConversation:e}=b.useChat();return e?n.jsx($a,{children:n.jsx("span",{children:"Loading..."}),...t}):null},Va=i.ikp("div",{_id:"aiChatRoot"}),Ae=t=>{const{isLoadingConversation:e,isHidden:a}=b.useChat(),{form:r}=A.useChatForm();return e||r?null:n.jsx(Va,{"data-hidden":h.dataAttr(a),...t})},Ua=i.ikp("div",{_id:"aiChatHeader"}),ke=i.ikp("div",{_id:"aiChatHeader__Toolbar"}),Fe=i.ikp("div",{_id:"aiChatHeader__ToolbarHeaderWrapper"}),Ka=i.ikp("div",{_id:"aiChatHeader__ToolbarHeader"}),Ee=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=`Ask ${e.aiAssistantName||"AI"}`;return n.jsx(Ka,{...t,children:a})}),Ie=i.ikp("div",{_id:"aiChatContent"}),Me=i.ikp(O.Root,{_id:"aiChatContentScrollArea"}),za=i.ikp(O.Viewport,{_id:"aiChatContentScrollArea__Viewport"}),Se=g.forwardRef(({children:t,...e},a)=>{const{containerRef:r}=Oa.useScrollToBottom(),s=oe.useComposedRefs(a,r);return n.jsx(za,{ref:s,children:n.jsx("div",{"data-part":"grid",style:{display:"grid"},children:t}),...e})}),fe=i.ikp(O.ScrollAreaScrollbar,{_id:"aiChatContentScrollArea__Scrollbar"}),Be=i.ikp(O.ScrollAreaThumb,{_id:"aiChatContentScrollArea__Thumb"}),xe=i.ikp(O.Corner,{_id:"aiChatContentScrollArea__Corner"}),Ga=i.ikp("div",{_id:"aiChatMessages"}),Te=t=>{const e=b.useChat(),{children:a,...r}=t;return n.jsx(Ga,{children:h.maybeRender(a,e),...r})},Ya=i.ikp("div",{_id:"aiChatDisclaimer"}),je=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return e.disclaimerSettings?.isEnabled?n.jsx(G.Root,{openDelay:100,children:n.jsx(Ya,{...t})}):null}),Ja=i.ikp("span",{_id:"aiChatDisclaimerLabel"}),ye=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=e.disclaimerSettings;return n.jsx(Ja,{children:a?.label,...t})}),He=i.ikp(G.Trigger,{_id:"aiChatDisclaimerTrigger",children:n.jsx(k.CustomIcon,{iconKey:"info"})}),Xa=i.ikp(G.Content,{_id:"aiChatDisclaimerContent"}),we=t=>n.jsx(Xa,{side:"top",sideOffset:8,align:"end",alignOffset:-10,...t});i.ikp($.Markdown,{_id:"aiChatDisclaimerText"});const Le=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=e.aiAssistantName,s=e.disclaimerSettings?.tooltip||`Information provided by ${a||"this AI assistant"} is not guaranteed to be accurate or comprehensive.`;return n.jsx($.Markdown,{shouldOpenLinksInNewTab:!0,children:s,...t})}),De=i.ikp(G.Arrow,{_id:"aiChatDisclaimerArrow"}),Za=i.ikp("div",{_id:"aiChatQuickQuestions"}),qe=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:a}=b.useChat();return!e.exampleQuestions?.length||a.length?null:n.jsx(Za,{...t})},en=i.ikp("h3",{_id:"aiChatQuickQuestionsLabel"}),Oe=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(en,{children:e.exampleQuestionsLabel,...t})}),tn=i.ikp("div",{_id:"aiChatQuickQuestionsList"}),Re=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=e.exampleQuestions,{children:r,...s}=t;return n.jsx(tn,{children:h.maybeRender(r,a),...s})}),an=i.ikp("div",{_id:"aiChatQuickQuestion"}),We=g.forwardRef((t,e)=>{const{aiChatSettings:a}=C.useInkeepConfig(),r=a.isFirstExampleQuestionHighlighted;return n.jsx(an,{ref:e,"data-highlight":h.dataAttr(r),...t})}),nn=i.ikp("button",{_id:"aiChatQuickQuestionButton"}),Qe=t=>{const{question:e,onClick:a,...r}=t,{handleSubmit:s}=b.useChat();return n.jsx(nn,{onClick:u.composeEventHandlers(a,()=>s(e)),children:e,...r})},rn=i.ikp("div",{_id:"aiChatWorkflows"}),Ne=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:a}=b.useChat();return!e.workflows?.length||a.length?null:n.jsx(rn,{...t})},sn=i.ikp("h3",{_id:"aiChatWorkflowsLabel"}),$e=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(sn,{children:e.workflowsHeader,...t})}),on=i.ikp("div",{_id:"aiChatWorkflowsList"}),Ve=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),a=e.workflows,{children:r,...s}=t;return n.jsx(on,{children:h.maybeRender(r,a),...s})}),dn=i.ikp("button",{_id:"aiChatWorkflow"}),Ue=t=>{const{workflow:e,onClick:a,...r}=t,{handleWorkflow:s}=b.useChat();return n.jsx(dn,{onClick:u.composeEventHandlers(a,()=>s(e)),children:e.displayName,...r})},cn=i.ikp(Sa.HiMiniBolt,{_id:"aiChatWorkflow__Icon"}),Ke=t=>n.jsx(cn,{...t}),mn=i.ikp("div",{_id:"aiChatMessageWrapper"}),ce=t=>{const{message:e,...a}=t;return e.role==="system"?null:n.jsx(P.MessageProvider,{message:e,children:n.jsx(mn,{"data-role":e.role,...a})})},ze=g.memo(t=>{const{message:e,...a}=t,{aiChatSettings:r,baseSettings:s}=C.useInkeepConfig(),d=r.aiAssistantName,o=d?`Hi, I'm ${d}!`:"Hi!",c=r.chatSubjectName??s.organizationDisplayName,m=`${o}
2
2
 
3
3
  I'm an AI assistant trained on documentation, help articles, and other content.`,l=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}${l}`,id:Qa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:v,...a})}),ln=i.ikp("div",{_id:"aiChatMessageHeader"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=i.ikp("div",{_id:"aiChatMessageLoading"}),Ye=t=>{const{isLoading:e,isStreaming:a,messages:r}=b.useChat(),{message:s}=P.useMessage();return!(r.at(-1)?.id===s?.id)||s.role!=="assistant"||!e||a?null:n.jsx(hn,{children:"Thinking...",...t})},un=i.ikp("div",{_id:"aiChatMessageAvatar"}),Je=t=>{const{message:e}=P.useMessage();return n.jsx(un,{"data-role":e.role,...t})},Cn=i.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Xe=t=>{const{message:e}=P.useMessage(),{baseSettings:a}=C.useInkeepConfig();return n.jsx(Cn,{"data-username":h.dataAttr(e.role==="user"&&!!a.userProperties.name),"data-role":e.role,...t})},pn=i.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Ze=g.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:a}=P.useMessage();return e.userProperties.name?n.jsx(pn,{"data-role":a.role,children:h.getInitials(e.userProperties.name),...t}):null}),pe=i.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),et=g.memo(t=>{const{onLoadingStatusChange:e,...a}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=C.useInkeepConfig(),{message:d}=P.useMessage(),{aiAssistantAvatar:o}=r??{},c=typeof o=="string"?o:o?.light,m=(typeof o=="string"?o:o?.dark)??c,l=qa.useColorModeValue(c,m),[p,v]=g.useState(l);g.useEffect(()=>{v(l)},[l]);const E=j=>{j==="error"&&v(null)};return d.role==="user"?s.name?null:r.userAvatar?n.jsx(pe,{"data-type":"image","data-role":d.role,src:r.userAvatar,...t}):n.jsx(xa.default,{"data-type":"icon","data-role":d.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":d.role,onLoadingStatusChange:u.composeEventHandlers(e,E),...a}):n.jsx(Ba.default,{"data-type":"icon","data-role":d.role,...t})}),vn=i.ikp("span",{_id:"aiChatMessageName"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(vn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},bn=i.ikp("div",{_id:"aiChatMessageContentWrapper"}),it=t=>{const{message:e}=P.useMessage();return n.jsx(bn,{"data-role":e.role,...t})},gn=i.ikp("div",{_id:"aiChatMessageContent"}),at=t=>{const{message:e}=P.useMessage();return n.jsx(gn,{"data-role":e.role,...t})},Pn=i.ikp("div",{_id:"aiChatMessageAttachments"}),nt=t=>{const{message:e}=P.useMessage(),a=e.metadata?.attributes?.attachments;return e.role!=="user"||!a?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(Pn,{...t})})},_n=i.ikp("div",{_id:"aiChatMessageAttachments__List"}),rt=t=>{const{children:e,...a}=t,{message:r}=P.useMessage(),s=r.metadata?.attributes?.attachments;return s?n.jsx(_n,{children:h.maybeRender(e,s),...a}):null},An=i.ikp("div",{_id:"aiChatMessageAttachments__Item"}),st=t=>{const{attachment:e,onClick:a,...r}=t,{selectItem:s,onOpen:d}=q.useMessageAttachments(),o=()=>{s(e),d()};return n.jsx(H.AttachmentItemProvider,{attachment:e,children:n.jsx(An,{onClick:u.composeEventHandlers(a,o),...r})})},kn=i.ikp(f.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),ot=t=>{const{attachment:e}=H.useAttachmentItem(),a=e.contentType?.attachmentIcon;return a?n.jsx(kn,{iconSettings:a,...t}):null},Fn=i.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),dt=t=>{const{attachment:e}=H.useAttachmentItem();return n.jsx(Fn,{children:e.title,...t})},En=i.ikp(_.Root,{_id:"aiChatMessageAttachmentsPreview"}),ct=t=>{const{onOpenChange:e,...a}=t,{selectItem:r,isOpen:s,onClose:d,selectedItem:o}=q.useMessageAttachments(),c=m=>{m||(d(),r(null))};return n.jsx(En,{open:s&&o!==null,onOpenChange:u.composeEventHandlers(e,c),...a})},mt=i.ikp(_.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),lt=i.ikp(_.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),In=i.ikp(_.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(In,{children:e?.title||"Attachment",...t})},ut=i.ikp(_.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(k.CustomIcon,{iconKey:"close"})}),Mn=i.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),Ct=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Mn,{children:e?.content,...t})},ve=i.ikp("div",{_id:"aiChatMessage"}),pt=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:a,...r}=t,{message:s}=P.useMessage(),{logEvent:d}=V.useChatEvents(),o=h.getMessageContent(s),{conversation:c}=D.useInkeepConversation();return s.role==="user"?n.jsx(ve,{"data-role":s.role,children:o,...r}):n.jsx(ve,{"data-role":s.role,...r,children:n.jsx($.Markdown,{children:o,componentStyles:a,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,l)=>{d({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:m}})},onCodeCopy:(m,l)=>{d({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:l}})}})})},Sn=i.ikp("div",{_id:"aiChatMessageActions"}),vt=t=>{const{isLoading:e,messages:a}=b.useChat(),{message:r}=P.useMessage();return a.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(Sn,{...t})},fn=i.ikp("div",{_id:"aiChatMessageToolActions"}),bt=t=>{const{children:e,...a}=t,{message:r}=P.useMessage(),{messageToolCalls:s}=b.useChat(),d=s[r.id]||[];return n.jsx(fn,{children:h.maybeRender(e,d),...a})},gt=t=>{const{onClick:e,action:a,...r}=t,{handleAction:s}=se.useChatAction(a),d=()=>{s()},o=a.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[a.icon&&n.jsx(f.BuiltInIconRenderer,{iconSettings:a.icon}),o]}),m=a.action.type,l=i.ikp(m==="open_link"?"a":"button",{_id:"aiChatMessageToolAction",children:c,"data-type":a.action.type,...m==="open_link"&&{href:a.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(e,d)});return n.jsx(l,{...r})},Bn=i.ikp("button",{_id:"aiChatMessageAction"}),Pt=t=>{const{action:e,onClick:a,className:r,...s}=t,{conversation:d}=D.useInkeepConversation(),{message:o}=P.useMessage(),{isStreaming:c,messages:m}=b.useChat(),[l,p]=ie.useCopyToClipboard(),{feedback:v,submitPositiveFeedback:E,setCurrentFeedback:j,currentFeedback:W}=re.useMessageFeedback(),{logEvent:X}=V.useChatEvents(),[O,Z]=Ha.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:ee}=he,ue=m.at(-1)?.id===o?.id,te=o.role==="assistant";if(ue&&c||!te||{copy:!1,upvote:ee,downvote:ee}[e])return null;const y={copy(){p(h.getMessageContent(o)),X({eventName:"assistant_message_copied",properties:{conversation:d}})},upvote(){E(o.id).then(()=>{Z()})},downvote(){j(o.id)}},L={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(k.CustomIcon,{iconKey:l?"messageCopied":"messageCopy"}),upvote:n.jsx(k.CustomIcon,{iconKey:O?"messageCopied":"thumbsUp"}),downvote:n.jsx(k.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":h.dataAttr(l)},upvote:{"data-upvoted":h.dataAttr(v[o.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(v[o.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":L[e],className:`${r} ${e}`,onClick:u.composeEventHandlers(a,y[e]),...s})},xn=i.ikp("div",{_id:"aiChatMessageSources"}),_t=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(xn,{...t})},Tn=i.ikp("div",{_id:"aiChatMessageSources__Header"}),At=t=>n.jsx(Tn,{children:"Sources",...t}),jn=i.ikp("div",{_id:"aiChatMessageSources__List"}),kt=t=>{const{message:e}=P.useMessage(),{children:a,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:d},aiChatSettings:{shouldOpenLinksInNewTab:o},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(l=>{const p=Oa.transformInkeepSource(l,"chatSourceItem",{organizationDisplayName:d,tabs:c,transformSource:s}),v=o||p.shouldOpenInNewTab;return{...p,isExternal:v}});return n.jsx(jn,{children:h.maybeRender(a,m),...r})},yn=i.ikp(Ta.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),Ft=t=>{const{source:e,onClick:a,...r}=t,{logEvent:s}=V.useChatEvents(),{conversation:d}=D.useInkeepConversation(),o=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversation:d,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(a,o),...r})})},Hn=i.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Et=t=>{const{source:e}=B.useSourceItem();return e.breadcrumbs?.length?n.jsx(Hn,{"data-type":e.type,...t}):null},wn=i.ikp(k.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Ln=i.ikp(f.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),It=t=>{const{source:e}=B.useSourceItem();return n.jsx(Ln,{iconSettings:e.icon,"data-type":e.type,...t})},Dn=i.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),Mt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Dn,{"data-type":e.type,children:e.title,...t})},qn=i.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),St=t=>{const{source:e}=B.useSourceItem();return n.jsx(qn,{"data-type":e.type,...t})},Rn=i.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),ft=t=>{const{source:e}=B.useSourceItem(),{children:a,...r}=t,s=g.useMemo(()=>e.description?Da.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(Rn,{"data-type":e.type,children:h.maybeRender(a,s),...r}):null},Wn=i.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),Bt=t=>{const{part:e,...a}=t,{source:r}=B.useSourceItem();return typeof e=="string"?e:n.jsx(Wn,{"data-type":r.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...a})},On=i.ikp(k.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=B.useSourceItem();return n.jsx(On,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Tt=i.ikp("div",{_id:"aiChatFooter"}),jt=i.ikp("div",{_id:"aiChatInput__Fieldset"}),yt=i.ikp("div",{_id:"aiChatInput__Group"}),Qn=i.ikp("textarea",{_id:"aiChatInput"}),Ht=g.forwardRef(({onChange:t,onKeyDown:e,...a},r)=>{const{handleInputChange:s,handleInputKeyDown:d,input:o,error:c,shouldAutoFocusInput:m,inputRef:l}=b.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),v=oe.useComposedRefs(r,l),E=ge.useModal();return g.useEffect(()=>{requestAnimationFrame(()=>{m&&l?.current&&(l.current.focus(),l.current.selectionStart=l.current.value.length)})},[m,l,E?.isOpen]),n.jsx(Qn,{asChild:!0,ref:v,maxLength:99999,placeholder:p.placeholder,value:o,onChange:u.composeEventHandlers(t,s),onKeyDown:u.composeEventHandlers(e,d),disabled:!!c||p.isViewOnly,...a,children:n.jsx(ne,{})})}),Nn=i.ikp("button",{_id:"aiChatInput__SendButton"}),wt=t=>{const{handleSubmit:e,isSubmitDisabled:a,error:r}=b.useChat(),{aiChatSettings:s}=C.useInkeepConfig(),{onClick:d,...o}=t;return n.jsx(Nn,{onClick:u.composeEventHandlers(d,()=>e()),"aria-label":"Send message",disabled:a||!!r||s.isViewOnly,...o})},Lt=i.ikp(k.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),$n=i.ikp("div",{_id:"aiChatAttachmentsBar"}),Dt=t=>{const{selectedWorkflow:e}=b.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(F.AttachmentsBarProvider,{children:n.jsx($n,{...t})})},Vn=i.ikp("div",{_id:"aiChatAttachmentsBar__List"}),qt=t=>{const{children:e,...a}=t,{messageAttachments:r}=b.useChat();return n.jsx(Vn,{children:h.maybeRender(e,r),...a})},Un=i.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Rt=t=>{const{attachment:e,...a}=t;return n.jsx(H.AttachmentItemProvider,{attachment:e,children:n.jsx(Un,{...a})})},Kn=i.ikp(f.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Wt=t=>{const{attachment:e}=H.useAttachmentItem(),a=e.contentType?.attachmentIcon;return a?n.jsx(Kn,{iconSettings:a,...t}):null},zn=i.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),Ot=t=>{const{attachment:e}=H.useAttachmentItem();return n.jsx(zn,{children:e.title,...t})},Gn=i.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Qt=t=>{const{onClick:e,...a}=t,{attachment:r}=H.useAttachmentItem(),{setMessageAttachments:s}=b.useChat(),d=()=>{s(o=>o.filter(c=>c.id!==r.id))};return n.jsx(Gn,{"aria-label":"Remove attachment",children:n.jsx(k.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,d),...a})},Nt=i.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),$t=i.ikp(T.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Vt=i.ikp(T.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(k.CustomIcon,{iconKey:"info"})}),me=i.ikp(T.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Ut=i.ikp(T.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Yn=i.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Kt=t=>{const{children:e,...a}=t,{selectedWorkflow:r}=b.useChat();return r?.supportedInputs?n.jsx(Yn,{children:h.maybeRender(e,r.supportedInputs),...a}):null},Jn=i.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),zt=t=>{const{input:e,onClick:a,...r}=t,{selectedWorkflow:s,messageAttachments:d,setMessageAttachments:o}=b.useChat(),{selectInput:c,onOpen:m}=F.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,o,[...d]):void 0;c(e),m()};return n.jsx(Jn,{children:e.displayName,onClick:u.composeEventHandlers(a,l),...r})},Gt=i.ikp(fa.IoAdd,{_id:"aiChatAttachmentsBar__InputIcon"}),Xn=i.ikp(_.Root,{_id:"aiChatAttachmentsBar__Modal"}),Yt=t=>{const{onOpenChange:e,...a}=t,{selectInput:r,isOpen:s,onClose:d,selectedInput:o}=F.useAttachmentsBar(),c=m=>{m||(d(),r(null))};return n.jsx(Xn,{open:s&&o!==null,onOpenChange:u.composeEventHandlers(e,c),...a})},Jt=i.ikp(_.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Xt=i.ikp(_.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Zt=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Zn=i.ikp(_.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),ei=t=>{const{selectedInput:e}=F.useAttachmentsBar(),a=`Add ${e?.displayName}`;return n.jsx(Zn,{children:a,...t})},er=i.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),ti=t=>{const{selectedInput:e}=F.useAttachmentsBar(),a=e?.workflowModalProps?.modalHelpText;return a?n.jsx(er,{children:a,...t}):null},tr=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),ii=t=>{const{children:e,...a}=t,{selectedInput:r}=F.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(tr,{asChild:!e,children:e||s,...a}):null},ai=i.ikp(_.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(k.CustomIcon,{iconKey:"close"})}),ni=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),ir=i.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ri=t=>{const{onSubmit:e,...a}=t,{form:r}=F.useAttachmentsBar();return n.jsx(ir,{onSubmit:u.composeEventHandlers(e,r.onSubmit),...a})},si=i.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),ar=i.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),oi=t=>{const{form:e,selectedInput:a}=F.useAttachmentsBar();return n.jsx(ar,{htmlFor:`${a?.id}-title`,children:e.labels.title,...t})},nr=i.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),di=t=>{const{onChange:e,...a}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(nr,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":h.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:u.composeEventHandlers(e,r.onChange),...a})},rr=i.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ci=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.title?n.jsx(rr,{"aria-live":"polite",children:e.errors.title,...t}):null},mi=i.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),sr=i.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),li=t=>{const{form:e,selectedInput:a}=F.useAttachmentsBar();return n.jsx(sr,{htmlFor:`${a?.id}-content`,children:e.labels.content,...t})},or=i.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),hi=t=>{const{onChange:e,...a}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(or,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":h.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:u.composeEventHandlers(e,r.onChange),...a,children:n.jsx(ne,{maxRows:10})})},dr=i.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),ui=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.content?n.jsx(dr,{"aria-live":"polite",children:e.errors.content,...t}):null},Ci=i.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),pi=i.ikp("div",{_id:"aiChatActionBar"}),vi=i.ikp("div",{_id:"aiChat__ChatActions"}),bi=i.ikp("div",{_id:"aiChatTagline__Container"}),gi=i.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),Pi=i.ikp(ya.default,{_id:"aiChatTagline__Logo"}),_i=i.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),cr=i.ikp("div",{_id:"aiChat__ChatAction"}),Y=t=>{const{action:e,onClick:a,className:r,...s}=t,{clear:d,stop:o,isLoading:c,messages:m,selectedWorkflow:l}=b.useChat(),{conversation:p}=D.useInkeepConversation(),{aiChatSettings:v,baseSettings:E}=C.useInkeepConfig(),{logEvent:j}=V.useChatEvents(),[W,X]=ie.useCopyToClipboard(),[O,Z]=ie.useCopyToClipboard();if({help:!1,copy:m.length===0||!v.isCopyChatButtonVisible||c,share:m.length===0||!v.isShareButtonVisible||!p.id||!!l||c,clear:m.length===0||v.isViewOnly||c,stop:!c}[e])return null;const te={help:()=>{},copy:()=>{const Q=m.map(y=>{const L=`**${y.role==="assistant"?"AI Assistant":"User"}**`,M=h.getMessageContent(y),S=ja.stringifyAttachments(y.metadata?.attributes?.attachments),N=S?`
7
+ Let me know how I can help.`,v={content:r.introMessage??`${m}${l}`,id:Qa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:v,...a})}),ln=i.ikp("div",{_id:"aiChatMessageHeader"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=i.ikp("div",{_id:"aiChatMessageLoading"}),Ye=t=>{const{isLoading:e,isStreaming:a,messages:r}=b.useChat(),{message:s}=P.useMessage();return!(r.at(-1)?.id===s?.id)||s.role!=="assistant"||!e||a?null:n.jsx(hn,{children:"Thinking...",...t})},un=i.ikp("div",{_id:"aiChatMessageAvatar"}),Je=t=>{const{message:e}=P.useMessage();return n.jsx(un,{"data-role":e.role,...t})},Cn=i.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Xe=t=>{const{message:e}=P.useMessage(),{baseSettings:a}=C.useInkeepConfig();return n.jsx(Cn,{"data-username":h.dataAttr(e.role==="user"&&!!a.userProperties.name),"data-role":e.role,...t})},pn=i.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Ze=g.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:a}=P.useMessage();return e.userProperties.name?n.jsx(pn,{"data-role":a.role,children:h.getInitials(e.userProperties.name),...t}):null}),pe=i.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),et=g.memo(t=>{const{onLoadingStatusChange:e,...a}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=C.useInkeepConfig(),{message:d}=P.useMessage(),{aiAssistantAvatar:o}=r??{},c=typeof o=="string"?o:o?.light,m=(typeof o=="string"?o:o?.dark)??c,l=qa.useColorModeValue(c,m),[p,v]=g.useState(l);g.useEffect(()=>{v(l)},[l]);const E=j=>{j==="error"&&v(null)};return d.role==="user"?s.name?null:r.userAvatar?n.jsx(pe,{"data-type":"image","data-role":d.role,src:r.userAvatar,...t}):n.jsx(xa.default,{"data-type":"icon","data-role":d.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":d.role,onLoadingStatusChange:u.composeEventHandlers(e,E),...a}):n.jsx(Ba.default,{"data-type":"icon","data-role":d.role,...t})}),vn=i.ikp("span",{_id:"aiChatMessageName"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(vn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},bn=i.ikp("div",{_id:"aiChatMessageContentWrapper"}),it=t=>{const{message:e}=P.useMessage();return n.jsx(bn,{"data-role":e.role,...t})},gn=i.ikp("div",{_id:"aiChatMessageContent"}),at=t=>{const{message:e}=P.useMessage();return n.jsx(gn,{"data-role":e.role,...t})},Pn=i.ikp("div",{_id:"aiChatMessageAttachments"}),nt=t=>{const{message:e}=P.useMessage(),a=e.metadata?.attributes?.attachments;return e.role!=="user"||!a?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(Pn,{...t})})},_n=i.ikp("div",{_id:"aiChatMessageAttachments__List"}),rt=t=>{const{children:e,...a}=t,{message:r}=P.useMessage(),s=r.metadata?.attributes?.attachments;return s?n.jsx(_n,{children:h.maybeRender(e,s),...a}):null},An=i.ikp("div",{_id:"aiChatMessageAttachments__Item"}),st=t=>{const{attachment:e,onClick:a,...r}=t,{selectItem:s,onOpen:d}=q.useMessageAttachments(),o=()=>{s(e),d()};return n.jsx(H.AttachmentItemProvider,{attachment:e,children:n.jsx(An,{onClick:u.composeEventHandlers(a,o),...r})})},kn=i.ikp(f.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),ot=t=>{const{attachment:e}=H.useAttachmentItem(),a=e.contentType?.attachmentIcon;return a?n.jsx(kn,{iconSettings:a,...t}):null},Fn=i.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),dt=t=>{const{attachment:e}=H.useAttachmentItem();return n.jsx(Fn,{children:e.title,...t})},En=i.ikp(_.Root,{_id:"aiChatMessageAttachmentsPreview"}),ct=t=>{const{onOpenChange:e,...a}=t,{selectItem:r,isOpen:s,onClose:d,selectedItem:o}=q.useMessageAttachments(),c=m=>{m||(d(),r(null))};return n.jsx(En,{open:s&&o!==null,onOpenChange:u.composeEventHandlers(e,c),...a})},mt=i.ikp(_.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),lt=i.ikp(_.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),In=i.ikp(_.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(In,{children:e?.title||"Attachment",...t})},ut=i.ikp(_.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(k.CustomIcon,{iconKey:"close"})}),Mn=i.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),Ct=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Mn,{children:e?.content,...t})},ve=i.ikp("div",{_id:"aiChatMessage"}),pt=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:a,...r}=t,{message:s}=P.useMessage(),{logEvent:d}=V.useChatEvents(),o=h.getMessageContent(s),{conversation:c}=D.useInkeepConversation();return s.role==="user"?n.jsx(ve,{"data-role":s.role,children:o,...r}):n.jsx(ve,{"data-role":s.role,...r,children:n.jsx($.Markdown,{children:o,componentStyles:a,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,l)=>{d({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:m}})},onCodeCopy:(m,l)=>{d({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:l}})}})})},Sn=i.ikp("div",{_id:"aiChatMessageActions"}),vt=t=>{const{isLoading:e,messages:a}=b.useChat(),{message:r}=P.useMessage();return a.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(Sn,{...t})},fn=i.ikp("div",{_id:"aiChatMessageToolActions"}),bt=t=>{const{children:e,...a}=t,{message:r}=P.useMessage(),{messageToolCalls:s}=b.useChat(),d=s[r.id]||[];return n.jsx(fn,{children:h.maybeRender(e,d),...a})},gt=t=>{const{onClick:e,action:a,...r}=t,{handleAction:s}=se.useChatAction(a),d=()=>{s()},o=a.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[a.icon&&n.jsx(f.BuiltInIconRenderer,{iconSettings:a.icon}),o]}),m=a.action.type,l=i.ikp(m==="open_link"?"a":"button",{_id:"aiChatMessageToolAction",children:c,"data-type":a.action.type,...m==="open_link"&&{href:a.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(e,d)});return n.jsx(l,{...r})},Bn=i.ikp("button",{_id:"aiChatMessageAction"}),Pt=t=>{const{action:e,onClick:a,className:r,...s}=t,{conversation:d}=D.useInkeepConversation(),{message:o}=P.useMessage(),{isStreaming:c,messages:m}=b.useChat(),[l,p]=ie.useCopyToClipboard(),{feedback:v,submitPositiveFeedback:E,setCurrentFeedback:j,currentFeedback:R}=re.useMessageFeedback(),{logEvent:X}=V.useChatEvents(),[W,Z]=Ha.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:ee}=he,ue=m.at(-1)?.id===o?.id,te=o.role==="assistant";if(ue&&c||!te||{copy:!1,upvote:ee,downvote:ee}[e])return null;const y={copy(){p(h.getMessageContent(o)),X({eventName:"assistant_message_copied",properties:{conversation:d}})},upvote(){E(o.id).then(()=>{Z()})},downvote(){j(o.id)}},L={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(k.CustomIcon,{iconKey:l?"messageCopied":"messageCopy"}),upvote:n.jsx(k.CustomIcon,{iconKey:W?"messageCopied":"thumbsUp"}),downvote:n.jsx(k.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":h.dataAttr(l)},upvote:{"data-upvoted":h.dataAttr(v[o.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(v[o.id]?.type==="negative"),"data-state":R===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":L[e],className:`${r} ${e}`,onClick:u.composeEventHandlers(a,y[e]),...s})},xn=i.ikp("div",{_id:"aiChatMessageSources"}),_t=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(xn,{...t})},Tn=i.ikp("div",{_id:"aiChatMessageSources__Header"}),At=t=>n.jsx(Tn,{children:"Sources",...t}),jn=i.ikp("div",{_id:"aiChatMessageSources__List"}),kt=t=>{const{message:e}=P.useMessage(),{children:a,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:d},aiChatSettings:{shouldOpenLinksInNewTab:o},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(l=>{const p=Wa.transformInkeepSource(l,"chatSourceItem",{organizationDisplayName:d,tabs:c,transformSource:s}),v=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:o;return{...p,isExternal:v}});return n.jsx(jn,{children:h.maybeRender(a,m),...r})},yn=i.ikp(Ta.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),Ft=t=>{const{source:e,onClick:a,...r}=t,{logEvent:s}=V.useChatEvents(),{conversation:d}=D.useInkeepConversation(),o=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversation:d,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(a,o),...r})})},Hn=i.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Et=t=>{const{source:e}=B.useSourceItem();return e.breadcrumbs?.length?n.jsx(Hn,{"data-type":e.type,...t}):null},wn=i.ikp(k.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Ln=i.ikp(f.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),It=t=>{const{source:e}=B.useSourceItem();return n.jsx(Ln,{iconSettings:e.icon,"data-type":e.type,...t})},Dn=i.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),Mt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Dn,{"data-type":e.type,children:e.title,...t})},qn=i.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),St=t=>{const{source:e}=B.useSourceItem();return n.jsx(qn,{"data-type":e.type,...t})},On=i.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),ft=t=>{const{source:e}=B.useSourceItem(),{children:a,...r}=t,s=g.useMemo(()=>e.description?Da.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(On,{"data-type":e.type,children:h.maybeRender(a,s),...r}):null},Rn=i.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),Bt=t=>{const{part:e,...a}=t,{source:r}=B.useSourceItem();return typeof e=="string"?e:n.jsx(Rn,{"data-type":r.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...a})},Wn=i.ikp(k.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Wn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Tt=i.ikp("div",{_id:"aiChatFooter"}),jt=i.ikp("div",{_id:"aiChatInput__Fieldset"}),yt=i.ikp("div",{_id:"aiChatInput__Group"}),Qn=i.ikp("textarea",{_id:"aiChatInput"}),Ht=g.forwardRef(({onChange:t,onKeyDown:e,...a},r)=>{const{handleInputChange:s,handleInputKeyDown:d,input:o,error:c,shouldAutoFocusInput:m,inputRef:l}=b.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),v=oe.useComposedRefs(r,l),E=ge.useModal();return g.useEffect(()=>{requestAnimationFrame(()=>{m&&l?.current&&(l.current.focus(),l.current.selectionStart=l.current.value.length)})},[m,l,E?.isOpen]),n.jsx(Qn,{asChild:!0,ref:v,maxLength:99999,placeholder:p.placeholder,value:o,onChange:u.composeEventHandlers(t,s),onKeyDown:u.composeEventHandlers(e,d),disabled:!!c||p.isViewOnly,...a,children:n.jsx(ne,{})})}),Nn=i.ikp("button",{_id:"aiChatInput__SendButton"}),wt=t=>{const{handleSubmit:e,isSubmitDisabled:a,error:r}=b.useChat(),{aiChatSettings:s}=C.useInkeepConfig(),{onClick:d,...o}=t;return n.jsx(Nn,{onClick:u.composeEventHandlers(d,()=>e()),"aria-label":"Send message",disabled:a||!!r||s.isViewOnly,...o})},Lt=i.ikp(k.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),$n=i.ikp("div",{_id:"aiChatAttachmentsBar"}),Dt=t=>{const{selectedWorkflow:e}=b.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(F.AttachmentsBarProvider,{children:n.jsx($n,{...t})})},Vn=i.ikp("div",{_id:"aiChatAttachmentsBar__List"}),qt=t=>{const{children:e,...a}=t,{messageAttachments:r}=b.useChat();return n.jsx(Vn,{children:h.maybeRender(e,r),...a})},Un=i.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Ot=t=>{const{attachment:e,...a}=t;return n.jsx(H.AttachmentItemProvider,{attachment:e,children:n.jsx(Un,{...a})})},Kn=i.ikp(f.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Rt=t=>{const{attachment:e}=H.useAttachmentItem(),a=e.contentType?.attachmentIcon;return a?n.jsx(Kn,{iconSettings:a,...t}):null},zn=i.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),Wt=t=>{const{attachment:e}=H.useAttachmentItem();return n.jsx(zn,{children:e.title,...t})},Gn=i.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Qt=t=>{const{onClick:e,...a}=t,{attachment:r}=H.useAttachmentItem(),{setMessageAttachments:s}=b.useChat(),d=()=>{s(o=>o.filter(c=>c.id!==r.id))};return n.jsx(Gn,{"aria-label":"Remove attachment",children:n.jsx(k.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,d),...a})},Nt=i.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),$t=i.ikp(T.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Vt=i.ikp(T.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(k.CustomIcon,{iconKey:"info"})}),me=i.ikp(T.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Ut=i.ikp(T.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Yn=i.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Kt=t=>{const{children:e,...a}=t,{selectedWorkflow:r}=b.useChat();return r?.supportedInputs?n.jsx(Yn,{children:h.maybeRender(e,r.supportedInputs),...a}):null},Jn=i.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),zt=t=>{const{input:e,onClick:a,...r}=t,{selectedWorkflow:s,messageAttachments:d,setMessageAttachments:o}=b.useChat(),{selectInput:c,onOpen:m}=F.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,o,[...d]):void 0;c(e),m()};return n.jsx(Jn,{children:e.displayName,onClick:u.composeEventHandlers(a,l),...r})},Gt=i.ikp(fa.IoAdd,{_id:"aiChatAttachmentsBar__InputIcon"}),Xn=i.ikp(_.Root,{_id:"aiChatAttachmentsBar__Modal"}),Yt=t=>{const{onOpenChange:e,...a}=t,{selectInput:r,isOpen:s,onClose:d,selectedInput:o}=F.useAttachmentsBar(),c=m=>{m||(d(),r(null))};return n.jsx(Xn,{open:s&&o!==null,onOpenChange:u.composeEventHandlers(e,c),...a})},Jt=i.ikp(_.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Xt=i.ikp(_.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Zt=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Zn=i.ikp(_.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),ei=t=>{const{selectedInput:e}=F.useAttachmentsBar(),a=`Add ${e?.displayName}`;return n.jsx(Zn,{children:a,...t})},er=i.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),ti=t=>{const{selectedInput:e}=F.useAttachmentsBar(),a=e?.workflowModalProps?.modalHelpText;return a?n.jsx(er,{children:a,...t}):null},tr=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),ii=t=>{const{children:e,...a}=t,{selectedInput:r}=F.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(tr,{asChild:!e,children:e||s,...a}):null},ai=i.ikp(_.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(k.CustomIcon,{iconKey:"close"})}),ni=i.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),ir=i.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ri=t=>{const{onSubmit:e,...a}=t,{form:r}=F.useAttachmentsBar();return n.jsx(ir,{onSubmit:u.composeEventHandlers(e,r.onSubmit),...a})},si=i.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),ar=i.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),oi=t=>{const{form:e,selectedInput:a}=F.useAttachmentsBar();return n.jsx(ar,{htmlFor:`${a?.id}-title`,children:e.labels.title,...t})},nr=i.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),di=t=>{const{onChange:e,...a}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(nr,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":h.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:u.composeEventHandlers(e,r.onChange),...a})},rr=i.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ci=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.title?n.jsx(rr,{"aria-live":"polite",children:e.errors.title,...t}):null},mi=i.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),sr=i.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),li=t=>{const{form:e,selectedInput:a}=F.useAttachmentsBar();return n.jsx(sr,{htmlFor:`${a?.id}-content`,children:e.labels.content,...t})},or=i.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),hi=t=>{const{onChange:e,...a}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(or,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":h.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:u.composeEventHandlers(e,r.onChange),...a,children:n.jsx(ne,{maxRows:10})})},dr=i.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),ui=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.content?n.jsx(dr,{"aria-live":"polite",children:e.errors.content,...t}):null},Ci=i.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),pi=i.ikp("div",{_id:"aiChatActionBar"}),vi=i.ikp("div",{_id:"aiChat__ChatActions"}),bi=i.ikp("div",{_id:"aiChatTagline__Container"}),gi=i.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),Pi=i.ikp(ya.default,{_id:"aiChatTagline__Logo"}),_i=i.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),cr=i.ikp("div",{_id:"aiChat__ChatAction"}),Y=t=>{const{action:e,onClick:a,className:r,...s}=t,{clear:d,stop:o,isLoading:c,messages:m,selectedWorkflow:l}=b.useChat(),{conversation:p}=D.useInkeepConversation(),{aiChatSettings:v,baseSettings:E}=C.useInkeepConfig(),{logEvent:j}=V.useChatEvents(),[R,X]=ie.useCopyToClipboard(),[W,Z]=ie.useCopyToClipboard();if({help:!1,copy:m.length===0||!v.isCopyChatButtonVisible||c,share:m.length===0||!v.isShareButtonVisible||!p.id||!!l||c,clear:m.length===0||v.isViewOnly||c,stop:!c}[e])return null;const te={help:()=>{},copy:()=>{const Q=m.map(y=>{const L=`**${y.role==="assistant"?"AI Assistant":"User"}**`,M=h.getMessageContent(y),S=ja.stringifyAttachments(y.metadata?.attributes?.attachments),N=S?`
8
8
 
9
9
  **Attachments**
10
10
 
@@ -14,4 +14,4 @@ ${M}${N}`}).join(`
14
14
 
15
15
  ---
16
16
 
17
- `);X(Q)},share:async()=>{const Q={visibility:"public",tags:[],userProperties:{},messages:p.messages.map(S=>({...S,id:Date.now().toString()+S.id,conversationId:void 0}))},{apiKey:y,analyticsApiBaseUrl:L}=E,M=await Wa.logConversation("",Q,y,L);if(M){const N=`${v.shareChatUrlBasePath}?${D.SHARE_QUERY_PARAM}=${M?.id}`;Z(N),j({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:N,conversation:M}})}},clear:d,stop:o},Ce={copy:W,share:O};return n.jsx(T.Tooltip,{delayDuration:0,open:Ce[e],children:n.jsx(cr,{"data-type":e,"data-copied":h.dataAttr(W||O),className:`${r} ${e}`,children:n.jsx(le,{action:e}),onClick:u.composeEventHandlers(a,te[e]),...s})})},mr=i.ikp(T.Trigger,{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...a}=t,{aiChatSettings:r}=C.useInkeepConfig(),s=r.toolbarButtonLabels??{},d={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:d[e],...a})},lr=i.ikp(T.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),Ai=t=>{const{action:e,children:a,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(lr,{sideOffset:5,...r,children:[n.jsx(T.Arrow,{}),a||s[e]]})},hr=i.ikp(z.Root,{_id:"aiChatHelpActions"}),ki=t=>{const{children:e,...a}=t,{aiChatSettings:r}=C.useInkeepConfig(),{getHelpOptions:s}=r;if(!s||(s??[]).length===0)return null;const{_pinned:d,_unpinned:o}=s.reduce((p,v)=>{const E=v.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[E]:[...p[E],v]}},{_pinned:[],_unpinned:[]}),c=o.length===1?[...d,o[0]]:d,m=o.length===1?[]:o,l=ae.useHelpMenuState();return n.jsx(ae.HelpMenuProvider,{value:l,children:n.jsx(hr,{open:l.open,onOpenChange:l.setOpen,children:h.maybeRender(e,{pinned:c,unpinned:m}),...a})})},ur=i.ikp(Y,{_id:"aiChatHelpAction",action:"help"}),Fi=t=>{const{action:e,onClick:a,...r}=t,{handleAction:s,logHelpAction:d}=se.useChatAction(e),o=e.action.type,c=o==="open_link",m=o==="open_link"?n.jsx("a",{href:e.action.url,target:"_blank",rel:"noreferrer",children:e.name}):e.name;return n.jsx(ur,{"aria-label":e.name,"data-name":e.name,children:m,asChild:c,onClick:u.composeEventHandlers(a,()=>{s(),d()}),...r})},Cr=i.ikp(z.Trigger,{_id:"aiChatHelpActions__Trigger"}),Ei=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(Y,{action:"help",...t,asChild:!0,children:n.jsx(Cr,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),pr=i.ikp(z.Content,{_id:"aiChatHelpActions__Menu"}),Ii=t=>n.jsx(pr,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Mi=i.ikp(z.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),Si=t=>{const{action:e,onClick:a,...r}=t,{handleAction:s,logHelpAction:d}=se.useChatAction(e),{setOpen:o}=ae.useHelpMenu(),c=()=>{s({onOpenForm:()=>o(!1)}),d()},m=e.action.type,l=i.ikp(m==="open_link"?"a":"button",{_id:"aiChatHelpActions__MenuItem",children:e.name,"aria-label":e.name,"data-name":e.name,"data-type":e.action.type,...m==="open_link"&&{href:e.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(a,c)});return n.jsx(l,{...r})},vr=i.ikp(f.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),fi=t=>{const{action:e,...a}=t;return e.icon?n.jsx(vr,{iconSettings:e.icon,...a}):null},br=i.ikp(_.Root,{_id:"aiChatFeedbackModal"}),Bi=t=>{const{onOpenChange:e,...a}=t,{currentFeedback:r,setCurrentFeedback:s}=re.useMessageFeedback();return n.jsx(br,{open:r!==null,onOpenChange:u.composeEventHandlers(e,()=>s(null)),...a})},xi=i.ikp(_.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),Ti=i.ikp(_.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),ji=i.ikp(_.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),yi=i.ikp(_.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(k.CustomIcon,{iconKey:"close"})}),Hi=i.ikp("div",{_id:"aiChatFeedbackModal__Body"}),gr=i.ikp("form",{_id:"aiChatFeedbackForm"}),wi=t=>{const{onSubmit:e,...a}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:d}=re.useMessageFeedback(),o=c=>{c.preventDefault();const m=c.target,l=new FormData(m),p=Object.fromEntries(l.entries());s&&(r(s,p),d(null))};return n.jsx(gr,{onSubmit:u.composeEventHandlers(e,o),...a})},Pr=i.ikp("div",{_id:"aiChatFeedbackItem"}),Li=t=>{const{name:e,...a}=t;return n.jsx(U.FeedbackItemProvider,{name:e,children:n.jsx(Pr,{...a})})},_r=i.ikp(K.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Di=t=>{const{name:e,focusItem:a}=U.useFeedbackItem(),{onCheckedChange:r,...s}=t,d=o=>{o&&a?.current?.focus()};return n.jsx(_r,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(r,d),...s})},qi=i.ikp(K.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Ar=i.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Ri=t=>{const{name:e}=U.useFeedbackItem(),a={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(Ar,{htmlFor:`feedback-${e}`,children:a[e],...t})},kr=i.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Wi=t=>{const{name:e,focusItem:a}=U.useFeedbackItem();return n.jsx(kr,{ref:a,name:`${e}:description`,...t})},Oi=i.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),Fr=i.ikp("div",{_id:"aiChatForm__Wrapper"}),Qi=t=>{const{form:e}=A.useChatForm();return e?n.jsx(Fr,{...t}):null},Er=i.ikp("form",{_id:"aiChatForm"}),Ni=t=>{const{onSubmit:e,...a}=t,{handleSubmit:r,isSuccess:s}=A.useChatForm();return s?null:n.jsx(Er,{onSubmit:u.composeEventHandlers(e,r),...a})},Ir=i.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(k.CustomIcon,{iconKey:"close"})}),$i=t=>{const{onClick:e,...a}=t,{closeForm:r}=A.useChatForm();return n.jsx(Ir,{onClick:u.composeEventHandlers(e,r),...a})},Vi=i.ikp("div",{_id:"aiChatForm__Header"}),Mr=i.ikp("h2",{_id:"aiChatForm__Heading"}),Ui=t=>{const{form:e}=A.useChatForm();return e?.heading?n.jsx(Mr,{children:e.heading,...t}):null},Sr=i.ikp("span",{_id:"aiChatForm__Description"}),Ki=t=>{const{form:e}=A.useChatForm();return e?.description?n.jsx(Sr,{children:e.description,...t}):null},fr=i.ikp("div",{_id:"aiChatForm__Content"}),zi=t=>{const{children:e,...a}=t,{fields:r=[]}=A.useChatForm();return n.jsx(fr,{children:h.maybeRender(e,r),...a})},Br=i.ikp("div",{_id:"aiChatForm__Field"}),Gi=t=>{const{field:e,autoFocus:a,...r}=t,{control:s,errors:d}=A.useChatForm();return n.jsx(La.Controller,{name:e.name,control:s,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:o})=>{const c=o.value!==void 0||e.inputType==="file";return n.jsx(x.FormFieldProvider,{"data-invalid":h.dataAttr(!!d[e.name]),field:e,fieldProps:o,autoFocus:a,children:c&&n.jsx(Br,{"data-input-type":e.inputType,"data-hidden":h.dataAttr(e.isHidden),...r})})}})},xr=i.ikp("label",{_id:"aiChatForm__FieldLabel"}),Yi=t=>{const{field:e}=x.useFormField();return n.jsx(xr,{"data-required":h.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},Tr=i.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),J=t=>{const{field:e,error:a,fieldProps:{onChange:r,onBlur:s,...d},autoFocus:o}=x.useFormField(),{onChange:c,onBlur:m,...l}=t;return n.jsx(Tr,{id:e.name,autoFocus:o,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":h.dataAttr(!!a),onChange:u.composeEventHandlers(c,r),onBlur:u.composeEventHandlers(m,s),...d,...l})},Ji=i.ikp(J,{_id:"aiChatForm__FieldEmail",type:"email"}),jr=i.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Xi=t=>{const{field:e,error:a,fieldProps:{value:r,onChange:s,onBlur:d,...o},autoFocus:c}=x.useFormField(),{onChange:m,onBlur:l,...p}=t,v=E=>{const j=E.target.files;s(j)};return n.jsx(jr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":h.dataAttr(!!a),...p,...o,onChange:u.composeEventHandlers(m,v),onBlur:u.composeEventHandlers(l,d)})},Zi=i.ikp(J,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ne,{maxRows:8})}),yr=i.ikp(K.Root,{_id:"aiChatForm__FieldCheckbox"}),ea=t=>{const{field:e,error:a,fieldProps:r,autoFocus:s}=x.useFormField(),{onCheckedChange:d,...o}=t;return n.jsx(yr,{id:e.name,name:e.name,autoFocus:s,"data-invalid":h.dataAttr(!!a),checked:r.value,onCheckedChange:u.composeEventHandlers(d,r.onChange),...o})},ta=i.ikp(K.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Hr=i.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),ia=t=>{const{field:e,error:a,fieldProps:r}=x.useFormField(),{onValueChange:s,...d}=t;return n.jsx(Hr,{name:e.name,"data-invalid":h.dataAttr(!!a),value:r.value,onValueChange:u.composeEventHandlers(s,r.onChange),...d})},aa=i.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),wr=i.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),na=t=>{const{field:e}=x.useFormField();return n.jsx(wr,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ra=i.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(f.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),sa=i.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),oa=i.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),da=i.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ca=i.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),ma=i.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(f.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Lr=i.ikp("span",{_id:"aiChatForm__FieldError"}),la=t=>{const{error:e}=x.useFormField();return e?n.jsx(Lr,{children:e.message?.toString(),...t}):null},Dr=i.ikp("span",{_id:"aiChatForm__Error"}),ha=t=>{const{formError:e}=A.useChatForm();return e?n.jsx(Dr,{children:e.message,...t}):null},ua=i.ikp("div",{_id:"aiChatForm__Footer"}),qr=i.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),Ca=t=>{const{onClick:e,...a}=t,{closeForm:r}=A.useChatForm();return n.jsx(qr,{onClick:u.composeEventHandlers(e,r),...a})},Rr=i.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),pa=t=>{const{onClick:e,...a}=t,{isSubmitting:r}=A.useChatForm();return n.jsx(Rr,{disabled:r,...a})},Wr=i.ikp("div",{_id:"aiChatForm__Success"}),va=t=>{const{isSuccess:e}=A.useChatForm();return e?n.jsx(Wr,{...t}):null},Or=i.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),ba=t=>{const{form:e}=A.useChatForm();return n.jsx(Or,{children:e?.successView.heading,...t})},Qr=i.ikp($.Markdown,{_id:"aiChatForm__SuccessMessage"}),ga=t=>{const{form:e}=A.useChatForm();return n.jsx(Qr,{children:e?.successView.message,...t})},Nr=i.ikp("button",{_id:"aiChatForm__SuccessButton"}),Pa=t=>{const{onClick:e,...a}=t,{form:r,closeForm:s}=A.useChatForm(),d=r?.successView?.doneButton;if(!d)return null;const o=d.icon&&n.jsx(f.BuiltInIconRenderer,{iconSettings:d.icon}),c=d.label;return n.jsx(Nr,{onClick:u.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[o,c]}),...a})};exports.Provider=b.ChatProvider;exports.ActionBar=pi;exports.Actions=vi;exports.AttachmentsBar=Dt;exports.AttachmentsBarActions=Nt;exports.AttachmentsBarAttachment=Rt;exports.AttachmentsBarAttachmentDelete=Qt;exports.AttachmentsBarAttachmentIcon=Wt;exports.AttachmentsBarAttachmentTitle=Ot;exports.AttachmentsBarForm=ri;exports.AttachmentsBarFormContent=mi;exports.AttachmentsBarFormContentError=ui;exports.AttachmentsBarFormContentInput=hi;exports.AttachmentsBarFormContentLabel=li;exports.AttachmentsBarFormSubmitButton=Ci;exports.AttachmentsBarFormTitle=si;exports.AttachmentsBarFormTitleError=ci;exports.AttachmentsBarFormTitleInput=di;exports.AttachmentsBarFormTitleLabel=oi;exports.AttachmentsBarInfoTip=$t;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Vt;exports.AttachmentsBarInfoTipText=Ut;exports.AttachmentsBarInput=zt;exports.AttachmentsBarInputIcon=Gt;exports.AttachmentsBarInputs=Kt;exports.AttachmentsBarList=qt;exports.AttachmentsBarModal=Yt;exports.AttachmentsBarModalBody=ni;exports.AttachmentsBarModalClose=ai;exports.AttachmentsBarModalContent=Xt;exports.AttachmentsBarModalDescription=ti;exports.AttachmentsBarModalHeader=Zt;exports.AttachmentsBarModalHeading=ei;exports.AttachmentsBarModalHelp=ii;exports.AttachmentsBarModalOverlay=Jt;exports.ChatAction=Y;exports.ChatActionFeedback=Ai;exports.ChatActionLabel=le;exports.ChatHelpAction=Fi;exports.Content=Ie;exports.ContentScrollArea=Me;exports.ContentScrollAreaCorner=xe;exports.ContentScrollAreaScrollbar=fe;exports.ContentScrollAreaThumb=Be;exports.ContentScrollAreaViewport=Se;exports.ConversationLoading=_e;exports.Disclaimer=je;exports.DisclaimerArrow=De;exports.DisclaimerContent=we;exports.DisclaimerLabel=ye;exports.DisclaimerText=Le;exports.DisclaimerTrigger=He;exports.EmbeddedChatPrimitiveActionBar=pi;exports.EmbeddedChatPrimitiveActions=vi;exports.EmbeddedChatPrimitiveAttachmentsBar=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=ui;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=hi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=Ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=oi;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=$t;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInput=zt;exports.EmbeddedChatPrimitiveAttachmentsBarInputIcon=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarList=qt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ni;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ai;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=ii;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=Jt;exports.EmbeddedChatPrimitiveChatAction=Y;exports.EmbeddedChatPrimitiveChatActionFeedback=Ai;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Fi;exports.EmbeddedChatPrimitiveContent=Ie;exports.EmbeddedChatPrimitiveContentScrollArea=Me;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=xe;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=fe;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=Be;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Se;exports.EmbeddedChatPrimitiveConversationLoading=_e;exports.EmbeddedChatPrimitiveDisclaimer=je;exports.EmbeddedChatPrimitiveDisclaimerArrow=De;exports.EmbeddedChatPrimitiveDisclaimerContent=we;exports.EmbeddedChatPrimitiveDisclaimerLabel=ye;exports.EmbeddedChatPrimitiveDisclaimerText=Le;exports.EmbeddedChatPrimitiveDisclaimerTrigger=He;exports.EmbeddedChatPrimitiveFeedbackForm=wi;exports.EmbeddedChatPrimitiveFeedbackItem=Li;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Di;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=qi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Wi;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Ri;exports.EmbeddedChatPrimitiveFeedbackModal=Bi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Hi;exports.EmbeddedChatPrimitiveFeedbackModalClose=yi;exports.EmbeddedChatPrimitiveFeedbackModalContent=Ti;exports.EmbeddedChatPrimitiveFeedbackModalHeader=ji;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=xi;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Oi;exports.EmbeddedChatPrimitiveFooter=Tt;exports.EmbeddedChatPrimitiveForm=Ni;exports.EmbeddedChatPrimitiveFormCancel=Ca;exports.EmbeddedChatPrimitiveFormClose=$i;exports.EmbeddedChatPrimitiveFormContent=zi;exports.EmbeddedChatPrimitiveFormDescription=Ki;exports.EmbeddedChatPrimitiveFormError=ha;exports.EmbeddedChatPrimitiveFormField=Gi;exports.EmbeddedChatPrimitiveFormFieldCheckbox=ea;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=ta;exports.EmbeddedChatPrimitiveFormFieldEmail=Ji;exports.EmbeddedChatPrimitiveFormFieldError=la;exports.EmbeddedChatPrimitiveFormFieldFile=Xi;exports.EmbeddedChatPrimitiveFormFieldLabel=Yi;exports.EmbeddedChatPrimitiveFormFieldSelect=ia;exports.EmbeddedChatPrimitiveFormFieldSelectContent=sa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ra;exports.EmbeddedChatPrimitiveFormFieldSelectItem=da;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=ma;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ca;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=aa;exports.EmbeddedChatPrimitiveFormFieldSelectValue=na;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=oa;exports.EmbeddedChatPrimitiveFormFieldText=J;exports.EmbeddedChatPrimitiveFormFieldTextArea=Zi;exports.EmbeddedChatPrimitiveFormFooter=ua;exports.EmbeddedChatPrimitiveFormHeader=Vi;exports.EmbeddedChatPrimitiveFormHeading=Ui;exports.EmbeddedChatPrimitiveFormSubmit=pa;exports.EmbeddedChatPrimitiveFormSuccess=va;exports.EmbeddedChatPrimitiveFormSuccessButton=Pa;exports.EmbeddedChatPrimitiveFormSuccessHeading=ba;exports.EmbeddedChatPrimitiveFormSuccessMessage=ga;exports.EmbeddedChatPrimitiveFormWrapper=Qi;exports.EmbeddedChatPrimitiveHeaderToolbar=ke;exports.EmbeddedChatPrimitiveHelpActions=ki;exports.EmbeddedChatPrimitiveHelpActionsMenu=Ii;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Mi;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=Si;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=fi;exports.EmbeddedChatPrimitiveHelpActionsTrigger=Ei;exports.EmbeddedChatPrimitiveInput=Ht;exports.EmbeddedChatPrimitiveInputFieldset=jt;exports.EmbeddedChatPrimitiveInputGroup=yt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=ze;exports.EmbeddedChatPrimitiveMessage=pt;exports.EmbeddedChatPrimitiveMessageAction=Pt;exports.EmbeddedChatPrimitiveMessageActions=vt;exports.EmbeddedChatPrimitiveMessageAttachments=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=dt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=Ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=ut;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=mt;exports.EmbeddedChatPrimitiveMessageAvatar=Je;exports.EmbeddedChatPrimitiveMessageAvatarContent=Xe;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Ze;exports.EmbeddedChatPrimitiveMessageAvatarImage=et;exports.EmbeddedChatPrimitiveMessageContent=at;exports.EmbeddedChatPrimitiveMessageContentWrapper=it;exports.EmbeddedChatPrimitiveMessageHeader=Ge;exports.EmbeddedChatPrimitiveMessageLoading=Ye;exports.EmbeddedChatPrimitiveMessageName=tt;exports.EmbeddedChatPrimitiveMessageSourceItem=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=Et;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=ft;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=Bt;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=It;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=xt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=St;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=Mt;exports.EmbeddedChatPrimitiveMessageSources=_t;exports.EmbeddedChatPrimitiveMessageSourcesHeader=At;exports.EmbeddedChatPrimitiveMessageSourcesList=kt;exports.EmbeddedChatPrimitiveMessageToolAction=gt;exports.EmbeddedChatPrimitiveMessageToolActions=bt;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=Te;exports.EmbeddedChatPrimitiveQuickQuestion=Oe;exports.EmbeddedChatPrimitiveQuickQuestionButton=Qe;exports.EmbeddedChatPrimitiveQuickQuestions=qe;exports.EmbeddedChatPrimitiveQuickQuestionsLabel=Re;exports.EmbeddedChatPrimitiveQuickQuestionsList=We;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=wt;exports.EmbeddedChatPrimitiveSendButtonIcon=Lt;exports.EmbeddedChatPrimitiveTaglineBrandName=_i;exports.EmbeddedChatPrimitiveTaglineContainer=bi;exports.EmbeddedChatPrimitiveTaglineLogo=Pi;exports.EmbeddedChatPrimitiveTaglineText=gi;exports.EmbeddedChatPrimitiveToolbarHeader=Ee;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ue;exports.EmbeddedChatPrimitiveWorkflowIcon=Ke;exports.EmbeddedChatPrimitiveWorkflows=Ne;exports.EmbeddedChatPrimitiveWorkflowsLabel=$e;exports.EmbeddedChatPrimitiveWorkflowsList=Ve;exports.EmbeddedChatPrimitiveWrapper=Pe;exports.FeedbackForm=wi;exports.FeedbackItem=Li;exports.FeedbackItemCheckbox=Di;exports.FeedbackItemCheckboxIndicator=qi;exports.FeedbackItemDescription=Wi;exports.FeedbackItemLabel=Ri;exports.FeedbackModal=Bi;exports.FeedbackModalBody=Hi;exports.FeedbackModalClose=yi;exports.FeedbackModalContent=Ti;exports.FeedbackModalHeader=ji;exports.FeedbackModalOverlay=xi;exports.FeedbackSubmitButton=Oi;exports.Footer=Tt;exports.Form=Ni;exports.FormCancel=Ca;exports.FormClose=$i;exports.FormContent=zi;exports.FormDescription=Ki;exports.FormError=ha;exports.FormField=Gi;exports.FormFieldCheckbox=ea;exports.FormFieldCheckboxIndicator=ta;exports.FormFieldEmail=Ji;exports.FormFieldError=la;exports.FormFieldFile=Xi;exports.FormFieldLabel=Yi;exports.FormFieldSelect=ia;exports.FormFieldSelectContent=sa;exports.FormFieldSelectIcon=ra;exports.FormFieldSelectItem=da;exports.FormFieldSelectItemIndicator=ma;exports.FormFieldSelectItemText=ca;exports.FormFieldSelectTrigger=aa;exports.FormFieldSelectValue=na;exports.FormFieldSelectViewport=oa;exports.FormFieldText=J;exports.FormFieldTextArea=Zi;exports.FormFooter=ua;exports.FormHeader=Vi;exports.FormHeading=Ui;exports.FormSubmit=pa;exports.FormSuccess=va;exports.FormSuccessButton=Pa;exports.FormSuccessHeading=ba;exports.FormSuccessMessage=ga;exports.FormWrapper=Qi;exports.Header=Ua;exports.HeaderToolbar=ke;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=ki;exports.HelpActionsMenu=Ii;exports.HelpActionsMenuArrow=Mi;exports.HelpActionsMenuItem=Si;exports.HelpActionsMenuItemIcon=fi;exports.HelpActionsTrigger=Ei;exports.Input=Ht;exports.InputFieldset=jt;exports.InputGroup=yt;exports.IntroMessageWrapper=ze;exports.Message=pt;exports.MessageAction=Pt;exports.MessageActions=vt;exports.MessageAttachments=nt;exports.MessageAttachmentsItem=st;exports.MessageAttachmentsItemIcon=ot;exports.MessageAttachmentsItemTitle=dt;exports.MessageAttachmentsList=rt;exports.MessageAttachmentsPreview=ct;exports.MessageAttachmentsPreviewBody=Ct;exports.MessageAttachmentsPreviewClose=ut;exports.MessageAttachmentsPreviewContent=lt;exports.MessageAttachmentsPreviewHeader=ht;exports.MessageAttachmentsPreviewOverlay=mt;exports.MessageAvatar=Je;exports.MessageAvatarContent=Xe;exports.MessageAvatarFallback=Ze;exports.MessageAvatarImage=et;exports.MessageContent=at;exports.MessageContentWrapper=it;exports.MessageHeader=Ge;exports.MessageLoading=Ye;exports.MessageName=tt;exports.MessageSourceItem=Ft;exports.MessageSourceItemBreadcrumbIcon=wn;exports.MessageSourceItemBreadcrumbs=Et;exports.MessageSourceItemDescription=ft;exports.MessageSourceItemDescriptionPart=Bt;exports.MessageSourceItemIcon=It;exports.MessageSourceItemIndicator=xt;exports.MessageSourceItemTag=St;exports.MessageSourceItemTitle=Mt;exports.MessageSources=_t;exports.MessageSourcesHeader=At;exports.MessageSourcesList=kt;exports.MessageToolAction=gt;exports.MessageToolActions=bt;exports.MessageWrapper=ce;exports.Messages=Te;exports.QuickQuestion=Oe;exports.QuickQuestionButton=Qe;exports.QuickQuestions=qe;exports.QuickQuestionsLabel=Re;exports.QuickQuestionsList=We;exports.Root=Ae;exports.SendButton=wt;exports.SendButtonIcon=Lt;exports.TaglineBrandName=_i;exports.TaglineContainer=bi;exports.TaglineLogo=Pi;exports.TaglineText=gi;exports.ToolbarHeader=Ee;exports.Workflow=Ue;exports.WorkflowIcon=Ke;exports.Workflows=Ne;exports.WorkflowsLabel=$e;exports.WorkflowsList=Ve;exports.Wrapper=Pe;
17
+ `);X(Q)},share:async()=>{const Q={visibility:"public",tags:[],userProperties:{},messages:p.messages.map(S=>({...S,id:Date.now().toString()+S.id,conversationId:void 0}))},{apiKey:y,analyticsApiBaseUrl:L}=E,M=await Ra.logConversation("",Q,y,L);if(M){const N=`${v.shareChatUrlBasePath}?${D.SHARE_QUERY_PARAM}=${M?.id}`;Z(N),j({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:N,conversation:M}})}},clear:d,stop:o},Ce={copy:R,share:W};return n.jsx(T.Tooltip,{delayDuration:0,open:Ce[e],children:n.jsx(cr,{"data-type":e,"data-copied":h.dataAttr(R||W),className:`${r} ${e}`,children:n.jsx(le,{action:e}),onClick:u.composeEventHandlers(a,te[e]),...s})})},mr=i.ikp(T.Trigger,{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...a}=t,{aiChatSettings:r}=C.useInkeepConfig(),s=r.toolbarButtonLabels??{},d={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:d[e],...a})},lr=i.ikp(T.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),Ai=t=>{const{action:e,children:a,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(lr,{sideOffset:5,...r,children:[n.jsx(T.Arrow,{}),a||s[e]]})},hr=i.ikp(z.Root,{_id:"aiChatHelpActions"}),ki=t=>{const{children:e,...a}=t,{aiChatSettings:r}=C.useInkeepConfig(),{getHelpOptions:s}=r;if(!s||(s??[]).length===0)return null;const{_pinned:d,_unpinned:o}=s.reduce((p,v)=>{const E=v.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[E]:[...p[E],v]}},{_pinned:[],_unpinned:[]}),c=o.length===1?[...d,o[0]]:d,m=o.length===1?[]:o,l=ae.useHelpMenuState();return n.jsx(ae.HelpMenuProvider,{value:l,children:n.jsx(hr,{open:l.open,onOpenChange:l.setOpen,children:h.maybeRender(e,{pinned:c,unpinned:m}),...a})})},ur=i.ikp(Y,{_id:"aiChatHelpAction",action:"help"}),Fi=t=>{const{action:e,onClick:a,...r}=t,{handleAction:s,logHelpAction:d}=se.useChatAction(e),o=e.action.type,c=o==="open_link",m=o==="open_link"?n.jsx("a",{href:e.action.url,target:"_blank",rel:"noreferrer",children:e.name}):e.name;return n.jsx(ur,{"aria-label":e.name,"data-name":e.name,children:m,asChild:c,onClick:u.composeEventHandlers(a,()=>{s(),d()}),...r})},Cr=i.ikp(z.Trigger,{_id:"aiChatHelpActions__Trigger"}),Ei=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(Y,{action:"help",...t,asChild:!0,children:n.jsx(Cr,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),pr=i.ikp(z.Content,{_id:"aiChatHelpActions__Menu"}),Ii=t=>n.jsx(pr,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Mi=i.ikp(z.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),Si=t=>{const{action:e,onClick:a,...r}=t,{handleAction:s,logHelpAction:d}=se.useChatAction(e),{setOpen:o}=ae.useHelpMenu(),c=()=>{s({onOpenForm:()=>o(!1)}),d()},m=e.action.type,l=i.ikp(m==="open_link"?"a":"button",{_id:"aiChatHelpActions__MenuItem",children:e.name,"aria-label":e.name,"data-name":e.name,"data-type":e.action.type,...m==="open_link"&&{href:e.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(a,c)});return n.jsx(l,{...r})},vr=i.ikp(f.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),fi=t=>{const{action:e,...a}=t;return e.icon?n.jsx(vr,{iconSettings:e.icon,...a}):null},br=i.ikp(_.Root,{_id:"aiChatFeedbackModal"}),Bi=t=>{const{onOpenChange:e,...a}=t,{currentFeedback:r,setCurrentFeedback:s}=re.useMessageFeedback();return n.jsx(br,{open:r!==null,onOpenChange:u.composeEventHandlers(e,()=>s(null)),...a})},xi=i.ikp(_.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),Ti=i.ikp(_.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),ji=i.ikp(_.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),yi=i.ikp(_.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(k.CustomIcon,{iconKey:"close"})}),Hi=i.ikp("div",{_id:"aiChatFeedbackModal__Body"}),gr=i.ikp("form",{_id:"aiChatFeedbackForm"}),wi=t=>{const{onSubmit:e,...a}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:d}=re.useMessageFeedback(),o=c=>{c.preventDefault();const m=c.target,l=new FormData(m),p=Object.fromEntries(l.entries());s&&(r(s,p),d(null))};return n.jsx(gr,{onSubmit:u.composeEventHandlers(e,o),...a})},Pr=i.ikp("div",{_id:"aiChatFeedbackItem"}),Li=t=>{const{name:e,...a}=t;return n.jsx(U.FeedbackItemProvider,{name:e,children:n.jsx(Pr,{...a})})},_r=i.ikp(K.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Di=t=>{const{name:e,focusItem:a}=U.useFeedbackItem(),{onCheckedChange:r,...s}=t,d=o=>{o&&a?.current?.focus()};return n.jsx(_r,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(r,d),...s})},qi=i.ikp(K.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Ar=i.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Oi=t=>{const{name:e}=U.useFeedbackItem(),a={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(Ar,{htmlFor:`feedback-${e}`,children:a[e],...t})},kr=i.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Ri=t=>{const{name:e,focusItem:a}=U.useFeedbackItem();return n.jsx(kr,{ref:a,name:`${e}:description`,...t})},Wi=i.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),Fr=i.ikp("div",{_id:"aiChatForm__Wrapper"}),Qi=t=>{const{form:e}=A.useChatForm();return e?n.jsx(Fr,{...t}):null},Er=i.ikp("form",{_id:"aiChatForm"}),Ni=t=>{const{onSubmit:e,...a}=t,{handleSubmit:r,isSuccess:s}=A.useChatForm();return s?null:n.jsx(Er,{onSubmit:u.composeEventHandlers(e,r),...a})},Ir=i.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(k.CustomIcon,{iconKey:"close"})}),$i=t=>{const{onClick:e,...a}=t,{closeForm:r}=A.useChatForm();return n.jsx(Ir,{onClick:u.composeEventHandlers(e,r),...a})},Vi=i.ikp("div",{_id:"aiChatForm__Header"}),Mr=i.ikp("h2",{_id:"aiChatForm__Heading"}),Ui=t=>{const{form:e}=A.useChatForm();return e?.heading?n.jsx(Mr,{children:e.heading,...t}):null},Sr=i.ikp("span",{_id:"aiChatForm__Description"}),Ki=t=>{const{form:e}=A.useChatForm();return e?.description?n.jsx(Sr,{children:e.description,...t}):null},fr=i.ikp("div",{_id:"aiChatForm__Content"}),zi=t=>{const{children:e,...a}=t,{fields:r=[]}=A.useChatForm();return n.jsx(fr,{children:h.maybeRender(e,r),...a})},Br=i.ikp("div",{_id:"aiChatForm__Field"}),Gi=t=>{const{field:e,autoFocus:a,...r}=t,{control:s,errors:d}=A.useChatForm();return n.jsx(La.Controller,{name:e.name,control:s,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:o})=>{const c=o.value!==void 0||e.inputType==="file";return n.jsx(x.FormFieldProvider,{"data-invalid":h.dataAttr(!!d[e.name]),field:e,fieldProps:o,autoFocus:a,children:c&&n.jsx(Br,{"data-input-type":e.inputType,"data-hidden":h.dataAttr(e.isHidden),...r})})}})},xr=i.ikp("label",{_id:"aiChatForm__FieldLabel"}),Yi=t=>{const{field:e}=x.useFormField();return n.jsx(xr,{"data-required":h.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},Tr=i.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),J=t=>{const{field:e,error:a,fieldProps:{onChange:r,onBlur:s,...d},autoFocus:o}=x.useFormField(),{onChange:c,onBlur:m,...l}=t;return n.jsx(Tr,{id:e.name,autoFocus:o,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":h.dataAttr(!!a),onChange:u.composeEventHandlers(c,r),onBlur:u.composeEventHandlers(m,s),...d,...l})},Ji=i.ikp(J,{_id:"aiChatForm__FieldEmail",type:"email"}),jr=i.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Xi=t=>{const{field:e,error:a,fieldProps:{value:r,onChange:s,onBlur:d,...o},autoFocus:c}=x.useFormField(),{onChange:m,onBlur:l,...p}=t,v=E=>{const j=E.target.files;s(j)};return n.jsx(jr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":h.dataAttr(!!a),...p,...o,onChange:u.composeEventHandlers(m,v),onBlur:u.composeEventHandlers(l,d)})},Zi=i.ikp(J,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ne,{maxRows:8})}),yr=i.ikp(K.Root,{_id:"aiChatForm__FieldCheckbox"}),ea=t=>{const{field:e,error:a,fieldProps:r,autoFocus:s}=x.useFormField(),{onCheckedChange:d,...o}=t;return n.jsx(yr,{id:e.name,name:e.name,autoFocus:s,"data-invalid":h.dataAttr(!!a),checked:r.value,onCheckedChange:u.composeEventHandlers(d,r.onChange),...o})},ta=i.ikp(K.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Hr=i.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),ia=t=>{const{field:e,error:a,fieldProps:r}=x.useFormField(),{onValueChange:s,...d}=t;return n.jsx(Hr,{name:e.name,"data-invalid":h.dataAttr(!!a),value:r.value,onValueChange:u.composeEventHandlers(s,r.onChange),...d})},aa=i.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),wr=i.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),na=t=>{const{field:e}=x.useFormField();return n.jsx(wr,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ra=i.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(f.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),sa=i.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),oa=i.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),da=i.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ca=i.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),ma=i.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(f.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Lr=i.ikp("span",{_id:"aiChatForm__FieldError"}),la=t=>{const{error:e}=x.useFormField();return e?n.jsx(Lr,{children:e.message?.toString(),...t}):null},Dr=i.ikp("span",{_id:"aiChatForm__Error"}),ha=t=>{const{formError:e}=A.useChatForm();return e?n.jsx(Dr,{children:e.message,...t}):null},ua=i.ikp("div",{_id:"aiChatForm__Footer"}),qr=i.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),Ca=t=>{const{onClick:e,...a}=t,{closeForm:r}=A.useChatForm();return n.jsx(qr,{onClick:u.composeEventHandlers(e,r),...a})},Or=i.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),pa=t=>{const{onClick:e,...a}=t,{isSubmitting:r}=A.useChatForm();return n.jsx(Or,{disabled:r,...a})},Rr=i.ikp("div",{_id:"aiChatForm__Success"}),va=t=>{const{isSuccess:e}=A.useChatForm();return e?n.jsx(Rr,{...t}):null},Wr=i.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),ba=t=>{const{form:e}=A.useChatForm();return n.jsx(Wr,{children:e?.successView.heading,...t})},Qr=i.ikp($.Markdown,{_id:"aiChatForm__SuccessMessage"}),ga=t=>{const{form:e}=A.useChatForm();return n.jsx(Qr,{children:e?.successView.message,...t})},Nr=i.ikp("button",{_id:"aiChatForm__SuccessButton"}),Pa=t=>{const{onClick:e,...a}=t,{form:r,closeForm:s}=A.useChatForm(),d=r?.successView?.doneButton;if(!d)return null;const o=d.icon&&n.jsx(f.BuiltInIconRenderer,{iconSettings:d.icon}),c=d.label;return n.jsx(Nr,{onClick:u.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[o,c]}),...a})};exports.Provider=b.ChatProvider;exports.ActionBar=pi;exports.Actions=vi;exports.AttachmentsBar=Dt;exports.AttachmentsBarActions=Nt;exports.AttachmentsBarAttachment=Ot;exports.AttachmentsBarAttachmentDelete=Qt;exports.AttachmentsBarAttachmentIcon=Rt;exports.AttachmentsBarAttachmentTitle=Wt;exports.AttachmentsBarForm=ri;exports.AttachmentsBarFormContent=mi;exports.AttachmentsBarFormContentError=ui;exports.AttachmentsBarFormContentInput=hi;exports.AttachmentsBarFormContentLabel=li;exports.AttachmentsBarFormSubmitButton=Ci;exports.AttachmentsBarFormTitle=si;exports.AttachmentsBarFormTitleError=ci;exports.AttachmentsBarFormTitleInput=di;exports.AttachmentsBarFormTitleLabel=oi;exports.AttachmentsBarInfoTip=$t;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Vt;exports.AttachmentsBarInfoTipText=Ut;exports.AttachmentsBarInput=zt;exports.AttachmentsBarInputIcon=Gt;exports.AttachmentsBarInputs=Kt;exports.AttachmentsBarList=qt;exports.AttachmentsBarModal=Yt;exports.AttachmentsBarModalBody=ni;exports.AttachmentsBarModalClose=ai;exports.AttachmentsBarModalContent=Xt;exports.AttachmentsBarModalDescription=ti;exports.AttachmentsBarModalHeader=Zt;exports.AttachmentsBarModalHeading=ei;exports.AttachmentsBarModalHelp=ii;exports.AttachmentsBarModalOverlay=Jt;exports.ChatAction=Y;exports.ChatActionFeedback=Ai;exports.ChatActionLabel=le;exports.ChatHelpAction=Fi;exports.Content=Ie;exports.ContentScrollArea=Me;exports.ContentScrollAreaCorner=xe;exports.ContentScrollAreaScrollbar=fe;exports.ContentScrollAreaThumb=Be;exports.ContentScrollAreaViewport=Se;exports.ConversationLoading=_e;exports.Disclaimer=je;exports.DisclaimerArrow=De;exports.DisclaimerContent=we;exports.DisclaimerLabel=ye;exports.DisclaimerText=Le;exports.DisclaimerTrigger=He;exports.EmbeddedChatPrimitiveActionBar=pi;exports.EmbeddedChatPrimitiveActions=vi;exports.EmbeddedChatPrimitiveAttachmentsBar=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=ui;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=hi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=Ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=oi;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=$t;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInput=zt;exports.EmbeddedChatPrimitiveAttachmentsBarInputIcon=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarList=qt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ni;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ai;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=ii;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=Jt;exports.EmbeddedChatPrimitiveChatAction=Y;exports.EmbeddedChatPrimitiveChatActionFeedback=Ai;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Fi;exports.EmbeddedChatPrimitiveContent=Ie;exports.EmbeddedChatPrimitiveContentScrollArea=Me;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=xe;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=fe;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=Be;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Se;exports.EmbeddedChatPrimitiveConversationLoading=_e;exports.EmbeddedChatPrimitiveDisclaimer=je;exports.EmbeddedChatPrimitiveDisclaimerArrow=De;exports.EmbeddedChatPrimitiveDisclaimerContent=we;exports.EmbeddedChatPrimitiveDisclaimerLabel=ye;exports.EmbeddedChatPrimitiveDisclaimerText=Le;exports.EmbeddedChatPrimitiveDisclaimerTrigger=He;exports.EmbeddedChatPrimitiveFeedbackForm=wi;exports.EmbeddedChatPrimitiveFeedbackItem=Li;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Di;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=qi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Ri;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Oi;exports.EmbeddedChatPrimitiveFeedbackModal=Bi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Hi;exports.EmbeddedChatPrimitiveFeedbackModalClose=yi;exports.EmbeddedChatPrimitiveFeedbackModalContent=Ti;exports.EmbeddedChatPrimitiveFeedbackModalHeader=ji;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=xi;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Wi;exports.EmbeddedChatPrimitiveFooter=Tt;exports.EmbeddedChatPrimitiveForm=Ni;exports.EmbeddedChatPrimitiveFormCancel=Ca;exports.EmbeddedChatPrimitiveFormClose=$i;exports.EmbeddedChatPrimitiveFormContent=zi;exports.EmbeddedChatPrimitiveFormDescription=Ki;exports.EmbeddedChatPrimitiveFormError=ha;exports.EmbeddedChatPrimitiveFormField=Gi;exports.EmbeddedChatPrimitiveFormFieldCheckbox=ea;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=ta;exports.EmbeddedChatPrimitiveFormFieldEmail=Ji;exports.EmbeddedChatPrimitiveFormFieldError=la;exports.EmbeddedChatPrimitiveFormFieldFile=Xi;exports.EmbeddedChatPrimitiveFormFieldLabel=Yi;exports.EmbeddedChatPrimitiveFormFieldSelect=ia;exports.EmbeddedChatPrimitiveFormFieldSelectContent=sa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ra;exports.EmbeddedChatPrimitiveFormFieldSelectItem=da;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=ma;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ca;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=aa;exports.EmbeddedChatPrimitiveFormFieldSelectValue=na;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=oa;exports.EmbeddedChatPrimitiveFormFieldText=J;exports.EmbeddedChatPrimitiveFormFieldTextArea=Zi;exports.EmbeddedChatPrimitiveFormFooter=ua;exports.EmbeddedChatPrimitiveFormHeader=Vi;exports.EmbeddedChatPrimitiveFormHeading=Ui;exports.EmbeddedChatPrimitiveFormSubmit=pa;exports.EmbeddedChatPrimitiveFormSuccess=va;exports.EmbeddedChatPrimitiveFormSuccessButton=Pa;exports.EmbeddedChatPrimitiveFormSuccessHeading=ba;exports.EmbeddedChatPrimitiveFormSuccessMessage=ga;exports.EmbeddedChatPrimitiveFormWrapper=Qi;exports.EmbeddedChatPrimitiveHeaderToolbar=ke;exports.EmbeddedChatPrimitiveHelpActions=ki;exports.EmbeddedChatPrimitiveHelpActionsMenu=Ii;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Mi;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=Si;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=fi;exports.EmbeddedChatPrimitiveHelpActionsTrigger=Ei;exports.EmbeddedChatPrimitiveInput=Ht;exports.EmbeddedChatPrimitiveInputFieldset=jt;exports.EmbeddedChatPrimitiveInputGroup=yt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=ze;exports.EmbeddedChatPrimitiveMessage=pt;exports.EmbeddedChatPrimitiveMessageAction=Pt;exports.EmbeddedChatPrimitiveMessageActions=vt;exports.EmbeddedChatPrimitiveMessageAttachments=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=dt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=Ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=ut;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=mt;exports.EmbeddedChatPrimitiveMessageAvatar=Je;exports.EmbeddedChatPrimitiveMessageAvatarContent=Xe;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Ze;exports.EmbeddedChatPrimitiveMessageAvatarImage=et;exports.EmbeddedChatPrimitiveMessageContent=at;exports.EmbeddedChatPrimitiveMessageContentWrapper=it;exports.EmbeddedChatPrimitiveMessageHeader=Ge;exports.EmbeddedChatPrimitiveMessageLoading=Ye;exports.EmbeddedChatPrimitiveMessageName=tt;exports.EmbeddedChatPrimitiveMessageSourceItem=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=Et;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=ft;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=Bt;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=It;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=xt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=St;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=Mt;exports.EmbeddedChatPrimitiveMessageSources=_t;exports.EmbeddedChatPrimitiveMessageSourcesHeader=At;exports.EmbeddedChatPrimitiveMessageSourcesList=kt;exports.EmbeddedChatPrimitiveMessageToolAction=gt;exports.EmbeddedChatPrimitiveMessageToolActions=bt;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=Te;exports.EmbeddedChatPrimitiveQuickQuestion=We;exports.EmbeddedChatPrimitiveQuickQuestionButton=Qe;exports.EmbeddedChatPrimitiveQuickQuestions=qe;exports.EmbeddedChatPrimitiveQuickQuestionsLabel=Oe;exports.EmbeddedChatPrimitiveQuickQuestionsList=Re;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=wt;exports.EmbeddedChatPrimitiveSendButtonIcon=Lt;exports.EmbeddedChatPrimitiveTaglineBrandName=_i;exports.EmbeddedChatPrimitiveTaglineContainer=bi;exports.EmbeddedChatPrimitiveTaglineLogo=Pi;exports.EmbeddedChatPrimitiveTaglineText=gi;exports.EmbeddedChatPrimitiveToolbarHeader=Ee;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ue;exports.EmbeddedChatPrimitiveWorkflowIcon=Ke;exports.EmbeddedChatPrimitiveWorkflows=Ne;exports.EmbeddedChatPrimitiveWorkflowsLabel=$e;exports.EmbeddedChatPrimitiveWorkflowsList=Ve;exports.EmbeddedChatPrimitiveWrapper=Pe;exports.FeedbackForm=wi;exports.FeedbackItem=Li;exports.FeedbackItemCheckbox=Di;exports.FeedbackItemCheckboxIndicator=qi;exports.FeedbackItemDescription=Ri;exports.FeedbackItemLabel=Oi;exports.FeedbackModal=Bi;exports.FeedbackModalBody=Hi;exports.FeedbackModalClose=yi;exports.FeedbackModalContent=Ti;exports.FeedbackModalHeader=ji;exports.FeedbackModalOverlay=xi;exports.FeedbackSubmitButton=Wi;exports.Footer=Tt;exports.Form=Ni;exports.FormCancel=Ca;exports.FormClose=$i;exports.FormContent=zi;exports.FormDescription=Ki;exports.FormError=ha;exports.FormField=Gi;exports.FormFieldCheckbox=ea;exports.FormFieldCheckboxIndicator=ta;exports.FormFieldEmail=Ji;exports.FormFieldError=la;exports.FormFieldFile=Xi;exports.FormFieldLabel=Yi;exports.FormFieldSelect=ia;exports.FormFieldSelectContent=sa;exports.FormFieldSelectIcon=ra;exports.FormFieldSelectItem=da;exports.FormFieldSelectItemIndicator=ma;exports.FormFieldSelectItemText=ca;exports.FormFieldSelectTrigger=aa;exports.FormFieldSelectValue=na;exports.FormFieldSelectViewport=oa;exports.FormFieldText=J;exports.FormFieldTextArea=Zi;exports.FormFooter=ua;exports.FormHeader=Vi;exports.FormHeading=Ui;exports.FormSubmit=pa;exports.FormSuccess=va;exports.FormSuccessButton=Pa;exports.FormSuccessHeading=ba;exports.FormSuccessMessage=ga;exports.FormWrapper=Qi;exports.Header=Ua;exports.HeaderToolbar=ke;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=ki;exports.HelpActionsMenu=Ii;exports.HelpActionsMenuArrow=Mi;exports.HelpActionsMenuItem=Si;exports.HelpActionsMenuItemIcon=fi;exports.HelpActionsTrigger=Ei;exports.Input=Ht;exports.InputFieldset=jt;exports.InputGroup=yt;exports.IntroMessageWrapper=ze;exports.Message=pt;exports.MessageAction=Pt;exports.MessageActions=vt;exports.MessageAttachments=nt;exports.MessageAttachmentsItem=st;exports.MessageAttachmentsItemIcon=ot;exports.MessageAttachmentsItemTitle=dt;exports.MessageAttachmentsList=rt;exports.MessageAttachmentsPreview=ct;exports.MessageAttachmentsPreviewBody=Ct;exports.MessageAttachmentsPreviewClose=ut;exports.MessageAttachmentsPreviewContent=lt;exports.MessageAttachmentsPreviewHeader=ht;exports.MessageAttachmentsPreviewOverlay=mt;exports.MessageAvatar=Je;exports.MessageAvatarContent=Xe;exports.MessageAvatarFallback=Ze;exports.MessageAvatarImage=et;exports.MessageContent=at;exports.MessageContentWrapper=it;exports.MessageHeader=Ge;exports.MessageLoading=Ye;exports.MessageName=tt;exports.MessageSourceItem=Ft;exports.MessageSourceItemBreadcrumbIcon=wn;exports.MessageSourceItemBreadcrumbs=Et;exports.MessageSourceItemDescription=ft;exports.MessageSourceItemDescriptionPart=Bt;exports.MessageSourceItemIcon=It;exports.MessageSourceItemIndicator=xt;exports.MessageSourceItemTag=St;exports.MessageSourceItemTitle=Mt;exports.MessageSources=_t;exports.MessageSourcesHeader=At;exports.MessageSourcesList=kt;exports.MessageToolAction=gt;exports.MessageToolActions=bt;exports.MessageWrapper=ce;exports.Messages=Te;exports.QuickQuestion=We;exports.QuickQuestionButton=Qe;exports.QuickQuestions=qe;exports.QuickQuestionsLabel=Oe;exports.QuickQuestionsList=Re;exports.Root=Ae;exports.SendButton=wt;exports.SendButtonIcon=Lt;exports.TaglineBrandName=_i;exports.TaglineContainer=bi;exports.TaglineLogo=Pi;exports.TaglineText=gi;exports.ToolbarHeader=Ee;exports.Workflow=Ue;exports.WorkflowIcon=Ke;exports.Workflows=Ne;exports.WorkflowsLabel=$e;exports.WorkflowsList=Ve;exports.Wrapper=Pe;
@@ -575,7 +575,7 @@ const mn = F(
575
575
  organizationDisplayName: r,
576
576
  tabs: d,
577
577
  transformSource: o
578
- }), p = c || C.shouldOpenInNewTab;
578
+ }), p = C.shouldOpenInNewTab !== void 0 ? C.shouldOpenInNewTab : c;
579
579
  return { ...C, isExternal: p };
580
580
  });
581
581
  return /* @__PURE__ */ n($t, { children: I(a, m), ...s });
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),S=require("../../providers/config-provider.cjs"),T=require("../../utils/transform-source/index.cjs"),k=(e,o)=>{const{baseSettings:{transformSource:r,organizationDisplayName:s},searchSettings:{tabs:u,searchQueryParamKey:p,shouldOpenLinksInNewTab:g}}=S.useInkeepConfig();return w.useMemo(()=>{const R=u.length>0?u:["All"],n={},y=new Set,i=R.map(t=>typeof t=="string"?t:t[0]);for(const t of i)n[t]=[];for(const t of e){const c=t.url||"";if(y.has(c))continue;y.add(c);const d=v(c,o,p),a=T.transformInkeepSource({title:t.title,url:d,description:I(t),type:_(t.rootRecord.__typename),tag:D(t),breadcrumbs:t.rootRecord.pathBreadcrumbs??[],contentType:t.rootRecord.contentType},"searchResultItem",{organizationDisplayName:s,tabs:u,transformSource:r}),l={...a,id:t.id,isExternal:g||!!a.shouldOpenInNewTab},h=l.tabs||[];for(const f of h){const b=typeof f=="string"?f:f[0];if(!i.includes(b)){console.warn(`Tab "${b}" found in item but not configured in tabs`);continue}n[b].push(l)}i.includes("All")&&n.All.push(l)}for(const t of Object.keys(n)){const c=R.find(a=>typeof a=="string"?a===t:a[0]===t),d=typeof c=="object"?c[1]?.isAlwaysVisible===!0:!1;n[t].length===0&&!d&&delete n[t]}return n},[e,r,s,u,o,p,g])};function v(e,o,r){try{const s=new URL(e);return s.searchParams.set(r,o),s.toString()}catch{return e}}const I=e=>{switch(e.rootRecord.__typename){case"DocumentationRecord":{const o=m(e.pathHeadings?.at(-1)?.content||""),r=m(e.content?.content||"");return e.preview||r||o}case"GitHubIssueRecord":case"StackOverflowRecord":case"DiscourseRecord":return e.rootRecord.body;default:return e.preview}},D=e=>{switch(e.rootRecord.__typename){case"StackOverflowRecord":return e.rootRecord.markedAsCorrectAnswer?"Resolved":void 0;case"GitHubIssueRecord":return e.rootRecord.state==="CLOSED"?"Closed":void 0}},m=e=>{const o=/(https?:\/\/\S+)/g;return e.replace(o,r=>{const s=r.split("/");return s.length>3?`...${s.slice(-2).join("/")}`:r})},_=e=>{switch(e){case"DocumentationRecord":return"documentation";case"GitHubIssueRecord":return"github_issue";case"DiscourseRecord":return"discourse";case"DiscordRecord":return"discord";case"StackOverflowRecord":return"stackoverflow";case"SlackEntry":return"slack_message";default:return"site"}};exports.useTransformResults=k;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),S=require("../../providers/config-provider.cjs"),T=require("../../utils/transform-source/index.cjs"),v=(e,o)=>{const{baseSettings:{transformSource:r,organizationDisplayName:s},searchSettings:{tabs:u,searchQueryParamKey:p,shouldOpenLinksInNewTab:g}}=S.useInkeepConfig();return w.useMemo(()=>{const R=u.length>0?u:["All"],n={},y=new Set,i=R.map(t=>typeof t=="string"?t:t[0]);for(const t of i)n[t]=[];for(const t of e){const a=t.url||"";if(y.has(a))continue;y.add(a);const d=I(a,o,p),c=T.transformInkeepSource({title:t.title,url:d,description:k(t),type:O(t.rootRecord.__typename),tag:D(t),breadcrumbs:t.rootRecord.pathBreadcrumbs??[],contentType:t.rootRecord.contentType},"searchResultItem",{organizationDisplayName:s,tabs:u,transformSource:r}),l={...c,id:t.id,isExternal:c.shouldOpenInNewTab!==void 0?c.shouldOpenInNewTab:g},m=l.tabs||[];for(const f of m){const b=typeof f=="string"?f:f[0];if(!i.includes(b)){console.warn(`Tab "${b}" found in item but not configured in tabs`);continue}n[b].push(l)}i.includes("All")&&n.All.push(l)}for(const t of Object.keys(n)){const a=R.find(c=>typeof c=="string"?c===t:c[0]===t),d=typeof a=="object"?a[1]?.isAlwaysVisible===!0:!1;n[t].length===0&&!d&&delete n[t]}return n},[e,r,s,u,o,p,g])};function I(e,o,r){try{const s=new URL(e);return s.searchParams.set(r,o),s.toString()}catch{return e}}const k=e=>{switch(e.rootRecord.__typename){case"DocumentationRecord":{const o=h(e.pathHeadings?.at(-1)?.content||""),r=h(e.content?.content||"");return e.preview||r||o}case"GitHubIssueRecord":case"StackOverflowRecord":case"DiscourseRecord":return e.rootRecord.body;default:return e.preview}},D=e=>{switch(e.rootRecord.__typename){case"StackOverflowRecord":return e.rootRecord.markedAsCorrectAnswer?"Resolved":void 0;case"GitHubIssueRecord":return e.rootRecord.state==="CLOSED"?"Closed":void 0}},h=e=>{const o=/(https?:\/\/\S+)/g;return e.replace(o,r=>{const s=r.split("/");return s.length>3?`...${s.slice(-2).join("/")}`:r})},O=e=>{switch(e){case"DocumentationRecord":return"documentation";case"GitHubIssueRecord":return"github_issue";case"DiscourseRecord":return"discourse";case"DiscordRecord":return"discord";case"StackOverflowRecord":return"stackoverflow";case"SlackEntry":return"slack_message";default:return"site"}};exports.useTransformResults=v;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { useMemo as w } from "react";
3
3
  import { useInkeepConfig as S } from "../../providers/config-provider.js";
4
- import { transformInkeepSource as k } from "../../utils/transform-source/index.js";
5
- const C = (e, o) => {
4
+ import { transformInkeepSource as I } from "../../utils/transform-source/index.js";
5
+ const N = (e, r) => {
6
6
  const {
7
- baseSettings: { transformSource: r, organizationDisplayName: s },
7
+ baseSettings: { transformSource: o, organizationDisplayName: s },
8
8
  searchSettings: { tabs: u, searchQueryParamKey: b, shouldOpenLinksInNewTab: g }
9
9
  } = S();
10
10
  return w(() => {
@@ -12,25 +12,25 @@ const C = (e, o) => {
12
12
  for (const t of i)
13
13
  n[t] = [];
14
14
  for (const t of e) {
15
- const c = t.url || "";
16
- if (R.has(c)) continue;
17
- R.add(c);
18
- const d = I(c, o, b), a = k(
15
+ const a = t.url || "";
16
+ if (R.has(a)) continue;
17
+ R.add(a);
18
+ const d = T(a, r, b), c = I(
19
19
  {
20
20
  title: t.title,
21
21
  url: d,
22
- description: T(t),
22
+ description: k(t),
23
23
  type: D(t.rootRecord.__typename),
24
24
  tag: v(t),
25
25
  breadcrumbs: t.rootRecord.pathBreadcrumbs ?? [],
26
26
  contentType: t.rootRecord.contentType
27
27
  },
28
28
  "searchResultItem",
29
- { organizationDisplayName: s, tabs: u, transformSource: r }
29
+ { organizationDisplayName: s, tabs: u, transformSource: o }
30
30
  ), l = {
31
- ...a,
31
+ ...c,
32
32
  id: t.id,
33
- isExternal: g || !!a.shouldOpenInNewTab
33
+ isExternal: c.shouldOpenInNewTab !== void 0 ? c.shouldOpenInNewTab : g
34
34
  }, y = l.tabs || [];
35
35
  for (const f of y) {
36
36
  const p = typeof f == "string" ? f : f[0];
@@ -43,33 +43,33 @@ const C = (e, o) => {
43
43
  i.includes("All") && n.All.push(l);
44
44
  }
45
45
  for (const t of Object.keys(n)) {
46
- const c = m.find((a) => typeof a == "string" ? a === t : a[0] === t), d = typeof c == "object" ? c[1]?.isAlwaysVisible === !0 : !1;
46
+ const a = m.find((c) => typeof c == "string" ? c === t : c[0] === t), d = typeof a == "object" ? a[1]?.isAlwaysVisible === !0 : !1;
47
47
  n[t].length === 0 && !d && delete n[t];
48
48
  }
49
49
  return n;
50
50
  }, [
51
51
  e,
52
- r,
52
+ o,
53
53
  s,
54
54
  u,
55
- o,
55
+ r,
56
56
  b,
57
57
  g
58
58
  ]);
59
59
  };
60
- function I(e, o, r) {
60
+ function T(e, r, o) {
61
61
  try {
62
62
  const s = new URL(e);
63
- return s.searchParams.set(r, o), s.toString();
63
+ return s.searchParams.set(o, r), s.toString();
64
64
  } catch {
65
65
  return e;
66
66
  }
67
67
  }
68
- const T = (e) => {
68
+ const k = (e) => {
69
69
  switch (e.rootRecord.__typename) {
70
70
  case "DocumentationRecord": {
71
- const o = h(e.pathHeadings?.at(-1)?.content || ""), r = h(e.content?.content || "");
72
- return e.preview || r || o;
71
+ const r = h(e.pathHeadings?.at(-1)?.content || ""), o = h(e.content?.content || "");
72
+ return e.preview || o || r;
73
73
  }
74
74
  case "GitHubIssueRecord":
75
75
  case "StackOverflowRecord":
@@ -86,10 +86,10 @@ const T = (e) => {
86
86
  return e.rootRecord.state === "CLOSED" ? "Closed" : void 0;
87
87
  }
88
88
  }, h = (e) => {
89
- const o = /(https?:\/\/\S+)/g;
90
- return e.replace(o, (r) => {
91
- const s = r.split("/");
92
- return s.length > 3 ? `...${s.slice(-2).join("/")}` : r;
89
+ const r = /(https?:\/\/\S+)/g;
90
+ return e.replace(r, (o) => {
91
+ const s = o.split("/");
92
+ return s.length > 3 ? `...${s.slice(-2).join("/")}` : o;
93
93
  });
94
94
  }, D = (e) => {
95
95
  switch (e) {
@@ -110,5 +110,5 @@ const T = (e) => {
110
110
  }
111
111
  };
112
112
  export {
113
- C as useTransformResults
113
+ N as useTransformResults
114
114
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),J=require("../../providers/config-provider.cjs"),V=require("../../hooks/use-media-query.cjs"),X=require("./search-query.graphql.cjs"),Y=require("./transform-results.cjs"),Z=require("../../providers/search-events-provider.cjs"),ee=require("../../hooks/use-instant-update.cjs"),te=require("../../utils/graphql-client.cjs"),se=()=>{const{baseSettings:L,searchSettings:N}=J.useInkeepConfig(),{apiKey:S,aiApiBaseUrl:O,userAuthToken:l}=L,{maxResults:R,placeholder:Q,defaultQuery:x,debounceTimeMs:q,onQueryChange:B,searchFunctionsRef:F,tabs:i}=N,{logEvent:C}=Z.useSearchEvents(),[c,T]=t.useState(x),k=t.useRef(null),[v,E]=t.useState(!1),[H,h]=t.useState(null),[$,a]=t.useState("NONE"),z=t.useCallback(e=>{a(e)},[]),[d,f]=t.useState([]),s=Y.useTransformResults(d,c),M=typeof i?.[0]=="string"?i[0]:i[0][0],[y,w]=t.useState(M),{disableTransition:I,disabled:D}=ee.useInstantUpdate(),K=t.useCallback(e=>{I(),w(e);const r=s[e][0].id;a(r)},[s,I]);t.useEffect(()=>{let e=y in s?y:Object.keys(s)[0];if(!s[e]?.length){const n=Object.keys(s).find(u=>s[u]?.length);n?e=n:e=M}if(!e)return;w(e);const r=s[e]?.[0];r&&a(r.id)},[s]);const b=V.useMediaQuery("(max-width: 768px)"),o=t.useRef({}),m=t.useRef(null),g=t.useRef(null);t.useImperativeHandle(F,()=>({updateQuery(e){T(e)},focusInput:()=>{k.current?.focus()}}));const A=`${O}/graphql`,P=t.useMemo(()=>({Authorization:`Bearer ${S}`,"Content-Type":"application/json",...l?{"User-Token":l}:{}}),[S,l]),U=t.useCallback(async e=>{m.current&&m.current.abort();const r=new AbortController;m.current=r;try{E(!0),h(null);const u=(await te.graphqlRequest(A,X.default,{searchInput:e},P))?.search.searchHits;o.current[e.searchQuery]=u,f(u)}catch(n){if(n.name==="AbortError")return;h("Failed to fetch search results. Please try again.")}E(!1)},[A,P]),_=t.useCallback(e=>{const r=o.current[e.searchQuery];C({eventName:"search_query_response_received",properties:{searchQuery:e.searchQuery,totalResults:r?.length}})},[]),j=t.useCallback(e=>{if(g.current&&window.clearTimeout(g.current),!e.searchQuery){f([]),h(null);return}g.current=window.setTimeout(()=>{C({eventName:"search_query_submitted",properties:{searchQuery:e.searchQuery}}),o.current[e.searchQuery]?(f(o.current[e.searchQuery]),_(e)):U(e).then(()=>{_(e)})},q)},[q,U]),p=t.useMemo(()=>({searchQuery:c,filters:{limit:R}}),[c,R]);t.useEffect(()=>{B?.(p.searchQuery),j(p)},[j,p]);const W=t.useCallback(e=>T(e.target.value),[]),G=t.useMemo(()=>Q||(b?"Search...":"Search for anything..."),[Q,b]);return{results:s,resultsList:d,hasContent:d.length>0||v,loading:v,error:H,query:c,onInput:W,placeholder:G,tab:y,onTabChange:K,selectedItem:$,setSelectedItem:a,onSelectedItemChange:z,transitionsDisabled:D,inputRef:k,isMobile:b}};exports.useInkeepSearch=se;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),X=require("../../providers/config-provider.cjs"),Y=require("../../hooks/use-media-query.cjs"),Z=require("./search-query.graphql.cjs"),ee=require("./transform-results.cjs"),te=require("../../providers/search-events-provider.cjs"),se=require("../../hooks/use-instant-update.cjs"),re=require("../../utils/graphql-client.cjs"),ne=()=>{const{baseSettings:N,searchSettings:O}=X.useInkeepConfig(),{apiKey:S,aiApiBaseUrl:x,userAuthToken:l,filters:R}=N,{maxResults:Q,placeholder:q,defaultQuery:B,debounceTimeMs:C,onQueryChange:H,searchFunctionsRef:$,tabs:i,filters:T}=O,{logEvent:k}=te.useSearchEvents(),[c,v]=t.useState(B),E=t.useRef(null),[M,w]=t.useState(!1),[z,h]=t.useState(null),[D,a]=t.useState("NONE"),K=t.useCallback(e=>{a(e)},[]),[f,d]=t.useState([]),s=ee.useTransformResults(f,c),I=typeof i?.[0]=="string"?i[0]:i[0][0],[y,A]=t.useState(I),{disableTransition:P,disabled:W}=se.useInstantUpdate(),G=t.useCallback(e=>{P(),A(e);const r=s[e][0].id;a(r)},[s,P]);t.useEffect(()=>{let e=y in s?y:Object.keys(s)[0];if(!s[e]?.length){const n=Object.keys(s).find(u=>s[u]?.length);n?e=n:e=I}if(!e)return;A(e);const r=s[e]?.[0];r&&a(r.id)},[s]);const b=Y.useMediaQuery("(max-width: 768px)"),o=t.useRef({}),m=t.useRef(null),g=t.useRef(null);t.useImperativeHandle($,()=>({updateQuery(e){v(e)},focusInput:()=>{E.current?.focus()}}));const U=`${x}/graphql`,_=t.useMemo(()=>({Authorization:`Bearer ${S}`,"Content-Type":"application/json",...l?{"User-Token":l}:{}}),[S,l]),j=t.useCallback(async e=>{m.current&&m.current.abort();const r=new AbortController;m.current=r;try{w(!0),h(null);const u=(await re.graphqlRequest(U,Z.default,{searchInput:e},_))?.search.searchHits;o.current[e.searchQuery]=u,d(u)}catch(n){if(n.name==="AbortError")return;h("Failed to fetch search results. Please try again.")}w(!1)},[U,_]),F=t.useCallback(e=>{const r=o.current[e.searchQuery];k({eventName:"search_query_response_received",properties:{searchQuery:e.searchQuery,totalResults:r?.length}})},[]),L=t.useCallback(e=>{if(g.current&&window.clearTimeout(g.current),!e.searchQuery){d([]),h(null);return}g.current=window.setTimeout(()=>{k({eventName:"search_query_submitted",properties:{searchQuery:e.searchQuery}}),o.current[e.searchQuery]?(d(o.current[e.searchQuery]),F(e)):j(e).then(()=>{F(e)})},C)},[C,j]),p=t.useMemo(()=>({searchQuery:c,filters:{...R,...T,limit:Q}}),[c,Q,R,T]);t.useEffect(()=>{H?.(p.searchQuery),L(p)},[L,p]);const J=t.useCallback(e=>v(e.target.value),[]),V=t.useMemo(()=>q||(b?"Search...":"Search for anything..."),[q,b]);return{results:s,resultsList:f,hasContent:f.length>0||M,loading:M,error:z,query:c,onInput:J,placeholder:V,tab:y,onTabChange:G,selectedItem:D,setSelectedItem:a,onSelectedItemChange:K,transitionsDisabled:W,inputRef:E,isMobile:b}};exports.useInkeepSearch=ne;