@inkeep/agents-ui 0.14.9 → 0.14.10
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/primitives/atoms/dialog.cjs +1 -1
- package/dist/primitives/atoms/dialog.js +90 -87
- package/dist/primitives/components/embedded-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat.js +33 -33
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),T=require("react"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),T=require("react"),m=require("@radix-ui/primitive"),P=require("@radix-ui/react-compose-refs"),H=require("@radix-ui/react-context"),R=require("@radix-ui/react-id"),W=require("@radix-ui/react-use-controllable-state"),z=require("@radix-ui/react-dismissable-layer"),B=require("@zag-js/focus-trap"),K=require("@radix-ui/react-portal"),_=require("@radix-ui/react-presence"),f=require("@radix-ui/react-primitive"),U=require("@radix-ui/react-focus-guards"),V=require("react-remove-scroll"),Y=require("aria-hidden"),Z=require("@radix-ui/react-slot");function J(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const c=J(T),x="Dialog",[N,Q]=H.createContextScope(x),[X,l]=N(x),O=e=>{const{__scopeDialog:r,children:o,open:s,defaultOpen:n,onOpenChange:t,modal:a=!0}=e,u=c.useRef(null),p=c.useRef(null),[g=!1,D]=W.useControllableState({prop:s,defaultProp:n??!1,onChange:t});return i.jsx(X,{scope:r,triggerRef:u,contentRef:p,contentId:R.useId(),titleId:R.useId(),descriptionId:R.useId(),open:g,onOpenChange:D,onOpenToggle:c.useCallback(()=>D(G=>!G),[D]),modal:a,children:o})};O.displayName=x;const M="DialogTrigger",S=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(M,o),t=P.useComposedRefs(r,n.triggerRef);return i.jsx(f.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":j(n.open),...s,ref:t,onClick:m.composeEventHandlers(e.onClick,n.onOpenToggle)})});S.displayName=M;const v="DialogPortal",[$,q]=N(v,{forceMount:void 0}),y=e=>{const{__scopeDialog:r,forceMount:o,children:s,container:n}=e,t=l(v,r);return i.jsx($,{scope:r,forceMount:o,children:c.Children.map(s,a=>i.jsx(_.Presence,{present:o||t.open,children:i.jsx(K.Portal,{asChild:!0,container:n,children:a})}))})};y.displayName=v;const C="DialogOverlay",E=c.forwardRef((e,r)=>{const o=q(C,e.__scopeDialog),{forceMount:s=o.forceMount,...n}=e,t=l(C,e.__scopeDialog);return t.modal?i.jsx(_.Presence,{present:s||t.open,children:i.jsx(ee,{...n,ref:r})}):null});E.displayName=C;const ee=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(C,o);return i.jsx(V.RemoveScroll,{as:Z.Slot,allowPinchZoom:!0,shards:[n.contentRef],gapMode:"padding",removeScrollBar:!0,children:i.jsx(f.Primitive.div,{"data-state":j(n.open),...s,ref:r,style:{pointerEvents:"auto",...s.style}})})}),d="DialogContent",h=c.forwardRef((e,r)=>{const o=q(d,e.__scopeDialog),{forceMount:s=o.forceMount,...n}=e,t=l(d,e.__scopeDialog);return i.jsx(_.Presence,{present:s||t.open,children:t.modal?i.jsx(te,{...n,ref:r}):i.jsx(oe,{...n,ref:r})})});h.displayName=d;const te=c.forwardRef((e,r)=>{const o=l(d,e.__scopeDialog),s=c.useRef(null),n=P.useComposedRefs(r,o.contentRef,s);return c.useEffect(()=>{const t=s.current;if(t){const a=document.querySelectorAll("[data-ikp-component]");return Y.hideOthers([t,...Array.from(a)])}},[]),i.jsx(A,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onPointerDownOutside:m.composeEventHandlers(e.onPointerDownOutside,t=>{const a=t.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&t.preventDefault(),t.target.closest("[data-ikp-component]")&&t.preventDefault()}),onFocusOutside:m.composeEventHandlers(e.onFocusOutside,t=>t.preventDefault())})}),oe=c.forwardRef((e,r)=>{const o=l(d,e.__scopeDialog),s=c.useRef(!1),n=c.useRef(!1);return i.jsx(A,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,t.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=t.target;o.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&n.current&&t.preventDefault()}})}),A=c.forwardRef((e,r)=>{const{__scopeDialog:o,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:t,...a}=e,u=l(d,o),p=c.useRef(null),g=P.useComposedRefs(r,p);return U.useFocusGuards(),T.useEffect(()=>{if(s)return B.trapFocus(p.current,{preventScroll:!0,onActivate:n,onDeactivate:t,initialFocus:!1})},[]),i.jsx(z.DismissableLayer,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":j(u.open),...a,ref:g,onDismiss:()=>u.onOpenChange(!1)})}),w="DialogTitle",I=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(w,o);return i.jsx(f.Primitive.h2,{id:n.titleId,...s,ref:r})});I.displayName=w;const k="DialogDescription",F=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(k,o);return i.jsx(f.Primitive.p,{id:n.descriptionId,...s,ref:r})});F.displayName=k;const L="DialogClose",b=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(L,o);return i.jsx(f.Primitive.button,{type:"button",...s,ref:r,onClick:m.composeEventHandlers(e.onClick,()=>n.onOpenChange(!1))})});b.displayName=L;function j(e){return e?"open":"closed"}const ne=O,re=y,se=E,ce=h,ie=I,ae=b;exports.Close=ae;exports.Content=ce;exports.Dialog=O;exports.DialogClose=b;exports.DialogContent=h;exports.DialogDescription=F;exports.DialogOverlay=E;exports.DialogPortal=y;exports.DialogTitle=I;exports.DialogTrigger=S;exports.Overlay=se;exports.Portal=re;exports.Root=ne;exports.Title=ie;exports.createDialogScope=Q;
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import * as
|
|
2
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import * as i from "react";
|
|
4
4
|
import { useEffect as G } from "react";
|
|
5
|
-
import { composeEventHandlers as
|
|
5
|
+
import { composeEventHandlers as D } from "@radix-ui/primitive";
|
|
6
6
|
import { useComposedRefs as _ } from "@radix-ui/react-compose-refs";
|
|
7
|
-
import { createContextScope as
|
|
7
|
+
import { createContextScope as W } from "@radix-ui/react-context";
|
|
8
8
|
import { useId as C } from "@radix-ui/react-id";
|
|
9
|
-
import { useControllableState as
|
|
10
|
-
import { DismissableLayer as
|
|
11
|
-
import { trapFocus as
|
|
12
|
-
import { Portal as
|
|
9
|
+
import { useControllableState as $ } from "@radix-ui/react-use-controllable-state";
|
|
10
|
+
import { DismissableLayer as j } from "@radix-ui/react-dismissable-layer";
|
|
11
|
+
import { trapFocus as q } from "@zag-js/focus-trap";
|
|
12
|
+
import { Portal as B } from "@radix-ui/react-portal";
|
|
13
13
|
import { Presence as O } from "@radix-ui/react-presence";
|
|
14
14
|
import { Primitive as d } from "@radix-ui/react-primitive";
|
|
15
|
-
import { useFocusGuards as
|
|
16
|
-
import { RemoveScroll as
|
|
17
|
-
import { hideOthers as
|
|
18
|
-
import { Slot as
|
|
19
|
-
const P = "Dialog", [E, Co] =
|
|
20
|
-
const { __scopeDialog: n, children: r, open: s, defaultOpen: e, onOpenChange: t, modal: a = !0 } = o,
|
|
15
|
+
import { useFocusGuards as H } from "@radix-ui/react-focus-guards";
|
|
16
|
+
import { RemoveScroll as K } from "react-remove-scroll";
|
|
17
|
+
import { hideOthers as V } from "aria-hidden";
|
|
18
|
+
import { Slot as Y } from "@radix-ui/react-slot";
|
|
19
|
+
const P = "Dialog", [E, Co] = W(P), [Z, l] = E(P), I = (o) => {
|
|
20
|
+
const { __scopeDialog: n, children: r, open: s, defaultOpen: e, onOpenChange: t, modal: a = !0 } = o, p = i.useRef(null), u = i.useRef(null), [g = !1, m] = $({
|
|
21
21
|
prop: s,
|
|
22
22
|
defaultProp: e ?? !1,
|
|
23
23
|
onChange: t
|
|
24
24
|
});
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
25
|
+
return /* @__PURE__ */ c(
|
|
26
|
+
Z,
|
|
27
27
|
{
|
|
28
28
|
scope: n,
|
|
29
|
-
triggerRef:
|
|
30
|
-
contentRef:
|
|
29
|
+
triggerRef: p,
|
|
30
|
+
contentRef: u,
|
|
31
31
|
contentId: C(),
|
|
32
32
|
titleId: C(),
|
|
33
33
|
descriptionId: C(),
|
|
34
|
-
open:
|
|
35
|
-
onOpenChange:
|
|
36
|
-
onOpenToggle:
|
|
34
|
+
open: g,
|
|
35
|
+
onOpenChange: m,
|
|
36
|
+
onOpenToggle: i.useCallback(() => m((L) => !L), [m]),
|
|
37
37
|
modal: a,
|
|
38
38
|
children: r
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
const
|
|
42
|
+
I.displayName = P;
|
|
43
|
+
const v = "DialogTrigger", z = i.forwardRef(
|
|
44
44
|
(o, n) => {
|
|
45
|
-
const { __scopeDialog: r, ...s } = o, e = l(
|
|
46
|
-
return /* @__PURE__ */
|
|
45
|
+
const { __scopeDialog: r, ...s } = o, e = l(v, r), t = _(n, e.triggerRef);
|
|
46
|
+
return /* @__PURE__ */ c(
|
|
47
47
|
d.button,
|
|
48
48
|
{
|
|
49
49
|
type: "button",
|
|
@@ -53,41 +53,41 @@ const I = "DialogTrigger", J = c.forwardRef(
|
|
|
53
53
|
"data-state": y(e.open),
|
|
54
54
|
...s,
|
|
55
55
|
ref: t,
|
|
56
|
-
onClick:
|
|
56
|
+
onClick: D(o.onClick, e.onOpenToggle)
|
|
57
57
|
}
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
|
-
|
|
62
|
-
const h = "DialogPortal", [
|
|
61
|
+
z.displayName = v;
|
|
62
|
+
const h = "DialogPortal", [J, x] = E(h, {
|
|
63
63
|
forceMount: void 0
|
|
64
64
|
}), N = (o) => {
|
|
65
65
|
const { __scopeDialog: n, forceMount: r, children: s, container: e } = o, t = l(h, n);
|
|
66
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ c(J, { scope: n, forceMount: r, children: i.Children.map(s, (a) => /* @__PURE__ */ c(O, { present: r || t.open, children: /* @__PURE__ */ c(B, { asChild: !0, container: e, children: a }) })) });
|
|
67
67
|
};
|
|
68
68
|
N.displayName = h;
|
|
69
|
-
const
|
|
69
|
+
const R = "DialogOverlay", M = i.forwardRef(
|
|
70
70
|
(o, n) => {
|
|
71
|
-
const r = x(
|
|
72
|
-
return t.modal ? /* @__PURE__ */
|
|
71
|
+
const r = x(R, o.__scopeDialog), { forceMount: s = r.forceMount, ...e } = o, t = l(R, o.__scopeDialog);
|
|
72
|
+
return t.modal ? /* @__PURE__ */ c(O, { present: s || t.open, children: /* @__PURE__ */ c(Q, { ...e, ref: n }) }) : null;
|
|
73
73
|
}
|
|
74
74
|
);
|
|
75
|
-
M.displayName =
|
|
76
|
-
const
|
|
75
|
+
M.displayName = R;
|
|
76
|
+
const Q = i.forwardRef(
|
|
77
77
|
(o, n) => {
|
|
78
|
-
const { __scopeDialog: r, ...s } = o, e = l(
|
|
78
|
+
const { __scopeDialog: r, ...s } = o, e = l(R, r);
|
|
79
79
|
return (
|
|
80
80
|
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
81
81
|
// ie. when `Overlay` and `Content` are siblings
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
82
|
+
/* @__PURE__ */ c(
|
|
83
|
+
K,
|
|
84
84
|
{
|
|
85
|
-
as:
|
|
85
|
+
as: Y,
|
|
86
86
|
allowPinchZoom: !0,
|
|
87
87
|
shards: [e.contentRef],
|
|
88
88
|
gapMode: "padding",
|
|
89
89
|
removeScrollBar: !0,
|
|
90
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ c(
|
|
91
91
|
d.div,
|
|
92
92
|
{
|
|
93
93
|
"data-state": y(e.open),
|
|
@@ -100,42 +100,45 @@ const U = c.forwardRef(
|
|
|
100
100
|
)
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
|
-
),
|
|
103
|
+
), f = "DialogContent", T = i.forwardRef(
|
|
104
104
|
(o, n) => {
|
|
105
|
-
const r = x(
|
|
106
|
-
return /* @__PURE__ */
|
|
105
|
+
const r = x(f, o.__scopeDialog), { forceMount: s = r.forceMount, ...e } = o, t = l(f, o.__scopeDialog);
|
|
106
|
+
return /* @__PURE__ */ c(O, { present: s || t.open, children: t.modal ? /* @__PURE__ */ c(U, { ...e, ref: n }) : /* @__PURE__ */ c(X, { ...e, ref: n }) });
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
|
-
T.displayName =
|
|
110
|
-
const
|
|
109
|
+
T.displayName = f;
|
|
110
|
+
const U = i.forwardRef(
|
|
111
111
|
(o, n) => {
|
|
112
|
-
const r = l(
|
|
113
|
-
return
|
|
112
|
+
const r = l(f, o.__scopeDialog), s = i.useRef(null), e = _(n, r.contentRef, s);
|
|
113
|
+
return i.useEffect(() => {
|
|
114
114
|
const t = s.current;
|
|
115
|
-
if (t)
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
if (t) {
|
|
116
|
+
const a = document.querySelectorAll("[data-ikp-component]");
|
|
117
|
+
return V([t, ...Array.from(a)]);
|
|
118
|
+
}
|
|
119
|
+
}, []), /* @__PURE__ */ c(
|
|
120
|
+
A,
|
|
118
121
|
{
|
|
119
122
|
...o,
|
|
120
123
|
ref: e,
|
|
121
124
|
trapFocus: r.open,
|
|
122
125
|
disableOutsidePointerEvents: !0,
|
|
123
|
-
onPointerDownOutside:
|
|
124
|
-
const a = t.detail.originalEvent,
|
|
125
|
-
(a.button === 2 ||
|
|
126
|
+
onPointerDownOutside: D(o.onPointerDownOutside, (t) => {
|
|
127
|
+
const a = t.detail.originalEvent, p = a.button === 0 && a.ctrlKey === !0;
|
|
128
|
+
(a.button === 2 || p) && t.preventDefault(), t.target.closest("[data-ikp-component]") && t.preventDefault();
|
|
126
129
|
}),
|
|
127
|
-
onFocusOutside:
|
|
130
|
+
onFocusOutside: D(
|
|
128
131
|
o.onFocusOutside,
|
|
129
132
|
(t) => t.preventDefault()
|
|
130
133
|
)
|
|
131
134
|
}
|
|
132
135
|
);
|
|
133
136
|
}
|
|
134
|
-
), X =
|
|
137
|
+
), X = i.forwardRef(
|
|
135
138
|
(o, n) => {
|
|
136
|
-
const r = l(
|
|
137
|
-
return /* @__PURE__ */
|
|
138
|
-
|
|
139
|
+
const r = l(f, o.__scopeDialog), s = i.useRef(!1), e = i.useRef(!1);
|
|
140
|
+
return /* @__PURE__ */ c(
|
|
141
|
+
A,
|
|
139
142
|
{
|
|
140
143
|
...o,
|
|
141
144
|
ref: n,
|
|
@@ -149,75 +152,75 @@ const W = c.forwardRef(
|
|
|
149
152
|
}
|
|
150
153
|
);
|
|
151
154
|
}
|
|
152
|
-
),
|
|
155
|
+
), A = i.forwardRef(
|
|
153
156
|
(o, n) => {
|
|
154
|
-
const { __scopeDialog: r, trapFocus: s, onOpenAutoFocus: e, onCloseAutoFocus: t, ...a } = o,
|
|
155
|
-
return
|
|
157
|
+
const { __scopeDialog: r, trapFocus: s, onOpenAutoFocus: e, onCloseAutoFocus: t, ...a } = o, p = l(f, r), u = i.useRef(null), g = _(n, u);
|
|
158
|
+
return H(), G(() => {
|
|
156
159
|
if (s)
|
|
157
|
-
return
|
|
160
|
+
return q(u.current, {
|
|
158
161
|
preventScroll: !0,
|
|
159
162
|
onActivate: e,
|
|
160
163
|
onDeactivate: t,
|
|
161
164
|
initialFocus: !1
|
|
162
165
|
});
|
|
163
|
-
}, []), /* @__PURE__ */
|
|
164
|
-
|
|
166
|
+
}, []), /* @__PURE__ */ c(
|
|
167
|
+
j,
|
|
165
168
|
{
|
|
166
169
|
role: "dialog",
|
|
167
|
-
id:
|
|
168
|
-
"aria-describedby":
|
|
169
|
-
"aria-labelledby":
|
|
170
|
-
"data-state": y(
|
|
170
|
+
id: p.contentId,
|
|
171
|
+
"aria-describedby": p.descriptionId,
|
|
172
|
+
"aria-labelledby": p.titleId,
|
|
173
|
+
"data-state": y(p.open),
|
|
171
174
|
...a,
|
|
172
|
-
ref:
|
|
173
|
-
onDismiss: () =>
|
|
175
|
+
ref: g,
|
|
176
|
+
onDismiss: () => p.onOpenChange(!1)
|
|
174
177
|
}
|
|
175
178
|
);
|
|
176
179
|
}
|
|
177
|
-
),
|
|
180
|
+
), b = "DialogTitle", w = i.forwardRef(
|
|
178
181
|
(o, n) => {
|
|
179
|
-
const { __scopeDialog: r, ...s } = o, e = l(
|
|
180
|
-
return /* @__PURE__ */
|
|
182
|
+
const { __scopeDialog: r, ...s } = o, e = l(b, r);
|
|
183
|
+
return /* @__PURE__ */ c(d.h2, { id: e.titleId, ...s, ref: n });
|
|
181
184
|
}
|
|
182
185
|
);
|
|
183
|
-
|
|
184
|
-
const
|
|
186
|
+
w.displayName = b;
|
|
187
|
+
const k = "DialogDescription", oo = i.forwardRef(
|
|
185
188
|
(o, n) => {
|
|
186
|
-
const { __scopeDialog: r, ...s } = o, e = l(
|
|
187
|
-
return /* @__PURE__ */
|
|
189
|
+
const { __scopeDialog: r, ...s } = o, e = l(k, r);
|
|
190
|
+
return /* @__PURE__ */ c(d.p, { id: e.descriptionId, ...s, ref: n });
|
|
188
191
|
}
|
|
189
192
|
);
|
|
190
|
-
oo.displayName =
|
|
191
|
-
const
|
|
193
|
+
oo.displayName = k;
|
|
194
|
+
const F = "DialogClose", S = i.forwardRef(
|
|
192
195
|
(o, n) => {
|
|
193
|
-
const { __scopeDialog: r, ...s } = o, e = l(
|
|
194
|
-
return /* @__PURE__ */
|
|
196
|
+
const { __scopeDialog: r, ...s } = o, e = l(F, r);
|
|
197
|
+
return /* @__PURE__ */ c(
|
|
195
198
|
d.button,
|
|
196
199
|
{
|
|
197
200
|
type: "button",
|
|
198
201
|
...s,
|
|
199
202
|
ref: n,
|
|
200
|
-
onClick:
|
|
203
|
+
onClick: D(o.onClick, () => e.onOpenChange(!1))
|
|
201
204
|
}
|
|
202
205
|
);
|
|
203
206
|
}
|
|
204
207
|
);
|
|
205
|
-
|
|
208
|
+
S.displayName = F;
|
|
206
209
|
function y(o) {
|
|
207
210
|
return o ? "open" : "closed";
|
|
208
211
|
}
|
|
209
|
-
const _o =
|
|
212
|
+
const _o = I, Oo = N, Po = M, ho = T, yo = w, Eo = S;
|
|
210
213
|
export {
|
|
211
214
|
Eo as Close,
|
|
212
215
|
ho as Content,
|
|
213
|
-
|
|
214
|
-
|
|
216
|
+
I as Dialog,
|
|
217
|
+
S as DialogClose,
|
|
215
218
|
T as DialogContent,
|
|
216
219
|
oo as DialogDescription,
|
|
217
220
|
M as DialogOverlay,
|
|
218
221
|
N as DialogPortal,
|
|
219
|
-
|
|
220
|
-
|
|
222
|
+
w as DialogTitle,
|
|
223
|
+
z as DialogTrigger,
|
|
221
224
|
Po as Overlay,
|
|
222
225
|
Oo as Portal,
|
|
223
226
|
_o as Root,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Ask me anything about \`${c}\`.`:`
|
|
4
4
|
|
|
5
|
-
How can I help?`,v={parts:[{type:"text",text:r.introMessage??`${d}${m}`}],id:wa,...e,role:"assistant"};return n.jsx(re,{message:v,...i})}),nn=a.ikp("div",{_id:"aiChatMessageHeader"}),We=t=>{const{message:e}=F.useMessage();return n.jsx(nn,{"data-role":e.role,...t})},rn=a.ikp("div",{_id:"aiChatMessageLoading",children:"Thinking..."}),Ne=t=>n.jsx(rn,{...t}),sn=a.ikp("div",{_id:"aiChatMessageAvatar"}),Qe=t=>{const{message:e}=F.useMessage();return n.jsx(sn,{"data-role":e.role,...t})},on=a.ikp(ne.Root,{_id:"aiChatMessageAvatarContent"}),Ve=t=>{const{message:e}=F.useMessage(),{baseSettings:i}=b.useInkeepConfig();return n.jsx(on,{"data-username":h.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},dn=a.ikp(ne.Fallback,{_id:"aiChatMessageAvatarFallback"}),$e=C.memo(t=>{const{baseSettings:e}=b.useInkeepConfig(),{message:i}=F.useMessage();return e.userProperties.name?n.jsx(dn,{"data-role":i.role,children:h.getInitials(e.userProperties.name),...t}):null}),me=a.ikp(ne.Image,{_id:"aiChatMessageAvatarImage"}),Ue=C.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=b.useInkeepConfig(),{message:o}=F.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=Sa.useColorModeValue(c,m),[v,g]=C.useState(l);C.useEffect(()=>{g(l)},[l]);const p=A=>{A==="error"&&g(null)};return o.role==="user"?s.name?null:r.userAvatar?n.jsx(me,{"data-type":"image",alt:"User avatar","data-role":o.role,src:r.userAvatar,...t}):n.jsx(Aa.default,{"data-type":"icon","data-role":o.role,...t}):v?n.jsx(me,{src:v,alt:"AI assistant avatar","data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,p),...i}):n.jsx(Pa.default,{"data-type":"icon","data-role":o.role,...t})}),cn=a.ikp("span",{_id:"aiChatMessageName"}),Ke=t=>{const{message:e}=F.useMessage();return n.jsx(cn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},mn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),ze=t=>{const{message:e}=F.useMessage(),{messageButtons:i}=P.useChat(),r=i[e.id]||[];return n.jsx(mn,{"data-role":e.role,"data-has-message-buttons":h.dataAttr(!!r.length),...t})},ln=a.ikp("div",{_id:"aiChatMessageContent"}),Ge=t=>{const{message:e}=F.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=a.ikp("div",{_id:"aiChatMessageAttachments"}),Ye=t=>{const{message:e}=F.useMessage(),i=[];return e.role!=="user"||!i?.length?null:n.jsx(R.MessageAttachmentsProvider,{children:n.jsx(hn,{...t})})},un=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),Je=t=>{const{children:e,...i}=t,r=[];return r?n.jsx(un,{children:h.maybeRender(e,r),...i}):null},Cn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),Xe=t=>{const{attachment:e,onClick:i,...r}=t,{selectItem:s,onOpen:o}=R.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(L.AttachmentItemProvider,{attachment:e,children:n.jsx(Cn,{onClick:u.composeEventHandlers(i,d),...r})})},pn=a.ikp(B.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),Ze=t=>{const{attachment:e}=L.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(pn,{iconSettings:i,...t}):null},vn=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),et=t=>{const{attachment:e}=L.useAttachmentItem();return n.jsx(vn,{children:e.title,...t})},bn=a.ikp(E.Root,{_id:"aiChatMessageAttachmentsPreview"}),tt=t=>{const{onOpenChange:e,...i}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=R.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(bn,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},it=a.ikp(E.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),at=a.ikp(E.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),gn=a.ikp(E.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),nt=t=>{const{selectedItem:e}=R.useMessageAttachments();return n.jsx(gn,{children:e?.title||"Attachment",...t})},rt=a.ikp(E.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Pn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),st=t=>{const{selectedItem:e}=R.useMessageAttachments();return n.jsx(Pn,{children:e?.content,...t})},ot=t=>{const{text:e,componentStyles:i,...r}=t,{aiChatSettings:s}=b.useInkeepConfig(),{shouldOpenLinksInNewTab:o}=s;return n.jsx(W.Markdown,{children:e,componentStyles:i,shouldOpenLinksInNewTab:o,...r})},dt=({name:t,props:e,componentDef:i})=>{const s=ya.useShadow()?.shadowHost,o=C.useRef(void 0),d=C.useRef(null),c=C.useRef(null),m=C.useRef(!1),[l,v]=C.useState(!1),[g,p]=C.useState(!1);return C.useEffect(()=>{o.current||(o.current=`dyn:${t}:${crypto.randomUUID()}`,v(!0))},[t]),C.useLayoutEffect(()=>{if(!i||!s||!l||!o.current)return;const A=o.current,M=document.createElement("div");return M.setAttribute("data-component",t),M.setAttribute("slot",A),d.current=M,m.current=!1,s.appendChild(M),p(!0),()=>{m.current=!0,p(!1),queueMicrotask(()=>{try{c.current&&(c.current.unmount(),c.current=null)}catch(_){console.debug("Ignoring unmount error:",_)}M.parentNode===s&&M.remove(),d.current=null})}},[i,s,l,t]),C.useEffect(()=>{const A=d.current;if(!A||m.current)return;const M=I=>{if(typeof I!="function"||I.length>1)return!1;try{if(typeof I=="function"&&I.constructor===Function){const w=I({});return C.isValidElement(w)}return!1}catch{return!0}};let _;if(M(i))try{const I=i;_=C.createElement(I,e||{})}catch(I){console.error("Error creating React element from component:",I);return}else if(typeof i=="function")_=i(e||{},A,null);else{console.error("Invalid component definition");return}if(C.isValidElement(_)||typeof _=="string"){if(m.current)return;c.current||(c.current=Ha.createRoot(A)),!m.current&&c.current&&c.current.render(_);return}c.current&&!m.current&&c.current.render(null)},[i,e,g]),n.jsx("slot",{name:o.current})},An=a.ikp("div",{_id:"aiChatMessagePart"}),_n=a.ikp("div",{_id:"aiChatMessageToolbar"}),ct=t=>{const{isLoading:e,messages:i}=P.useChat(),{message:r}=F.useMessage();return i.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(_n,{...t})},En=a.ikp("div",{_id:"aiChatMessageAnnotationActions"}),mt=t=>{const{children:e,...i}=t,{message:r}=F.useMessage(),{messageButtons:s}=P.useChat(),o=s[r.id]||[];return n.jsx(En,{children:h.maybeRender(e,o),...i})},Fn=a.ikp("a",{_id:"aiChatMessageAnnotationAction"}),kn=a.ikp("button",{_id:"aiChatMessageAnnotationAction"}),lt=t=>{const{onClick:e,action:i,...r}=t,{handleAction:s}=ee.useChatAction(i),{logEvent:o}=ae.useBaseEvents(),{conversationId:d}=P.useChat(),c=()=>{s(),o({eventName:"user_escalation_indicated",properties:{escalationType:"contact_us",conversationId:d}})},m=i.label||"Contact Support",l=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(B.BuiltInIconRenderer,{iconSettings:i.icon}),m]});return i.action.type==="open_link"?n.jsx(Fn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,c),children:l,...r}):n.jsx(kn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,c),children:l,...r})},In=a.ikp("button",{_id:"aiChatMessageAction"}),ht=t=>{const{action:e,onClick:i,className:r,...s}=t,{conversationId:o}=P.useChat(),{baseSettings:{onFeedback:d}}=b.useInkeepConfig(),{message:c}=F.useMessage(),{isStreaming:m,messages:l}=P.useChat(),[v,g]=Y.useCopyToClipboard(),{feedback:p,submitPositiveFeedback:A,setCurrentFeedback:M,currentFeedback:_}=Z.useMessageFeedback(),{logEvent:I}=ae.useBaseEvents(),[w,de]=Fa.useSettleAction(),U=l.at(-1)?.id===c?.id,K=c.role==="assistant";if(U&&m||!K)return null;const q={copy(){g(h.getMessageContent(c)),I({eventName:"assistant_message_copied",properties:{conversationId:o}})},upvote(){A(c.id).then(()=>{de()})},downvote(){M(c.id)}},z={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},G={copy:n.jsx(f.CustomIcon,{iconKey:v?"messageCopied":"messageCopy"}),upvote:n.jsx(f.CustomIcon,{iconKey:w?"messageCopied":"thumbsUp"}),downvote:n.jsx(f.CustomIcon,{iconKey:"thumbsDown"})},ha={copy:{"data-copied":h.dataAttr(v)},upvote:{"data-upvoted":h.dataAttr(p[c.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(p[c.id]?.type==="negative"),"data-state":_===null?"closed":"open"}};return{copy:!1,upvote:!d,downvote:!d}[e]?null:n.jsx(In,{"data-action":e,...ha[e],children:G[e],"aria-label":z[e],className:`${r} ${e}`,onClick:u.composeEventHandlers(i,q[e]),...s})},Mn=a.ikp("div",{_id:"aiChatMessageSources"}),ut=t=>{const{message:e}=F.useMessage();return e.role!=="assistant"||!e.parts.filter(r=>r.type==="data-artifact"&&r.data?.type?.toLowerCase()===he.CITATION_ARTIFACT_TYPE)?.length?null:n.jsx(Mn,{...t})},fn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Ct=t=>n.jsx(fn,{children:"Sources",...t}),Sn=a.ikp("div",{_id:"aiChatMessageSources__List"}),pt=t=>{const{message:e}=F.useMessage(),{children:i,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=b.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.parts.filter(g=>g.type==="data-artifact"&&g.data?.type?.toLowerCase()===he.CITATION_ARTIFACT_TYPE);if(!m?.length)return null;const l=new Map,v=m.filter(g=>{const p=g.data.artifactSummary.url;return!p||l.has(p)?!1:(l.set(p,!0),!0)}).map(g=>{const p=g.data,A={id:p?.artifactId,title:p?.artifactSummary?.title||p?.name,url:p?.artifactSummary?.url||"",description:"",breadcrumbs:[],type:p?.artifactSummary?.record_type,contentType:p?.artifactType,tag:p?.artifactType},_=(s??(w=>({...w,shouldOpenInNewTab:d,icon:ja.getIcon(w)})))(A,"chatSourceItem",{organizationDisplayName:o,tabs:c}),I=_.shouldOpenInNewTab!==void 0?_.shouldOpenInNewTab:d;return{..._,isExternal:I}});return n.jsx(Sn,{children:h.maybeRender(i,v),...r})},xn=a.ikp(_a.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),vt=t=>{const{source:e,onClick:i,...r}=t,{logEvent:s}=ae.useBaseEvents(),{conversationId:o}=P.useChat(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversationId:o,link:e}})};return n.jsx(T.SourceItemProvider,{source:e,children:n.jsx(xn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...r})})},Bn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),bt=t=>{const{source:e}=T.useSourceItem();return e.breadcrumbs?.length?n.jsx(Bn,{"data-type":e.type,...t}):null},Tn=a.ikp(f.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),yn=a.ikp(B.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),gt=t=>{const{source:e}=T.useSourceItem();return n.jsx(yn,{iconSettings:e.icon,"data-type":e.type,...t})},jn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),Pt=t=>{const{source:e}=T.useSourceItem();return n.jsx(jn,{"data-type":e.type,children:e.title,...t})},Hn=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),At=t=>{const{source:e}=T.useSourceItem();return n.jsx(Hn,{"data-type":e.type,...t})},wn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),_t=t=>{const{source:e}=T.useSourceItem(),{children:i,...r}=t,s=C.useMemo(()=>e.description?Ma.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(wn,{"data-type":e.type,children:h.maybeRender(i,s),...r}):null},Ln=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),Et=t=>{const{part:e,...i}=t,{source:r}=T.useSourceItem();return typeof e=="string"?e:n.jsx(Ln,{"data-type":r.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...i})},Dn=a.ikp(f.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),Ft=t=>{const{source:e}=T.useSourceItem();return n.jsx(Dn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},kt=a.ikp("div",{_id:"aiChatFooter"}),It=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Mt=a.ikp("div",{_id:"aiChatInput__Group"}),Rn=a.ikp("textarea",{_id:"aiChatInput"}),ft=C.forwardRef(({onChange:t,onKeyDown:e,...i},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:l}=P.useChat(),{aiChatSettings:v}=b.useInkeepConfig(),g=te.useComposedRefs(r,l);return Ta.useWidgetAutoFocus("chat",l,m),n.jsx(Rn,{asChild:!0,ref:g,maxLength:99999,placeholder:v.placeholder,value:d,onChange:u.composeEventHandlers(t,s),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||v.isViewOnly,...i,children:n.jsx(X,{})})}),On=a.ikp("button",{_id:"aiChatInput__SendButton"}),St=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:r}=P.useChat(),{aiChatSettings:s}=b.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(On,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!r||s.isViewOnly,...d})},xt=a.ikp(f.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),qn=a.ikp("div",{_id:"aiChatAttachmentsBar"}),Bt=t=>{const e={supportedInputs:[]};return!e||!e.supportedInputs?.length?null:n.jsx(S.AttachmentsBarProvider,{children:n.jsx(qn,{...t})})},Wn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Tt=t=>{const{children:e,...i}=t,r=[];return n.jsx(Wn,{children:h.maybeRender(e,r),...i})},Nn=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),yt=t=>{const{attachment:e,...i}=t;return n.jsx(L.AttachmentItemProvider,{attachment:e,children:n.jsx(Nn,{...i})})},Qn=a.ikp(B.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),jt=t=>{const{attachment:e}=L.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Qn,{iconSettings:i,...t}):null},Vn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),Ht=t=>{const{attachment:e}=L.useAttachmentItem();return n.jsx(Vn,{children:e.title,...t})},$n=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),wt=t=>{const{onClick:e,...i}=t,r=()=>{};return n.jsx($n,{"aria-label":"Remove attachment",children:n.jsx(f.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,r),...i})},Lt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Dt=a.ikp(H.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Rt=a.ikp(H.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(f.CustomIcon,{iconKey:"info"})}),se=a.ikp(H.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Ot=a.ikp(H.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(se,{}),"Attachments will be kept in context for the entire conversation."]})}),Un=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),qt=t=>{const{children:e,...i}=t,r={supportedInputs:[]};return r?.supportedInputs?n.jsx(Un,{children:h.maybeRender(e,r.supportedInputs),...i}):null},Kn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),Wt=t=>{const{input:e,onClick:i,...r}=t,s={supportedInputs:[]},o=[],d=()=>{},{selectInput:c,onOpen:m}=S.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(Kn,{children:e.displayName,onClick:u.composeEventHandlers(i,l),...r})},zn=a.ikp(E.Root,{_id:"aiChatAttachmentsBar__Modal"}),Nt=t=>{const{onOpenChange:e,...i}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=S.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(zn,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},Qt=a.ikp(E.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Vt=a.ikp(E.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),$t=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Gn=a.ikp(E.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Ut=t=>{const{selectedInput:e}=S.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Gn,{children:i,...t})},Yn=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Kt=t=>{const{selectedInput:e}=S.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(Yn,{children:i,...t}):null},Jn=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),zt=t=>{const{children:e,...i}=t,{selectedInput:r}=S.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(Jn,{asChild:!e,children:e||s,...i}):null},Gt=a.ikp(E.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),Xn=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),Jt=t=>{const{onSubmit:e,...i}=t,{form:r}=S.useAttachmentsBar();return n.jsx(Xn,{onSubmit:u.composeEventHandlers(e,r.onSubmit),...i})},Xt=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),Zn=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),Zt=t=>{const{form:e,selectedInput:i}=S.useAttachmentsBar();return n.jsx(Zn,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},er=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ei=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=S.useAttachmentsBar();return n.jsx(er,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":h.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:u.composeEventHandlers(e,r.onChange),...i})},tr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ti=t=>{const{form:e}=S.useAttachmentsBar();return e.errors.title?n.jsx(tr,{"aria-live":"polite",children:e.errors.title,...t}):null},ii=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),ir=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),ai=t=>{const{form:e,selectedInput:i}=S.useAttachmentsBar();return n.jsx(ir,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},ar=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ni=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=S.useAttachmentsBar();return n.jsx(ar,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":h.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:u.composeEventHandlers(e,r.onChange),...i,children:n.jsx(X,{maxRows:10})})},nr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),ri=t=>{const{form:e}=S.useAttachmentsBar();return e.errors.content?n.jsx(nr,{"aria-live":"polite",children:e.errors.content,...t}):null},si=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),oi=a.ikp("div",{_id:"aiChatActionBar"}),di=a.ikp("div",{_id:"aiChat__ChatActions"}),ci=a.ikp("div",{_id:"aiChatTagline__Container"}),mi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),li=a.ikp(Ea.default,{_id:"aiChatTagline__Logo"}),hi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),rr=a.ikp(H.Trigger,{_id:"aiChat__ChatAction"}),V=t=>{const{action:e,onClick:i,className:r,...s}=t,o={},{clear:d,stop:c,isLoading:m,isStreaming:l,messages:v}=P.useChat(),{conversationId:g}=P.useChat(),{aiChatSettings:p}=b.useInkeepConfig(),[A,M]=Y.useCopyToClipboard(),[_]=Y.useCopyToClipboard();if({help:!1,copy:v.length===0||!p.isCopyChatButtonVisible||m||l,share:v.length===0||!p.isShareButtonVisible||!g||!!o||m||l,clear:v.length===0||p.isViewOnly||m||l,stop:!m&&!l}[e])return null;const U={help:()=>{},copy:()=>{const ce=v.map(q=>{const z=`**${q.role==="assistant"?"AI Assistant":"User"}**`,G=h.getMessageContent(q);return`${z}
|
|
5
|
+
How can I help?`,v={parts:[{type:"text",text:r.introMessage??`${d}${m}`}],id:wa,...e,role:"assistant"};return n.jsx(re,{message:v,...i})}),nn=a.ikp("div",{_id:"aiChatMessageHeader"}),We=t=>{const{message:e}=F.useMessage();return n.jsx(nn,{"data-role":e.role,...t})},rn=a.ikp("div",{_id:"aiChatMessageLoading",children:"Thinking..."}),Ne=t=>n.jsx(rn,{...t}),sn=a.ikp("div",{_id:"aiChatMessageAvatar"}),Qe=t=>{const{message:e}=F.useMessage();return n.jsx(sn,{"data-role":e.role,...t})},on=a.ikp(ne.Root,{_id:"aiChatMessageAvatarContent"}),Ve=t=>{const{message:e}=F.useMessage(),{baseSettings:i}=b.useInkeepConfig();return n.jsx(on,{"data-username":h.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},dn=a.ikp(ne.Fallback,{_id:"aiChatMessageAvatarFallback"}),$e=C.memo(t=>{const{baseSettings:e}=b.useInkeepConfig(),{message:i}=F.useMessage();return e.userProperties.name?n.jsx(dn,{"data-role":i.role,children:h.getInitials(e.userProperties.name),...t}):null}),me=a.ikp(ne.Image,{_id:"aiChatMessageAvatarImage"}),Ue=C.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=b.useInkeepConfig(),{message:o}=F.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=Sa.useColorModeValue(c,m),[v,g]=C.useState(l);C.useEffect(()=>{g(l)},[l]);const p=A=>{A==="error"&&g(null)};return o.role==="user"?s.name?null:r.userAvatar?n.jsx(me,{"data-type":"image",alt:"User avatar","data-role":o.role,src:r.userAvatar,...t}):n.jsx(Aa.default,{"data-type":"icon","data-role":o.role,...t}):v?n.jsx(me,{src:v,alt:"AI assistant avatar","data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,p),...i}):n.jsx(Pa.default,{"data-type":"icon","data-role":o.role,...t})}),cn=a.ikp("span",{_id:"aiChatMessageName"}),Ke=t=>{const{message:e}=F.useMessage();return n.jsx(cn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},mn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),ze=t=>{const{message:e}=F.useMessage(),{messageButtons:i}=P.useChat(),r=i[e.id]||[];return n.jsx(mn,{"data-role":e.role,"data-has-message-buttons":h.dataAttr(!!r.length),...t})},ln=a.ikp("div",{_id:"aiChatMessageContent"}),Ge=t=>{const{message:e}=F.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=a.ikp("div",{_id:"aiChatMessageAttachments"}),Ye=t=>{const{message:e}=F.useMessage(),i=[];return e.role!=="user"||!i?.length?null:n.jsx(R.MessageAttachmentsProvider,{children:n.jsx(hn,{...t})})},un=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),Je=t=>{const{children:e,...i}=t,r=[];return r?n.jsx(un,{children:h.maybeRender(e,r),...i}):null},Cn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),Xe=t=>{const{attachment:e,onClick:i,...r}=t,{selectItem:s,onOpen:o}=R.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(L.AttachmentItemProvider,{attachment:e,children:n.jsx(Cn,{onClick:u.composeEventHandlers(i,d),...r})})},pn=a.ikp(B.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),Ze=t=>{const{attachment:e}=L.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(pn,{iconSettings:i,...t}):null},vn=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),et=t=>{const{attachment:e}=L.useAttachmentItem();return n.jsx(vn,{children:e.title,...t})},bn=a.ikp(E.Root,{_id:"aiChatMessageAttachmentsPreview"}),tt=t=>{const{onOpenChange:e,...i}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=R.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(bn,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},it=a.ikp(E.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),at=a.ikp(E.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),gn=a.ikp(E.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),nt=t=>{const{selectedItem:e}=R.useMessageAttachments();return n.jsx(gn,{children:e?.title||"Attachment",...t})},rt=a.ikp(E.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Pn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),st=t=>{const{selectedItem:e}=R.useMessageAttachments();return n.jsx(Pn,{children:e?.content,...t})},ot=t=>{const{text:e,componentStyles:i,...r}=t,{aiChatSettings:s}=b.useInkeepConfig(),{shouldOpenLinksInNewTab:o}=s;return n.jsx(W.Markdown,{children:e,componentStyles:i,shouldOpenLinksInNewTab:o,...r})},dt=({name:t,props:e,componentDef:i})=>{const s=ya.useShadow()?.shadowHost,o=C.useRef(void 0),d=C.useRef(null),c=C.useRef(null),m=C.useRef(!1),[l,v]=C.useState(!1),[g,p]=C.useState(!1);return C.useEffect(()=>{o.current||(o.current=`dyn:${t}:${crypto.randomUUID()}`,v(!0))},[t]),C.useLayoutEffect(()=>{if(!i||!s||!l||!o.current)return;const A=o.current,I=document.createElement("div");return I.setAttribute("data-ikp-component",""),I.setAttribute("data-component",t),I.setAttribute("slot",A),d.current=I,m.current=!1,s.appendChild(I),p(!0),()=>{m.current=!0,p(!1),queueMicrotask(()=>{try{c.current&&(c.current.unmount(),c.current=null)}catch(_){console.debug("Ignoring unmount error:",_)}I.parentNode===s&&I.remove(),d.current=null})}},[i,s,l,t]),C.useEffect(()=>{const A=d.current;if(!A||m.current)return;const I=M=>{if(typeof M!="function"||M.length>1)return!1;try{if(typeof M=="function"&&M.constructor===Function){const w=M({});return C.isValidElement(w)}return!1}catch{return!0}};let _;if(I(i))try{const M=i;_=C.createElement(M,e||{})}catch(M){console.error("Error creating React element from component:",M);return}else if(typeof i=="function")_=i(e||{},A,null);else{console.error("Invalid component definition");return}if(C.isValidElement(_)||typeof _=="string"){if(m.current)return;c.current||(c.current=Ha.createRoot(A)),!m.current&&c.current&&c.current.render(_);return}c.current&&!m.current&&c.current.render(null)},[i,e,g]),n.jsx("slot",{name:o.current})},An=a.ikp("div",{_id:"aiChatMessagePart"}),_n=a.ikp("div",{_id:"aiChatMessageToolbar"}),ct=t=>{const{isLoading:e,messages:i}=P.useChat(),{message:r}=F.useMessage();return i.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(_n,{...t})},En=a.ikp("div",{_id:"aiChatMessageAnnotationActions"}),mt=t=>{const{children:e,...i}=t,{message:r}=F.useMessage(),{messageButtons:s}=P.useChat(),o=s[r.id]||[];return n.jsx(En,{children:h.maybeRender(e,o),...i})},Fn=a.ikp("a",{_id:"aiChatMessageAnnotationAction"}),kn=a.ikp("button",{_id:"aiChatMessageAnnotationAction"}),lt=t=>{const{onClick:e,action:i,...r}=t,{handleAction:s}=ee.useChatAction(i),{logEvent:o}=ae.useBaseEvents(),{conversationId:d}=P.useChat(),c=()=>{s(),o({eventName:"user_escalation_indicated",properties:{escalationType:"contact_us",conversationId:d}})},m=i.label||"Contact Support",l=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(B.BuiltInIconRenderer,{iconSettings:i.icon}),m]});return i.action.type==="open_link"?n.jsx(Fn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,c),children:l,...r}):n.jsx(kn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,c),children:l,...r})},In=a.ikp("button",{_id:"aiChatMessageAction"}),ht=t=>{const{action:e,onClick:i,className:r,...s}=t,{conversationId:o}=P.useChat(),{baseSettings:{onFeedback:d}}=b.useInkeepConfig(),{message:c}=F.useMessage(),{isStreaming:m,messages:l}=P.useChat(),[v,g]=Y.useCopyToClipboard(),{feedback:p,submitPositiveFeedback:A,setCurrentFeedback:I,currentFeedback:_}=Z.useMessageFeedback(),{logEvent:M}=ae.useBaseEvents(),[w,de]=Fa.useSettleAction(),U=l.at(-1)?.id===c?.id,K=c.role==="assistant";if(U&&m||!K)return null;const q={copy(){g(h.getMessageContent(c)),M({eventName:"assistant_message_copied",properties:{conversationId:o}})},upvote(){A(c.id).then(()=>{de()})},downvote(){I(c.id)}},z={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},G={copy:n.jsx(f.CustomIcon,{iconKey:v?"messageCopied":"messageCopy"}),upvote:n.jsx(f.CustomIcon,{iconKey:w?"messageCopied":"thumbsUp"}),downvote:n.jsx(f.CustomIcon,{iconKey:"thumbsDown"})},ha={copy:{"data-copied":h.dataAttr(v)},upvote:{"data-upvoted":h.dataAttr(p[c.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(p[c.id]?.type==="negative"),"data-state":_===null?"closed":"open"}};return{copy:!1,upvote:!d,downvote:!d}[e]?null:n.jsx(In,{"data-action":e,...ha[e],children:G[e],"aria-label":z[e],className:`${r} ${e}`,onClick:u.composeEventHandlers(i,q[e]),...s})},Mn=a.ikp("div",{_id:"aiChatMessageSources"}),ut=t=>{const{message:e}=F.useMessage();return e.role!=="assistant"||!e.parts.filter(r=>r.type==="data-artifact"&&r.data?.type?.toLowerCase()===he.CITATION_ARTIFACT_TYPE)?.length?null:n.jsx(Mn,{...t})},fn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Ct=t=>n.jsx(fn,{children:"Sources",...t}),Sn=a.ikp("div",{_id:"aiChatMessageSources__List"}),pt=t=>{const{message:e}=F.useMessage(),{children:i,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=b.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.parts.filter(g=>g.type==="data-artifact"&&g.data?.type?.toLowerCase()===he.CITATION_ARTIFACT_TYPE);if(!m?.length)return null;const l=new Map,v=m.filter(g=>{const p=g.data.artifactSummary.url;return!p||l.has(p)?!1:(l.set(p,!0),!0)}).map(g=>{const p=g.data,A={id:p?.artifactId,title:p?.artifactSummary?.title||p?.name,url:p?.artifactSummary?.url||"",description:"",breadcrumbs:[],type:p?.artifactSummary?.record_type,contentType:p?.artifactType,tag:p?.artifactType},_=(s??(w=>({...w,shouldOpenInNewTab:d,icon:ja.getIcon(w)})))(A,"chatSourceItem",{organizationDisplayName:o,tabs:c}),M=_.shouldOpenInNewTab!==void 0?_.shouldOpenInNewTab:d;return{..._,isExternal:M}});return n.jsx(Sn,{children:h.maybeRender(i,v),...r})},xn=a.ikp(_a.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),vt=t=>{const{source:e,onClick:i,...r}=t,{logEvent:s}=ae.useBaseEvents(),{conversationId:o}=P.useChat(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversationId:o,link:e}})};return n.jsx(T.SourceItemProvider,{source:e,children:n.jsx(xn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...r})})},Bn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),bt=t=>{const{source:e}=T.useSourceItem();return e.breadcrumbs?.length?n.jsx(Bn,{"data-type":e.type,...t}):null},Tn=a.ikp(f.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),yn=a.ikp(B.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),gt=t=>{const{source:e}=T.useSourceItem();return n.jsx(yn,{iconSettings:e.icon,"data-type":e.type,...t})},jn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),Pt=t=>{const{source:e}=T.useSourceItem();return n.jsx(jn,{"data-type":e.type,children:e.title,...t})},Hn=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),At=t=>{const{source:e}=T.useSourceItem();return n.jsx(Hn,{"data-type":e.type,...t})},wn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),_t=t=>{const{source:e}=T.useSourceItem(),{children:i,...r}=t,s=C.useMemo(()=>e.description?Ma.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(wn,{"data-type":e.type,children:h.maybeRender(i,s),...r}):null},Ln=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),Et=t=>{const{part:e,...i}=t,{source:r}=T.useSourceItem();return typeof e=="string"?e:n.jsx(Ln,{"data-type":r.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...i})},Dn=a.ikp(f.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),Ft=t=>{const{source:e}=T.useSourceItem();return n.jsx(Dn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},kt=a.ikp("div",{_id:"aiChatFooter"}),It=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Mt=a.ikp("div",{_id:"aiChatInput__Group"}),Rn=a.ikp("textarea",{_id:"aiChatInput"}),ft=C.forwardRef(({onChange:t,onKeyDown:e,...i},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:l}=P.useChat(),{aiChatSettings:v}=b.useInkeepConfig(),g=te.useComposedRefs(r,l);return Ta.useWidgetAutoFocus("chat",l,m),n.jsx(Rn,{asChild:!0,ref:g,maxLength:99999,placeholder:v.placeholder,value:d,onChange:u.composeEventHandlers(t,s),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||v.isViewOnly,...i,children:n.jsx(X,{})})}),On=a.ikp("button",{_id:"aiChatInput__SendButton"}),St=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:r}=P.useChat(),{aiChatSettings:s}=b.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(On,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!r||s.isViewOnly,...d})},xt=a.ikp(f.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),qn=a.ikp("div",{_id:"aiChatAttachmentsBar"}),Bt=t=>{const e={supportedInputs:[]};return!e||!e.supportedInputs?.length?null:n.jsx(S.AttachmentsBarProvider,{children:n.jsx(qn,{...t})})},Wn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Tt=t=>{const{children:e,...i}=t,r=[];return n.jsx(Wn,{children:h.maybeRender(e,r),...i})},Nn=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),yt=t=>{const{attachment:e,...i}=t;return n.jsx(L.AttachmentItemProvider,{attachment:e,children:n.jsx(Nn,{...i})})},Qn=a.ikp(B.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),jt=t=>{const{attachment:e}=L.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Qn,{iconSettings:i,...t}):null},Vn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),Ht=t=>{const{attachment:e}=L.useAttachmentItem();return n.jsx(Vn,{children:e.title,...t})},$n=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),wt=t=>{const{onClick:e,...i}=t,r=()=>{};return n.jsx($n,{"aria-label":"Remove attachment",children:n.jsx(f.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,r),...i})},Lt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Dt=a.ikp(H.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Rt=a.ikp(H.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(f.CustomIcon,{iconKey:"info"})}),se=a.ikp(H.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Ot=a.ikp(H.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(se,{}),"Attachments will be kept in context for the entire conversation."]})}),Un=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),qt=t=>{const{children:e,...i}=t,r={supportedInputs:[]};return r?.supportedInputs?n.jsx(Un,{children:h.maybeRender(e,r.supportedInputs),...i}):null},Kn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),Wt=t=>{const{input:e,onClick:i,...r}=t,s={supportedInputs:[]},o=[],d=()=>{},{selectInput:c,onOpen:m}=S.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(Kn,{children:e.displayName,onClick:u.composeEventHandlers(i,l),...r})},zn=a.ikp(E.Root,{_id:"aiChatAttachmentsBar__Modal"}),Nt=t=>{const{onOpenChange:e,...i}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=S.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(zn,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},Qt=a.ikp(E.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Vt=a.ikp(E.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),$t=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Gn=a.ikp(E.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Ut=t=>{const{selectedInput:e}=S.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Gn,{children:i,...t})},Yn=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Kt=t=>{const{selectedInput:e}=S.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(Yn,{children:i,...t}):null},Jn=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),zt=t=>{const{children:e,...i}=t,{selectedInput:r}=S.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(Jn,{asChild:!e,children:e||s,...i}):null},Gt=a.ikp(E.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),Xn=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),Jt=t=>{const{onSubmit:e,...i}=t,{form:r}=S.useAttachmentsBar();return n.jsx(Xn,{onSubmit:u.composeEventHandlers(e,r.onSubmit),...i})},Xt=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),Zn=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),Zt=t=>{const{form:e,selectedInput:i}=S.useAttachmentsBar();return n.jsx(Zn,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},er=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ei=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=S.useAttachmentsBar();return n.jsx(er,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":h.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:u.composeEventHandlers(e,r.onChange),...i})},tr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ti=t=>{const{form:e}=S.useAttachmentsBar();return e.errors.title?n.jsx(tr,{"aria-live":"polite",children:e.errors.title,...t}):null},ii=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),ir=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),ai=t=>{const{form:e,selectedInput:i}=S.useAttachmentsBar();return n.jsx(ir,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},ar=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ni=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=S.useAttachmentsBar();return n.jsx(ar,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":h.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:u.composeEventHandlers(e,r.onChange),...i,children:n.jsx(X,{maxRows:10})})},nr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),ri=t=>{const{form:e}=S.useAttachmentsBar();return e.errors.content?n.jsx(nr,{"aria-live":"polite",children:e.errors.content,...t}):null},si=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),oi=a.ikp("div",{_id:"aiChatActionBar"}),di=a.ikp("div",{_id:"aiChat__ChatActions"}),ci=a.ikp("div",{_id:"aiChatTagline__Container"}),mi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),li=a.ikp(Ea.default,{_id:"aiChatTagline__Logo"}),hi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),rr=a.ikp(H.Trigger,{_id:"aiChat__ChatAction"}),V=t=>{const{action:e,onClick:i,className:r,...s}=t,o={},{clear:d,stop:c,isLoading:m,isStreaming:l,messages:v}=P.useChat(),{conversationId:g}=P.useChat(),{aiChatSettings:p}=b.useInkeepConfig(),[A,I]=Y.useCopyToClipboard(),[_]=Y.useCopyToClipboard();if({help:!1,copy:v.length===0||!p.isCopyChatButtonVisible||m||l,share:v.length===0||!p.isShareButtonVisible||!g||!!o||m||l,clear:v.length===0||p.isViewOnly||m||l,stop:!m&&!l}[e])return null;const U={help:()=>{},copy:()=>{const ce=v.map(q=>{const z=`**${q.role==="assistant"?"AI Assistant":"User"}**`,G=h.getMessageContent(q);return`${z}
|
|
6
6
|
|
|
7
7
|
${G}`}).join(`
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
`);M(ce)},share:async()=>{},clear:d,stop:c},K={copy:A,share:_};return n.jsx(H.Tooltip,{delayDuration:0,open:K[e],children:n.jsx(rr,{"data-type":e,"data-copied":h.dataAttr(A||_),className:`${r} ${e}`,children:n.jsx(oe,{action:e}),onClick:u.composeEventHandlers(i,U[e]),...s})})},sr=a.ikp("span",{_id:"aiChat__ChatActionLabel"}),oe=t=>{const{action:e,...i}=t,{aiChatSettings:r}=b.useInkeepConfig(),s=r.toolbarButtonLabels??{},o={help:s.getHelp??"Get Help",copy:s.copyChat??"Copy",share:s.share??"Share",clear:s.clear??"Clear",stop:s.stop??"Stop"};return n.jsx(sr,{children:o[e],...i})},or=a.ikp(H.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),ui=t=>{const{action:e,children:i,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(or,{sideOffset:5,...r,children:[n.jsx(H.Arrow,{}),i||s[e]]})},dr=a.ikp(j.Root,{_id:"aiChatHelpActions"}),Ci=t=>{const{children:e,...i}=t,{aiChatSettings:r}=b.useInkeepConfig(),{getHelpOptions:s}=r;if(!s||(s??[]).length===0)return null;const{_pinned:o,_unpinned:d}=s.reduce((v,g)=>{const p=g.isPinnedToToolbar?"_pinned":"_unpinned";return{...v,[p]:[...v[p],g]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,l=J.useHelpMenuState();return n.jsx(J.HelpMenuProvider,{value:l,children:n.jsx(dr,{open:l.open,onOpenChange:l.setOpen,children:h.maybeRender(e,{pinned:c,unpinned:m}),...i})})},cr=a.ikp(V,{_id:"aiChatHelpAction",action:"help"}),mr=a.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),pi=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=ee.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:u.composeEventHandlers(i,()=>{s(),o()}),...r};return d==="open_link"?n.jsx(mr,{href:e.action.url,...c}):n.jsx(cr,{...c})},lr=a.ikp(j.Trigger,{_id:"aiChatHelpActions__Trigger"}),vi=C.memo(t=>{const{aiChatSettings:e}=b.useInkeepConfig();return n.jsx(V,{action:"help",...t,asChild:!0,children:n.jsx(lr,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),hr=a.ikp(j.Content,{_id:"aiChatHelpActions__Menu"}),bi=t=>n.jsx(hr,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),gi=a.ikp(j.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),Pi=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=ee.useChatAction(e),{setOpen:d}=J.useHelpMenu(),c=()=>{s({onOpenForm:()=>d(!1)}),o()},m=e.action.type,l=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(l,{...r})},ur=a.ikp(B.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),Ai=t=>{const{action:e,...i}=t;return e.icon?n.jsx(ur,{iconSettings:e.icon,...i}):null},Cr=a.ikp(E.Root,{_id:"aiChatFeedbackModal"}),_i=t=>{const{onOpenChange:e,...i}=t,{currentFeedback:r,setCurrentFeedback:s}=Z.useMessageFeedback();return n.jsx(Cr,{open:r!==null,onOpenChange:u.composeEventHandlers(e,()=>s(null)),...i})},Ei=a.ikp(E.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),Fi=a.ikp(E.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),ki=a.ikp(E.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),Ii=a.ikp(E.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Mi=a.ikp("div",{_id:"aiChatFeedbackModal__Body"}),pr=a.ikp("form",{_id:"aiChatFeedbackForm"}),fi=t=>{const{onSubmit:e,...i}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:o}=Z.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,l=new FormData(m),v=Object.fromEntries(l.entries());s&&(r(s,v),o(null))};return n.jsx(pr,{onSubmit:u.composeEventHandlers(e,d),...i})},vr=a.ikp("div",{_id:"aiChatFeedbackItem"}),Si=t=>{const{name:e,...i}=t;return n.jsx(N.FeedbackItemProvider,{name:e,children:n.jsx(vr,{...i})})},br=a.ikp(Q.Root,{_id:"aiChatFeedbackItem__Checkbox"}),xi=t=>{const{name:e,focusItem:i}=N.useFeedbackItem(),{onCheckedChange:r,...s}=t,o=d=>{d&&i?.current?.focus()};return n.jsx(br,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(r,o),...s})},Bi=a.ikp(Q.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(le.CheckboxIcon,{})}),gr=a.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Ti=t=>{const{name:e}=N.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(gr,{htmlFor:`feedback-${e}`,children:i[e],...t})},Pr=a.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),yi=t=>{const{name:e,focusItem:i}=N.useFeedbackItem();return n.jsx(Pr,{ref:i,name:`${e}:description`,...t})},ji=a.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),Ar=a.ikp("div",{_id:"aiChatForm__Wrapper"}),Hi=t=>{const{form:e}=k.useChatForm();return e?n.jsx(Ar,{...t}):null},_r=a.ikp("form",{_id:"aiChatForm"}),wi=t=>{const{onSubmit:e,...i}=t,{conversationId:r,messages:s}=P.useChat(),{handleSubmit:o,isSuccess:d}=k.useChatForm();return d?null:n.jsx(_r,{onSubmit:u.composeEventHandlers(e,c=>o(c,{id:r,messages:s})),...i})},Er=a.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Li=t=>{const{onClick:e,...i}=t,{closeForm:r}=k.useChatForm();return n.jsx(Er,{onClick:u.composeEventHandlers(e,r),...i})},Di=a.ikp("div",{_id:"aiChatForm__Header"}),Fr=a.ikp("h2",{_id:"aiChatForm__Heading"}),Ri=t=>{const{form:e}=k.useChatForm();return e?.heading?n.jsx(Fr,{children:e.heading,...t}):null},kr=a.ikp(W.Markdown,{_id:"aiChatForm__Description"}),Oi=t=>{const{form:e}=k.useChatForm();return e?.description?n.jsx(kr,{children:e.description,...t}):null},Ir=a.ikp("div",{_id:"aiChatForm__Content"}),qi=t=>{const{children:e,...i}=t,{getFields:r}=k.useChatForm(),{conversationId:s}=P.useChat(),o=r(s)||[];return n.jsx(Ir,{children:h.maybeRender(e,o),...i})},Mr=a.ikp("div",{_id:"aiChatForm__Field"}),Wi=t=>{const{field:e,autoFocus:i,...r}=t,{control:s,errors:o}=k.useChatForm();return n.jsx(Ia.Controller,{name:e.name,control:s,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const c=d.value!==void 0||e.inputType==="file";return n.jsx(y.FormFieldProvider,{"data-invalid":h.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:i,children:c&&n.jsx(Mr,{"data-input-type":e.inputType,"data-hidden":h.dataAttr(e.isHidden),...r})})}})},fr=a.ikp("label",{_id:"aiChatForm__FieldLabel"}),Ni=t=>{const{field:e}=y.useFormField();return n.jsx(fr,{"data-required":h.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},Sr=a.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),$=t=>{const{field:e,error:i,fieldProps:{onChange:r,onBlur:s,...o},autoFocus:d}=y.useFormField(),{onChange:c,onBlur:m,...l}=t;return n.jsx(Sr,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":h.dataAttr(!!i),onChange:u.composeEventHandlers(c,r),onBlur:u.composeEventHandlers(m,s),...o,...l})},Qi=a.ikp($,{_id:"aiChatForm__FieldEmail",type:"email"}),xr=a.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Vi=t=>{const{field:e,error:i,fieldProps:{value:r,onChange:s,onBlur:o,...d},autoFocus:c}=y.useFormField(),{onChange:m,onBlur:l,...v}=t,g=p=>{const A=p.target.files;s(A)};return n.jsx(xr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":h.dataAttr(!!i),...v,...d,onChange:u.composeEventHandlers(m,g),onBlur:u.composeEventHandlers(l,o)})},$i=a.ikp($,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(X,{maxRows:8})}),Br=a.ikp(Q.Root,{_id:"aiChatForm__FieldCheckbox"}),Ui=t=>{const{field:e,error:i,fieldProps:r,autoFocus:s}=y.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(Br,{id:e.name,name:e.name,autoFocus:s,"data-invalid":h.dataAttr(!!i),checked:r.value,onCheckedChange:u.composeEventHandlers(o,r.onChange),...d})},Ki=a.ikp(Q.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(le.CheckboxIcon,{})}),Tr=a.ikp(x.Root,{_id:"aiChatForm__FieldSelect"}),zi=t=>{const{field:e,error:i,fieldProps:r}=y.useFormField(),{onValueChange:s,...o}=t;return n.jsx(Tr,{name:e.name,"data-invalid":h.dataAttr(!!i),value:r.value,onValueChange:u.composeEventHandlers(s,r.onChange),...o})},Gi=a.ikp(x.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),yr=a.ikp(x.Value,{_id:"aiChatForm__FieldSelect__Value"}),Yi=t=>{const{field:e}=y.useFormField();return n.jsx(yr,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},Ji=a.ikp(x.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(B.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),Xi=a.ikp(x.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),Zi=a.ikp(x.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),ea=a.ikp(x.Item,{_id:"aiChatForm__FieldSelect__Item"}),ta=a.ikp(x.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),ia=a.ikp(x.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(B.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),jr=a.ikp("span",{_id:"aiChatForm__FieldError"}),aa=t=>{const{error:e}=y.useFormField();return e?n.jsx(jr,{children:e.message?.toString(),...t}):null},Hr=a.ikp("span",{_id:"aiChatForm__Error"}),na=t=>{const{formError:e}=k.useChatForm();return e?n.jsx(Hr,{children:e.message,...t}):null},ra=a.ikp("div",{_id:"aiChatForm__Footer"}),wr=a.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel",type:"button"}),sa=t=>{const{onClick:e,...i}=t,{closeForm:r}=k.useChatForm();return n.jsx(wr,{onClick:u.composeEventHandlers(e,r),...i})},Lr=a.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),oa=t=>{const{onClick:e,...i}=t,{isSubmitting:r,form:s}=k.useChatForm(),o=s?.buttons.submit.label||"Submit";return n.jsx(Lr,{disabled:r,...i,children:o})},Dr=a.ikp("div",{_id:"aiChatForm__Success"}),da=t=>{const{isSuccess:e}=k.useChatForm();return e?n.jsx(Dr,{...t}):null},Rr=a.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),ca=t=>{const{form:e}=k.useChatForm();return n.jsx(Rr,{children:e?.successView?.heading,...t})},Or=a.ikp(W.Markdown,{_id:"aiChatForm__SuccessMessage"}),ma=t=>{const{form:e}=k.useChatForm();return n.jsx(Or,{children:e?.successView?.message,...t})},qr=a.ikp("button",{_id:"aiChatForm__SuccessButton"}),la=t=>{const{onClick:e,...i}=t,{form:r,closeForm:s}=k.useChatForm(),o=r?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(B.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx(qr,{onClick:u.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[d,c]}),...i})};exports.Provider=P.ChatProvider;exports.ActionBar=oi;exports.Actions=di;exports.AttachmentsBar=Bt;exports.AttachmentsBarActions=Lt;exports.AttachmentsBarAttachment=yt;exports.AttachmentsBarAttachmentDelete=wt;exports.AttachmentsBarAttachmentIcon=jt;exports.AttachmentsBarAttachmentTitle=Ht;exports.AttachmentsBarForm=Jt;exports.AttachmentsBarFormContent=ii;exports.AttachmentsBarFormContentError=ri;exports.AttachmentsBarFormContentInput=ni;exports.AttachmentsBarFormContentLabel=ai;exports.AttachmentsBarFormSubmitButton=si;exports.AttachmentsBarFormTitle=Xt;exports.AttachmentsBarFormTitleError=ti;exports.AttachmentsBarFormTitleInput=ei;exports.AttachmentsBarFormTitleLabel=Zt;exports.AttachmentsBarInfoTip=Dt;exports.AttachmentsBarInfoTipArrow=se;exports.AttachmentsBarInfoTipIcon=Rt;exports.AttachmentsBarInfoTipText=Ot;exports.AttachmentsBarInput=Wt;exports.AttachmentsBarInputs=qt;exports.AttachmentsBarList=Tt;exports.AttachmentsBarModal=Nt;exports.AttachmentsBarModalBody=Yt;exports.AttachmentsBarModalClose=Gt;exports.AttachmentsBarModalContent=Vt;exports.AttachmentsBarModalDescription=Kt;exports.AttachmentsBarModalHeader=$t;exports.AttachmentsBarModalHeading=Ut;exports.AttachmentsBarModalHelp=zt;exports.AttachmentsBarModalOverlay=Qt;exports.ChatAction=V;exports.ChatActionFeedback=ui;exports.ChatActionLabel=oe;exports.ChatHelpAction=pi;exports.Content=ge;exports.ContentScrollArea=Pe;exports.ContentScrollAreaCorner=Fe;exports.ContentScrollAreaScrollbar=_e;exports.ContentScrollAreaThumb=Ee;exports.ContentScrollAreaViewport=Ae;exports.Disclaimer=Ie;exports.DisclaimerArrow=Be;exports.DisclaimerContent=Se;exports.DisclaimerLabel=Me;exports.DisclaimerText=xe;exports.DisclaimerTrigger=fe;exports.DynamicComponent=dt;exports.EmbeddedChatPrimitiveActionBar=oi;exports.EmbeddedChatPrimitiveActions=di;exports.EmbeddedChatPrimitiveAttachmentsBar=Bt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=Lt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=yt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=wt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=jt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=Ht;exports.EmbeddedChatPrimitiveAttachmentsBarForm=Jt;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=ii;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=ni;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=ai;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ti;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=ei;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=se;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarInput=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=qt;exports.EmbeddedChatPrimitiveAttachmentsBarList=Tt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=$t;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=Qt;exports.EmbeddedChatPrimitiveChatAction=V;exports.EmbeddedChatPrimitiveChatActionFeedback=ui;exports.EmbeddedChatPrimitiveChatActionLabel=oe;exports.EmbeddedChatPrimitiveChatHelpAction=pi;exports.EmbeddedChatPrimitiveContent=ge;exports.EmbeddedChatPrimitiveContentScrollArea=Pe;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Fe;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=_e;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=Ee;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Ae;exports.EmbeddedChatPrimitiveDisclaimer=Ie;exports.EmbeddedChatPrimitiveDisclaimerArrow=Be;exports.EmbeddedChatPrimitiveDisclaimerContent=Se;exports.EmbeddedChatPrimitiveDisclaimerLabel=Me;exports.EmbeddedChatPrimitiveDisclaimerText=xe;exports.EmbeddedChatPrimitiveDisclaimerTrigger=fe;exports.EmbeddedChatPrimitiveDynamicComponent=dt;exports.EmbeddedChatPrimitiveExampleQuestion=He;exports.EmbeddedChatPrimitiveExampleQuestionButton=we;exports.EmbeddedChatPrimitiveExampleQuestions=Te;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=ye;exports.EmbeddedChatPrimitiveExampleQuestionsList=je;exports.EmbeddedChatPrimitiveFeedbackForm=fi;exports.EmbeddedChatPrimitiveFeedbackItem=Si;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=xi;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=Bi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=yi;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Ti;exports.EmbeddedChatPrimitiveFeedbackModal=_i;exports.EmbeddedChatPrimitiveFeedbackModalBody=Mi;exports.EmbeddedChatPrimitiveFeedbackModalClose=Ii;exports.EmbeddedChatPrimitiveFeedbackModalContent=Fi;exports.EmbeddedChatPrimitiveFeedbackModalHeader=ki;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Ei;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=ji;exports.EmbeddedChatPrimitiveFooter=kt;exports.EmbeddedChatPrimitiveForm=wi;exports.EmbeddedChatPrimitiveFormCancel=sa;exports.EmbeddedChatPrimitiveFormClose=Li;exports.EmbeddedChatPrimitiveFormContent=qi;exports.EmbeddedChatPrimitiveFormDescription=Oi;exports.EmbeddedChatPrimitiveFormError=na;exports.EmbeddedChatPrimitiveFormField=Wi;exports.EmbeddedChatPrimitiveFormFieldCheckbox=Ui;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=Ki;exports.EmbeddedChatPrimitiveFormFieldEmail=Qi;exports.EmbeddedChatPrimitiveFormFieldError=aa;exports.EmbeddedChatPrimitiveFormFieldFile=Vi;exports.EmbeddedChatPrimitiveFormFieldLabel=Ni;exports.EmbeddedChatPrimitiveFormFieldSelect=zi;exports.EmbeddedChatPrimitiveFormFieldSelectContent=Xi;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=Ji;exports.EmbeddedChatPrimitiveFormFieldSelectItem=ea;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=ia;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ta;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=Gi;exports.EmbeddedChatPrimitiveFormFieldSelectValue=Yi;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=Zi;exports.EmbeddedChatPrimitiveFormFieldText=$;exports.EmbeddedChatPrimitiveFormFieldTextArea=$i;exports.EmbeddedChatPrimitiveFormFooter=ra;exports.EmbeddedChatPrimitiveFormHeader=Di;exports.EmbeddedChatPrimitiveFormHeading=Ri;exports.EmbeddedChatPrimitiveFormSubmit=oa;exports.EmbeddedChatPrimitiveFormSuccess=da;exports.EmbeddedChatPrimitiveFormSuccessButton=la;exports.EmbeddedChatPrimitiveFormSuccessHeading=ca;exports.EmbeddedChatPrimitiveFormSuccessMessage=ma;exports.EmbeddedChatPrimitiveFormWrapper=Hi;exports.EmbeddedChatPrimitiveHeaderToolbar=pe;exports.EmbeddedChatPrimitiveHelpActions=Ci;exports.EmbeddedChatPrimitiveHelpActionsMenu=bi;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=gi;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=Pi;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=Ai;exports.EmbeddedChatPrimitiveHelpActionsTrigger=vi;exports.EmbeddedChatPrimitiveInput=ft;exports.EmbeddedChatPrimitiveInputFieldset=It;exports.EmbeddedChatPrimitiveInputGroup=Mt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=qe;exports.EmbeddedChatPrimitiveMarkdown=ot;exports.EmbeddedChatPrimitiveMessageAction=ht;exports.EmbeddedChatPrimitiveMessageAnnotationAction=lt;exports.EmbeddedChatPrimitiveMessageAnnotationActions=mt;exports.EmbeddedChatPrimitiveMessageAttachments=Ye;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=Xe;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=Ze;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=et;exports.EmbeddedChatPrimitiveMessageAttachmentsList=Je;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=tt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=st;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=at;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=it;exports.EmbeddedChatPrimitiveMessageAvatar=Qe;exports.EmbeddedChatPrimitiveMessageAvatarContent=Ve;exports.EmbeddedChatPrimitiveMessageAvatarFallback=$e;exports.EmbeddedChatPrimitiveMessageAvatarImage=Ue;exports.EmbeddedChatPrimitiveMessageContent=Ge;exports.EmbeddedChatPrimitiveMessageContentWrapper=ze;exports.EmbeddedChatPrimitiveMessageHeader=We;exports.EmbeddedChatPrimitiveMessageLoading=Ne;exports.EmbeddedChatPrimitiveMessageName=Ke;exports.EmbeddedChatPrimitiveMessageSourceItem=vt;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=bt;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=_t;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=Et;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=gt;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemTag=At;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=Pt;exports.EmbeddedChatPrimitiveMessageSources=ut;exports.EmbeddedChatPrimitiveMessageSourcesHeader=Ct;exports.EmbeddedChatPrimitiveMessageSourcesList=pt;exports.EmbeddedChatPrimitiveMessageToolbar=ct;exports.EmbeddedChatPrimitiveMessageWrapper=re;exports.EmbeddedChatPrimitiveMessages=ke;exports.EmbeddedChatPrimitiveRoot=Ce;exports.EmbeddedChatPrimitiveSendButton=St;exports.EmbeddedChatPrimitiveSendButtonIcon=xt;exports.EmbeddedChatPrimitiveTaglineBrandName=hi;exports.EmbeddedChatPrimitiveTaglineContainer=ci;exports.EmbeddedChatPrimitiveTaglineLogo=li;exports.EmbeddedChatPrimitiveTaglineText=mi;exports.EmbeddedChatPrimitiveToolbarHeader=be;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=ve;exports.EmbeddedChatPrimitiveWorkflow=Oe;exports.EmbeddedChatPrimitiveWorkflows=Le;exports.EmbeddedChatPrimitiveWorkflowsLabel=De;exports.EmbeddedChatPrimitiveWorkflowsList=Re;exports.EmbeddedChatPrimitiveWrapper=ue;exports.ExampleQuestion=He;exports.ExampleQuestionButton=we;exports.ExampleQuestions=Te;exports.ExampleQuestionsLabel=ye;exports.ExampleQuestionsList=je;exports.FeedbackForm=fi;exports.FeedbackItem=Si;exports.FeedbackItemCheckbox=xi;exports.FeedbackItemCheckboxIndicator=Bi;exports.FeedbackItemDescription=yi;exports.FeedbackItemLabel=Ti;exports.FeedbackModal=_i;exports.FeedbackModalBody=Mi;exports.FeedbackModalClose=Ii;exports.FeedbackModalContent=Fi;exports.FeedbackModalHeader=ki;exports.FeedbackModalOverlay=Ei;exports.FeedbackSubmitButton=ji;exports.Footer=kt;exports.Form=wi;exports.FormCancel=sa;exports.FormClose=Li;exports.FormContent=qi;exports.FormDescription=Oi;exports.FormError=na;exports.FormField=Wi;exports.FormFieldCheckbox=Ui;exports.FormFieldCheckboxIndicator=Ki;exports.FormFieldEmail=Qi;exports.FormFieldError=aa;exports.FormFieldFile=Vi;exports.FormFieldLabel=Ni;exports.FormFieldSelect=zi;exports.FormFieldSelectContent=Xi;exports.FormFieldSelectIcon=Ji;exports.FormFieldSelectItem=ea;exports.FormFieldSelectItemIndicator=ia;exports.FormFieldSelectItemText=ta;exports.FormFieldSelectTrigger=Gi;exports.FormFieldSelectValue=Yi;exports.FormFieldSelectViewport=Zi;exports.FormFieldText=$;exports.FormFieldTextArea=$i;exports.FormFooter=ra;exports.FormHeader=Di;exports.FormHeading=Ri;exports.FormSubmit=oa;exports.FormSuccess=da;exports.FormSuccessButton=la;exports.FormSuccessHeading=ca;exports.FormSuccessMessage=ma;exports.FormWrapper=Hi;exports.Header=Ra;exports.HeaderToolbar=pe;exports.HeaderToolbarWrapper=ve;exports.HelpActions=Ci;exports.HelpActionsMenu=bi;exports.HelpActionsMenuArrow=gi;exports.HelpActionsMenuItem=Pi;exports.HelpActionsMenuItemIcon=Ai;exports.HelpActionsTrigger=vi;exports.Input=ft;exports.InputFieldset=It;exports.InputGroup=Mt;exports.IntroMessageWrapper=qe;exports.Markdown=ot;exports.MessageAction=ht;exports.MessageAnnotationAction=lt;exports.MessageAnnotationActions=mt;exports.MessageAttachments=Ye;exports.MessageAttachmentsItem=Xe;exports.MessageAttachmentsItemIcon=Ze;exports.MessageAttachmentsItemTitle=et;exports.MessageAttachmentsList=Je;exports.MessageAttachmentsPreview=tt;exports.MessageAttachmentsPreviewBody=st;exports.MessageAttachmentsPreviewClose=rt;exports.MessageAttachmentsPreviewContent=at;exports.MessageAttachmentsPreviewHeader=nt;exports.MessageAttachmentsPreviewOverlay=it;exports.MessageAvatar=Qe;exports.MessageAvatarContent=Ve;exports.MessageAvatarFallback=$e;exports.MessageAvatarImage=Ue;exports.MessageContent=Ge;exports.MessageContentWrapper=ze;exports.MessageHeader=We;exports.MessageLoading=Ne;exports.MessageName=Ke;exports.MessageSourceItem=vt;exports.MessageSourceItemBreadcrumbIcon=Tn;exports.MessageSourceItemBreadcrumbs=bt;exports.MessageSourceItemDescription=_t;exports.MessageSourceItemDescriptionPart=Et;exports.MessageSourceItemIcon=gt;exports.MessageSourceItemIndicator=Ft;exports.MessageSourceItemTag=At;exports.MessageSourceItemTitle=Pt;exports.MessageSources=ut;exports.MessageSourcesHeader=Ct;exports.MessageSourcesList=pt;exports.MessageToolbar=ct;exports.MessageWrapper=re;exports.Messages=ke;exports.PrimitiveMessagePart=An;exports.Root=Ce;exports.SendButton=St;exports.SendButtonIcon=xt;exports.TaglineBrandName=hi;exports.TaglineContainer=ci;exports.TaglineLogo=li;exports.TaglineText=mi;exports.ToolbarHeader=be;exports.Workflow=Oe;exports.Workflows=Le;exports.WorkflowsLabel=De;exports.WorkflowsList=Re;exports.Wrapper=ue;
|
|
11
|
+
`);I(ce)},share:async()=>{},clear:d,stop:c},K={copy:A,share:_};return n.jsx(H.Tooltip,{delayDuration:0,open:K[e],children:n.jsx(rr,{"data-type":e,"data-copied":h.dataAttr(A||_),className:`${r} ${e}`,children:n.jsx(oe,{action:e}),onClick:u.composeEventHandlers(i,U[e]),...s})})},sr=a.ikp("span",{_id:"aiChat__ChatActionLabel"}),oe=t=>{const{action:e,...i}=t,{aiChatSettings:r}=b.useInkeepConfig(),s=r.toolbarButtonLabels??{},o={help:s.getHelp??"Get Help",copy:s.copyChat??"Copy",share:s.share??"Share",clear:s.clear??"Clear",stop:s.stop??"Stop"};return n.jsx(sr,{children:o[e],...i})},or=a.ikp(H.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),ui=t=>{const{action:e,children:i,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(or,{sideOffset:5,...r,children:[n.jsx(H.Arrow,{}),i||s[e]]})},dr=a.ikp(j.Root,{_id:"aiChatHelpActions"}),Ci=t=>{const{children:e,...i}=t,{aiChatSettings:r}=b.useInkeepConfig(),{getHelpOptions:s}=r;if(!s||(s??[]).length===0)return null;const{_pinned:o,_unpinned:d}=s.reduce((v,g)=>{const p=g.isPinnedToToolbar?"_pinned":"_unpinned";return{...v,[p]:[...v[p],g]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,l=J.useHelpMenuState();return n.jsx(J.HelpMenuProvider,{value:l,children:n.jsx(dr,{open:l.open,onOpenChange:l.setOpen,children:h.maybeRender(e,{pinned:c,unpinned:m}),...i})})},cr=a.ikp(V,{_id:"aiChatHelpAction",action:"help"}),mr=a.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),pi=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=ee.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:u.composeEventHandlers(i,()=>{s(),o()}),...r};return d==="open_link"?n.jsx(mr,{href:e.action.url,...c}):n.jsx(cr,{...c})},lr=a.ikp(j.Trigger,{_id:"aiChatHelpActions__Trigger"}),vi=C.memo(t=>{const{aiChatSettings:e}=b.useInkeepConfig();return n.jsx(V,{action:"help",...t,asChild:!0,children:n.jsx(lr,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),hr=a.ikp(j.Content,{_id:"aiChatHelpActions__Menu"}),bi=t=>n.jsx(hr,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),gi=a.ikp(j.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),Pi=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=ee.useChatAction(e),{setOpen:d}=J.useHelpMenu(),c=()=>{s({onOpenForm:()=>d(!1)}),o()},m=e.action.type,l=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(l,{...r})},ur=a.ikp(B.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),Ai=t=>{const{action:e,...i}=t;return e.icon?n.jsx(ur,{iconSettings:e.icon,...i}):null},Cr=a.ikp(E.Root,{_id:"aiChatFeedbackModal"}),_i=t=>{const{onOpenChange:e,...i}=t,{currentFeedback:r,setCurrentFeedback:s}=Z.useMessageFeedback();return n.jsx(Cr,{open:r!==null,onOpenChange:u.composeEventHandlers(e,()=>s(null)),...i})},Ei=a.ikp(E.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),Fi=a.ikp(E.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),ki=a.ikp(E.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),Ii=a.ikp(E.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Mi=a.ikp("div",{_id:"aiChatFeedbackModal__Body"}),pr=a.ikp("form",{_id:"aiChatFeedbackForm"}),fi=t=>{const{onSubmit:e,...i}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:o}=Z.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,l=new FormData(m),v=Object.fromEntries(l.entries());s&&(r(s,v),o(null))};return n.jsx(pr,{onSubmit:u.composeEventHandlers(e,d),...i})},vr=a.ikp("div",{_id:"aiChatFeedbackItem"}),Si=t=>{const{name:e,...i}=t;return n.jsx(N.FeedbackItemProvider,{name:e,children:n.jsx(vr,{...i})})},br=a.ikp(Q.Root,{_id:"aiChatFeedbackItem__Checkbox"}),xi=t=>{const{name:e,focusItem:i}=N.useFeedbackItem(),{onCheckedChange:r,...s}=t,o=d=>{d&&i?.current?.focus()};return n.jsx(br,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(r,o),...s})},Bi=a.ikp(Q.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(le.CheckboxIcon,{})}),gr=a.ikp("label",{_id:"aiChatFeedbackItem__Label"}),Ti=t=>{const{name:e}=N.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(gr,{htmlFor:`feedback-${e}`,children:i[e],...t})},Pr=a.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),yi=t=>{const{name:e,focusItem:i}=N.useFeedbackItem();return n.jsx(Pr,{ref:i,name:`${e}:description`,...t})},ji=a.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),Ar=a.ikp("div",{_id:"aiChatForm__Wrapper"}),Hi=t=>{const{form:e}=k.useChatForm();return e?n.jsx(Ar,{...t}):null},_r=a.ikp("form",{_id:"aiChatForm"}),wi=t=>{const{onSubmit:e,...i}=t,{conversationId:r,messages:s}=P.useChat(),{handleSubmit:o,isSuccess:d}=k.useChatForm();return d?null:n.jsx(_r,{onSubmit:u.composeEventHandlers(e,c=>o(c,{id:r,messages:s})),...i})},Er=a.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Li=t=>{const{onClick:e,...i}=t,{closeForm:r}=k.useChatForm();return n.jsx(Er,{onClick:u.composeEventHandlers(e,r),...i})},Di=a.ikp("div",{_id:"aiChatForm__Header"}),Fr=a.ikp("h2",{_id:"aiChatForm__Heading"}),Ri=t=>{const{form:e}=k.useChatForm();return e?.heading?n.jsx(Fr,{children:e.heading,...t}):null},kr=a.ikp(W.Markdown,{_id:"aiChatForm__Description"}),Oi=t=>{const{form:e}=k.useChatForm();return e?.description?n.jsx(kr,{children:e.description,...t}):null},Ir=a.ikp("div",{_id:"aiChatForm__Content"}),qi=t=>{const{children:e,...i}=t,{getFields:r}=k.useChatForm(),{conversationId:s}=P.useChat(),o=r(s)||[];return n.jsx(Ir,{children:h.maybeRender(e,o),...i})},Mr=a.ikp("div",{_id:"aiChatForm__Field"}),Wi=t=>{const{field:e,autoFocus:i,...r}=t,{control:s,errors:o}=k.useChatForm();return n.jsx(Ia.Controller,{name:e.name,control:s,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const c=d.value!==void 0||e.inputType==="file";return n.jsx(y.FormFieldProvider,{"data-invalid":h.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:i,children:c&&n.jsx(Mr,{"data-input-type":e.inputType,"data-hidden":h.dataAttr(e.isHidden),...r})})}})},fr=a.ikp("label",{_id:"aiChatForm__FieldLabel"}),Ni=t=>{const{field:e}=y.useFormField();return n.jsx(fr,{"data-required":h.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},Sr=a.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),$=t=>{const{field:e,error:i,fieldProps:{onChange:r,onBlur:s,...o},autoFocus:d}=y.useFormField(),{onChange:c,onBlur:m,...l}=t;return n.jsx(Sr,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":h.dataAttr(!!i),onChange:u.composeEventHandlers(c,r),onBlur:u.composeEventHandlers(m,s),...o,...l})},Qi=a.ikp($,{_id:"aiChatForm__FieldEmail",type:"email"}),xr=a.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Vi=t=>{const{field:e,error:i,fieldProps:{value:r,onChange:s,onBlur:o,...d},autoFocus:c}=y.useFormField(),{onChange:m,onBlur:l,...v}=t,g=p=>{const A=p.target.files;s(A)};return n.jsx(xr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":h.dataAttr(!!i),...v,...d,onChange:u.composeEventHandlers(m,g),onBlur:u.composeEventHandlers(l,o)})},$i=a.ikp($,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(X,{maxRows:8})}),Br=a.ikp(Q.Root,{_id:"aiChatForm__FieldCheckbox"}),Ui=t=>{const{field:e,error:i,fieldProps:r,autoFocus:s}=y.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(Br,{id:e.name,name:e.name,autoFocus:s,"data-invalid":h.dataAttr(!!i),checked:r.value,onCheckedChange:u.composeEventHandlers(o,r.onChange),...d})},Ki=a.ikp(Q.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(le.CheckboxIcon,{})}),Tr=a.ikp(x.Root,{_id:"aiChatForm__FieldSelect"}),zi=t=>{const{field:e,error:i,fieldProps:r}=y.useFormField(),{onValueChange:s,...o}=t;return n.jsx(Tr,{name:e.name,"data-invalid":h.dataAttr(!!i),value:r.value,onValueChange:u.composeEventHandlers(s,r.onChange),...o})},Gi=a.ikp(x.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),yr=a.ikp(x.Value,{_id:"aiChatForm__FieldSelect__Value"}),Yi=t=>{const{field:e}=y.useFormField();return n.jsx(yr,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},Ji=a.ikp(x.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(B.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),Xi=a.ikp(x.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),Zi=a.ikp(x.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),ea=a.ikp(x.Item,{_id:"aiChatForm__FieldSelect__Item"}),ta=a.ikp(x.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),ia=a.ikp(x.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(B.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),jr=a.ikp("span",{_id:"aiChatForm__FieldError"}),aa=t=>{const{error:e}=y.useFormField();return e?n.jsx(jr,{children:e.message?.toString(),...t}):null},Hr=a.ikp("span",{_id:"aiChatForm__Error"}),na=t=>{const{formError:e}=k.useChatForm();return e?n.jsx(Hr,{children:e.message,...t}):null},ra=a.ikp("div",{_id:"aiChatForm__Footer"}),wr=a.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel",type:"button"}),sa=t=>{const{onClick:e,...i}=t,{closeForm:r}=k.useChatForm();return n.jsx(wr,{onClick:u.composeEventHandlers(e,r),...i})},Lr=a.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),oa=t=>{const{onClick:e,...i}=t,{isSubmitting:r,form:s}=k.useChatForm(),o=s?.buttons.submit.label||"Submit";return n.jsx(Lr,{disabled:r,...i,children:o})},Dr=a.ikp("div",{_id:"aiChatForm__Success"}),da=t=>{const{isSuccess:e}=k.useChatForm();return e?n.jsx(Dr,{...t}):null},Rr=a.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),ca=t=>{const{form:e}=k.useChatForm();return n.jsx(Rr,{children:e?.successView?.heading,...t})},Or=a.ikp(W.Markdown,{_id:"aiChatForm__SuccessMessage"}),ma=t=>{const{form:e}=k.useChatForm();return n.jsx(Or,{children:e?.successView?.message,...t})},qr=a.ikp("button",{_id:"aiChatForm__SuccessButton"}),la=t=>{const{onClick:e,...i}=t,{form:r,closeForm:s}=k.useChatForm(),o=r?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(B.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx(qr,{onClick:u.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[d,c]}),...i})};exports.Provider=P.ChatProvider;exports.ActionBar=oi;exports.Actions=di;exports.AttachmentsBar=Bt;exports.AttachmentsBarActions=Lt;exports.AttachmentsBarAttachment=yt;exports.AttachmentsBarAttachmentDelete=wt;exports.AttachmentsBarAttachmentIcon=jt;exports.AttachmentsBarAttachmentTitle=Ht;exports.AttachmentsBarForm=Jt;exports.AttachmentsBarFormContent=ii;exports.AttachmentsBarFormContentError=ri;exports.AttachmentsBarFormContentInput=ni;exports.AttachmentsBarFormContentLabel=ai;exports.AttachmentsBarFormSubmitButton=si;exports.AttachmentsBarFormTitle=Xt;exports.AttachmentsBarFormTitleError=ti;exports.AttachmentsBarFormTitleInput=ei;exports.AttachmentsBarFormTitleLabel=Zt;exports.AttachmentsBarInfoTip=Dt;exports.AttachmentsBarInfoTipArrow=se;exports.AttachmentsBarInfoTipIcon=Rt;exports.AttachmentsBarInfoTipText=Ot;exports.AttachmentsBarInput=Wt;exports.AttachmentsBarInputs=qt;exports.AttachmentsBarList=Tt;exports.AttachmentsBarModal=Nt;exports.AttachmentsBarModalBody=Yt;exports.AttachmentsBarModalClose=Gt;exports.AttachmentsBarModalContent=Vt;exports.AttachmentsBarModalDescription=Kt;exports.AttachmentsBarModalHeader=$t;exports.AttachmentsBarModalHeading=Ut;exports.AttachmentsBarModalHelp=zt;exports.AttachmentsBarModalOverlay=Qt;exports.ChatAction=V;exports.ChatActionFeedback=ui;exports.ChatActionLabel=oe;exports.ChatHelpAction=pi;exports.Content=ge;exports.ContentScrollArea=Pe;exports.ContentScrollAreaCorner=Fe;exports.ContentScrollAreaScrollbar=_e;exports.ContentScrollAreaThumb=Ee;exports.ContentScrollAreaViewport=Ae;exports.Disclaimer=Ie;exports.DisclaimerArrow=Be;exports.DisclaimerContent=Se;exports.DisclaimerLabel=Me;exports.DisclaimerText=xe;exports.DisclaimerTrigger=fe;exports.DynamicComponent=dt;exports.EmbeddedChatPrimitiveActionBar=oi;exports.EmbeddedChatPrimitiveActions=di;exports.EmbeddedChatPrimitiveAttachmentsBar=Bt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=Lt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=yt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=wt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=jt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=Ht;exports.EmbeddedChatPrimitiveAttachmentsBarForm=Jt;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=ii;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=ni;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=ai;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ti;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=ei;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=se;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarInput=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=qt;exports.EmbeddedChatPrimitiveAttachmentsBarList=Tt;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=$t;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=Qt;exports.EmbeddedChatPrimitiveChatAction=V;exports.EmbeddedChatPrimitiveChatActionFeedback=ui;exports.EmbeddedChatPrimitiveChatActionLabel=oe;exports.EmbeddedChatPrimitiveChatHelpAction=pi;exports.EmbeddedChatPrimitiveContent=ge;exports.EmbeddedChatPrimitiveContentScrollArea=Pe;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Fe;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=_e;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=Ee;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Ae;exports.EmbeddedChatPrimitiveDisclaimer=Ie;exports.EmbeddedChatPrimitiveDisclaimerArrow=Be;exports.EmbeddedChatPrimitiveDisclaimerContent=Se;exports.EmbeddedChatPrimitiveDisclaimerLabel=Me;exports.EmbeddedChatPrimitiveDisclaimerText=xe;exports.EmbeddedChatPrimitiveDisclaimerTrigger=fe;exports.EmbeddedChatPrimitiveDynamicComponent=dt;exports.EmbeddedChatPrimitiveExampleQuestion=He;exports.EmbeddedChatPrimitiveExampleQuestionButton=we;exports.EmbeddedChatPrimitiveExampleQuestions=Te;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=ye;exports.EmbeddedChatPrimitiveExampleQuestionsList=je;exports.EmbeddedChatPrimitiveFeedbackForm=fi;exports.EmbeddedChatPrimitiveFeedbackItem=Si;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=xi;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=Bi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=yi;exports.EmbeddedChatPrimitiveFeedbackItemLabel=Ti;exports.EmbeddedChatPrimitiveFeedbackModal=_i;exports.EmbeddedChatPrimitiveFeedbackModalBody=Mi;exports.EmbeddedChatPrimitiveFeedbackModalClose=Ii;exports.EmbeddedChatPrimitiveFeedbackModalContent=Fi;exports.EmbeddedChatPrimitiveFeedbackModalHeader=ki;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Ei;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=ji;exports.EmbeddedChatPrimitiveFooter=kt;exports.EmbeddedChatPrimitiveForm=wi;exports.EmbeddedChatPrimitiveFormCancel=sa;exports.EmbeddedChatPrimitiveFormClose=Li;exports.EmbeddedChatPrimitiveFormContent=qi;exports.EmbeddedChatPrimitiveFormDescription=Oi;exports.EmbeddedChatPrimitiveFormError=na;exports.EmbeddedChatPrimitiveFormField=Wi;exports.EmbeddedChatPrimitiveFormFieldCheckbox=Ui;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=Ki;exports.EmbeddedChatPrimitiveFormFieldEmail=Qi;exports.EmbeddedChatPrimitiveFormFieldError=aa;exports.EmbeddedChatPrimitiveFormFieldFile=Vi;exports.EmbeddedChatPrimitiveFormFieldLabel=Ni;exports.EmbeddedChatPrimitiveFormFieldSelect=zi;exports.EmbeddedChatPrimitiveFormFieldSelectContent=Xi;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=Ji;exports.EmbeddedChatPrimitiveFormFieldSelectItem=ea;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=ia;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ta;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=Gi;exports.EmbeddedChatPrimitiveFormFieldSelectValue=Yi;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=Zi;exports.EmbeddedChatPrimitiveFormFieldText=$;exports.EmbeddedChatPrimitiveFormFieldTextArea=$i;exports.EmbeddedChatPrimitiveFormFooter=ra;exports.EmbeddedChatPrimitiveFormHeader=Di;exports.EmbeddedChatPrimitiveFormHeading=Ri;exports.EmbeddedChatPrimitiveFormSubmit=oa;exports.EmbeddedChatPrimitiveFormSuccess=da;exports.EmbeddedChatPrimitiveFormSuccessButton=la;exports.EmbeddedChatPrimitiveFormSuccessHeading=ca;exports.EmbeddedChatPrimitiveFormSuccessMessage=ma;exports.EmbeddedChatPrimitiveFormWrapper=Hi;exports.EmbeddedChatPrimitiveHeaderToolbar=pe;exports.EmbeddedChatPrimitiveHelpActions=Ci;exports.EmbeddedChatPrimitiveHelpActionsMenu=bi;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=gi;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=Pi;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=Ai;exports.EmbeddedChatPrimitiveHelpActionsTrigger=vi;exports.EmbeddedChatPrimitiveInput=ft;exports.EmbeddedChatPrimitiveInputFieldset=It;exports.EmbeddedChatPrimitiveInputGroup=Mt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=qe;exports.EmbeddedChatPrimitiveMarkdown=ot;exports.EmbeddedChatPrimitiveMessageAction=ht;exports.EmbeddedChatPrimitiveMessageAnnotationAction=lt;exports.EmbeddedChatPrimitiveMessageAnnotationActions=mt;exports.EmbeddedChatPrimitiveMessageAttachments=Ye;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=Xe;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=Ze;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=et;exports.EmbeddedChatPrimitiveMessageAttachmentsList=Je;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=tt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=st;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=at;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=it;exports.EmbeddedChatPrimitiveMessageAvatar=Qe;exports.EmbeddedChatPrimitiveMessageAvatarContent=Ve;exports.EmbeddedChatPrimitiveMessageAvatarFallback=$e;exports.EmbeddedChatPrimitiveMessageAvatarImage=Ue;exports.EmbeddedChatPrimitiveMessageContent=Ge;exports.EmbeddedChatPrimitiveMessageContentWrapper=ze;exports.EmbeddedChatPrimitiveMessageHeader=We;exports.EmbeddedChatPrimitiveMessageLoading=Ne;exports.EmbeddedChatPrimitiveMessageName=Ke;exports.EmbeddedChatPrimitiveMessageSourceItem=vt;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=bt;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=_t;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=Et;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=gt;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemTag=At;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=Pt;exports.EmbeddedChatPrimitiveMessageSources=ut;exports.EmbeddedChatPrimitiveMessageSourcesHeader=Ct;exports.EmbeddedChatPrimitiveMessageSourcesList=pt;exports.EmbeddedChatPrimitiveMessageToolbar=ct;exports.EmbeddedChatPrimitiveMessageWrapper=re;exports.EmbeddedChatPrimitiveMessages=ke;exports.EmbeddedChatPrimitiveRoot=Ce;exports.EmbeddedChatPrimitiveSendButton=St;exports.EmbeddedChatPrimitiveSendButtonIcon=xt;exports.EmbeddedChatPrimitiveTaglineBrandName=hi;exports.EmbeddedChatPrimitiveTaglineContainer=ci;exports.EmbeddedChatPrimitiveTaglineLogo=li;exports.EmbeddedChatPrimitiveTaglineText=mi;exports.EmbeddedChatPrimitiveToolbarHeader=be;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=ve;exports.EmbeddedChatPrimitiveWorkflow=Oe;exports.EmbeddedChatPrimitiveWorkflows=Le;exports.EmbeddedChatPrimitiveWorkflowsLabel=De;exports.EmbeddedChatPrimitiveWorkflowsList=Re;exports.EmbeddedChatPrimitiveWrapper=ue;exports.ExampleQuestion=He;exports.ExampleQuestionButton=we;exports.ExampleQuestions=Te;exports.ExampleQuestionsLabel=ye;exports.ExampleQuestionsList=je;exports.FeedbackForm=fi;exports.FeedbackItem=Si;exports.FeedbackItemCheckbox=xi;exports.FeedbackItemCheckboxIndicator=Bi;exports.FeedbackItemDescription=yi;exports.FeedbackItemLabel=Ti;exports.FeedbackModal=_i;exports.FeedbackModalBody=Mi;exports.FeedbackModalClose=Ii;exports.FeedbackModalContent=Fi;exports.FeedbackModalHeader=ki;exports.FeedbackModalOverlay=Ei;exports.FeedbackSubmitButton=ji;exports.Footer=kt;exports.Form=wi;exports.FormCancel=sa;exports.FormClose=Li;exports.FormContent=qi;exports.FormDescription=Oi;exports.FormError=na;exports.FormField=Wi;exports.FormFieldCheckbox=Ui;exports.FormFieldCheckboxIndicator=Ki;exports.FormFieldEmail=Qi;exports.FormFieldError=aa;exports.FormFieldFile=Vi;exports.FormFieldLabel=Ni;exports.FormFieldSelect=zi;exports.FormFieldSelectContent=Xi;exports.FormFieldSelectIcon=Ji;exports.FormFieldSelectItem=ea;exports.FormFieldSelectItemIndicator=ia;exports.FormFieldSelectItemText=ta;exports.FormFieldSelectTrigger=Gi;exports.FormFieldSelectValue=Yi;exports.FormFieldSelectViewport=Zi;exports.FormFieldText=$;exports.FormFieldTextArea=$i;exports.FormFooter=ra;exports.FormHeader=Di;exports.FormHeading=Ri;exports.FormSubmit=oa;exports.FormSuccess=da;exports.FormSuccessButton=la;exports.FormSuccessHeading=ca;exports.FormSuccessMessage=ma;exports.FormWrapper=Hi;exports.Header=Ra;exports.HeaderToolbar=pe;exports.HeaderToolbarWrapper=ve;exports.HelpActions=Ci;exports.HelpActionsMenu=bi;exports.HelpActionsMenuArrow=gi;exports.HelpActionsMenuItem=Pi;exports.HelpActionsMenuItemIcon=Ai;exports.HelpActionsTrigger=vi;exports.Input=ft;exports.InputFieldset=It;exports.InputGroup=Mt;exports.IntroMessageWrapper=qe;exports.Markdown=ot;exports.MessageAction=ht;exports.MessageAnnotationAction=lt;exports.MessageAnnotationActions=mt;exports.MessageAttachments=Ye;exports.MessageAttachmentsItem=Xe;exports.MessageAttachmentsItemIcon=Ze;exports.MessageAttachmentsItemTitle=et;exports.MessageAttachmentsList=Je;exports.MessageAttachmentsPreview=tt;exports.MessageAttachmentsPreviewBody=st;exports.MessageAttachmentsPreviewClose=rt;exports.MessageAttachmentsPreviewContent=at;exports.MessageAttachmentsPreviewHeader=nt;exports.MessageAttachmentsPreviewOverlay=it;exports.MessageAvatar=Qe;exports.MessageAvatarContent=Ve;exports.MessageAvatarFallback=$e;exports.MessageAvatarImage=Ue;exports.MessageContent=Ge;exports.MessageContentWrapper=ze;exports.MessageHeader=We;exports.MessageLoading=Ne;exports.MessageName=Ke;exports.MessageSourceItem=vt;exports.MessageSourceItemBreadcrumbIcon=Tn;exports.MessageSourceItemBreadcrumbs=bt;exports.MessageSourceItemDescription=_t;exports.MessageSourceItemDescriptionPart=Et;exports.MessageSourceItemIcon=gt;exports.MessageSourceItemIndicator=Ft;exports.MessageSourceItemTag=At;exports.MessageSourceItemTitle=Pt;exports.MessageSources=ut;exports.MessageSourcesHeader=Ct;exports.MessageSourcesList=pt;exports.MessageToolbar=ct;exports.MessageWrapper=re;exports.Messages=ke;exports.PrimitiveMessagePart=An;exports.Root=Ce;exports.SendButton=St;exports.SendButtonIcon=xt;exports.TaglineBrandName=hi;exports.TaglineContainer=ci;exports.TaglineLogo=li;exports.TaglineText=mi;exports.ToolbarHeader=be;exports.Workflow=Oe;exports.Workflows=Le;exports.WorkflowsLabel=De;exports.WorkflowsList=Re;exports.Wrapper=ue;
|
|
@@ -22,7 +22,7 @@ import { SourceItemProvider as We, useSourceItem as H } from "../providers/sourc
|
|
|
22
22
|
import { useInkeepConfig as p } from "../providers/config-provider.js";
|
|
23
23
|
import { useMessageFeedback as oe } from "../providers/feedback-provider.js";
|
|
24
24
|
import { MessageAttachmentsProvider as Re, useMessageAttachments as U } from "../providers/message-attachments-provider.js";
|
|
25
|
-
import { useMessage as
|
|
25
|
+
import { useMessage as M, MessageProvider as Ne } from "../providers/message-provider.js";
|
|
26
26
|
import { CheckboxIcon as pe } from "../atoms/icons/checkbox-icon.js";
|
|
27
27
|
import { useCopyToClipboard as J } from "../hooks/use-copy-to-clipboard.js";
|
|
28
28
|
import { FeedbackItemProvider as Ve, useFeedbackItem as se } from "../providers/feedback-item-provider.js";
|
|
@@ -262,7 +262,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
262
262
|
), kt = a("div", {
|
|
263
263
|
_id: "aiChatMessageHeader"
|
|
264
264
|
}), Hn = (t) => {
|
|
265
|
-
const { message: e } =
|
|
265
|
+
const { message: e } = M();
|
|
266
266
|
return /* @__PURE__ */ n(kt, { "data-role": e.role, ...t });
|
|
267
267
|
}, Bt = a("div", {
|
|
268
268
|
_id: "aiChatMessageLoading",
|
|
@@ -270,12 +270,12 @@ const ot = "__intro__", st = a("div", {
|
|
|
270
270
|
}), Ln = (t) => /* @__PURE__ */ n(Bt, { ...t }), yt = a("div", {
|
|
271
271
|
_id: "aiChatMessageAvatar"
|
|
272
272
|
}), xn = (t) => {
|
|
273
|
-
const { message: e } =
|
|
273
|
+
const { message: e } = M();
|
|
274
274
|
return /* @__PURE__ */ n(yt, { "data-role": e.role, ...t });
|
|
275
275
|
}, Tt = a(ee.Root, {
|
|
276
276
|
_id: "aiChatMessageAvatarContent"
|
|
277
277
|
}), Dn = (t) => {
|
|
278
|
-
const { message: e } =
|
|
278
|
+
const { message: e } = M(), { baseSettings: i } = p();
|
|
279
279
|
return /* @__PURE__ */ n(
|
|
280
280
|
Tt,
|
|
281
281
|
{
|
|
@@ -288,7 +288,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
288
288
|
_id: "aiChatMessageAvatarFallback"
|
|
289
289
|
}), On = E(
|
|
290
290
|
(t) => {
|
|
291
|
-
const { baseSettings: e } = p(), { message: i } =
|
|
291
|
+
const { baseSettings: e } = p(), { message: i } = M();
|
|
292
292
|
return e.userProperties.name ? /* @__PURE__ */ n(
|
|
293
293
|
wt,
|
|
294
294
|
{
|
|
@@ -305,7 +305,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
305
305
|
const { onLoadingStatusChange: e, ...i } = t, {
|
|
306
306
|
aiChatSettings: r,
|
|
307
307
|
baseSettings: { userProperties: o }
|
|
308
|
-
} = p(), { message: s } =
|
|
308
|
+
} = p(), { message: s } = M(), { aiAssistantAvatar: c } = r ?? {}, d = typeof c == "string" ? c : c?.light, m = (typeof c == "string" ? c : c?.dark) ?? d, l = Ze(d, m), [C, v] = W(l);
|
|
309
309
|
Y(() => {
|
|
310
310
|
v(l);
|
|
311
311
|
}, [l]);
|
|
@@ -353,7 +353,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
353
353
|
), Ht = a("span", {
|
|
354
354
|
_id: "aiChatMessageName"
|
|
355
355
|
}), Rn = (t) => {
|
|
356
|
-
const { message: e } =
|
|
356
|
+
const { message: e } = M();
|
|
357
357
|
return /* @__PURE__ */ n(
|
|
358
358
|
Ht,
|
|
359
359
|
{
|
|
@@ -365,7 +365,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
365
365
|
}, Lt = a("div", {
|
|
366
366
|
_id: "aiChatMessageContentWrapper"
|
|
367
367
|
}), Nn = (t) => {
|
|
368
|
-
const { message: e } =
|
|
368
|
+
const { message: e } = M(), { messageButtons: i } = b(), r = i[e.id] || [];
|
|
369
369
|
return /* @__PURE__ */ n(
|
|
370
370
|
Lt,
|
|
371
371
|
{
|
|
@@ -377,12 +377,12 @@ const ot = "__intro__", st = a("div", {
|
|
|
377
377
|
}, xt = a("div", {
|
|
378
378
|
_id: "aiChatMessageContent"
|
|
379
379
|
}), Vn = (t) => {
|
|
380
|
-
const { message: e } =
|
|
380
|
+
const { message: e } = M();
|
|
381
381
|
return /* @__PURE__ */ n(xt, { "data-role": e.role, ...t });
|
|
382
382
|
}, Dt = a("div", {
|
|
383
383
|
_id: "aiChatMessageAttachments"
|
|
384
384
|
}), $n = (t) => {
|
|
385
|
-
const { message: e } =
|
|
385
|
+
const { message: e } = M(), i = [];
|
|
386
386
|
return e.role !== "user" || !i?.length ? null : /* @__PURE__ */ n(Re, { children: /* @__PURE__ */ n(Dt, { ...t }) });
|
|
387
387
|
}, Ot = a("div", {
|
|
388
388
|
_id: "aiChatMessageAttachments__List"
|
|
@@ -472,25 +472,25 @@ const ot = "__intro__", st = a("div", {
|
|
|
472
472
|
}, [t]), Fe(() => {
|
|
473
473
|
if (!i || !o || !l || !s.current)
|
|
474
474
|
return;
|
|
475
|
-
const _ = s.current,
|
|
476
|
-
return
|
|
475
|
+
const _ = s.current, F = document.createElement("div");
|
|
476
|
+
return F.setAttribute("data-ikp-component", ""), F.setAttribute("data-component", t), F.setAttribute("slot", _), c.current = F, m.current = !1, o.appendChild(F), u(!0), () => {
|
|
477
477
|
m.current = !0, u(!1), queueMicrotask(() => {
|
|
478
478
|
try {
|
|
479
479
|
d.current && (d.current.unmount(), d.current = null);
|
|
480
480
|
} catch (A) {
|
|
481
481
|
console.debug("Ignoring unmount error:", A);
|
|
482
482
|
}
|
|
483
|
-
|
|
483
|
+
F.parentNode === o && F.remove(), c.current = null;
|
|
484
484
|
});
|
|
485
485
|
};
|
|
486
486
|
}, [i, o, l, t]), Y(() => {
|
|
487
487
|
const _ = c.current;
|
|
488
488
|
if (!_ || m.current) return;
|
|
489
|
-
const
|
|
490
|
-
if (typeof
|
|
489
|
+
const F = (f) => {
|
|
490
|
+
if (typeof f != "function" || f.length > 1) return !1;
|
|
491
491
|
try {
|
|
492
|
-
if (typeof
|
|
493
|
-
const w =
|
|
492
|
+
if (typeof f == "function" && f.constructor === Function) {
|
|
493
|
+
const w = f({});
|
|
494
494
|
return G.isValidElement(w);
|
|
495
495
|
}
|
|
496
496
|
return !1;
|
|
@@ -499,12 +499,12 @@ const ot = "__intro__", st = a("div", {
|
|
|
499
499
|
}
|
|
500
500
|
};
|
|
501
501
|
let A;
|
|
502
|
-
if (
|
|
502
|
+
if (F(i))
|
|
503
503
|
try {
|
|
504
|
-
const
|
|
505
|
-
A = G.createElement(
|
|
506
|
-
} catch (
|
|
507
|
-
console.error("Error creating React element from component:",
|
|
504
|
+
const f = i;
|
|
505
|
+
A = G.createElement(f, e || {});
|
|
506
|
+
} catch (f) {
|
|
507
|
+
console.error("Error creating React element from component:", f);
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
510
|
else if (typeof i == "function")
|
|
@@ -525,12 +525,12 @@ const ot = "__intro__", st = a("div", {
|
|
|
525
525
|
}), Ut = a("div", {
|
|
526
526
|
_id: "aiChatMessageToolbar"
|
|
527
527
|
}), ir = (t) => {
|
|
528
|
-
const { isLoading: e, messages: i } = b(), { message: r } =
|
|
528
|
+
const { isLoading: e, messages: i } = b(), { message: r } = M();
|
|
529
529
|
return i.at(-1)?.id === r?.id && e || r.role === "user" ? null : /* @__PURE__ */ n(Ut, { ...t });
|
|
530
530
|
}, Kt = a("div", {
|
|
531
531
|
_id: "aiChatMessageAnnotationActions"
|
|
532
532
|
}), ar = (t) => {
|
|
533
|
-
const { children: e, ...i } = t, { message: r } =
|
|
533
|
+
const { children: e, ...i } = t, { message: r } = M(), { messageButtons: o } = b(), s = o[r.id] || [];
|
|
534
534
|
return /* @__PURE__ */ n(Kt, { children: k(e, s), ...i });
|
|
535
535
|
}, qt = a("a", {
|
|
536
536
|
_id: "aiChatMessageAnnotationAction"
|
|
@@ -574,11 +574,11 @@ const ot = "__intro__", st = a("div", {
|
|
|
574
574
|
}), rr = (t) => {
|
|
575
575
|
const { action: e, onClick: i, className: r, ...o } = t, { conversationId: s } = b(), {
|
|
576
576
|
baseSettings: { onFeedback: c }
|
|
577
|
-
} = p(), { message: d } =
|
|
577
|
+
} = p(), { message: d } = M(), { isStreaming: m, messages: l } = b(), [C, v] = J(), { feedback: u, submitPositiveFeedback: _, setCurrentFeedback: F, currentFeedback: A } = oe(), { logEvent: f } = me(), [w, le] = Ue(), K = l.at(-1)?.id === d?.id, q = d.role === "assistant";
|
|
578
578
|
if (K && m || !q) return null;
|
|
579
579
|
const D = {
|
|
580
580
|
copy() {
|
|
581
|
-
v(ve(d)),
|
|
581
|
+
v(ve(d)), f({
|
|
582
582
|
eventName: "assistant_message_copied",
|
|
583
583
|
properties: {
|
|
584
584
|
conversationId: s
|
|
@@ -591,7 +591,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
591
591
|
});
|
|
592
592
|
},
|
|
593
593
|
downvote() {
|
|
594
|
-
|
|
594
|
+
F(d.id);
|
|
595
595
|
}
|
|
596
596
|
}, j = {
|
|
597
597
|
copy: "Copy Message",
|
|
@@ -630,7 +630,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
630
630
|
}, Gt = a("div", {
|
|
631
631
|
_id: "aiChatMessageSources"
|
|
632
632
|
}), or = (t) => {
|
|
633
|
-
const { message: e } =
|
|
633
|
+
const { message: e } = M();
|
|
634
634
|
return e.role !== "assistant" || !e.parts.filter(
|
|
635
635
|
(r) => r.type === "data-artifact" && r.data?.type?.toLowerCase() === be
|
|
636
636
|
)?.length ? null : /* @__PURE__ */ n(Gt, { ...t });
|
|
@@ -639,7 +639,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
639
639
|
}), sr = (t) => /* @__PURE__ */ n(Yt, { children: "Sources", ...t }), Jt = a("div", {
|
|
640
640
|
_id: "aiChatMessageSources__List"
|
|
641
641
|
}), cr = (t) => {
|
|
642
|
-
const { message: e } =
|
|
642
|
+
const { message: e } = M(), { children: i, ...r } = t, {
|
|
643
643
|
baseSettings: { transformSource: o, organizationDisplayName: s },
|
|
644
644
|
aiChatSettings: { shouldOpenLinksInNewTab: c },
|
|
645
645
|
searchSettings: { tabs: d }
|
|
@@ -669,8 +669,8 @@ const ot = "__intro__", st = a("div", {
|
|
|
669
669
|
})))(_, "chatSourceItem", {
|
|
670
670
|
organizationDisplayName: s,
|
|
671
671
|
tabs: d
|
|
672
|
-
}),
|
|
673
|
-
return { ...A, isExternal:
|
|
672
|
+
}), f = A.shouldOpenInNewTab !== void 0 ? A.shouldOpenInNewTab : c;
|
|
673
|
+
return { ...A, isExternal: f };
|
|
674
674
|
});
|
|
675
675
|
return /* @__PURE__ */ n(Jt, { children: k(i, C), ...r });
|
|
676
676
|
}, Xt = a(De, {
|
|
@@ -1050,7 +1050,7 @@ const ot = "__intro__", st = a("div", {
|
|
|
1050
1050
|
}), ki = a(y.Trigger, {
|
|
1051
1051
|
_id: "aiChat__ChatAction"
|
|
1052
1052
|
}), _e = (t) => {
|
|
1053
|
-
const { action: e, onClick: i, className: r, ...o } = t, s = {}, { clear: c, stop: d, isLoading: m, isStreaming: l, messages: C } = b(), { conversationId: v } = b(), { aiChatSettings: u } = p(), [_,
|
|
1053
|
+
const { action: e, onClick: i, className: r, ...o } = t, s = {}, { clear: c, stop: d, isLoading: m, isStreaming: l, messages: C } = b(), { conversationId: v } = b(), { aiChatSettings: u } = p(), [_, F] = J(), [
|
|
1054
1054
|
A
|
|
1055
1055
|
/* copyShareUri */
|
|
1056
1056
|
] = J();
|
|
@@ -1076,7 +1076,7 @@ ${z}`;
|
|
|
1076
1076
|
---
|
|
1077
1077
|
|
|
1078
1078
|
`);
|
|
1079
|
-
|
|
1079
|
+
F(he);
|
|
1080
1080
|
},
|
|
1081
1081
|
share: async () => {
|
|
1082
1082
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.14.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.14.9",componentType:n,tags:o}),[n,o]),u={logEvent:t.useCallback(async c=>{const v={...i,...c.properties,...r},d={eventName:c.eventName,properties:v};return s.onEvent?.(d)},[s,i,r])};return E.jsx(a.Provider,{value:u,children:e})},g=()=>{const e=t.useContext(a);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=p;exports.useBaseEvents=g;
|
|
@@ -5,7 +5,7 @@ import { useInkeepConfig as g } from "./config-provider.js";
|
|
|
5
5
|
const a = d(void 0), P = ({ children: e }) => {
|
|
6
6
|
const { baseSettings: t, componentType: o } = g(), { tags: s, analyticsProperties: n } = t, r = u(
|
|
7
7
|
() => ({
|
|
8
|
-
widgetLibraryVersion: "0.14.
|
|
8
|
+
widgetLibraryVersion: "0.14.9",
|
|
9
9
|
componentType: o,
|
|
10
10
|
tags: s
|
|
11
11
|
}),
|