@inkeep/cxkit-primitives 0.5.87 → 0.5.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat-button.cjs +1 -1
- package/dist/components/chat-button.js +8 -7
- package/dist/components/embedded-chat.cjs +3 -3
- package/dist/components/embedded-chat.js +61 -59
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/providers/base-events-provider.cjs +1 -1
- package/dist/providers/base-events-provider.js +1 -1
- package/dist/providers/chat-form-provider.cjs +1 -1
- package/dist/providers/chat-form-provider.js +35 -35
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),c=require("react"),f=require("@radix-ui/react-avatar"),n=require("./factory.cjs"),B=require("../atoms/avatars/ai.cjs"),_=require("../providers/config-provider.cjs"),p=require("../utils/compose-event-handlers.cjs"),A=require("@inkeep/cxkit-color-mode");function P(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=P(f),k=n.ikp("div",{_id:"chatButton__Container"}),b=n.ikp("button",{_id:"chatButton__Button"}),y=n.ikp("div",{_id:"chatButton__Text"}),S=n.ikp(l.Root,{_id:"chatButton__AvatarContent"}),j=n.ikp(l.Image,{_id:"chatButton__AvatarImage"}),g=c.memo(e=>{const{onLoadingStatusChange:a,avatar:t,...o}=e,{aiChatSettings:m}=_.useInkeepConfig(),{aiAssistantAvatar:r}=m??{},i=typeof t=="string"?t:A.useColorModeValue(t?.light,t?.dark),u=typeof r=="string"?r:r?.dark,[s,v]=c.useState(i??u);c.useEffect(()=>{v(i??u)},[i,u]);const C=h=>{h==="error"&&v(null)};return s?d.jsx(j,{src:s,"data-type":"image",onLoadingStatusChange:p.composeEventHandlers(a,C),...o}):d.jsx(B.default,{"data-type":"icon",...e})});exports.ChatButton=b;exports.ChatButtonAvatarContent=S;exports.ChatButtonAvatarImage=g;exports.ChatButtonContainer=k;exports.ChatButtonPrimitiveAvatarImage=g;exports.ChatButtonText=y;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),c=require("react"),f=require("@radix-ui/react-avatar"),n=require("./factory.cjs"),B=require("../atoms/avatars/ai.cjs"),_=require("../providers/config-provider.cjs"),p=require("../utils/compose-event-handlers.cjs"),A=require("@inkeep/cxkit-color-mode");function P(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=P(f),k=n.ikp("div",{_id:"chatButton__Container"}),b=n.ikp("button",{_id:"chatButton__Button"}),y=n.ikp("div",{_id:"chatButton__Text"}),S=n.ikp(l.Root,{_id:"chatButton__AvatarContent"}),j=n.ikp(l.Image,{_id:"chatButton__AvatarImage"}),g=c.memo(e=>{const{onLoadingStatusChange:a,avatar:t,...o}=e,{aiChatSettings:m}=_.useInkeepConfig(),{aiAssistantAvatar:r}=m??{},i=typeof t=="string"?t:A.useColorModeValue(t?.light,t?.dark),u=typeof r=="string"?r:r?.dark,[s,v]=c.useState(i??u);c.useEffect(()=>{v(i??u)},[i,u]);const C=h=>{h==="error"&&v(null)};return s?d.jsx(j,{src:s,alt:"Chat avatar","data-type":"image",onLoadingStatusChange:p.composeEventHandlers(a,C),...o}):d.jsx(B.default,{"data-type":"icon",...e})});exports.ChatButton=b;exports.ChatButtonAvatarContent=S;exports.ChatButtonAvatarImage=g;exports.ChatButtonContainer=k;exports.ChatButtonPrimitiveAvatarImage=g;exports.ChatButtonText=y;
|
|
@@ -5,8 +5,8 @@ import * as u from "@radix-ui/react-avatar";
|
|
|
5
5
|
import { ikp as t } from "./factory.js";
|
|
6
6
|
import f from "../atoms/avatars/ai.js";
|
|
7
7
|
import { useInkeepConfig as _ } from "../providers/config-provider.js";
|
|
8
|
-
import { composeEventHandlers as
|
|
9
|
-
import { useColorModeValue as
|
|
8
|
+
import { composeEventHandlers as l } from "../utils/compose-event-handlers.js";
|
|
9
|
+
import { useColorModeValue as p } from "@inkeep/cxkit-color-mode";
|
|
10
10
|
const b = t("div", {
|
|
11
11
|
_id: "chatButton__Container"
|
|
12
12
|
}), E = t("button", {
|
|
@@ -15,23 +15,24 @@ const b = t("div", {
|
|
|
15
15
|
_id: "chatButton__Text"
|
|
16
16
|
}), j = t(u.Root, {
|
|
17
17
|
_id: "chatButton__AvatarContent"
|
|
18
|
-
}),
|
|
18
|
+
}), A = t(u.Image, {
|
|
19
19
|
_id: "chatButton__AvatarImage"
|
|
20
20
|
}), H = g((r) => {
|
|
21
|
-
const { onLoadingStatusChange:
|
|
21
|
+
const { onLoadingStatusChange: h, avatar: a, ...v } = r, { aiChatSettings: c } = _(), { aiAssistantAvatar: o } = c ?? {}, n = typeof a == "string" ? a : p(a?.light, a?.dark), i = typeof o == "string" ? o : o?.dark, [e, s] = d(
|
|
22
22
|
n ?? i
|
|
23
23
|
);
|
|
24
24
|
return B(() => {
|
|
25
25
|
s(n ?? i);
|
|
26
26
|
}, [n, i]), e ? /* @__PURE__ */ m(
|
|
27
|
-
|
|
27
|
+
A,
|
|
28
28
|
{
|
|
29
29
|
src: e,
|
|
30
|
+
alt: "Chat avatar",
|
|
30
31
|
"data-type": "image",
|
|
31
|
-
onLoadingStatusChange:
|
|
32
|
+
onLoadingStatusChange: l(h, (C) => {
|
|
32
33
|
C === "error" && s(null);
|
|
33
34
|
}),
|
|
34
|
-
...
|
|
35
|
+
...v
|
|
35
36
|
}
|
|
36
37
|
) : /* @__PURE__ */ m(f, { "data-type": "icon", ...r });
|
|
37
38
|
});
|
|
@@ -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"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),g=require("react"),ae=require("react-textarea-autosize"),ba=require("@radix-ui/react-avatar"),ga=require("@radix-ui/react-checkbox"),Pa=require("@radix-ui/react-popover"),Aa=require("@radix-ui/react-tooltip"),_a=require("@radix-ui/react-scroll-area"),Fa=require("@radix-ui/react-select"),A=require("../atoms/dialog.cjs"),Ea=require("../atoms/avatars/ai.cjs"),ka=require("../atoms/avatars/user.cjs"),F=require("../atoms/icons/custom-icon.cjs"),x=require("../atoms/icons/built-in-icon-renderer.cjs"),Ia=require("../atoms/link.cjs"),V=require("../atoms/markdown/index.cjs"),w=require("../providers/attachment-item-provider.cjs"),E=require("../providers/attachments-bar-provider.cjs"),B=require("../providers/source-item-provider.cjs"),C=require("../providers/config-provider.cjs"),O=require("../providers/conversation-provider.cjs"),U=require("../providers/chat-events-provider.cjs"),ne=require("../providers/feedback-provider.cjs"),q=require("../providers/message-attachments-provider.cjs"),P=require("../providers/message-provider.cjs"),be=require("../atoms/icons/checkbox-icon.cjs"),te=require("../hooks/use-copy-to-clipboard.cjs"),K=require("../providers/feedback-item-provider.cjs"),Ma=require("../utils/get-message-metadata.cjs"),l=require("../utils/misc.cjs"),a=require("./factory.cjs"),v=require("./embedded-chat/chat-provider.cjs"),Sa=require("./tagline-logo-icon.cjs"),xa=require("../hooks/use-settle-action.cjs"),Ba=require("../hooks/use-container-size.cjs"),se=require("./embedded-chat/use-chat-action.cjs"),ie=require("../providers/help-menu-provider.cjs"),_=require("../providers/chat-form-provider.cjs"),f=require("../providers/form-field-provider.cjs"),fa=require("react-hook-form"),Ta=require("../utils/highlight-emphasis.cjs"),ja=require("./modal/modal-provider.cjs"),ya=require("@inkeep/cxkit-color-mode"),re=require("../utils/compose-refs.cjs"),u=require("../utils/compose-event-handlers.cjs"),Ha=require("../hooks/use-scroll-to-bottom.cjs"),wa=require("../atoms/api/analytics/conversation.cjs"),La=require("../utils/transform-source/index.cjs"),Da=require("../hooks/use-debounce.cjs"),oe=require("../providers/hover-popover-provider.cjs"),Oa=require("./modal/widget-auto-focus.cjs");function L(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const de=L(ba),z=L(ga),T=L(Pa),j=L(Aa),R=L(_a),I=L(Fa),qa="__intro__",Ra=a.ikp("div",{_id:"aiChatWrapper"}),ge=g.forwardRef((t,e)=>{const{...i}=t,{isHidden:s,isMobile:r}=v.useChat(),[o,d]=Ba.useContainerSize(),c=re.useComposedRefs(e,o),m=d?.width?d.width>580:!0,h=ja.useModal();return n.jsx(Ra,{ref:c,"data-widget-md":l.dataAttr(m),"data-hidden":l.dataAttr(s),"data-in-modal":l.dataAttr(!!h),"data-mobile":l.dataAttr(r),...i})}),Wa=a.ikp("div",{_id:"aiChatConversationLoading"}),Pe=t=>{const{isLoadingConversation:e}=v.useChat();return e?n.jsx(Wa,{children:n.jsx("span",{children:"Loading..."}),...t}):null},Na=a.ikp("div",{_id:"aiChatRoot"}),Ae=t=>{const{isLoadingConversation:e,isHidden:i}=v.useChat(),{form:s}=_.useChatForm();return e||s?null:n.jsx(Na,{"data-hidden":l.dataAttr(i),...t})},Qa=a.ikp("div",{_id:"aiChatHeader"}),_e=a.ikp("div",{_id:"aiChatHeader__Toolbar"}),Fe=a.ikp("div",{_id:"aiChatHeader__ToolbarHeaderWrapper"}),$a=a.ikp("div",{_id:"aiChatHeader__ToolbarHeader"}),Ee=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=`Ask ${e.aiAssistantName||"AI"}`;return n.jsx($a,{...t,children:i})}),ke=a.ikp("div",{_id:"aiChatContent"}),Ie=a.ikp(R.Root,{_id:"aiChatContentScrollArea"}),Va=a.ikp(R.Viewport,{_id:"aiChatContentScrollArea__Viewport"}),Me=g.forwardRef(({children:t,...e},i)=>{const{containerRef:s}=Ha.useScrollToBottom(),r=re.useComposedRefs(i,s);return n.jsx(Va,{ref:r,children:n.jsx("div",{"data-part":"grid",style:{display:"grid"},children:t}),...e})}),Se=a.ikp(R.ScrollAreaScrollbar,{_id:"aiChatContentScrollArea__Scrollbar"}),xe=a.ikp(R.ScrollAreaThumb,{_id:"aiChatContentScrollArea__Thumb"}),Be=a.ikp(R.Corner,{_id:"aiChatContentScrollArea__Corner"}),Ua=a.ikp("div",{_id:"aiChatMessages"}),fe=t=>{const e=v.useChat(),{children:i,...s}=t;return n.jsx(Ua,{children:l.maybeRender(i,e),...s})},Ka=a.ikp("div",{_id:"aiChatDisclaimer"}),Te=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),[i,s]=g.useState(!1),r=Da.useDebounce(i,100);return e.disclaimerSettings?.isEnabled?n.jsx(oe.HoverPopoverProvider,{open:i,setOpen:s,children:n.jsx(T.Root,{open:r,onOpenChange:s,children:n.jsx(Ka,{...t})})}):null}),za=a.ikp("span",{_id:"aiChatDisclaimerLabel"}),je=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.disclaimerSettings;return n.jsx(za,{children:i?.label,...t})}),Ga=a.ikp(T.Trigger,{_id:"aiChatDisclaimerTrigger",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),ye=g.memo(t=>{const{setOpen:e}=oe.useHoverPopover(),i=()=>e(!0),s=()=>e(!1);return n.jsx(Ga,{onMouseEnter:i,onMouseLeave:s,...t})}),Ya=a.ikp(T.Content,{_id:"aiChatDisclaimerContent"}),He=t=>{const{setOpen:e}=oe.useHoverPopover(),i=()=>e(!0),s=()=>e(!1);return n.jsx(Ya,{onMouseEnter:i,onMouseLeave:s,side:"top",sideOffset:8,align:"end",alignOffset:-10,...t})},Ja=a.ikp(V.Markdown,{_id:"aiChatDisclaimerText"}),we=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.aiAssistantName,r=e.disclaimerSettings?.tooltip||`Information provided by ${i||"this AI assistant"} is not guaranteed to be accurate or comprehensive.`;return n.jsx(Ja,{shouldOpenLinksInNewTab:!0,children:r,...t})}),Le=a.ikp(T.Arrow,{_id:"aiChatDisclaimerArrow"}),Xa=a.ikp("div",{_id:"aiChatExampleQuestions"}),De=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:i}=v.useChat();return!e.exampleQuestions?.length||i.length?null:n.jsx(Xa,{...t})},Za=a.ikp("h3",{_id:"aiChatExampleQuestionsLabel"}),Oe=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(Za,{children:e.exampleQuestionsLabel,...t})}),en=a.ikp("div",{_id:"aiChatExampleQuestionsList"}),qe=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.exampleQuestions,{children:s,...r}=t;return n.jsx(en,{children:l.maybeRender(s,i),...r})}),tn=a.ikp("div",{_id:"aiChatExampleQuestion"}),Re=g.forwardRef((t,e)=>{const{aiChatSettings:i}=C.useInkeepConfig(),s=i.isFirstExampleQuestionHighlighted;return n.jsx(tn,{ref:e,"data-highlight":l.dataAttr(s),...t})}),an=a.ikp("button",{_id:"aiChatExampleQuestionButton"}),We=t=>{const{question:e,onClick:i,...s}=t,{handleSubmit:r}=v.useChat();return n.jsx(an,{onClick:u.composeEventHandlers(i,()=>r(e)),children:e,...s})},nn=a.ikp("div",{_id:"aiChatWorkflows"}),Ne=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{messages:i}=v.useChat();return!e.workflows?.length||i.length?null:n.jsx(nn,{...t})},sn=a.ikp("h3",{_id:"aiChatWorkflowsLabel"}),Qe=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(sn,{children:e.workflowsHeader,...t})}),rn=a.ikp("div",{_id:"aiChatWorkflowsList"}),$e=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig(),i=e.workflows,{children:s,...r}=t;return n.jsx(rn,{children:l.maybeRender(s,i),...r})}),on=a.ikp("button",{_id:"aiChatWorkflow"}),Ve=t=>{const{workflow:e,onClick:i,...s}=t,{handleWorkflow:r}=v.useChat();return n.jsx(on,{onClick:u.composeEventHandlers(i,()=>r(e)),children:e.displayName,...s})},dn=a.ikp("div",{_id:"aiChatMessageWrapper"}),ce=t=>{const{message:e,...i}=t;return e.role==="system"?null:n.jsx(P.MessageProvider,{message:e,children:n.jsx(dn,{"data-role":e.role,...i})})},Ue=g.memo(t=>{const{message:e,...i}=t,{aiChatSettings:s,baseSettings:r}=C.useInkeepConfig(),o=s.aiAssistantName,d=o?`Hi, I'm ${o}!`:"Hi!",c=s.chatSubjectName??r.organizationDisplayName,m=`${d}
|
|
2
2
|
|
|
3
3
|
I'm an AI assistant trained on documentation, help articles, and other content.`,h=c?`
|
|
4
4
|
|
|
5
5
|
Ask me anything about \`${c}\`.`:`
|
|
6
6
|
|
|
7
|
-
Let me know how I can help.`,b={content:s.introMessage??`${m}${h}`,id:qa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),cn=a.ikp("div",{_id:"aiChatMessageHeader"}),Ke=t=>{const{message:e}=P.useMessage();return n.jsx(cn,{"data-role":e.role,...t})},mn=a.ikp("div",{_id:"aiChatMessageLoading"}),ze=t=>{const{isLoading:e,isStreaming:i,messages:s}=v.useChat(),{message:r}=P.useMessage();return!(s.at(-1)?.id===r?.id)||r.role!=="assistant"||!e||i?null:n.jsx(mn,{children:"Thinking...",...t})},ln=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Ye=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=C.useInkeepConfig();return n.jsx(hn,{"data-username":l.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},un=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Je=g.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(un,{"data-role":i.role,children:l.getInitials(e.userProperties.name),...t}):null}),pe=a.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),Xe=g.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:s,baseSettings:{userProperties:r}}=C.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=s??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,h=ya.useColorModeValue(c,m),[p,b]=g.useState(h);g.useEffect(()=>{b(h)},[h]);const k=y=>{y==="error"&&b(null)};return o.role==="user"?r.name?null:s.userAvatar?n.jsx(pe,{"data-type":"image","data-role":o.role,src:s.userAvatar,...t}):n.jsx(ka.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,k),...i}):n.jsx(Ea.default,{"data-type":"icon","data-role":o.role,...t})}),Cn=a.ikp("span",{_id:"aiChatMessageName"}),Ze=t=>{const{message:e}=P.useMessage();return n.jsx(Cn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},pn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),et=t=>{const{message:e}=P.useMessage(),{messageButtons:i}=v.useChat(),s=i[e.id]||[];return n.jsx(pn,{"data-role":e.role,"data-has-message-buttons":l.dataAttr(!!s.length),...t})},vn=a.ikp("div",{_id:"aiChatMessageContent"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(vn,{"data-role":e.role,...t})},bn=a.ikp("div",{_id:"aiChatMessageAttachments"}),it=t=>{const{message:e}=P.useMessage(),i=e.metadata?.attributes?.attachments;return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(bn,{...t})})},gn=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),at=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),r=s.metadata?.attributes?.attachments;return r?n.jsx(gn,{children:l.maybeRender(e,r),...i}):null},Pn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),nt=t=>{const{attachment:e,onClick:i,...s}=t,{selectItem:r,onOpen:o}=q.useMessageAttachments(),d=()=>{r(e),o()};return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Pn,{onClick:u.composeEventHandlers(i,d),...s})})},An=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),st=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(An,{iconSettings:i,...t}):null},_n=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),rt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(_n,{children:e.title,...t})},Fn=a.ikp(A.Root,{_id:"aiChatMessageAttachmentsPreview"}),ot=t=>{const{onOpenChange:e,...i}=t,{selectItem:s,isOpen:r,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),s(null))};return n.jsx(Fn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},dt=a.ikp(A.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),ct=a.ikp(A.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),En=a.ikp(A.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),mt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(En,{children:e?.title||"Attachment",...t})},lt=a.ikp(A.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),kn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(kn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),ut=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:i,...s}=t,{message:r}=P.useMessage(),{logEvent:o}=V.useChatEvents(),d=l.getMessageContent(r),{conversation:c}=O.useInkeepConversation();return r.role==="user"?n.jsx(ve,{"data-role":r.role,children:d,...s}):n.jsx(ve,{"data-role":r.role,...s,children:n.jsx(ae.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,h)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:h?.toString(),url:m}})},onCodeCopy:(m,h)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:h}})}})})},In=a.ikp("div",{_id:"aiChatMessageToolbar"}),Ct=t=>{const{isLoading:e,messages:i}=v.useChat(),{message:s}=P.useMessage();return i.at(-1)?.id===s?.id&&e||s.role==="user"?null:n.jsx(In,{...t})},Mn=a.ikp("div",{_id:"aiChatMessageToolActions"}),pt=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),{messageButtons:r}=v.useChat(),o=r[s.id]||[];return n.jsx(Mn,{children:l.maybeRender(e,o),...i})},Sn=a.ikp("a",{_id:"aiChatMessageToolAction"}),xn=a.ikp("button",{_id:"aiChatMessageToolAction"}),vt=t=>{const{onClick:e,action:i,...s}=t,{handleAction:r}=se.useChatAction(i),o=()=>{r()},d=i.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),d]});return i.action.type==="open_link"?n.jsx(Sn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s}):n.jsx(xn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s})},Bn=a.ikp("button",{_id:"aiChatMessageAction"}),bt=t=>{const{action:e,onClick:i,className:s,...r}=t,{conversation:o}=O.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=v.useChat(),[h,p]=ee.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:W}=ne.useMessageFeedback(),{logEvent:Y}=V.useChatEvents(),[N,J]=xa.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:X}=he,ue=m.at(-1)?.id===d?.id,Z=d.role==="assistant";if(ue&&c||!Z||{copy:!1,upvote:X,downvote:X}[e])return null;const H={copy(){p(l.getMessageContent(d)),Y({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{J()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(F.CustomIcon,{iconKey:h?"messageCopied":"messageCopy"}),upvote:n.jsx(F.CustomIcon,{iconKey:N?"messageCopied":"thumbsUp"}),downvote:n.jsx(F.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":l.dataAttr(h)},upvote:{"data-upvoted":l.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":l.dataAttr(b[d.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":D[e],className:`${s} ${e}`,onClick:u.composeEventHandlers(i,H[e]),...r})},fn=a.ikp("div",{_id:"aiChatMessageSources"}),gt=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(fn,{...t})},Tn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Pt=t=>n.jsx(Tn,{children:"Sources",...t}),jn=a.ikp("div",{_id:"aiChatMessageSources__List"}),At=t=>{const{message:e}=P.useMessage(),{children:i,...s}=t,{baseSettings:{transformSource:r,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(h=>{const p=La.transformInkeepSource(h,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:r}),b=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:b}});return n.jsx(jn,{children:l.maybeRender(i,m),...s})},yn=a.ikp(Ia.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),_t=t=>{const{source:e,onClick:i,...s}=t,{logEvent:r}=V.useChatEvents(),{conversation:o}=O.useInkeepConversation(),d=()=>{r({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(B.SourceItemProvider,{source:e,children:n.jsx(yn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...s})})},Hn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Ft=t=>{const{source:e}=B.useSourceItem();return e.breadcrumbs?.length?n.jsx(Hn,{"data-type":e.type,...t}):null},wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Ln=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),Et=t=>{const{source:e}=B.useSourceItem();return n.jsx(Ln,{iconSettings:e.icon,"data-type":e.type,...t})},Dn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),kt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Dn,{"data-type":e.type,children:e.title,...t})},On=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),It=t=>{const{source:e}=B.useSourceItem();return n.jsx(On,{"data-type":e.type,...t})},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),Mt=t=>{const{source:e}=B.useSourceItem(),{children:i,...s}=t,r=g.useMemo(()=>e.description?Ta.highlightEmphasis(e.description):[],[e.description]);return r.length?n.jsx(qn,{"data-type":e.type,children:l.maybeRender(i,r),...s}):null},Rn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),St=t=>{const{part:e,...i}=t,{source:s}=B.useSourceItem();return typeof e=="string"?e:n.jsx(Rn,{"data-type":s.type,children:e.content,"data-highlighted":l.dataAttr(e.highlighted),...i})},Wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Wn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Bt=a.ikp("div",{_id:"aiChatFooter"}),ft=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Tt=a.ikp("div",{_id:"aiChatInput__Group"}),Nn=a.ikp("textarea",{_id:"aiChatInput"}),jt=g.forwardRef(({onChange:t,onKeyDown:e,...i},s)=>{const{handleInputChange:r,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:h}=v.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),b=re.useComposedRefs(s,h);return Oa.useWidgetAutoFocus("chat",h,m),n.jsx(Nn,{asChild:!0,ref:b,maxLength:99999,placeholder:p.placeholder,value:d,onChange:u.composeEventHandlers(t,r),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(ie,{})})}),Qn=a.ikp("button",{_id:"aiChatInput__SendButton"}),yt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:s}=v.useChat(),{aiChatSettings:r}=C.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Qn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!s||r.isViewOnly,...d})},Ht=a.ikp(F.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),$n=a.ikp("div",{_id:"aiChatAttachmentsBar"}),wt=t=>{const{selectedWorkflow:e}=v.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(E.AttachmentsBarProvider,{children:n.jsx($n,{...t})})},Vn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Lt=t=>{const{children:e,...i}=t,{messageAttachments:s}=v.useChat();return n.jsx(Vn,{children:l.maybeRender(e,s),...i})},Un=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Dt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Un,{...i})})},Kn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Kn,{iconSettings:i,...t}):null},zn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),qt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(zn,{children:e.title,...t})},Gn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Rt=t=>{const{onClick:e,...i}=t,{attachment:s}=w.useAttachmentItem(),{setMessageAttachments:r}=v.useChat(),o=()=>{r(d=>d.filter(c=>c.id!==s.id))};return n.jsx(Gn,{"aria-label":"Remove attachment",children:n.jsx(F.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,o),...i})},Wt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Nt=a.ikp(j.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Qt=a.ikp(j.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),me=a.ikp(j.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),$t=a.ikp(j.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Vt=t=>{const{children:e,...i}=t,{selectedWorkflow:s}=v.useChat();return s?.supportedInputs?n.jsx(Yn,{children:l.maybeRender(e,s.supportedInputs),...i}):null},Jn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),Ut=t=>{const{input:e,onClick:i,...s}=t,{selectedWorkflow:r,messageAttachments:o,setMessageAttachments:d}=v.useChat(),{selectInput:c,onOpen:m}=E.useAttachmentsBar(),h=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return r?e.onInvoke(r,e,d,[...o]):void 0;c(e),m()};return n.jsx(Jn,{children:e.displayName,onClick:u.composeEventHandlers(i,h),...s})},Xn=a.ikp(A.Root,{_id:"aiChatAttachmentsBar__Modal"}),Kt=t=>{const{onOpenChange:e,...i}=t,{selectInput:s,isOpen:r,onClose:o,selectedInput:d}=E.useAttachmentsBar(),c=m=>{m||(o(),s(null))};return n.jsx(Xn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},zt=a.ikp(A.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Gt=a.ikp(A.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Zn=a.ikp(A.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Jt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Zn,{children:i,...t})},es=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Xt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(es,{children:i,...t}):null},ts=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Zt=t=>{const{children:e,...i}=t,{selectedInput:s}=E.useAttachmentsBar(),r=s?.workflowModalProps?.modalHelpElement;return r?n.jsx(ts,{asChild:!e,children:e||r,...i}):null},ei=a.ikp(A.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),ti=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),is=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ii=t=>{const{onSubmit:e,...i}=t,{form:s}=E.useAttachmentsBar();return n.jsx(is,{onSubmit:u.composeEventHandlers(e,s.onSubmit),...i})},ai=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),as=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),ni=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(as,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},ns=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),si=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(ns,{name:"title",value:s.data.title,id:`${r?.id}-title`,"data-invalid":l.dataAttr(!!s.errors.title),"aria-invalid":!!s.errors.title,onChange:u.composeEventHandlers(e,s.onChange),...i})},ss=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ri=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.title?n.jsx(ss,{"aria-live":"polite",children:e.errors.title,...t}):null},oi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),rs=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),di=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(rs,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},os=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ci=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(os,{asChild:!0,rows:4,name:"content",value:s.data.content,id:`${r?.id}-content`,"data-invalid":l.dataAttr(!!s.errors.content),"aria-invalid":!!s.errors.content,onChange:u.composeEventHandlers(e,s.onChange),...i,children:n.jsx(ie,{maxRows:10})})},ds=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),mi=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.content?n.jsx(ds,{"aria-live":"polite",children:e.errors.content,...t}):null},li=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),hi=a.ikp("div",{_id:"aiChatActionBar"}),ui=a.ikp("div",{_id:"aiChat__ChatActions"}),Ci=a.ikp("div",{_id:"aiChatTagline__Container"}),pi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),vi=a.ikp(Sa.default,{_id:"aiChatTagline__Logo"}),bi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),cs=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),z=t=>{const{action:e,onClick:i,className:s,...r}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:h}=v.useChat(),{conversation:p}=O.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=C.useInkeepConfig(),{logEvent:y}=V.useChatEvents(),[W,Y]=ee.useCopyToClipboard(),[N,J]=ee.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!p.id||!!h||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const Z={help:()=>{},copy:()=>{const Q=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=l.getMessageContent(H),S=Ma.stringifyAttachments(H.metadata?.attributes?.attachments),$=S?`
|
|
7
|
+
Let me know how I can help.`,b={content:s.introMessage??`${m}${h}`,id:qa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),cn=a.ikp("div",{_id:"aiChatMessageHeader"}),Ke=t=>{const{message:e}=P.useMessage();return n.jsx(cn,{"data-role":e.role,...t})},mn=a.ikp("div",{_id:"aiChatMessageLoading"}),ze=t=>{const{isLoading:e,isStreaming:i,messages:s}=v.useChat(),{message:r}=P.useMessage();return!(s.at(-1)?.id===r?.id)||r.role!=="assistant"||!e||i?null:n.jsx(mn,{children:"Thinking...",...t})},ln=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Ye=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=C.useInkeepConfig();return n.jsx(hn,{"data-username":l.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},un=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Je=g.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(un,{"data-role":i.role,children:l.getInitials(e.userProperties.name),...t}):null}),pe=a.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),Xe=g.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:s,baseSettings:{userProperties:r}}=C.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=s??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,h=ya.useColorModeValue(c,m),[p,b]=g.useState(h);g.useEffect(()=>{b(h)},[h]);const k=y=>{y==="error"&&b(null)};return o.role==="user"?r.name?null:s.userAvatar?n.jsx(pe,{"data-type":"image",alt:"User avatar","data-role":o.role,src:s.userAvatar,...t}):n.jsx(ka.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,alt:"AI assistant avatar","data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,k),...i}):n.jsx(Ea.default,{"data-type":"icon","data-role":o.role,...t})}),Cn=a.ikp("span",{_id:"aiChatMessageName"}),Ze=t=>{const{message:e}=P.useMessage();return n.jsx(Cn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},pn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),et=t=>{const{message:e}=P.useMessage(),{messageButtons:i}=v.useChat(),s=i[e.id]||[];return n.jsx(pn,{"data-role":e.role,"data-has-message-buttons":l.dataAttr(!!s.length),...t})},vn=a.ikp("div",{_id:"aiChatMessageContent"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(vn,{"data-role":e.role,...t})},bn=a.ikp("div",{_id:"aiChatMessageAttachments"}),it=t=>{const{message:e}=P.useMessage(),i=e.metadata?.attributes?.attachments;return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(bn,{...t})})},gn=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),at=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),r=s.metadata?.attributes?.attachments;return r?n.jsx(gn,{children:l.maybeRender(e,r),...i}):null},Pn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),nt=t=>{const{attachment:e,onClick:i,...s}=t,{selectItem:r,onOpen:o}=q.useMessageAttachments(),d=()=>{r(e),o()};return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Pn,{onClick:u.composeEventHandlers(i,d),...s})})},An=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),st=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(An,{iconSettings:i,...t}):null},_n=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),rt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(_n,{children:e.title,...t})},Fn=a.ikp(A.Root,{_id:"aiChatMessageAttachmentsPreview"}),ot=t=>{const{onOpenChange:e,...i}=t,{selectItem:s,isOpen:r,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),s(null))};return n.jsx(Fn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},dt=a.ikp(A.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),ct=a.ikp(A.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),En=a.ikp(A.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),mt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(En,{children:e?.title||"Attachment",...t})},lt=a.ikp(A.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),kn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(kn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),ut=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:i,...s}=t,{message:r}=P.useMessage(),{logEvent:o}=U.useChatEvents(),d=l.getMessageContent(r),{conversation:c}=O.useInkeepConversation();return r.role==="user"?n.jsx(ve,{"data-role":r.role,children:d,...s}):n.jsx(ve,{"data-role":r.role,...s,children:n.jsx(V.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,h)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:h?.toString(),url:m}})},onCodeCopy:(m,h)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:h}})}})})},In=a.ikp("div",{_id:"aiChatMessageToolbar"}),Ct=t=>{const{isLoading:e,messages:i}=v.useChat(),{message:s}=P.useMessage();return i.at(-1)?.id===s?.id&&e||s.role==="user"?null:n.jsx(In,{...t})},Mn=a.ikp("div",{_id:"aiChatMessageToolActions"}),pt=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),{messageButtons:r}=v.useChat(),o=r[s.id]||[];return n.jsx(Mn,{children:l.maybeRender(e,o),...i})},Sn=a.ikp("a",{_id:"aiChatMessageToolAction"}),xn=a.ikp("button",{_id:"aiChatMessageToolAction"}),vt=t=>{const{onClick:e,action:i,...s}=t,{handleAction:r}=se.useChatAction(i),o=()=>{r()},d=i.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),d]});return i.action.type==="open_link"?n.jsx(Sn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s}):n.jsx(xn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s})},Bn=a.ikp("button",{_id:"aiChatMessageAction"}),bt=t=>{const{action:e,onClick:i,className:s,...r}=t,{conversation:o}=O.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=v.useChat(),[h,p]=te.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:W}=ne.useMessageFeedback(),{logEvent:J}=U.useChatEvents(),[N,X]=xa.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:Z}=he,ue=m.at(-1)?.id===d?.id,ee=d.role==="assistant";if(ue&&c||!ee||{copy:!1,upvote:Z,downvote:Z}[e])return null;const H={copy(){p(l.getMessageContent(d)),J({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{X()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(F.CustomIcon,{iconKey:h?"messageCopied":"messageCopy"}),upvote:n.jsx(F.CustomIcon,{iconKey:N?"messageCopied":"thumbsUp"}),downvote:n.jsx(F.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":l.dataAttr(h)},upvote:{"data-upvoted":l.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":l.dataAttr(b[d.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":D[e],className:`${s} ${e}`,onClick:u.composeEventHandlers(i,H[e]),...r})},fn=a.ikp("div",{_id:"aiChatMessageSources"}),gt=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(fn,{...t})},Tn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Pt=t=>n.jsx(Tn,{children:"Sources",...t}),jn=a.ikp("div",{_id:"aiChatMessageSources__List"}),At=t=>{const{message:e}=P.useMessage(),{children:i,...s}=t,{baseSettings:{transformSource:r,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(h=>{const p=La.transformInkeepSource(h,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:r}),b=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:b}});return n.jsx(jn,{children:l.maybeRender(i,m),...s})},yn=a.ikp(Ia.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),_t=t=>{const{source:e,onClick:i,...s}=t,{logEvent:r}=U.useChatEvents(),{conversation:o}=O.useInkeepConversation(),d=()=>{r({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(B.SourceItemProvider,{source:e,children:n.jsx(yn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...s})})},Hn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Ft=t=>{const{source:e}=B.useSourceItem();return e.breadcrumbs?.length?n.jsx(Hn,{"data-type":e.type,...t}):null},wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Ln=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),Et=t=>{const{source:e}=B.useSourceItem();return n.jsx(Ln,{iconSettings:e.icon,"data-type":e.type,...t})},Dn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),kt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Dn,{"data-type":e.type,children:e.title,...t})},On=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),It=t=>{const{source:e}=B.useSourceItem();return n.jsx(On,{"data-type":e.type,...t})},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),Mt=t=>{const{source:e}=B.useSourceItem(),{children:i,...s}=t,r=g.useMemo(()=>e.description?Ta.highlightEmphasis(e.description):[],[e.description]);return r.length?n.jsx(qn,{"data-type":e.type,children:l.maybeRender(i,r),...s}):null},Rn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),St=t=>{const{part:e,...i}=t,{source:s}=B.useSourceItem();return typeof e=="string"?e:n.jsx(Rn,{"data-type":s.type,children:e.content,"data-highlighted":l.dataAttr(e.highlighted),...i})},Wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Wn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Bt=a.ikp("div",{_id:"aiChatFooter"}),ft=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Tt=a.ikp("div",{_id:"aiChatInput__Group"}),Nn=a.ikp("textarea",{_id:"aiChatInput"}),jt=g.forwardRef(({onChange:t,onKeyDown:e,...i},s)=>{const{handleInputChange:r,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:h}=v.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),b=re.useComposedRefs(s,h);return Oa.useWidgetAutoFocus("chat",h,m),n.jsx(Nn,{asChild:!0,ref:b,maxLength:99999,placeholder:p.placeholder,value:d,onChange:u.composeEventHandlers(t,r),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(ae,{})})}),Qn=a.ikp("button",{_id:"aiChatInput__SendButton"}),yt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:s}=v.useChat(),{aiChatSettings:r}=C.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Qn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!s||r.isViewOnly,...d})},Ht=a.ikp(F.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),$n=a.ikp("div",{_id:"aiChatAttachmentsBar"}),wt=t=>{const{selectedWorkflow:e}=v.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(E.AttachmentsBarProvider,{children:n.jsx($n,{...t})})},Vn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Lt=t=>{const{children:e,...i}=t,{messageAttachments:s}=v.useChat();return n.jsx(Vn,{children:l.maybeRender(e,s),...i})},Un=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Dt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Un,{...i})})},Kn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Kn,{iconSettings:i,...t}):null},zn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),qt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(zn,{children:e.title,...t})},Gn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Rt=t=>{const{onClick:e,...i}=t,{attachment:s}=w.useAttachmentItem(),{setMessageAttachments:r}=v.useChat(),o=()=>{r(d=>d.filter(c=>c.id!==s.id))};return n.jsx(Gn,{"aria-label":"Remove attachment",children:n.jsx(F.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,o),...i})},Wt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Nt=a.ikp(j.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Qt=a.ikp(j.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),me=a.ikp(j.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),$t=a.ikp(j.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Vt=t=>{const{children:e,...i}=t,{selectedWorkflow:s}=v.useChat();return s?.supportedInputs?n.jsx(Yn,{children:l.maybeRender(e,s.supportedInputs),...i}):null},Jn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),Ut=t=>{const{input:e,onClick:i,...s}=t,{selectedWorkflow:r,messageAttachments:o,setMessageAttachments:d}=v.useChat(),{selectInput:c,onOpen:m}=E.useAttachmentsBar(),h=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return r?e.onInvoke(r,e,d,[...o]):void 0;c(e),m()};return n.jsx(Jn,{children:e.displayName,onClick:u.composeEventHandlers(i,h),...s})},Xn=a.ikp(A.Root,{_id:"aiChatAttachmentsBar__Modal"}),Kt=t=>{const{onOpenChange:e,...i}=t,{selectInput:s,isOpen:r,onClose:o,selectedInput:d}=E.useAttachmentsBar(),c=m=>{m||(o(),s(null))};return n.jsx(Xn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},zt=a.ikp(A.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Gt=a.ikp(A.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Zn=a.ikp(A.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Jt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Zn,{children:i,...t})},es=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Xt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(es,{children:i,...t}):null},ts=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Zt=t=>{const{children:e,...i}=t,{selectedInput:s}=E.useAttachmentsBar(),r=s?.workflowModalProps?.modalHelpElement;return r?n.jsx(ts,{asChild:!e,children:e||r,...i}):null},ei=a.ikp(A.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),ti=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),is=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ii=t=>{const{onSubmit:e,...i}=t,{form:s}=E.useAttachmentsBar();return n.jsx(is,{onSubmit:u.composeEventHandlers(e,s.onSubmit),...i})},ai=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),as=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),ni=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(as,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},ns=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),si=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(ns,{name:"title",value:s.data.title,id:`${r?.id}-title`,"data-invalid":l.dataAttr(!!s.errors.title),"aria-invalid":!!s.errors.title,onChange:u.composeEventHandlers(e,s.onChange),...i})},ss=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ri=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.title?n.jsx(ss,{"aria-live":"polite",children:e.errors.title,...t}):null},oi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),rs=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),di=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(rs,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},os=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ci=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(os,{asChild:!0,rows:4,name:"content",value:s.data.content,id:`${r?.id}-content`,"data-invalid":l.dataAttr(!!s.errors.content),"aria-invalid":!!s.errors.content,onChange:u.composeEventHandlers(e,s.onChange),...i,children:n.jsx(ae,{maxRows:10})})},ds=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),mi=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.content?n.jsx(ds,{"aria-live":"polite",children:e.errors.content,...t}):null},li=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),hi=a.ikp("div",{_id:"aiChatActionBar"}),ui=a.ikp("div",{_id:"aiChat__ChatActions"}),Ci=a.ikp("div",{_id:"aiChatTagline__Container"}),pi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),vi=a.ikp(Sa.default,{_id:"aiChatTagline__Logo"}),bi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),cs=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),G=t=>{const{action:e,onClick:i,className:s,...r}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:h}=v.useChat(),{conversation:p}=O.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=C.useInkeepConfig(),{logEvent:y}=U.useChatEvents(),[W,J]=te.useCopyToClipboard(),[N,X]=te.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!p.id||!!h||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const ee={help:()=>{},copy:()=>{const Q=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=l.getMessageContent(H),S=Ma.stringifyAttachments(H.metadata?.attributes?.attachments),$=S?`
|
|
8
8
|
|
|
9
9
|
**Attachments**
|
|
10
10
|
|
|
@@ -14,4 +14,4 @@ ${M}${$}`}).join(`
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
`);Y(Q)},share:async()=>{const Q={visibility:"public",tags:[],userProperties:{},messages:p.messages.map(S=>({...S,createdAt:void 0,updatedAt:void 0,id:Date.now().toString()+S.id,conversationId:void 0}))},{apiKey:H,analyticsApiBaseUrl:D}=k,M=await wa.logConversation("",Q,H,D);if(M){const $=`${b.shareChatUrlBasePath}?${O.SHARE_QUERY_PARAM}=${M?.id}`;J($),y({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:$,conversation:M}})}},clear:o,stop:d},Ce={copy:W,share:N};return n.jsx(j.Tooltip,{delayDuration:0,open:Ce[e],children:n.jsx(cs,{"data-type":e,"data-copied":l.dataAttr(W||N),className:`${s} ${e}`,children:n.jsx(le,{action:e}),onClick:u.composeEventHandlers(i,Z[e]),...r})})},ms=a.ikp("span",{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...i}=t,{aiChatSettings:s}=C.useInkeepConfig(),r=s.toolbarButtonLabels??{},o={help:r.getHelp??"Get Help",copy:r.copyChat??"Copy",share:r.share??"Share",clear:r.clear??"Clear",stop:r.stop??"Stop"};return n.jsx(ms,{children:o[e],...i})},ls=a.ikp(j.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),gi=t=>{const{action:e,children:i,...s}=t,r={copy:"Copied!",share:"Link copied!"};return n.jsxs(ls,{sideOffset:5,...s,children:[n.jsx(j.Arrow,{}),i||r[e]]})},hs=a.ikp(T.Root,{_id:"aiChatHelpActions"}),Pi=t=>{const{children:e,...i}=t,{aiChatSettings:s}=C.useInkeepConfig(),{getHelpOptions:r}=s;if(!r||(r??[]).length===0)return null;const{_pinned:o,_unpinned:d}=r.reduce((p,b)=>{const k=b.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[k]:[...p[k],b]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,h=te.useHelpMenuState();return n.jsx(te.HelpMenuProvider,{value:h,children:n.jsx(hs,{open:h.open,onOpenChange:h.setOpen,children:l.maybeRender(e,{pinned:c,unpinned:m}),...i})})},us=a.ikp(z,{_id:"aiChatHelpAction",action:"help"}),Cs=a.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),Ai=t=>{const{action:e,onClick:i,...s}=t,{handleAction:r,logHelpAction:o}=se.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:u.composeEventHandlers(i,()=>{r(),o()}),...s};return d==="open_link"?n.jsx(Cs,{href:e.action.url,...c}):n.jsx(us,{...c})},ps=a.ikp(T.Trigger,{_id:"aiChatHelpActions__Trigger"}),_i=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(z,{action:"help",...t,asChild:!0,children:n.jsx(ps,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),vs=a.ikp(T.Content,{_id:"aiChatHelpActions__Menu"}),Fi=t=>n.jsx(vs,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Ei=a.ikp(T.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),ki=t=>{const{action:e,onClick:i,...s}=t,{handleAction:r,logHelpAction:o}=se.useChatAction(e),{setOpen:d}=te.useHelpMenu(),c=()=>{r({onOpenForm:()=>d(!1)}),o()},m=e.action.type,h=a.ikp(m==="open_link"?"a":"button",{_id:"aiChatHelpActions__MenuItem",children:e.name,"aria-label":e.name,"data-name":e.name,"data-type":e.action.type,...m==="open_link"&&{href:e.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(i,c)});return n.jsx(h,{...s})},bs=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),Ii=t=>{const{action:e,...i}=t;return e.icon?n.jsx(bs,{iconSettings:e.icon,...i}):null},gs=a.ikp(A.Root,{_id:"aiChatFeedbackModal"}),Mi=t=>{const{onOpenChange:e,...i}=t,{currentFeedback:s,setCurrentFeedback:r}=ne.useMessageFeedback();return n.jsx(gs,{open:s!==null,onOpenChange:u.composeEventHandlers(e,()=>r(null)),...i})},Si=a.ikp(A.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),xi=a.ikp(A.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),Bi=a.ikp(A.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),fi=a.ikp(A.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),Ti=a.ikp("div",{_id:"aiChatFeedbackModal__Body"}),Ps=a.ikp("form",{_id:"aiChatFeedbackForm"}),ji=t=>{const{onSubmit:e,...i}=t,{submitNegativeFeedback:s,currentFeedback:r,setCurrentFeedback:o}=ne.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,h=new FormData(m),p=Object.fromEntries(h.entries());r&&(s(r,p),o(null))};return n.jsx(Ps,{onSubmit:u.composeEventHandlers(e,d),...i})},As=a.ikp("div",{_id:"aiChatFeedbackItem"}),yi=t=>{const{name:e,...i}=t;return n.jsx(U.FeedbackItemProvider,{name:e,children:n.jsx(As,{...i})})},_s=a.ikp(K.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Hi=t=>{const{name:e,focusItem:i}=U.useFeedbackItem(),{onCheckedChange:s,...r}=t,o=d=>{d&&i?.current?.focus()};return n.jsx(_s,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(s,o),...r})},wi=a.ikp(K.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Fs=a.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Li=t=>{const{name:e}=U.useFeedbackItem(),i={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(Fs,{htmlFor:`feedback-${e}`,children:i[e],...t})},Es=a.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Di=t=>{const{name:e,focusItem:i}=U.useFeedbackItem();return n.jsx(Es,{ref:i,name:`${e}:description`,...t})},Oi=a.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),ks=a.ikp("div",{_id:"aiChatForm__Wrapper"}),qi=t=>{const{form:e}=_.useChatForm();return e?n.jsx(ks,{...t}):null},Is=a.ikp("form",{_id:"aiChatForm"}),Ri=t=>{const{onSubmit:e,...i}=t,{handleSubmit:s,isSuccess:r}=_.useChatForm();return r?null:n.jsx(Is,{onSubmit:u.composeEventHandlers(e,s),...i})},Ms=a.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),Wi=t=>{const{onClick:e,...i}=t,{closeForm:s}=_.useChatForm();return n.jsx(Ms,{onClick:u.composeEventHandlers(e,s),...i})},Ni=a.ikp("div",{_id:"aiChatForm__Header"}),Ss=a.ikp("h2",{_id:"aiChatForm__Heading"}),Qi=t=>{const{form:e}=_.useChatForm();return e?.heading?n.jsx(Ss,{children:e.heading,...t}):null},xs=a.ikp("span",{_id:"aiChatForm__Description"}),$i=t=>{const{form:e}=_.useChatForm();return e?.description?n.jsx(xs,{children:e.description,...t}):null},Bs=a.ikp("div",{_id:"aiChatForm__Content"}),Vi=t=>{const{children:e,...i}=t,{fields:s=[]}=_.useChatForm();return n.jsx(Bs,{children:l.maybeRender(e,s),...i})},fs=a.ikp("div",{_id:"aiChatForm__Field"}),Ui=t=>{const{field:e,autoFocus:i,...s}=t,{control:r,errors:o}=_.useChatForm();return n.jsx(fa.Controller,{name:e.name,control:r,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const c=d.value!==void 0||e.inputType==="file";return n.jsx(f.FormFieldProvider,{"data-invalid":l.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:i,children:c&&n.jsx(fs,{"data-input-type":e.inputType,"data-hidden":l.dataAttr(e.isHidden),...s})})}})},Ts=a.ikp("label",{_id:"aiChatForm__FieldLabel"}),Ki=t=>{const{field:e}=f.useFormField();return n.jsx(Ts,{"data-required":l.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},js=a.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),G=t=>{const{field:e,error:i,fieldProps:{onChange:s,onBlur:r,...o},autoFocus:d}=f.useFormField(),{onChange:c,onBlur:m,...h}=t;return n.jsx(js,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":l.dataAttr(!!i),onChange:u.composeEventHandlers(c,s),onBlur:u.composeEventHandlers(m,r),...o,...h})},zi=a.ikp(G,{_id:"aiChatForm__FieldEmail",type:"email"}),ys=a.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Gi=t=>{const{field:e,error:i,fieldProps:{value:s,onChange:r,onBlur:o,...d},autoFocus:c}=f.useFormField(),{onChange:m,onBlur:h,...p}=t,b=k=>{const y=k.target.files;r(y)};return n.jsx(ys,{id:e.name,autoFocus:c,"data-value":s,"data-invalid":l.dataAttr(!!i),...p,...d,onChange:u.composeEventHandlers(m,b),onBlur:u.composeEventHandlers(h,o)})},Yi=a.ikp(G,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ie,{maxRows:8})}),Hs=a.ikp(K.Root,{_id:"aiChatForm__FieldCheckbox"}),Ji=t=>{const{field:e,error:i,fieldProps:s,autoFocus:r}=f.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(Hs,{id:e.name,name:e.name,autoFocus:r,"data-invalid":l.dataAttr(!!i),checked:s.value,onCheckedChange:u.composeEventHandlers(o,s.onChange),...d})},Xi=a.ikp(K.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),ws=a.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),Zi=t=>{const{field:e,error:i,fieldProps:s}=f.useFormField(),{onValueChange:r,...o}=t;return n.jsx(ws,{name:e.name,"data-invalid":l.dataAttr(!!i),value:s.value,onValueChange:u.composeEventHandlers(r,s.onChange),...o})},ea=a.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),Ls=a.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),ta=t=>{const{field:e}=f.useFormField();return n.jsx(Ls,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ia=a.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),aa=a.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),na=a.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),sa=a.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ra=a.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),oa=a.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Ds=a.ikp("span",{_id:"aiChatForm__FieldError"}),da=t=>{const{error:e}=f.useFormField();return e?n.jsx(Ds,{children:e.message?.toString(),...t}):null},Os=a.ikp("span",{_id:"aiChatForm__Error"}),ca=t=>{const{formError:e}=_.useChatForm();return e?n.jsx(Os,{children:e.message,...t}):null},ma=a.ikp("div",{_id:"aiChatForm__Footer"}),qs=a.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),la=t=>{const{onClick:e,...i}=t,{closeForm:s}=_.useChatForm();return n.jsx(qs,{onClick:u.composeEventHandlers(e,s),...i})},Rs=a.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),ha=t=>{const{onClick:e,...i}=t,{isSubmitting:s}=_.useChatForm();return n.jsx(Rs,{disabled:s,...i})},Ws=a.ikp("div",{_id:"aiChatForm__Success"}),ua=t=>{const{isSuccess:e}=_.useChatForm();return e?n.jsx(Ws,{...t}):null},Ns=a.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),Ca=t=>{const{form:e}=_.useChatForm();return n.jsx(Ns,{children:e?.successView.heading,...t})},Qs=a.ikp(ae.Markdown,{_id:"aiChatForm__SuccessMessage"}),pa=t=>{const{form:e}=_.useChatForm();return n.jsx(Qs,{children:e?.successView.message,...t})},$s=a.ikp("button",{_id:"aiChatForm__SuccessButton"}),va=t=>{const{onClick:e,...i}=t,{form:s,closeForm:r}=_.useChatForm(),o=s?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx($s,{onClick:u.composeEventHandlers(e,r),children:n.jsxs(n.Fragment,{children:[d,c]}),...i})};exports.Provider=v.ChatProvider;exports.ActionBar=hi;exports.Actions=ui;exports.AttachmentsBar=wt;exports.AttachmentsBarActions=Wt;exports.AttachmentsBarAttachment=Dt;exports.AttachmentsBarAttachmentDelete=Rt;exports.AttachmentsBarAttachmentIcon=Ot;exports.AttachmentsBarAttachmentTitle=qt;exports.AttachmentsBarForm=ii;exports.AttachmentsBarFormContent=oi;exports.AttachmentsBarFormContentError=mi;exports.AttachmentsBarFormContentInput=ci;exports.AttachmentsBarFormContentLabel=di;exports.AttachmentsBarFormSubmitButton=li;exports.AttachmentsBarFormTitle=ai;exports.AttachmentsBarFormTitleError=ri;exports.AttachmentsBarFormTitleInput=si;exports.AttachmentsBarFormTitleLabel=ni;exports.AttachmentsBarInfoTip=Nt;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Qt;exports.AttachmentsBarInfoTipText=$t;exports.AttachmentsBarInput=Ut;exports.AttachmentsBarInputs=Vt;exports.AttachmentsBarList=Lt;exports.AttachmentsBarModal=Kt;exports.AttachmentsBarModalBody=ti;exports.AttachmentsBarModalClose=ei;exports.AttachmentsBarModalContent=Gt;exports.AttachmentsBarModalDescription=Xt;exports.AttachmentsBarModalHeader=Yt;exports.AttachmentsBarModalHeading=Jt;exports.AttachmentsBarModalHelp=Zt;exports.AttachmentsBarModalOverlay=zt;exports.ChatAction=z;exports.ChatActionFeedback=gi;exports.ChatActionLabel=le;exports.ChatHelpAction=Ai;exports.Content=ke;exports.ContentScrollArea=Ie;exports.ContentScrollAreaCorner=Be;exports.ContentScrollAreaScrollbar=Se;exports.ContentScrollAreaThumb=xe;exports.ContentScrollAreaViewport=Me;exports.ConversationLoading=Pe;exports.Disclaimer=Te;exports.DisclaimerArrow=Le;exports.DisclaimerContent=He;exports.DisclaimerLabel=je;exports.DisclaimerText=we;exports.DisclaimerTrigger=ye;exports.EmbeddedChatPrimitiveActionBar=hi;exports.EmbeddedChatPrimitiveActions=ui;exports.EmbeddedChatPrimitiveAttachmentsBar=wt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=qt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ii;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=oi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=ai;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=ni;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=$t;exports.EmbeddedChatPrimitiveAttachmentsBarInput=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarList=Lt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=Jt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=zt;exports.EmbeddedChatPrimitiveChatAction=z;exports.EmbeddedChatPrimitiveChatActionFeedback=gi;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Ai;exports.EmbeddedChatPrimitiveContent=ke;exports.EmbeddedChatPrimitiveContentScrollArea=Ie;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Be;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=Se;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=xe;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Me;exports.EmbeddedChatPrimitiveConversationLoading=Pe;exports.EmbeddedChatPrimitiveDisclaimer=Te;exports.EmbeddedChatPrimitiveDisclaimerArrow=Le;exports.EmbeddedChatPrimitiveDisclaimerContent=He;exports.EmbeddedChatPrimitiveDisclaimerLabel=je;exports.EmbeddedChatPrimitiveDisclaimerText=we;exports.EmbeddedChatPrimitiveDisclaimerTrigger=ye;exports.EmbeddedChatPrimitiveExampleQuestion=Re;exports.EmbeddedChatPrimitiveExampleQuestionButton=We;exports.EmbeddedChatPrimitiveExampleQuestions=De;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=Oe;exports.EmbeddedChatPrimitiveExampleQuestionsList=qe;exports.EmbeddedChatPrimitiveFeedbackForm=ji;exports.EmbeddedChatPrimitiveFeedbackItem=yi;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Hi;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=wi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Di;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Li;exports.EmbeddedChatPrimitiveFeedbackModal=Mi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Ti;exports.EmbeddedChatPrimitiveFeedbackModalClose=fi;exports.EmbeddedChatPrimitiveFeedbackModalContent=xi;exports.EmbeddedChatPrimitiveFeedbackModalHeader=Bi;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Si;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Oi;exports.EmbeddedChatPrimitiveFooter=Bt;exports.EmbeddedChatPrimitiveForm=Ri;exports.EmbeddedChatPrimitiveFormCancel=la;exports.EmbeddedChatPrimitiveFormClose=Wi;exports.EmbeddedChatPrimitiveFormContent=Vi;exports.EmbeddedChatPrimitiveFormDescription=$i;exports.EmbeddedChatPrimitiveFormError=ca;exports.EmbeddedChatPrimitiveFormField=Ui;exports.EmbeddedChatPrimitiveFormFieldCheckbox=Ji;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=Xi;exports.EmbeddedChatPrimitiveFormFieldEmail=zi;exports.EmbeddedChatPrimitiveFormFieldError=da;exports.EmbeddedChatPrimitiveFormFieldFile=Gi;exports.EmbeddedChatPrimitiveFormFieldLabel=Ki;exports.EmbeddedChatPrimitiveFormFieldSelect=Zi;exports.EmbeddedChatPrimitiveFormFieldSelectContent=aa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ia;exports.EmbeddedChatPrimitiveFormFieldSelectItem=sa;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=oa;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ra;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=ea;exports.EmbeddedChatPrimitiveFormFieldSelectValue=ta;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=na;exports.EmbeddedChatPrimitiveFormFieldText=G;exports.EmbeddedChatPrimitiveFormFieldTextArea=Yi;exports.EmbeddedChatPrimitiveFormFooter=ma;exports.EmbeddedChatPrimitiveFormHeader=Ni;exports.EmbeddedChatPrimitiveFormHeading=Qi;exports.EmbeddedChatPrimitiveFormSubmit=ha;exports.EmbeddedChatPrimitiveFormSuccess=ua;exports.EmbeddedChatPrimitiveFormSuccessButton=va;exports.EmbeddedChatPrimitiveFormSuccessHeading=Ca;exports.EmbeddedChatPrimitiveFormSuccessMessage=pa;exports.EmbeddedChatPrimitiveFormWrapper=qi;exports.EmbeddedChatPrimitiveHeaderToolbar=_e;exports.EmbeddedChatPrimitiveHelpActions=Pi;exports.EmbeddedChatPrimitiveHelpActionsMenu=Fi;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Ei;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=ki;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=Ii;exports.EmbeddedChatPrimitiveHelpActionsTrigger=_i;exports.EmbeddedChatPrimitiveInput=jt;exports.EmbeddedChatPrimitiveInputFieldset=ft;exports.EmbeddedChatPrimitiveInputGroup=Tt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=Ue;exports.EmbeddedChatPrimitiveMessage=ut;exports.EmbeddedChatPrimitiveMessageAction=bt;exports.EmbeddedChatPrimitiveMessageAttachments=it;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=at;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=mt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=dt;exports.EmbeddedChatPrimitiveMessageAvatar=Ge;exports.EmbeddedChatPrimitiveMessageAvatarContent=Ye;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Je;exports.EmbeddedChatPrimitiveMessageAvatarImage=Xe;exports.EmbeddedChatPrimitiveMessageContent=tt;exports.EmbeddedChatPrimitiveMessageContentWrapper=et;exports.EmbeddedChatPrimitiveMessageHeader=Ke;exports.EmbeddedChatPrimitiveMessageLoading=ze;exports.EmbeddedChatPrimitiveMessageName=Ze;exports.EmbeddedChatPrimitiveMessageSourceItem=_t;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=Mt;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=St;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=Et;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=xt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=It;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=kt;exports.EmbeddedChatPrimitiveMessageSources=gt;exports.EmbeddedChatPrimitiveMessageSourcesHeader=Pt;exports.EmbeddedChatPrimitiveMessageSourcesList=At;exports.EmbeddedChatPrimitiveMessageToolAction=vt;exports.EmbeddedChatPrimitiveMessageToolActions=pt;exports.EmbeddedChatPrimitiveMessageToolbar=Ct;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=fe;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=yt;exports.EmbeddedChatPrimitiveSendButtonIcon=Ht;exports.EmbeddedChatPrimitiveTaglineBrandName=bi;exports.EmbeddedChatPrimitiveTaglineContainer=Ci;exports.EmbeddedChatPrimitiveTaglineLogo=vi;exports.EmbeddedChatPrimitiveTaglineText=pi;exports.EmbeddedChatPrimitiveToolbarHeader=Ee;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ve;exports.EmbeddedChatPrimitiveWorkflows=Ne;exports.EmbeddedChatPrimitiveWorkflowsLabel=Qe;exports.EmbeddedChatPrimitiveWorkflowsList=$e;exports.EmbeddedChatPrimitiveWrapper=ge;exports.ExampleQuestion=Re;exports.ExampleQuestionButton=We;exports.ExampleQuestions=De;exports.ExampleQuestionsLabel=Oe;exports.ExampleQuestionsList=qe;exports.FeedbackForm=ji;exports.FeedbackItem=yi;exports.FeedbackItemCheckbox=Hi;exports.FeedbackItemCheckboxIndicator=wi;exports.FeedbackItemDescription=Di;exports.FeedbackItemLabel=Li;exports.FeedbackModal=Mi;exports.FeedbackModalBody=Ti;exports.FeedbackModalClose=fi;exports.FeedbackModalContent=xi;exports.FeedbackModalHeader=Bi;exports.FeedbackModalOverlay=Si;exports.FeedbackSubmitButton=Oi;exports.Footer=Bt;exports.Form=Ri;exports.FormCancel=la;exports.FormClose=Wi;exports.FormContent=Vi;exports.FormDescription=$i;exports.FormError=ca;exports.FormField=Ui;exports.FormFieldCheckbox=Ji;exports.FormFieldCheckboxIndicator=Xi;exports.FormFieldEmail=zi;exports.FormFieldError=da;exports.FormFieldFile=Gi;exports.FormFieldLabel=Ki;exports.FormFieldSelect=Zi;exports.FormFieldSelectContent=aa;exports.FormFieldSelectIcon=ia;exports.FormFieldSelectItem=sa;exports.FormFieldSelectItemIndicator=oa;exports.FormFieldSelectItemText=ra;exports.FormFieldSelectTrigger=ea;exports.FormFieldSelectValue=ta;exports.FormFieldSelectViewport=na;exports.FormFieldText=G;exports.FormFieldTextArea=Yi;exports.FormFooter=ma;exports.FormHeader=Ni;exports.FormHeading=Qi;exports.FormSubmit=ha;exports.FormSuccess=ua;exports.FormSuccessButton=va;exports.FormSuccessHeading=Ca;exports.FormSuccessMessage=pa;exports.FormWrapper=qi;exports.Header=Qa;exports.HeaderToolbar=_e;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=Pi;exports.HelpActionsMenu=Fi;exports.HelpActionsMenuArrow=Ei;exports.HelpActionsMenuItem=ki;exports.HelpActionsMenuItemIcon=Ii;exports.HelpActionsTrigger=_i;exports.Input=jt;exports.InputFieldset=ft;exports.InputGroup=Tt;exports.IntroMessageWrapper=Ue;exports.Message=ut;exports.MessageAction=bt;exports.MessageAttachments=it;exports.MessageAttachmentsItem=nt;exports.MessageAttachmentsItemIcon=st;exports.MessageAttachmentsItemTitle=rt;exports.MessageAttachmentsList=at;exports.MessageAttachmentsPreview=ot;exports.MessageAttachmentsPreviewBody=ht;exports.MessageAttachmentsPreviewClose=lt;exports.MessageAttachmentsPreviewContent=ct;exports.MessageAttachmentsPreviewHeader=mt;exports.MessageAttachmentsPreviewOverlay=dt;exports.MessageAvatar=Ge;exports.MessageAvatarContent=Ye;exports.MessageAvatarFallback=Je;exports.MessageAvatarImage=Xe;exports.MessageContent=tt;exports.MessageContentWrapper=et;exports.MessageHeader=Ke;exports.MessageLoading=ze;exports.MessageName=Ze;exports.MessageSourceItem=_t;exports.MessageSourceItemBreadcrumbIcon=wn;exports.MessageSourceItemBreadcrumbs=Ft;exports.MessageSourceItemDescription=Mt;exports.MessageSourceItemDescriptionPart=St;exports.MessageSourceItemIcon=Et;exports.MessageSourceItemIndicator=xt;exports.MessageSourceItemTag=It;exports.MessageSourceItemTitle=kt;exports.MessageSources=gt;exports.MessageSourcesHeader=Pt;exports.MessageSourcesList=At;exports.MessageToolAction=vt;exports.MessageToolActions=pt;exports.MessageToolbar=Ct;exports.MessageWrapper=ce;exports.Messages=fe;exports.Root=Ae;exports.SendButton=yt;exports.SendButtonIcon=Ht;exports.TaglineBrandName=bi;exports.TaglineContainer=Ci;exports.TaglineLogo=vi;exports.TaglineText=pi;exports.ToolbarHeader=Ee;exports.Workflow=Ve;exports.Workflows=Ne;exports.WorkflowsLabel=Qe;exports.WorkflowsList=$e;exports.Wrapper=ge;
|
|
17
|
+
`);J(Q)},share:async()=>{const Q={visibility:"public",tags:[],userProperties:{},messages:p.messages.map(S=>({...S,createdAt:void 0,updatedAt:void 0,id:Date.now().toString()+S.id,conversationId:void 0}))},{apiKey:H,analyticsApiBaseUrl:D}=k,M=await wa.logConversation("",Q,H,D);if(M){const $=`${b.shareChatUrlBasePath}?${O.SHARE_QUERY_PARAM}=${M?.id}`;X($),y({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:$,conversation:M}})}},clear:o,stop:d},Ce={copy:W,share:N};return n.jsx(j.Tooltip,{delayDuration:0,open:Ce[e],children:n.jsx(cs,{"data-type":e,"data-copied":l.dataAttr(W||N),className:`${s} ${e}`,children:n.jsx(le,{action:e}),onClick:u.composeEventHandlers(i,ee[e]),...r})})},ms=a.ikp("span",{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...i}=t,{aiChatSettings:s}=C.useInkeepConfig(),r=s.toolbarButtonLabels??{},o={help:r.getHelp??"Get Help",copy:r.copyChat??"Copy",share:r.share??"Share",clear:r.clear??"Clear",stop:r.stop??"Stop"};return n.jsx(ms,{children:o[e],...i})},ls=a.ikp(j.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),gi=t=>{const{action:e,children:i,...s}=t,r={copy:"Copied!",share:"Link copied!"};return n.jsxs(ls,{sideOffset:5,...s,children:[n.jsx(j.Arrow,{}),i||r[e]]})},hs=a.ikp(T.Root,{_id:"aiChatHelpActions"}),Pi=t=>{const{children:e,...i}=t,{aiChatSettings:s}=C.useInkeepConfig(),{getHelpOptions:r}=s;if(!r||(r??[]).length===0)return null;const{_pinned:o,_unpinned:d}=r.reduce((p,b)=>{const k=b.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[k]:[...p[k],b]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,h=ie.useHelpMenuState();return n.jsx(ie.HelpMenuProvider,{value:h,children:n.jsx(hs,{open:h.open,onOpenChange:h.setOpen,children:l.maybeRender(e,{pinned:c,unpinned:m}),...i})})},us=a.ikp(G,{_id:"aiChatHelpAction",action:"help"}),Cs=a.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),Ai=t=>{const{action:e,onClick:i,...s}=t,{handleAction:r,logHelpAction:o}=se.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:u.composeEventHandlers(i,()=>{r(),o()}),...s};return d==="open_link"?n.jsx(Cs,{href:e.action.url,...c}):n.jsx(us,{...c})},ps=a.ikp(T.Trigger,{_id:"aiChatHelpActions__Trigger"}),_i=g.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(G,{action:"help",...t,asChild:!0,children:n.jsx(ps,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),vs=a.ikp(T.Content,{_id:"aiChatHelpActions__Menu"}),Fi=t=>n.jsx(vs,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Ei=a.ikp(T.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),ki=t=>{const{action:e,onClick:i,...s}=t,{handleAction:r,logHelpAction:o}=se.useChatAction(e),{setOpen:d}=ie.useHelpMenu(),c=()=>{r({onOpenForm:()=>d(!1)}),o()},m=e.action.type,h=a.ikp(m==="open_link"?"a":"button",{_id:"aiChatHelpActions__MenuItem",children:e.name,"aria-label":e.name,"data-name":e.name,"data-type":e.action.type,...m==="open_link"&&{href:e.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(i,c)});return n.jsx(h,{...s})},bs=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),Ii=t=>{const{action:e,...i}=t;return e.icon?n.jsx(bs,{iconSettings:e.icon,...i}):null},gs=a.ikp(A.Root,{_id:"aiChatFeedbackModal"}),Mi=t=>{const{onOpenChange:e,...i}=t,{currentFeedback:s,setCurrentFeedback:r}=ne.useMessageFeedback();return n.jsx(gs,{open:s!==null,onOpenChange:u.composeEventHandlers(e,()=>r(null)),...i})},Si=a.ikp(A.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),xi=a.ikp(A.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),Bi=a.ikp(A.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),fi=a.ikp(A.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),Ti=a.ikp("div",{_id:"aiChatFeedbackModal__Body"}),Ps=a.ikp("form",{_id:"aiChatFeedbackForm"}),ji=t=>{const{onSubmit:e,...i}=t,{submitNegativeFeedback:s,currentFeedback:r,setCurrentFeedback:o}=ne.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,h=new FormData(m),p=Object.fromEntries(h.entries());r&&(s(r,p),o(null))};return n.jsx(Ps,{onSubmit:u.composeEventHandlers(e,d),...i})},As=a.ikp("div",{_id:"aiChatFeedbackItem"}),yi=t=>{const{name:e,...i}=t;return n.jsx(K.FeedbackItemProvider,{name:e,children:n.jsx(As,{...i})})},_s=a.ikp(z.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Hi=t=>{const{name:e,focusItem:i}=K.useFeedbackItem(),{onCheckedChange:s,...r}=t,o=d=>{d&&i?.current?.focus()};return n.jsx(_s,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(s,o),...r})},wi=a.ikp(z.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Fs=a.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Li=t=>{const{name:e}=K.useFeedbackItem(),i={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(Fs,{htmlFor:`feedback-${e}`,children:i[e],...t})},Es=a.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Di=t=>{const{name:e,focusItem:i}=K.useFeedbackItem();return n.jsx(Es,{ref:i,name:`${e}:description`,...t})},Oi=a.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),ks=a.ikp("div",{_id:"aiChatForm__Wrapper"}),qi=t=>{const{form:e}=_.useChatForm();return e?n.jsx(ks,{...t}):null},Is=a.ikp("form",{_id:"aiChatForm"}),Ri=t=>{const{onSubmit:e,...i}=t,{handleSubmit:s,isSuccess:r}=_.useChatForm();return r?null:n.jsx(Is,{onSubmit:u.composeEventHandlers(e,s),...i})},Ms=a.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),Wi=t=>{const{onClick:e,...i}=t,{closeForm:s}=_.useChatForm();return n.jsx(Ms,{onClick:u.composeEventHandlers(e,s),...i})},Ni=a.ikp("div",{_id:"aiChatForm__Header"}),Ss=a.ikp("h2",{_id:"aiChatForm__Heading"}),Qi=t=>{const{form:e}=_.useChatForm();return e?.heading?n.jsx(Ss,{children:e.heading,...t}):null},xs=a.ikp(V.Markdown,{_id:"aiChatForm__Description"}),$i=t=>{const{form:e}=_.useChatForm();return e?.description?n.jsx(xs,{children:e.description,...t}):null},Bs=a.ikp("div",{_id:"aiChatForm__Content"}),Vi=t=>{const{children:e,...i}=t,{fields:s=[]}=_.useChatForm();return n.jsx(Bs,{children:l.maybeRender(e,s),...i})},fs=a.ikp("div",{_id:"aiChatForm__Field"}),Ui=t=>{const{field:e,autoFocus:i,...s}=t,{control:r,errors:o}=_.useChatForm();return n.jsx(fa.Controller,{name:e.name,control:r,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const c=d.value!==void 0||e.inputType==="file";return n.jsx(f.FormFieldProvider,{"data-invalid":l.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:i,children:c&&n.jsx(fs,{"data-input-type":e.inputType,"data-hidden":l.dataAttr(e.isHidden),...s})})}})},Ts=a.ikp("label",{_id:"aiChatForm__FieldLabel"}),Ki=t=>{const{field:e}=f.useFormField();return n.jsx(Ts,{"data-required":l.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},js=a.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),Y=t=>{const{field:e,error:i,fieldProps:{onChange:s,onBlur:r,...o},autoFocus:d}=f.useFormField(),{onChange:c,onBlur:m,...h}=t;return n.jsx(js,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":l.dataAttr(!!i),onChange:u.composeEventHandlers(c,s),onBlur:u.composeEventHandlers(m,r),...o,...h})},zi=a.ikp(Y,{_id:"aiChatForm__FieldEmail",type:"email"}),ys=a.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Gi=t=>{const{field:e,error:i,fieldProps:{value:s,onChange:r,onBlur:o,...d},autoFocus:c}=f.useFormField(),{onChange:m,onBlur:h,...p}=t,b=k=>{const y=k.target.files;r(y)};return n.jsx(ys,{id:e.name,autoFocus:c,"data-value":s,"data-invalid":l.dataAttr(!!i),...p,...d,onChange:u.composeEventHandlers(m,b),onBlur:u.composeEventHandlers(h,o)})},Yi=a.ikp(Y,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ae,{maxRows:8})}),Hs=a.ikp(z.Root,{_id:"aiChatForm__FieldCheckbox"}),Ji=t=>{const{field:e,error:i,fieldProps:s,autoFocus:r}=f.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(Hs,{id:e.name,name:e.name,autoFocus:r,"data-invalid":l.dataAttr(!!i),checked:s.value,onCheckedChange:u.composeEventHandlers(o,s.onChange),...d})},Xi=a.ikp(z.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),ws=a.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),Zi=t=>{const{field:e,error:i,fieldProps:s}=f.useFormField(),{onValueChange:r,...o}=t;return n.jsx(ws,{name:e.name,"data-invalid":l.dataAttr(!!i),value:s.value,onValueChange:u.composeEventHandlers(r,s.onChange),...o})},ea=a.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),Ls=a.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),ta=t=>{const{field:e}=f.useFormField();return n.jsx(Ls,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ia=a.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),aa=a.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),na=a.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),sa=a.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ra=a.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),oa=a.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Ds=a.ikp("span",{_id:"aiChatForm__FieldError"}),da=t=>{const{error:e}=f.useFormField();return e?n.jsx(Ds,{children:e.message?.toString(),...t}):null},Os=a.ikp("span",{_id:"aiChatForm__Error"}),ca=t=>{const{formError:e}=_.useChatForm();return e?n.jsx(Os,{children:e.message,...t}):null},ma=a.ikp("div",{_id:"aiChatForm__Footer"}),qs=a.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),la=t=>{const{onClick:e,...i}=t,{closeForm:s}=_.useChatForm();return n.jsx(qs,{onClick:u.composeEventHandlers(e,s),...i})},Rs=a.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),ha=t=>{const{onClick:e,...i}=t,{isSubmitting:s,form:r}=_.useChatForm(),o=r?.buttons.submit.label||"Submit";return n.jsx(Rs,{disabled:s,...i,children:o})},Ws=a.ikp("div",{_id:"aiChatForm__Success"}),ua=t=>{const{isSuccess:e}=_.useChatForm();return e?n.jsx(Ws,{...t}):null},Ns=a.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),Ca=t=>{const{form:e}=_.useChatForm();return n.jsx(Ns,{children:e?.successView?.heading,...t})},Qs=a.ikp(V.Markdown,{_id:"aiChatForm__SuccessMessage"}),pa=t=>{const{form:e}=_.useChatForm();return n.jsx(Qs,{children:e?.successView?.message,...t})},$s=a.ikp("button",{_id:"aiChatForm__SuccessButton"}),va=t=>{const{onClick:e,...i}=t,{form:s,closeForm:r}=_.useChatForm(),o=s?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx($s,{onClick:u.composeEventHandlers(e,r),children:n.jsxs(n.Fragment,{children:[d,c]}),...i})};exports.Provider=v.ChatProvider;exports.ActionBar=hi;exports.Actions=ui;exports.AttachmentsBar=wt;exports.AttachmentsBarActions=Wt;exports.AttachmentsBarAttachment=Dt;exports.AttachmentsBarAttachmentDelete=Rt;exports.AttachmentsBarAttachmentIcon=Ot;exports.AttachmentsBarAttachmentTitle=qt;exports.AttachmentsBarForm=ii;exports.AttachmentsBarFormContent=oi;exports.AttachmentsBarFormContentError=mi;exports.AttachmentsBarFormContentInput=ci;exports.AttachmentsBarFormContentLabel=di;exports.AttachmentsBarFormSubmitButton=li;exports.AttachmentsBarFormTitle=ai;exports.AttachmentsBarFormTitleError=ri;exports.AttachmentsBarFormTitleInput=si;exports.AttachmentsBarFormTitleLabel=ni;exports.AttachmentsBarInfoTip=Nt;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Qt;exports.AttachmentsBarInfoTipText=$t;exports.AttachmentsBarInput=Ut;exports.AttachmentsBarInputs=Vt;exports.AttachmentsBarList=Lt;exports.AttachmentsBarModal=Kt;exports.AttachmentsBarModalBody=ti;exports.AttachmentsBarModalClose=ei;exports.AttachmentsBarModalContent=Gt;exports.AttachmentsBarModalDescription=Xt;exports.AttachmentsBarModalHeader=Yt;exports.AttachmentsBarModalHeading=Jt;exports.AttachmentsBarModalHelp=Zt;exports.AttachmentsBarModalOverlay=zt;exports.ChatAction=G;exports.ChatActionFeedback=gi;exports.ChatActionLabel=le;exports.ChatHelpAction=Ai;exports.Content=ke;exports.ContentScrollArea=Ie;exports.ContentScrollAreaCorner=Be;exports.ContentScrollAreaScrollbar=Se;exports.ContentScrollAreaThumb=xe;exports.ContentScrollAreaViewport=Me;exports.ConversationLoading=Pe;exports.Disclaimer=Te;exports.DisclaimerArrow=Le;exports.DisclaimerContent=He;exports.DisclaimerLabel=je;exports.DisclaimerText=we;exports.DisclaimerTrigger=ye;exports.EmbeddedChatPrimitiveActionBar=hi;exports.EmbeddedChatPrimitiveActions=ui;exports.EmbeddedChatPrimitiveAttachmentsBar=wt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=qt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ii;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=oi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=ai;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=ni;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=$t;exports.EmbeddedChatPrimitiveAttachmentsBarInput=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarList=Lt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=Jt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=zt;exports.EmbeddedChatPrimitiveChatAction=G;exports.EmbeddedChatPrimitiveChatActionFeedback=gi;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Ai;exports.EmbeddedChatPrimitiveContent=ke;exports.EmbeddedChatPrimitiveContentScrollArea=Ie;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Be;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=Se;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=xe;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Me;exports.EmbeddedChatPrimitiveConversationLoading=Pe;exports.EmbeddedChatPrimitiveDisclaimer=Te;exports.EmbeddedChatPrimitiveDisclaimerArrow=Le;exports.EmbeddedChatPrimitiveDisclaimerContent=He;exports.EmbeddedChatPrimitiveDisclaimerLabel=je;exports.EmbeddedChatPrimitiveDisclaimerText=we;exports.EmbeddedChatPrimitiveDisclaimerTrigger=ye;exports.EmbeddedChatPrimitiveExampleQuestion=Re;exports.EmbeddedChatPrimitiveExampleQuestionButton=We;exports.EmbeddedChatPrimitiveExampleQuestions=De;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=Oe;exports.EmbeddedChatPrimitiveExampleQuestionsList=qe;exports.EmbeddedChatPrimitiveFeedbackForm=ji;exports.EmbeddedChatPrimitiveFeedbackItem=yi;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Hi;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=wi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Di;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Li;exports.EmbeddedChatPrimitiveFeedbackModal=Mi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Ti;exports.EmbeddedChatPrimitiveFeedbackModalClose=fi;exports.EmbeddedChatPrimitiveFeedbackModalContent=xi;exports.EmbeddedChatPrimitiveFeedbackModalHeader=Bi;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Si;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Oi;exports.EmbeddedChatPrimitiveFooter=Bt;exports.EmbeddedChatPrimitiveForm=Ri;exports.EmbeddedChatPrimitiveFormCancel=la;exports.EmbeddedChatPrimitiveFormClose=Wi;exports.EmbeddedChatPrimitiveFormContent=Vi;exports.EmbeddedChatPrimitiveFormDescription=$i;exports.EmbeddedChatPrimitiveFormError=ca;exports.EmbeddedChatPrimitiveFormField=Ui;exports.EmbeddedChatPrimitiveFormFieldCheckbox=Ji;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=Xi;exports.EmbeddedChatPrimitiveFormFieldEmail=zi;exports.EmbeddedChatPrimitiveFormFieldError=da;exports.EmbeddedChatPrimitiveFormFieldFile=Gi;exports.EmbeddedChatPrimitiveFormFieldLabel=Ki;exports.EmbeddedChatPrimitiveFormFieldSelect=Zi;exports.EmbeddedChatPrimitiveFormFieldSelectContent=aa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ia;exports.EmbeddedChatPrimitiveFormFieldSelectItem=sa;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=oa;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ra;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=ea;exports.EmbeddedChatPrimitiveFormFieldSelectValue=ta;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=na;exports.EmbeddedChatPrimitiveFormFieldText=Y;exports.EmbeddedChatPrimitiveFormFieldTextArea=Yi;exports.EmbeddedChatPrimitiveFormFooter=ma;exports.EmbeddedChatPrimitiveFormHeader=Ni;exports.EmbeddedChatPrimitiveFormHeading=Qi;exports.EmbeddedChatPrimitiveFormSubmit=ha;exports.EmbeddedChatPrimitiveFormSuccess=ua;exports.EmbeddedChatPrimitiveFormSuccessButton=va;exports.EmbeddedChatPrimitiveFormSuccessHeading=Ca;exports.EmbeddedChatPrimitiveFormSuccessMessage=pa;exports.EmbeddedChatPrimitiveFormWrapper=qi;exports.EmbeddedChatPrimitiveHeaderToolbar=_e;exports.EmbeddedChatPrimitiveHelpActions=Pi;exports.EmbeddedChatPrimitiveHelpActionsMenu=Fi;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Ei;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=ki;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=Ii;exports.EmbeddedChatPrimitiveHelpActionsTrigger=_i;exports.EmbeddedChatPrimitiveInput=jt;exports.EmbeddedChatPrimitiveInputFieldset=ft;exports.EmbeddedChatPrimitiveInputGroup=Tt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=Ue;exports.EmbeddedChatPrimitiveMessage=ut;exports.EmbeddedChatPrimitiveMessageAction=bt;exports.EmbeddedChatPrimitiveMessageAttachments=it;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=at;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=mt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=dt;exports.EmbeddedChatPrimitiveMessageAvatar=Ge;exports.EmbeddedChatPrimitiveMessageAvatarContent=Ye;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Je;exports.EmbeddedChatPrimitiveMessageAvatarImage=Xe;exports.EmbeddedChatPrimitiveMessageContent=tt;exports.EmbeddedChatPrimitiveMessageContentWrapper=et;exports.EmbeddedChatPrimitiveMessageHeader=Ke;exports.EmbeddedChatPrimitiveMessageLoading=ze;exports.EmbeddedChatPrimitiveMessageName=Ze;exports.EmbeddedChatPrimitiveMessageSourceItem=_t;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=Mt;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=St;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=Et;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=xt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=It;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=kt;exports.EmbeddedChatPrimitiveMessageSources=gt;exports.EmbeddedChatPrimitiveMessageSourcesHeader=Pt;exports.EmbeddedChatPrimitiveMessageSourcesList=At;exports.EmbeddedChatPrimitiveMessageToolAction=vt;exports.EmbeddedChatPrimitiveMessageToolActions=pt;exports.EmbeddedChatPrimitiveMessageToolbar=Ct;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=fe;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=yt;exports.EmbeddedChatPrimitiveSendButtonIcon=Ht;exports.EmbeddedChatPrimitiveTaglineBrandName=bi;exports.EmbeddedChatPrimitiveTaglineContainer=Ci;exports.EmbeddedChatPrimitiveTaglineLogo=vi;exports.EmbeddedChatPrimitiveTaglineText=pi;exports.EmbeddedChatPrimitiveToolbarHeader=Ee;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ve;exports.EmbeddedChatPrimitiveWorkflows=Ne;exports.EmbeddedChatPrimitiveWorkflowsLabel=Qe;exports.EmbeddedChatPrimitiveWorkflowsList=$e;exports.EmbeddedChatPrimitiveWrapper=ge;exports.ExampleQuestion=Re;exports.ExampleQuestionButton=We;exports.ExampleQuestions=De;exports.ExampleQuestionsLabel=Oe;exports.ExampleQuestionsList=qe;exports.FeedbackForm=ji;exports.FeedbackItem=yi;exports.FeedbackItemCheckbox=Hi;exports.FeedbackItemCheckboxIndicator=wi;exports.FeedbackItemDescription=Di;exports.FeedbackItemLabel=Li;exports.FeedbackModal=Mi;exports.FeedbackModalBody=Ti;exports.FeedbackModalClose=fi;exports.FeedbackModalContent=xi;exports.FeedbackModalHeader=Bi;exports.FeedbackModalOverlay=Si;exports.FeedbackSubmitButton=Oi;exports.Footer=Bt;exports.Form=Ri;exports.FormCancel=la;exports.FormClose=Wi;exports.FormContent=Vi;exports.FormDescription=$i;exports.FormError=ca;exports.FormField=Ui;exports.FormFieldCheckbox=Ji;exports.FormFieldCheckboxIndicator=Xi;exports.FormFieldEmail=zi;exports.FormFieldError=da;exports.FormFieldFile=Gi;exports.FormFieldLabel=Ki;exports.FormFieldSelect=Zi;exports.FormFieldSelectContent=aa;exports.FormFieldSelectIcon=ia;exports.FormFieldSelectItem=sa;exports.FormFieldSelectItemIndicator=oa;exports.FormFieldSelectItemText=ra;exports.FormFieldSelectTrigger=ea;exports.FormFieldSelectValue=ta;exports.FormFieldSelectViewport=na;exports.FormFieldText=Y;exports.FormFieldTextArea=Yi;exports.FormFooter=ma;exports.FormHeader=Ni;exports.FormHeading=Qi;exports.FormSubmit=ha;exports.FormSuccess=ua;exports.FormSuccessButton=va;exports.FormSuccessHeading=Ca;exports.FormSuccessMessage=pa;exports.FormWrapper=qi;exports.Header=Qa;exports.HeaderToolbar=_e;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=Pi;exports.HelpActionsMenu=Fi;exports.HelpActionsMenuArrow=Ei;exports.HelpActionsMenuItem=ki;exports.HelpActionsMenuItemIcon=Ii;exports.HelpActionsTrigger=_i;exports.Input=jt;exports.InputFieldset=ft;exports.InputGroup=Tt;exports.IntroMessageWrapper=Ue;exports.Message=ut;exports.MessageAction=bt;exports.MessageAttachments=it;exports.MessageAttachmentsItem=nt;exports.MessageAttachmentsItemIcon=st;exports.MessageAttachmentsItemTitle=rt;exports.MessageAttachmentsList=at;exports.MessageAttachmentsPreview=ot;exports.MessageAttachmentsPreviewBody=ht;exports.MessageAttachmentsPreviewClose=lt;exports.MessageAttachmentsPreviewContent=ct;exports.MessageAttachmentsPreviewHeader=mt;exports.MessageAttachmentsPreviewOverlay=dt;exports.MessageAvatar=Ge;exports.MessageAvatarContent=Ye;exports.MessageAvatarFallback=Je;exports.MessageAvatarImage=Xe;exports.MessageContent=tt;exports.MessageContentWrapper=et;exports.MessageHeader=Ke;exports.MessageLoading=ze;exports.MessageName=Ze;exports.MessageSourceItem=_t;exports.MessageSourceItemBreadcrumbIcon=wn;exports.MessageSourceItemBreadcrumbs=Ft;exports.MessageSourceItemDescription=Mt;exports.MessageSourceItemDescriptionPart=St;exports.MessageSourceItemIcon=Et;exports.MessageSourceItemIndicator=xt;exports.MessageSourceItemTag=It;exports.MessageSourceItemTitle=kt;exports.MessageSources=gt;exports.MessageSourcesHeader=Pt;exports.MessageSourcesList=At;exports.MessageToolAction=vt;exports.MessageToolActions=pt;exports.MessageToolbar=Ct;exports.MessageWrapper=ce;exports.Messages=fe;exports.Root=Ae;exports.SendButton=yt;exports.SendButtonIcon=Ht;exports.TaglineBrandName=bi;exports.TaglineContainer=Ci;exports.TaglineLogo=vi;exports.TaglineText=pi;exports.ToolbarHeader=Ee;exports.Workflow=Ve;exports.Workflows=Ne;exports.WorkflowsLabel=Qe;exports.WorkflowsList=$e;exports.Wrapper=ge;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as n, jsxs as Q, Fragment as
|
|
2
|
+
import { jsx as n, jsxs as Q, Fragment as ee } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as V, memo as P, useState as be, useEffect as Ie, useMemo as fe } from "react";
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
4
|
+
import te from "react-textarea-autosize";
|
|
5
|
+
import * as ie from "@radix-ui/react-avatar";
|
|
6
6
|
import * as U from "@radix-ui/react-checkbox";
|
|
7
7
|
import * as k from "@radix-ui/react-popover";
|
|
8
8
|
import * as B from "@radix-ui/react-tooltip";
|
|
9
9
|
import * as D from "@radix-ui/react-scroll-area";
|
|
10
10
|
import * as f from "@radix-ui/react-select";
|
|
11
|
-
import { Overlay as
|
|
11
|
+
import { Overlay as ae, Content as ne, Close as se, Title as oe, Root as re } from "../atoms/dialog.js";
|
|
12
12
|
import Ee from "../atoms/avatars/ai.js";
|
|
13
13
|
import Se from "../atoms/avatars/user.js";
|
|
14
14
|
import { CustomIcon as A } from "../atoms/icons/custom-icon.js";
|
|
15
15
|
import { BuiltInIconRenderer as T } from "../atoms/icons/built-in-icon-renderer.js";
|
|
16
16
|
import { LinkWithQueryParams as ke } from "../atoms/link.js";
|
|
17
|
-
import { Markdown as
|
|
17
|
+
import { Markdown as K } from "../atoms/markdown/index.js";
|
|
18
18
|
import { AttachmentItemProvider as _e, useAttachmentItem as O } from "../providers/attachment-item-provider.js";
|
|
19
19
|
import { AttachmentsBarProvider as Be, useAttachmentsBar as F } from "../providers/attachments-bar-provider.js";
|
|
20
20
|
import { SourceItemProvider as Te, useSourceItem as H } from "../providers/source-item-provider.js";
|
|
21
21
|
import { useInkeepConfig as u } from "../providers/config-provider.js";
|
|
22
|
-
import { useInkeepConversation as
|
|
23
|
-
import { useChatEvents as
|
|
22
|
+
import { useInkeepConversation as q, SHARE_QUERY_PARAM as ye } from "../providers/conversation-provider.js";
|
|
23
|
+
import { useChatEvents as j } from "../providers/chat-events-provider.js";
|
|
24
24
|
import { useMessageFeedback as ce } from "../providers/feedback-provider.js";
|
|
25
|
-
import { MessageAttachmentsProvider as we, useMessageAttachments as
|
|
25
|
+
import { MessageAttachmentsProvider as we, useMessageAttachments as G } from "../providers/message-attachments-provider.js";
|
|
26
26
|
import { MessageProvider as He, useMessage as b } from "../providers/message-provider.js";
|
|
27
27
|
import { CheckboxIcon as Ae } from "../atoms/icons/checkbox-icon.js";
|
|
28
|
-
import { useCopyToClipboard as
|
|
28
|
+
import { useCopyToClipboard as Z } from "../hooks/use-copy-to-clipboard.js";
|
|
29
29
|
import { FeedbackItemProvider as Le, useFeedbackItem as de } from "../providers/feedback-item-provider.js";
|
|
30
30
|
import { stringifyAttachments as xe } from "../utils/get-message-metadata.js";
|
|
31
31
|
import { dataAttr as p, maybeRender as M, getInitials as De, getMessageContent as me } from "../utils/misc.js";
|
|
@@ -170,7 +170,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
170
170
|
...t
|
|
171
171
|
}
|
|
172
172
|
);
|
|
173
|
-
}, lt = i(
|
|
173
|
+
}, lt = i(K, {
|
|
174
174
|
_id: "aiChatDisclaimerText"
|
|
175
175
|
}), vn = P(
|
|
176
176
|
(t) => {
|
|
@@ -281,7 +281,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
281
281
|
}), Tn = (t) => {
|
|
282
282
|
const { message: e } = b();
|
|
283
283
|
return /* @__PURE__ */ n(ft, { "data-role": e.role, ...t });
|
|
284
|
-
}, Et = i(
|
|
284
|
+
}, Et = i(ie.Root, {
|
|
285
285
|
_id: "aiChatMessageAvatarContent"
|
|
286
286
|
}), yn = (t) => {
|
|
287
287
|
const { message: e } = b(), { baseSettings: a } = u();
|
|
@@ -293,7 +293,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
293
293
|
...t
|
|
294
294
|
}
|
|
295
295
|
);
|
|
296
|
-
}, St = i(
|
|
296
|
+
}, St = i(ie.Fallback, {
|
|
297
297
|
_id: "aiChatMessageAvatarFallback"
|
|
298
298
|
}), wn = P(
|
|
299
299
|
(t) => {
|
|
@@ -307,7 +307,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
307
307
|
}
|
|
308
308
|
) : null;
|
|
309
309
|
}
|
|
310
|
-
), ve = i(
|
|
310
|
+
), ve = i(ie.Image, {
|
|
311
311
|
_id: "aiChatMessageAvatarImage"
|
|
312
312
|
}), Hn = P(
|
|
313
313
|
(t) => {
|
|
@@ -325,6 +325,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
325
325
|
ve,
|
|
326
326
|
{
|
|
327
327
|
"data-type": "image",
|
|
328
|
+
alt: "User avatar",
|
|
328
329
|
"data-role": r.role,
|
|
329
330
|
src: s.userAvatar,
|
|
330
331
|
...t
|
|
@@ -340,6 +341,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
340
341
|
ve,
|
|
341
342
|
{
|
|
342
343
|
src: C,
|
|
344
|
+
alt: "AI assistant avatar",
|
|
343
345
|
"data-type": "image",
|
|
344
346
|
"data-role": r.role,
|
|
345
347
|
onLoadingStatusChange: h(
|
|
@@ -399,7 +401,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
399
401
|
}, Ht = i("div", {
|
|
400
402
|
_id: "aiChatMessageAttachments__Item"
|
|
401
403
|
}), Nn = (t) => {
|
|
402
|
-
const { attachment: e, onClick: a, ...s } = t, { selectItem: o, onOpen: r } =
|
|
404
|
+
const { attachment: e, onClick: a, ...s } = t, { selectItem: o, onOpen: r } = G();
|
|
403
405
|
return /* @__PURE__ */ n(_e, { attachment: e, children: /* @__PURE__ */ n(
|
|
404
406
|
Ht,
|
|
405
407
|
{
|
|
@@ -419,10 +421,10 @@ const et = "__intro__", tt = i("div", {
|
|
|
419
421
|
}), $n = (t) => {
|
|
420
422
|
const { attachment: e } = O();
|
|
421
423
|
return /* @__PURE__ */ n(xt, { children: e.title, ...t });
|
|
422
|
-
}, Dt = i(
|
|
424
|
+
}, Dt = i(re, {
|
|
423
425
|
_id: "aiChatMessageAttachmentsPreview"
|
|
424
426
|
}), Qn = (t) => {
|
|
425
|
-
const { onOpenChange: e, ...a } = t, { selectItem: s, isOpen: o, onClose: r, selectedItem: c } =
|
|
427
|
+
const { onOpenChange: e, ...a } = t, { selectItem: s, isOpen: o, onClose: r, selectedItem: c } = G();
|
|
426
428
|
return /* @__PURE__ */ n(
|
|
427
429
|
Dt,
|
|
428
430
|
{
|
|
@@ -433,15 +435,15 @@ const et = "__intro__", tt = i("div", {
|
|
|
433
435
|
...a
|
|
434
436
|
}
|
|
435
437
|
);
|
|
436
|
-
}, Vn = i(
|
|
438
|
+
}, Vn = i(ae, {
|
|
437
439
|
_id: "aiChatMessageAttachmentsPreview__Overlay"
|
|
438
|
-
}), Un = i(
|
|
440
|
+
}), Un = i(ne, {
|
|
439
441
|
_id: "aiChatMessageAttachmentsPreview__Content",
|
|
440
442
|
"aria-describedby": void 0
|
|
441
|
-
}), Ot = i(
|
|
443
|
+
}), Ot = i(oe, {
|
|
442
444
|
_id: "aiChatMessageAttachmentsPreview__Header"
|
|
443
445
|
}), Kn = (t) => {
|
|
444
|
-
const { selectedItem: e } =
|
|
446
|
+
const { selectedItem: e } = G();
|
|
445
447
|
return /* @__PURE__ */ n(
|
|
446
448
|
Ot,
|
|
447
449
|
{
|
|
@@ -449,20 +451,20 @@ const et = "__intro__", tt = i("div", {
|
|
|
449
451
|
...t
|
|
450
452
|
}
|
|
451
453
|
);
|
|
452
|
-
}, qn = i(
|
|
454
|
+
}, qn = i(se, {
|
|
453
455
|
_id: "aiChatMessageAttachmentsPreview__Close",
|
|
454
456
|
children: /* @__PURE__ */ n(A, { iconKey: "close" })
|
|
455
457
|
}), Wt = i("p", {
|
|
456
458
|
_id: "aiChatMessageAttachmentsPreview__Body"
|
|
457
459
|
}), jn = (t) => {
|
|
458
|
-
const { selectedItem: e } =
|
|
460
|
+
const { selectedItem: e } = G();
|
|
459
461
|
return /* @__PURE__ */ n(Wt, { children: e?.content, ...t });
|
|
460
462
|
}, ge = i("div", {
|
|
461
463
|
_id: "aiChatMessage"
|
|
462
464
|
}), Gn = (t) => {
|
|
463
|
-
const { aiChatSettings: e } = u(), { componentStyles: a, ...s } = t, { message: o } = b(), { logEvent: r } =
|
|
465
|
+
const { aiChatSettings: e } = u(), { componentStyles: a, ...s } = t, { message: o } = b(), { logEvent: r } = j(), c = me(o), { conversation: d } = q();
|
|
464
466
|
return o.role === "user" ? /* @__PURE__ */ n(ge, { "data-role": o.role, children: c, ...s }) : /* @__PURE__ */ n(ge, { "data-role": o.role, ...s, children: /* @__PURE__ */ n(
|
|
465
|
-
|
|
467
|
+
K,
|
|
466
468
|
{
|
|
467
469
|
children: c,
|
|
468
470
|
componentStyles: a,
|
|
@@ -505,7 +507,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
505
507
|
}), Jn = (t) => {
|
|
506
508
|
const { onClick: e, action: a, ...s } = t, { handleAction: o } = le(a), r = () => {
|
|
507
509
|
o();
|
|
508
|
-
}, c = a.label || "Contact Support", d = /* @__PURE__ */ Q(
|
|
510
|
+
}, c = a.label || "Contact Support", d = /* @__PURE__ */ Q(ee, { children: [
|
|
509
511
|
a.icon && /* @__PURE__ */ n(T, { iconSettings: a.icon }),
|
|
510
512
|
c
|
|
511
513
|
] });
|
|
@@ -532,17 +534,17 @@ const et = "__intro__", tt = i("div", {
|
|
|
532
534
|
}, Vt = i("button", {
|
|
533
535
|
_id: "aiChatMessageAction"
|
|
534
536
|
}), Xn = (t) => {
|
|
535
|
-
const { action: e, onClick: a, className: s, ...o } = t, { conversation: r } =
|
|
537
|
+
const { action: e, onClick: a, className: s, ...o } = t, { conversation: r } = q(), { message: c } = b(), { isStreaming: d, messages: m } = g(), [l, C] = Z(), { feedback: v, submitPositiveFeedback: I, setCurrentFeedback: y, currentFeedback: W } = ce(), { logEvent: z } = j(), [N, Y] = We(), {
|
|
536
538
|
baseSettings: { privacyPreferences: ue }
|
|
537
|
-
} = u(), { optOutAllAnalytics:
|
|
538
|
-
if (Ce && d || !
|
|
539
|
+
} = u(), { optOutAllAnalytics: J } = ue, Ce = m.at(-1)?.id === c?.id, X = c.role === "assistant";
|
|
540
|
+
if (Ce && d || !X || {
|
|
539
541
|
copy: !1,
|
|
540
|
-
upvote:
|
|
541
|
-
downvote:
|
|
542
|
+
upvote: J,
|
|
543
|
+
downvote: J
|
|
542
544
|
}[e]) return null;
|
|
543
545
|
const w = {
|
|
544
546
|
copy() {
|
|
545
|
-
C(me(c)),
|
|
547
|
+
C(me(c)), z({
|
|
546
548
|
eventName: "assistant_message_copied",
|
|
547
549
|
properties: {
|
|
548
550
|
conversation: r
|
|
@@ -551,7 +553,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
551
553
|
},
|
|
552
554
|
upvote() {
|
|
553
555
|
I(c.id).then(() => {
|
|
554
|
-
|
|
556
|
+
Y();
|
|
555
557
|
});
|
|
556
558
|
},
|
|
557
559
|
downvote() {
|
|
@@ -615,7 +617,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
615
617
|
}, jt = i(ke, {
|
|
616
618
|
_id: "aiChatMessageSourceItem"
|
|
617
619
|
}), is = (t) => {
|
|
618
|
-
const { source: e, onClick: a, ...s } = t, { logEvent: o } =
|
|
620
|
+
const { source: e, onClick: a, ...s } = t, { logEvent: o } = j(), { conversation: r } = q(), c = () => {
|
|
619
621
|
o({
|
|
620
622
|
eventName: "assistant_source_item_clicked",
|
|
621
623
|
properties: {
|
|
@@ -719,7 +721,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
719
721
|
onKeyDown: h(e, r),
|
|
720
722
|
disabled: !!d || C.isViewOnly,
|
|
721
723
|
...a,
|
|
722
|
-
children: /* @__PURE__ */ n(
|
|
724
|
+
children: /* @__PURE__ */ n(te, {})
|
|
723
725
|
}
|
|
724
726
|
);
|
|
725
727
|
}), ii = i("button", {
|
|
@@ -793,7 +795,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
793
795
|
side: "bottom",
|
|
794
796
|
sideOffset: 3,
|
|
795
797
|
align: "center",
|
|
796
|
-
children: /* @__PURE__ */ Q(
|
|
798
|
+
children: /* @__PURE__ */ Q(ee, { children: [
|
|
797
799
|
/* @__PURE__ */ n(di, {}),
|
|
798
800
|
"Attachments will be kept in context for the entire conversation."
|
|
799
801
|
] })
|
|
@@ -824,7 +826,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
824
826
|
...s
|
|
825
827
|
}
|
|
826
828
|
);
|
|
827
|
-
}, hi = i(
|
|
829
|
+
}, hi = i(re, {
|
|
828
830
|
_id: "aiChatAttachmentsBar__Modal"
|
|
829
831
|
}), Bs = (t) => {
|
|
830
832
|
const { onOpenChange: e, ...a } = t, { selectInput: s, isOpen: o, onClose: r, selectedInput: c } = F();
|
|
@@ -838,14 +840,14 @@ const et = "__intro__", tt = i("div", {
|
|
|
838
840
|
...a
|
|
839
841
|
}
|
|
840
842
|
);
|
|
841
|
-
}, Ts = i(
|
|
843
|
+
}, Ts = i(ae, {
|
|
842
844
|
_id: "aiChatAttachmentsBar__ModalOverlay"
|
|
843
|
-
}), ys = i(
|
|
845
|
+
}), ys = i(ne, {
|
|
844
846
|
_id: "aiChatAttachmentsBar__ModalContent",
|
|
845
847
|
"aria-describedby": void 0
|
|
846
848
|
}), ws = i("div", {
|
|
847
849
|
_id: "aiChatAttachmentsBar__ModalHeader"
|
|
848
|
-
}), ui = i(
|
|
850
|
+
}), ui = i(oe, {
|
|
849
851
|
_id: "aiChatAttachmentsBar__ModalHeading"
|
|
850
852
|
}), Hs = (t) => {
|
|
851
853
|
const { selectedInput: e } = F(), a = `Add ${e?.displayName}`;
|
|
@@ -860,7 +862,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
860
862
|
}), xs = (t) => {
|
|
861
863
|
const { children: e, ...a } = t, { selectedInput: s } = F(), o = s?.workflowModalProps?.modalHelpElement;
|
|
862
864
|
return o ? /* @__PURE__ */ n(pi, { asChild: !e, children: e || o, ...a }) : null;
|
|
863
|
-
}, Ds = i(
|
|
865
|
+
}, Ds = i(se, {
|
|
864
866
|
_id: "aiChatAttachmentsBar__ModalClose",
|
|
865
867
|
children: /* @__PURE__ */ n(A, { iconKey: "close" })
|
|
866
868
|
}), Os = i("div", {
|
|
@@ -950,7 +952,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
950
952
|
"aria-invalid": !!s.errors.content,
|
|
951
953
|
onChange: h(e, s.onChange),
|
|
952
954
|
...a,
|
|
953
|
-
children: /* @__PURE__ */ n(
|
|
955
|
+
children: /* @__PURE__ */ n(te, { maxRows: 10 })
|
|
954
956
|
}
|
|
955
957
|
);
|
|
956
958
|
}, Fi = i("span", {
|
|
@@ -989,7 +991,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
989
991
|
}), Mi = i(B.Trigger, {
|
|
990
992
|
_id: "aiChat__ChatAction"
|
|
991
993
|
}), Fe = (t) => {
|
|
992
|
-
const { action: e, onClick: a, className: s, ...o } = t, { clear: r, stop: c, isLoading: d, messages: m, selectedWorkflow: l } = g(), { conversation: C } =
|
|
994
|
+
const { action: e, onClick: a, className: s, ...o } = t, { clear: r, stop: c, isLoading: d, messages: m, selectedWorkflow: l } = g(), { conversation: C } = q(), { aiChatSettings: v, baseSettings: I } = u(), { logEvent: y } = j(), [W, z] = Z(), [N, Y] = Z();
|
|
993
995
|
if ({
|
|
994
996
|
help: !1,
|
|
995
997
|
copy: m.length === 0 || !v.isCopyChatButtonVisible || d,
|
|
@@ -997,7 +999,7 @@ const et = "__intro__", tt = i("div", {
|
|
|
997
999
|
clear: m.length === 0 || v.isViewOnly || d,
|
|
998
1000
|
stop: !d
|
|
999
1001
|
}[e]) return null;
|
|
1000
|
-
const
|
|
1002
|
+
const X = {
|
|
1001
1003
|
// Help actions are handled by HelpAction component
|
|
1002
1004
|
help: () => {
|
|
1003
1005
|
},
|
|
@@ -1016,7 +1018,7 @@ ${E}${$}`;
|
|
|
1016
1018
|
---
|
|
1017
1019
|
|
|
1018
1020
|
`);
|
|
1019
|
-
|
|
1021
|
+
z(R);
|
|
1020
1022
|
},
|
|
1021
1023
|
share: async () => {
|
|
1022
1024
|
const R = {
|
|
@@ -1038,7 +1040,7 @@ ${E}${$}`;
|
|
|
1038
1040
|
);
|
|
1039
1041
|
if (E) {
|
|
1040
1042
|
const $ = `${v.shareChatUrlBasePath}?${ye}=${E?.id}`;
|
|
1041
|
-
|
|
1043
|
+
Y($), y({
|
|
1042
1044
|
eventName: "chat_share_button_clicked",
|
|
1043
1045
|
properties: {
|
|
1044
1046
|
sharedConversationId: E?.id,
|
|
@@ -1062,7 +1064,7 @@ ${E}${$}`;
|
|
|
1062
1064
|
"data-copied": p(W || N),
|
|
1063
1065
|
className: `${s} ${e}`,
|
|
1064
1066
|
children: /* @__PURE__ */ n(fi, { action: e }),
|
|
1065
|
-
onClick: h(a,
|
|
1067
|
+
onClick: h(a, X[e]),
|
|
1066
1068
|
...o
|
|
1067
1069
|
}
|
|
1068
1070
|
) });
|
|
@@ -1173,7 +1175,7 @@ ${E}${$}`;
|
|
|
1173
1175
|
}), ro = (t) => {
|
|
1174
1176
|
const { action: e, ...a } = t;
|
|
1175
1177
|
return e.icon ? /* @__PURE__ */ n(wi, { iconSettings: e.icon, ...a }) : null;
|
|
1176
|
-
}, Hi = i(
|
|
1178
|
+
}, Hi = i(re, {
|
|
1177
1179
|
_id: "aiChatFeedbackModal"
|
|
1178
1180
|
}), co = (t) => {
|
|
1179
1181
|
const { onOpenChange: e, ...a } = t, { currentFeedback: s, setCurrentFeedback: o } = ce();
|
|
@@ -1185,15 +1187,15 @@ ${E}${$}`;
|
|
|
1185
1187
|
...a
|
|
1186
1188
|
}
|
|
1187
1189
|
);
|
|
1188
|
-
}, mo = i(
|
|
1190
|
+
}, mo = i(ae, {
|
|
1189
1191
|
_id: "aiChatFeedbackModal__Overlay"
|
|
1190
|
-
}), lo = i(
|
|
1192
|
+
}), lo = i(ne, {
|
|
1191
1193
|
_id: "aiChatFeedbackModal__Content",
|
|
1192
1194
|
"aria-describedby": void 0
|
|
1193
|
-
}), ho = i(
|
|
1195
|
+
}), ho = i(oe, {
|
|
1194
1196
|
_id: "aiChatFeedbackModal__Header",
|
|
1195
1197
|
children: "Help improve my answers!"
|
|
1196
|
-
}), uo = i(
|
|
1198
|
+
}), uo = i(se, {
|
|
1197
1199
|
_id: "aiChatFeedbackModal__Close",
|
|
1198
1200
|
children: /* @__PURE__ */ n(A, { iconKey: "close" })
|
|
1199
1201
|
}), Co = i("div", {
|
|
@@ -1280,7 +1282,7 @@ ${E}${$}`;
|
|
|
1280
1282
|
}), Eo = (t) => {
|
|
1281
1283
|
const { form: e } = _();
|
|
1282
1284
|
return e?.heading ? /* @__PURE__ */ n(Qi, { children: e.heading, ...t }) : null;
|
|
1283
|
-
}, Vi = i(
|
|
1285
|
+
}, Vi = i(K, {
|
|
1284
1286
|
_id: "aiChatForm__Description"
|
|
1285
1287
|
}), So = (t) => {
|
|
1286
1288
|
const { form: e } = _();
|
|
@@ -1392,7 +1394,7 @@ ${E}${$}`;
|
|
|
1392
1394
|
_id: "aiChatForm__FieldTextArea",
|
|
1393
1395
|
type: "textarea",
|
|
1394
1396
|
asChild: !0,
|
|
1395
|
-
children: /* @__PURE__ */ n(
|
|
1397
|
+
children: /* @__PURE__ */ n(te, { maxRows: 8 })
|
|
1396
1398
|
}), zi = i(U.Root, {
|
|
1397
1399
|
_id: "aiChatForm__FieldCheckbox"
|
|
1398
1400
|
}), Lo = (t) => {
|
|
@@ -1482,8 +1484,8 @@ ${E}${$}`;
|
|
|
1482
1484
|
children: "Submit",
|
|
1483
1485
|
type: "submit"
|
|
1484
1486
|
}), zo = (t) => {
|
|
1485
|
-
const { onClick: e, ...a } = t, { isSubmitting: s } = _();
|
|
1486
|
-
return /* @__PURE__ */ n(ta, { disabled: s, ...a });
|
|
1487
|
+
const { onClick: e, ...a } = t, { isSubmitting: s, form: o } = _(), r = o?.buttons.submit.label || "Submit";
|
|
1488
|
+
return /* @__PURE__ */ n(ta, { disabled: s, ...a, children: r });
|
|
1487
1489
|
}, ia = i("div", {
|
|
1488
1490
|
_id: "aiChatForm__Success"
|
|
1489
1491
|
}), Yo = (t) => {
|
|
@@ -1493,12 +1495,12 @@ ${E}${$}`;
|
|
|
1493
1495
|
_id: "aiChatForm__SuccessHeading"
|
|
1494
1496
|
}), Jo = (t) => {
|
|
1495
1497
|
const { form: e } = _();
|
|
1496
|
-
return /* @__PURE__ */ n(aa, { children: e?.successView
|
|
1497
|
-
}, na = i(
|
|
1498
|
+
return /* @__PURE__ */ n(aa, { children: e?.successView?.heading, ...t });
|
|
1499
|
+
}, na = i(K, {
|
|
1498
1500
|
_id: "aiChatForm__SuccessMessage"
|
|
1499
1501
|
}), Xo = (t) => {
|
|
1500
1502
|
const { form: e } = _();
|
|
1501
|
-
return /* @__PURE__ */ n(na, { children: e?.successView
|
|
1503
|
+
return /* @__PURE__ */ n(na, { children: e?.successView?.message, ...t });
|
|
1502
1504
|
}, sa = i("button", {
|
|
1503
1505
|
_id: "aiChatForm__SuccessButton"
|
|
1504
1506
|
}), Zo = (t) => {
|
|
@@ -1509,7 +1511,7 @@ ${E}${$}`;
|
|
|
1509
1511
|
sa,
|
|
1510
1512
|
{
|
|
1511
1513
|
onClick: h(e, o),
|
|
1512
|
-
children: /* @__PURE__ */ Q(
|
|
1514
|
+
children: /* @__PURE__ */ Q(ee, { children: [
|
|
1513
1515
|
c,
|
|
1514
1516
|
d
|
|
1515
1517
|
] }),
|
package/dist/index.d.cts
CHANGED
|
@@ -3451,7 +3451,7 @@ declare const PrimitiveFormClose: ForwardRefExoticComponent< PolymorphicProps &
|
|
|
3451
3451
|
|
|
3452
3452
|
declare const PrimitiveFormContent: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
3453
3453
|
|
|
3454
|
-
declare const PrimitiveFormDescription: ForwardRefExoticComponent< PolymorphicProps & Omit<
|
|
3454
|
+
declare const PrimitiveFormDescription: ForwardRefExoticComponent< PolymorphicProps & Omit< ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & MarkdownProps, "_id"> & Partial<Pick< ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & MarkdownProps, "_id">>>;
|
|
3455
3455
|
|
|
3456
3456
|
declare const PrimitiveFormError: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id">>>;
|
|
3457
3457
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3451,7 +3451,7 @@ declare const PrimitiveFormClose: ForwardRefExoticComponent< PolymorphicProps &
|
|
|
3451
3451
|
|
|
3452
3452
|
declare const PrimitiveFormContent: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
3453
3453
|
|
|
3454
|
-
declare const PrimitiveFormDescription: ForwardRefExoticComponent< PolymorphicProps & Omit<
|
|
3454
|
+
declare const PrimitiveFormDescription: ForwardRefExoticComponent< PolymorphicProps & Omit< ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & MarkdownProps, "_id"> & Partial<Pick< ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & MarkdownProps, "_id">>>;
|
|
3455
3455
|
|
|
3456
3456
|
declare const PrimitiveFormError: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id">>>;
|
|
3457
3457
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),t=require("react"),f=require("../atoms/api/analytics/events.cjs"),b=require("./config-provider.cjs"),x=require("./user-provider.cjs"),E=t.createContext(void 0),q=({children:e})=>{const{baseSettings:s,componentType:r}=b.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:m,env:g,analyticsProperties:v}=s,{userProperties:u}=x.useUser(),l=t.useMemo(()=>({widgetLibraryVersion:"0.5.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),t=require("react"),f=require("../atoms/api/analytics/events.cjs"),b=require("./config-provider.cjs"),x=require("./user-provider.cjs"),E=t.createContext(void 0),q=({children:e})=>{const{baseSettings:s,componentType:r}=b.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:m,env:g,analyticsProperties:v}=s,{userProperties:u}=x.useUser(),l=t.useMemo(()=>({widgetLibraryVersion:"0.5.89",componentType:r,tags:a}),[r,a]),d=!m.optOutAllAnalytics&&g!=="development",P={logEvent:t.useCallback(async n=>{const o={...l,...n.properties,...v},p={eventName:n.eventName,properties:o,userProperties:u},y=["modal_opened","modal_closed"].includes(n.eventName);if(d&&!y){if("conversation"in o&&!o.conversation?.id)return;f.logEvent(p,i,c)}s.onEvent?.(p)},[d,s,i,c,u,l,v])};return B.jsx(E.Provider,{value:P,children:e})},C=()=>{const e=t.useContext(E);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=q;exports.useBaseEvents=C;
|
|
@@ -7,7 +7,7 @@ import { useUser as A } from "./user-provider.js";
|
|
|
7
7
|
const u = B(void 0), $ = ({ children: e }) => {
|
|
8
8
|
const { baseSettings: t, componentType: s } = w(), { apiKey: r, analyticsApiBaseUrl: i, tags: a, privacyPreferences: d, env: E, analyticsProperties: c } = t, { userProperties: v } = A(), p = P(
|
|
9
9
|
() => ({
|
|
10
|
-
widgetLibraryVersion: "0.5.
|
|
10
|
+
widgetLibraryVersion: "0.5.89",
|
|
11
11
|
componentType: s,
|
|
12
12
|
tags: a
|
|
13
13
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),o=require("react"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),o=require("react"),w=require("react-hook-form"),x=require("./conversation-provider.cjs"),P=require("../components/modal/modal-provider.cjs"),M=require("../utils/form.cjs"),V="root.serverError",h=o.createContext(void 0);function S(){const[e,n]=o.useState(null),[v,u]=o.useState(!1),{conversation:i}=x.useInkeepConversation(),F=P.useModal(),C=t=>{n(t)},a=()=>{n(null),u(!1),e?.buttons.close?.action==="close_modal"&&F?.setOpen(!1)},c=o.useMemo(()=>e?.fields.map(t=>{const r=t;return"_type"in t&&t._type==="include_chat_session"&&(r.isRequired=!1,r.inputType="checkbox",i.id||(r.isHidden=!0)),r}),[e?.fields,i.id]),m=c?.find(t=>"_type"in t&&t._type==="include_chat_session"),s=o.useMemo(()=>M.getFormDefaultValues(c),[c]),{control:b,handleSubmit:p,formState:{errors:l,isSubmitting:E},setError:_,reset:d}=w.useForm({defaultValues:s});o.useEffect(()=>{s&&d(s)},[d,s]);const y=p(async t=>{const R=i.id&&m&&t[m.name]?i:null;try{await e?.buttons.submit.onSubmit({values:t,conversation:R}),u(!0),e?.successView||a()}catch(f){_(V,{message:f instanceof Error?f.message:"Something went wrong."})}}),g=l?.root?.serverError;return{form:e,openForm:C,closeForm:a,handleSubmit:y,isSuccess:v,isSubmitting:E,formError:g,fields:c,errors:l,control:b,defaultValues:s}}const j=({children:e})=>{const n=S();return q.jsx(h.Provider,{value:n,children:e})},k=()=>{const e=o.useContext(h);if(!e)throw new Error("useChatForm must be used within a ChatFormProvider");return e};exports.ChatFormProvider=j;exports.useChatForm=k;exports.useChatFormState=S;
|
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useForm as
|
|
2
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
3
|
+
import { useState as d, useMemo as p, useEffect as R, createContext as V, useContext as M } from "react";
|
|
4
|
+
import { useForm as P } from "react-hook-form";
|
|
5
5
|
import { useInkeepConversation as k } from "./conversation-provider.js";
|
|
6
6
|
import { useModal as I } from "../components/modal/modal-provider.js";
|
|
7
7
|
import { getFormDefaultValues as O } from "../utils/form.js";
|
|
8
|
-
const j = "root.serverError",
|
|
8
|
+
const j = "root.serverError", h = V(void 0);
|
|
9
9
|
function q() {
|
|
10
|
-
const [
|
|
11
|
-
r(
|
|
12
|
-
},
|
|
13
|
-
r(null), c(!1),
|
|
14
|
-
}, i =
|
|
15
|
-
const s =
|
|
16
|
-
return "_type" in
|
|
17
|
-
}), [
|
|
10
|
+
const [t, r] = d(null), [S, c] = d(!1), { conversation: n } = k(), b = I(), v = (o) => {
|
|
11
|
+
r(o);
|
|
12
|
+
}, a = () => {
|
|
13
|
+
r(null), c(!1), t?.buttons.close?.action === "close_modal" && b?.setOpen(!1);
|
|
14
|
+
}, i = p(() => t?.fields.map((o) => {
|
|
15
|
+
const s = o;
|
|
16
|
+
return "_type" in o && o._type === "include_chat_session" && (s.isRequired = !1, s.inputType = "checkbox", n.id || (s.isHidden = !0)), s;
|
|
17
|
+
}), [t?.fields, n.id]), u = i?.find((o) => "_type" in o && o._type === "include_chat_session"), e = p(() => O(i), [i]), {
|
|
18
18
|
control: C,
|
|
19
19
|
handleSubmit: F,
|
|
20
|
-
formState: { errors:
|
|
20
|
+
formState: { errors: m, isSubmitting: E },
|
|
21
21
|
setError: _,
|
|
22
|
-
reset:
|
|
23
|
-
} =
|
|
22
|
+
reset: l
|
|
23
|
+
} = P({
|
|
24
24
|
defaultValues: e
|
|
25
25
|
});
|
|
26
26
|
R(() => {
|
|
27
|
-
e &&
|
|
28
|
-
}, [
|
|
29
|
-
const
|
|
30
|
-
const
|
|
27
|
+
e && l(e);
|
|
28
|
+
}, [l, e]);
|
|
29
|
+
const w = F(async (o) => {
|
|
30
|
+
const y = n.id && u && o[u.name] ? n : null;
|
|
31
31
|
try {
|
|
32
|
-
await
|
|
33
|
-
} catch (
|
|
32
|
+
await t?.buttons.submit.onSubmit({ values: o, conversation: y }), c(!0), t?.successView || a();
|
|
33
|
+
} catch (f) {
|
|
34
34
|
_(j, {
|
|
35
|
-
message:
|
|
35
|
+
message: f instanceof Error ? f.message : "Something went wrong."
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
}),
|
|
38
|
+
}), x = m?.root?.serverError;
|
|
39
39
|
return {
|
|
40
|
-
form:
|
|
41
|
-
openForm:
|
|
42
|
-
closeForm:
|
|
43
|
-
handleSubmit:
|
|
44
|
-
isSuccess:
|
|
40
|
+
form: t,
|
|
41
|
+
openForm: v,
|
|
42
|
+
closeForm: a,
|
|
43
|
+
handleSubmit: w,
|
|
44
|
+
isSuccess: S,
|
|
45
45
|
isSubmitting: E,
|
|
46
|
-
formError:
|
|
46
|
+
formError: x,
|
|
47
47
|
fields: i,
|
|
48
|
-
errors:
|
|
48
|
+
errors: m,
|
|
49
49
|
control: C,
|
|
50
50
|
defaultValues: e
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
const G = ({ children:
|
|
53
|
+
const G = ({ children: t }) => {
|
|
54
54
|
const r = q();
|
|
55
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ g(h.Provider, { value: r, children: t });
|
|
56
56
|
}, J = () => {
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
57
|
+
const t = M(h);
|
|
58
|
+
if (!t)
|
|
59
59
|
throw new Error("useChatForm must be used within a ChatFormProvider");
|
|
60
|
-
return
|
|
60
|
+
return t;
|
|
61
61
|
};
|
|
62
62
|
export {
|
|
63
63
|
G as ChatFormProvider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/cxkit-primitives",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.89",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"remark-gfm": "^4.0.1",
|
|
64
64
|
"unist-util-visit": "^5.0.0",
|
|
65
65
|
"use-sync-external-store": "^1.4.0",
|
|
66
|
-
"@inkeep/cxkit-color-mode": "0.5.
|
|
67
|
-
"@inkeep/cxkit-theme": "0.5.
|
|
68
|
-
"@inkeep/cxkit-types": "0.5.
|
|
66
|
+
"@inkeep/cxkit-color-mode": "0.5.89",
|
|
67
|
+
"@inkeep/cxkit-theme": "0.5.89",
|
|
68
|
+
"@inkeep/cxkit-types": "0.5.89"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@biomejs/biome": "1.9.4",
|