@opencx/widget-react 4.0.0

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.
Files changed (69) hide show
  1. package/README.md +5 -0
  2. package/dist/WidgetPopoverAnchor.d.ts +2 -0
  3. package/dist/WidgetPopoverContent.d.ts +3 -0
  4. package/dist/WidgetPopoverTrigger.d.ts +3 -0
  5. package/dist/components/AgentOrBotAvatar.d.ts +6 -0
  6. package/dist/components/AttachmentPreview.d.ts +7 -0
  7. package/dist/components/BotOrAgentMessage.d.ts +7 -0
  8. package/dist/components/BotOrAgentMessageGroup.d.ts +7 -0
  9. package/dist/components/Header.d.ts +3 -0
  10. package/dist/components/MightSolveUserIssueSuggestedReplies.d.ts +2 -0
  11. package/dist/components/PoweredByOpen.d.ts +4 -0
  12. package/dist/components/SuggestedReplyButton.d.ts +5 -0
  13. package/dist/components/UserMessage.d.ts +8 -0
  14. package/dist/components/UserMessageGroup.d.ts +5 -0
  15. package/dist/components/custom-components/BotOrAgentTextResponse.component.d.ts +16 -0
  16. package/dist/components/custom-components/Fallback.component.d.ts +6 -0
  17. package/dist/components/custom-components/Handoff.component.d.ts +3 -0
  18. package/dist/components/custom-components/Loading.component.d.ts +6 -0
  19. package/dist/components/lib/DynamicIcon.d.ts +6 -0
  20. package/dist/components/lib/LoadingSpinner.d.ts +4 -0
  21. package/dist/components/lib/MotionDiv.d.ts +19 -0
  22. package/dist/components/lib/avatar.d.ts +6 -0
  23. package/dist/components/lib/button.d.ts +11 -0
  24. package/dist/components/lib/dialog.d.ts +24 -0
  25. package/dist/components/lib/dropdown-menu.d.ts +27 -0
  26. package/dist/components/lib/input.d.ts +4 -0
  27. package/dist/components/lib/popover.d.ts +8 -0
  28. package/dist/components/lib/skeleton.d.ts +3 -0
  29. package/dist/components/lib/switch.d.ts +4 -0
  30. package/dist/components/lib/tooltip.d.ts +10 -0
  31. package/dist/components/lib/utils/cn.d.ts +2 -0
  32. package/dist/components/lib/widget-portal.d.ts +9 -0
  33. package/dist/components/lib/wobble.d.ts +26 -0
  34. package/dist/components/markdown.d.ts +3 -0
  35. package/dist/components/svg/ChatBubbleSvg.d.ts +5 -0
  36. package/dist/components/svg/OpenLogoSvg.d.ts +4 -0
  37. package/dist/hooks/useCanvas.d.ts +3 -0
  38. package/dist/hooks/useIsSmallScreen.d.ts +3 -0
  39. package/dist/hooks/useLocale.d.ts +6 -0
  40. package/dist/hooks/useSetWidgetSize.d.ts +8 -0
  41. package/dist/hooks/useTheme.d.ts +62 -0
  42. package/dist/hooks/useWidgetContentHeight.d.ts +3 -0
  43. package/dist/index.cjs +51 -0
  44. package/dist/index.cjs.map +1 -0
  45. package/dist/index.d.ts +9 -0
  46. package/dist/index.js +2778 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/screens/chat/ChatCanvas.d.ts +2 -0
  49. package/dist/screens/chat/ChatFooter.d.ts +2 -0
  50. package/dist/screens/chat/ChatMain.d.ts +2 -0
  51. package/dist/screens/chat/index.d.ts +2 -0
  52. package/dist/screens/index.d.ts +2 -0
  53. package/dist/screens/sessions/index.d.ts +2 -0
  54. package/dist/screens/welcome/index.d.ts +2 -0
  55. package/dist/translation/ar.locale.d.ts +2 -0
  56. package/dist/translation/de.locale.d.ts +2 -0
  57. package/dist/translation/en.locale.d.ts +2 -0
  58. package/dist/translation/es.locale.d.ts +2 -0
  59. package/dist/translation/fr.locale.d.ts +2 -0
  60. package/dist/translation/index.d.ts +16 -0
  61. package/dist/translation/nl.locale.d.ts +2 -0
  62. package/dist/translation/pt.locale.d.ts +2 -0
  63. package/dist/translation/tr.locale.d.ts +2 -0
  64. package/dist/translation/translation.types.d.ts +4 -0
  65. package/dist/utils/data-component.d.ts +7 -0
  66. package/dist/utils/group-messages-by-type.d.ts +5 -0
  67. package/dist-embed/script.js +365 -0
  68. package/dist-embed/script.js.map +1 -0
  69. package/package.json +75 -0
package/dist/index.js ADDED
@@ -0,0 +1,2778 @@
1
+ import { jsx as o, jsxs as c, Fragment as nt } from "react/jsx-runtime";
2
+ import * as ie from "@radix-ui/react-popover";
3
+ import * as E from "react";
4
+ import se, { memo as Et, forwardRef as st, useState as j, cloneElement as Ft, useEffect as le, useMemo as at, useRef as ce, createElement as Qe } from "react";
5
+ import { useConfig as S, useWidget as $, useWidgetRouter as A, usePreludeData as de, useDocumentDir as ve, useWidgetTrigger as V, useSessions as Y, useMessages as q, useModes as it, useUploadFiles as Pt, useIsAwaitingBotReply as lt, useContact as Wt, WidgetProvider as Ht, WidgetTriggerProvider as At } from "@opencx/widget-react-headless";
6
+ import ct from "rehype-raw";
7
+ import dt from "remark-gfm";
8
+ import * as O from "@radix-ui/react-dialog";
9
+ import { X as Bt, CircleDashedIcon as Lt, XIcon as be, SquareXIcon as $t, SquareCheckBigIcon as Yt, SquareCheckIcon as qt, ShrinkIcon as Xt, Minimize2Icon as Ut, MinimizeIcon as Vt, Maximize2Icon as Kt, MaximizeIcon as Gt, ExpandIcon as Zt, CircleXIcon as Jt, CircleCheckBigIcon as Qt, CircleCheckIcon as pt, CheckCheckIcon as eo, CheckIcon as to, ChevronLeftIcon as oo, LoaderIcon as ro, PaperclipIcon as no, ImageIcon as so, CircleDashed as ao, ArrowUpIcon as io, AlertCircle as lo, Loader2 as co, FileAudio2Icon as po, FileVideo2Icon as ho, FileIcon as mo, UserRoundIcon as wo, ChevronRightIcon as go, SendHorizontal as uo, ChevronDownIcon as fo } from "lucide-react";
10
+ import { clsx as vo } from "clsx";
11
+ import { twMerge as bo } from "tailwind-merge";
12
+ import { createPortal as xo } from "react-dom";
13
+ import ht, { useFrame as yo } from "@uiw/react-iframe";
14
+ import { Slot as ko } from "@radix-ui/react-slot";
15
+ import { cva as Co } from "class-variance-authority";
16
+ import zo from "react-markdown";
17
+ import { isExhaustive as D } from "@opencx/widget-core";
18
+ import { motion as Z, AnimatePresence as T } from "framer-motion";
19
+ import * as K from "@radix-ui/react-avatar";
20
+ import * as ee from "@radix-ui/react-tooltip";
21
+ import et from "tinycolor2";
22
+ import { useDropzone as No } from "react-dropzone";
23
+ import So from "react-use/lib/useAsyncFn";
24
+ import { z as me } from "zod";
25
+ function w(e) {
26
+ return { "data-component": e };
27
+ }
28
+ function d(...e) {
29
+ return bo(vo(e));
30
+ }
31
+ const mt = "opencx-widget-portal";
32
+ function pe() {
33
+ return null;
34
+ }
35
+ function _o({ children: e }) {
36
+ var r, n;
37
+ const t = (n = (r = yo()) == null ? void 0 : r.document) == null ? void 0 : n.getElementById(mt);
38
+ return t ? xo(e, t) : (console.error("Portal container not found!"), null);
39
+ }
40
+ function Io() {
41
+ return /* @__PURE__ */ o("div", { id: mt, className: "absolute size-full top-0 left-0" });
42
+ }
43
+ pe.Portal = _o;
44
+ pe.Container = Io;
45
+ const U = {
46
+ x: 2,
47
+ y: 2
48
+ }, H = Et(
49
+ st(
50
+ ({ children: e, className: t, scale: r = 1.02, off: n = !1 }, s) => {
51
+ const [a, l] = j(!1), [i, p] = j({ x: 0, y: 0 });
52
+ if (n || /translate/.test(
53
+ e.props.className || ""
54
+ )) return e;
55
+ const b = (m) => {
56
+ var v, k;
57
+ const { clientX: g, clientY: _ } = m, x = m.currentTarget.getBoundingClientRect(), I = g - (x.left + x.width / 2), M = _ - (x.top + x.height / 2), F = Math.max(
58
+ -1,
59
+ Math.min(1, I / (x.width / 2))
60
+ ), P = Math.max(
61
+ -1,
62
+ Math.min(1, M / (x.height / 2))
63
+ ), W = F * U.x, R = P * U.y;
64
+ p({ x: W, y: R }), (k = (v = e.props).onMouseMove) == null || k.call(v, m);
65
+ }, C = () => {
66
+ var m, g;
67
+ l(!0), (g = (m = e.props).onMouseEnter) == null || g.call(m);
68
+ }, f = () => {
69
+ var m, g;
70
+ l(!1), p({ x: 0, y: 0 }), (g = (m = e.props).onMouseLeave) == null || g.call(m);
71
+ }, h = {
72
+ "--wobble-x": a ? `${i.x}px` : "0px",
73
+ "--wobble-y": a ? `${i.y}px` : "0px",
74
+ "--scale": 1 - (r - 1)
75
+ };
76
+ return Ft(e, {
77
+ ref: s,
78
+ onMouseMove: b,
79
+ onMouseEnter: C,
80
+ onMouseLeave: f,
81
+ style: {
82
+ ...h,
83
+ ...e.props.style
84
+ },
85
+ className: d(
86
+ "translate-x-[var(--wobble-x)]",
87
+ "translate-y-[var(--wobble-y)]",
88
+ "hover:scale-[var(--scale)] active:hover:scale-[calc(var(--scale)-0.02)]",
89
+ t,
90
+ e.props.className,
91
+ "transition-all ease-out"
92
+ )
93
+ });
94
+ }
95
+ )
96
+ );
97
+ H.displayName = "Wobble";
98
+ const To = Co(
99
+ d(
100
+ "inline-flex shrink-0 items-center justify-center gap-2",
101
+ "text-sm font-medium whitespace-nowrap",
102
+ "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
103
+ "disabled:pointer-events-none disabled:opacity-50",
104
+ "active:scale-95 hover:active:scale-95",
105
+ "rounded-xl",
106
+ "transition"
107
+ ),
108
+ {
109
+ variants: {
110
+ variant: {
111
+ default: "bg-primary text-primary-foreground",
112
+ destructive: "bg-destructive text-destructive-foreground",
113
+ outline: "bg-background",
114
+ secondary: "bg-secondary text-secondary-foreground",
115
+ ghost: "hover:bg-secondary",
116
+ link: "text-primary underline-offset-4 hover:underline"
117
+ },
118
+ size: {
119
+ default: "h-10 px-4 py-2",
120
+ sm: "py-2 px-3.5 text-xs",
121
+ /**
122
+ * This size is useful for top level buttons that needs to sit nicely inside the iframe's border radius.
123
+ * Having the minimum height higher than usual (the `default` variant) will make the border radius look just right.
124
+ */
125
+ lg: "min-h-12 px-4 rounded-[20px]",
126
+ icon: "h-10 w-10",
127
+ fit: "size-fit p-2",
128
+ free: "p-2",
129
+ selfless: "p-0"
130
+ }
131
+ },
132
+ defaultVariants: {
133
+ variant: "default",
134
+ size: "default"
135
+ }
136
+ }
137
+ ), z = E.forwardRef(
138
+ ({ className: e, variant: t = "default", size: r, asChild: n = !1, ...s }, a) => /* @__PURE__ */ o(H, { ref: a, children: /* @__PURE__ */ o(
139
+ n ? ko : "button",
140
+ {
141
+ ...w("ui_lib/btn"),
142
+ "data-variant": t,
143
+ className: d(To({ variant: t, size: r, className: e })),
144
+ ...s
145
+ }
146
+ ) })
147
+ );
148
+ z.displayName = "Button";
149
+ const wt = O.Root, gt = O.Trigger, ut = E.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ o(
150
+ O.Overlay,
151
+ {
152
+ ref: r,
153
+ className: d(
154
+ "fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
155
+ e
156
+ ),
157
+ ...t
158
+ }
159
+ ));
160
+ ut.displayName = O.Overlay.displayName;
161
+ const xe = E.forwardRef(({ className: e, children: t, withClose: r = !1, ...n }, s) => /* @__PURE__ */ c(pe.Portal, { children: [
162
+ /* @__PURE__ */ o(ut, {}),
163
+ /* @__PURE__ */ c(
164
+ O.Content,
165
+ {
166
+ ref: s,
167
+ className: d(
168
+ "fixed left-[50%] top-[50%] z-50 flex flex-col space-y-4 w-full max-w-[61.8%] translate-x-[-50%] translate-y-[-50%] border bg-background p-4 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-3xl",
169
+ e
170
+ ),
171
+ ...n,
172
+ children: [
173
+ t,
174
+ r && /* @__PURE__ */ o(
175
+ O.Close,
176
+ {
177
+ asChild: !0,
178
+ className: "absolute right-4 top-4 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
179
+ children: /* @__PURE__ */ c(z, { size: "fit", className: "rounded-full", variant: "secondary", children: [
180
+ /* @__PURE__ */ o(Bt, { className: "h-4 w-4" }),
181
+ /* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
182
+ ] })
183
+ }
184
+ )
185
+ ]
186
+ }
187
+ )
188
+ ] }));
189
+ xe.displayName = O.Content.displayName;
190
+ const ft = ({
191
+ className: e,
192
+ ...t
193
+ }) => /* @__PURE__ */ o(
194
+ "div",
195
+ {
196
+ className: d("flex flex-col gap-2 text-center pt-2", e),
197
+ ...t
198
+ }
199
+ );
200
+ ft.displayName = "DialogHeader";
201
+ const vt = ({
202
+ className: e,
203
+ ...t
204
+ }) => /* @__PURE__ */ o(
205
+ "div",
206
+ {
207
+ className: d("flex flex-col gap-2 text-center", e),
208
+ ...t
209
+ }
210
+ );
211
+ vt.displayName = "DialogBody";
212
+ const bt = ({
213
+ className: e,
214
+ ...t
215
+ }) => /* @__PURE__ */ o("div", { className: d("flex flex-col gap-2", e), ...t });
216
+ bt.displayName = "DialogFooter";
217
+ const ye = E.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ o(
218
+ O.Title,
219
+ {
220
+ ref: r,
221
+ className: d(
222
+ "text-lg font-semibold leading-none tracking-tight",
223
+ e
224
+ ),
225
+ ...t
226
+ }
227
+ ));
228
+ ye.displayName = O.Title.displayName;
229
+ const xt = E.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ o(
230
+ O.Description,
231
+ {
232
+ ref: r,
233
+ className: d("text-sm text-muted-foreground", e),
234
+ ...t
235
+ }
236
+ ));
237
+ xt.displayName = O.Description.displayName;
238
+ function yt({ attachment: e }) {
239
+ const { name: t, size: r, type: n, url: s } = e, a = n.startsWith("image/"), l = n.startsWith("video/"), i = n.startsWith("audio/");
240
+ return i ? /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o("div", { className: "w-full shrink-0 overflow-hidden", children: /* @__PURE__ */ c("audio", { controls: !0, className: "w-full", children: [
241
+ /* @__PURE__ */ o("source", { src: s, type: n }),
242
+ "Your browser does not support the audio tag."
243
+ ] }) }) }) : l ? /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o("div", { className: "w-full border shrink-0 rounded-2xl overflow-hidden", children: /* @__PURE__ */ c("video", { controls: !0, children: [
244
+ /* @__PURE__ */ o("source", { src: s, type: n }),
245
+ "Your browser does not support the video tag."
246
+ ] }) }) }) : !a && !l && !i ? /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o("div", { className: "size-fit border shrink-0 rounded-2xl overflow-hidden", children: /* @__PURE__ */ c("div", { className: "flex items-end gap-2 p-2", children: [
247
+ /* @__PURE__ */ o(
248
+ "a",
249
+ {
250
+ href: s,
251
+ target: "_blank",
252
+ rel: "noopener noreferrer",
253
+ className: d(
254
+ "text-xs text-blue-500 line-clamp-2 underline hover:text-blue-600",
255
+ "break-words [word-break:break-word]"
256
+ // `[word-break:break-word]` is deprecated but works in the browser, while `break-words` which is `[overflow-wrap: break-word]` does not work
257
+ ),
258
+ children: t
259
+ }
260
+ ),
261
+ /* @__PURE__ */ c("span", { className: "text-xs text-muted-foreground whitespace-nowrap", children: [
262
+ (r / 1024).toFixed(2),
263
+ " KB"
264
+ ] })
265
+ ] }) }) }) : /* @__PURE__ */ c(wt, { children: [
266
+ /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(gt, { children: /* @__PURE__ */ o("div", { className: "size-fit border shrink-0 rounded-2xl overflow-hidden", children: a && /* @__PURE__ */ o("img", { src: s, className: "object-cover size-16", alt: t }) }) }) }),
267
+ /* @__PURE__ */ c(
268
+ xe,
269
+ {
270
+ "aria-describedby": void 0,
271
+ className: "size-full max-w-full rounded-3xl flex items-center justify-center bg-transparent border-none gap-0",
272
+ withClose: !0,
273
+ children: [
274
+ /* @__PURE__ */ o(ye, { className: "sr-only", children: "Image preview" }),
275
+ a && /* @__PURE__ */ o("div", { className: "size-fit shrink-0 rounded-2xl overflow-hidden max-h-full", children: /* @__PURE__ */ o("img", { src: s, className: "object-cover size-auto", alt: t }) })
276
+ ]
277
+ }
278
+ )
279
+ ] });
280
+ }
281
+ const kt = se.memo(
282
+ zo,
283
+ (e, t) => e.children === t.children && e.className === t.className
284
+ );
285
+ function ae({
286
+ data: e,
287
+ id: t,
288
+ type: r,
289
+ attachments: n,
290
+ isFirstInGroup: s,
291
+ isLastInGroup: a,
292
+ isAloneInGroup: l,
293
+ dataComponentNames: i,
294
+ classNames: p
295
+ }) {
296
+ const { anchorTarget: y } = S(), { message: b, variant: C = "default" } = e;
297
+ return C === "error" ? /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("div", { className: "flex flex-row flex-wrap items-center justify-start", children: /* @__PURE__ */ o("div", { className: "leading-snug text-sm text-destructive", children: b }) }) }) : /* @__PURE__ */ c(
298
+ "div",
299
+ {
300
+ ...w((i == null ? void 0 : i.messageContainer) ?? "chat/agent_msg/root"),
301
+ className: d(
302
+ "w-5/6 flex flex-col items-start gap-1",
303
+ p == null ? void 0 : p.messageContainer
304
+ ),
305
+ children: [
306
+ n && n.length > 0 && /* @__PURE__ */ o("div", { className: "w-full gap-1 flex flex-row flex-wrap items-center justify-start", children: n == null ? void 0 : n.map((f) => /* @__PURE__ */ o(yt, { attachment: f }, f.id)) }),
307
+ b.length > 0 && /* @__PURE__ */ o(
308
+ "div",
309
+ {
310
+ ...w((i == null ? void 0 : i.message) ?? "chat/agent_msg/msg"),
311
+ "data-first": s,
312
+ "data-last": a,
313
+ "data-alone": l,
314
+ className: d(
315
+ "transition-all",
316
+ "w-fit py-3 px-4 rounded-3xl bg-secondary text-secondary-foreground",
317
+ "leading-snug text-sm prose prose-sm prose-a:decoration-primary prose-a:underline",
318
+ "break-words [word-break:break-word]",
319
+ // `[word-break:break-word]` is deprecated but works in the browser, while `break-words` which is `[overflow-wrap: break-word]` does not work
320
+ // No need to add "whitespace-pre-wrap" in the agent or bot message because it is markup and content appear on separate lines as expected
321
+ // Adding "whitespace-pre-wrap" will result in unnecessarily huge line breaks
322
+ // We're using the booleans directly here, not the data attributes, to make any external styling more specific than this
323
+ s && !l && "rounded-bl-md",
324
+ a && !l && "rounded-tl-md",
325
+ !s && !a && !l && "rounded-l-md",
326
+ p == null ? void 0 : p.message
327
+ ),
328
+ children: /* @__PURE__ */ o(
329
+ kt,
330
+ {
331
+ "data-type": r,
332
+ "data-id": t,
333
+ remarkPlugins: [dt],
334
+ rehypePlugins: [ct],
335
+ components: {
336
+ a: ({ children: f, ...h }) => /* @__PURE__ */ o("a", { target: y ?? "_top", ...h, children: f })
337
+ },
338
+ children: b
339
+ }
340
+ )
341
+ }
342
+ )
343
+ ]
344
+ }
345
+ );
346
+ }
347
+ function Mo(e) {
348
+ return /* @__PURE__ */ o("div", { className: "w-full max-w-full overflow-auto shrink-0", children: /* @__PURE__ */ o(
349
+ "pre",
350
+ {
351
+ dir: "auto",
352
+ className: "text-xs leading-tight whitespace-pre-wrap break-word",
353
+ children: JSON.stringify(e, null, 1)
354
+ }
355
+ ) });
356
+ }
357
+ const ke = E.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ o(
358
+ K.Root,
359
+ {
360
+ ref: r,
361
+ className: d(
362
+ "relative flex size-6 aspect-square shrink-0 overflow-hidden rounded-full bg-secondary",
363
+ // 'border',
364
+ e
365
+ ),
366
+ ...t
367
+ }
368
+ ));
369
+ ke.displayName = K.Root.displayName;
370
+ const Ce = E.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ o(
371
+ K.Image,
372
+ {
373
+ ref: r,
374
+ className: d("aspect-square h-full w-full", e),
375
+ ...t
376
+ }
377
+ ));
378
+ Ce.displayName = K.Image.displayName;
379
+ const ze = E.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ o(
380
+ K.Fallback,
381
+ {
382
+ ref: r,
383
+ className: d(
384
+ "flex size-full text-xs items-center justify-center rounded-lg",
385
+ e
386
+ ),
387
+ ...t
388
+ }
389
+ ));
390
+ ze.displayName = K.Fallback.displayName;
391
+ function ge({
392
+ agent: e,
393
+ ...t
394
+ }) {
395
+ var r, n;
396
+ return /* @__PURE__ */ c(ke, { ...t, children: [
397
+ /* @__PURE__ */ o(Ce, { src: (e == null ? void 0 : e.avatar) ?? "", alt: "Agent Icon" }),
398
+ (e == null ? void 0 : e.name) && /* @__PURE__ */ o(ze, { children: (n = (r = e == null ? void 0 : e.name) == null ? void 0 : r.slice(0, 1)) == null ? void 0 : n.toUpperCase() })
399
+ ] });
400
+ }
401
+ const Do = 10, Oo = (e, t, r) => ({
402
+ initial: { opacity: 0, x: -e, ...t.initial },
403
+ animate: { opacity: 1, x: 0, ...t.animate, transition: { delay: r } },
404
+ exit: { opacity: 0, x: e, ...t.exit }
405
+ }), Ro = (e, t, r) => ({
406
+ initial: { opacity: 0, x: e, ...t.initial },
407
+ animate: { opacity: 1, x: 0, ...t.animate, transition: { delay: r } },
408
+ exit: { opacity: 0, x: -e, ...t.exit }
409
+ }), jo = (e, t, r) => ({
410
+ initial: { opacity: 0, y: e, ...t.initial },
411
+ animate: { opacity: 1, y: 0, ...t.animate, transition: { delay: r } },
412
+ exit: { opacity: 0, y: -e, ...t.exit }
413
+ }), Eo = (e, t, r) => ({
414
+ initial: { opacity: 0, y: -e, ...t.initial },
415
+ animate: { opacity: 1, y: 0, ...t.animate, transition: { delay: r } },
416
+ exit: { opacity: 0, y: e, ...t.exit }
417
+ }), Fo = {
418
+ right: Oo,
419
+ left: Ro,
420
+ up: jo,
421
+ down: Eo
422
+ }, u = st(
423
+ ({
424
+ fadeIn: e = "down",
425
+ distance: t = Do,
426
+ children: r,
427
+ snapExit: n = !1,
428
+ overrides: s = {},
429
+ delay: a = 0,
430
+ ...l
431
+ }, i) => {
432
+ const p = e ? Fo[e](t, s, a) : {};
433
+ return n && p.exit && typeof p.exit == "object" && !Array.isArray(p.exit) && (p.exit.transition = { duration: 0 }), /* @__PURE__ */ o(Z.div, { ref: i, ...l, ...p, children: r });
434
+ }
435
+ );
436
+ u.displayName = "MotionDiv";
437
+ function Po({ agent: e }) {
438
+ return /* @__PURE__ */ o(T, { children: /* @__PURE__ */ c(
439
+ u,
440
+ {
441
+ ...w("chat/bot_loading/root"),
442
+ className: "flex flex-row items-end w-full gap-2 animate-pulse",
443
+ children: [
444
+ /* @__PURE__ */ o(ge, { agent: e }),
445
+ /* @__PURE__ */ c(
446
+ "div",
447
+ {
448
+ ...w("chat/bot_loading/bouncing_dots_container"),
449
+ className: d(
450
+ "flex items-center [&_span]:bg-secondary-foreground [&_span]:size-1 gap-1 p-2 rounded-xl bg-secondary"
451
+ // 'border',
452
+ ),
453
+ children: [
454
+ /* @__PURE__ */ o(Z.span, { className: "rounded-full animate-bounce [animation-delay:-0.3s]" }),
455
+ /* @__PURE__ */ o(Z.span, { className: "rounded-full animate-bounce [animation-delay:-0.15s]" }),
456
+ /* @__PURE__ */ o(Z.span, { className: "rounded-full animate-bounce" })
457
+ ]
458
+ }
459
+ )
460
+ ]
461
+ }
462
+ ) });
463
+ }
464
+ const Ct = '@import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..700;1,14..32,100..700&display=swap";@import"https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}*{-ms-overflow-style:none;scrollbar-width:none}*::-webkit-scrollbar{display:none}*{border-color:hsl(var(--opencx-border))}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),0 3px rgb(var(--tw-prose-kbd-shadows) / 10%);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: 17 24 39;--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: 255 255 255;--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.prose-sm{font-size:.875rem;line-height:1.7142857}.prose-sm :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.prose-sm :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.3333333em;margin-bottom:1.3333333em;padding-inline-start:1.1111111em}.prose-sm :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.prose-sm :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.prose-sm :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.prose-sm :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.prose-sm :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;border-radius:.3125rem;padding-top:.1428571em;padding-inline-end:.3571429em;padding-bottom:.1428571em;padding-inline-start:.3571429em}.prose-sm :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em}.prose-sm :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.9em}.prose-sm :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8888889em}.prose-sm :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}.prose-sm :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}.prose-sm :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;margin-bottom:.2857143em}.prose-sm :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}.prose-sm :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}.prose-sm :where(.prose-sm>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm :where(.prose-sm>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(.prose-sm>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}.prose-sm :where(.prose-sm>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(.prose-sm>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}.prose-sm :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;padding-inline-start:1.5714286em}.prose-sm :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2.8571429em;margin-bottom:2.8571429em}.prose-sm :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.5}.prose-sm :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.prose-sm :where(.prose-sm>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(.prose-sm>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.left-0{left:0}.left-2{left:.5rem}.left-\\[50\\%\\]{left:50%}.right-4{right:1rem}.right-6{right:1.5rem}.top-0{top:0}.top-4{top:1rem}.top-6{top:1.5rem}.top-\\[50\\%\\]{top:50%}.isolate{isolation:isolate}.z-10{z-index:10}.z-50{z-index:50}.m-2{margin:.5rem}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.ml-auto{margin-left:auto}.mt-0\\.5{margin-top:.125rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.contents{display:contents}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.size-10{width:2.5rem;height:2.5rem}.size-12{width:3rem;height:3rem}.size-16{width:4rem;height:4rem}.size-3{width:.75rem;height:.75rem}.size-4{width:1rem;height:1rem}.size-6{width:1.5rem;height:1.5rem}.size-8{width:2rem;height:2rem}.size-auto{width:auto;height:auto}.size-fit{width:fit-content;height:fit-content}.size-full{width:100%;height:100%}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-full{height:100%}.h-px{height:1px}.max-h-16{max-height:4rem}.max-h-full{max-height:100%}.min-h-12{min-height:3rem}.w-0{width:0px}.w-1\\/2{width:50%}.w-10{width:2.5rem}.w-2{width:.5rem}.w-2\\/5{width:40%}.w-3\\.5{width:.875rem}.w-3\\/5{width:60%}.w-4{width:1rem}.w-5\\/6{width:83.333333%}.w-60{width:15rem}.w-9{width:2.25rem}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.min-w-\\[8rem\\]{min-width:8rem}.max-w-\\[61\\.8\\%\\]{max-width:61.8%}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.translate-x-\\[-50\\%\\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\\[var\\(--wobble-x\\)\\]{--tw-translate-x: var(--wobble-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\\[-50\\%\\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\\[var\\(--wobble-y\\)\\]{--tw-translate-y: var(--wobble-y);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-\\[1px\\]{gap:1px}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.scroll-smooth{scroll-behavior:smooth}.text-ellipsis{text-overflow:ellipsis}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\\[20px\\]{border-radius:20px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.rounded-bl-md{border-bottom-left-radius:.375rem}.rounded-br-md{border-bottom-right-radius:.375rem}.rounded-tl-md{border-top-left-radius:.375rem}.rounded-tr-md{border-top-right-radius:.375rem}.border{border-width:1px}.border-2{border-width:2px}.border-none{border-style:none}.border-transparent{border-color:transparent}.bg-\\[white\\]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--opencx-background))}.bg-black\\/50{background-color:#00000080}.bg-black\\/60{background-color:#0009}.bg-destructive{background-color:hsl(var(--opencx-destructive))}.bg-muted{background-color:hsl(var(--opencx-muted))}.bg-primary{background-color:hsl(var(--opencx-primary))}.bg-secondary{background-color:hsl(var(--opencx-secondary))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-\\[radial-gradient\\(ellipse_at_top_left\\,hsl\\(var\\(--opencx-primary\\)\\)\\,transparent\\)\\,radial-gradient\\(ellipse_at_top_right\\,hsl\\(var\\(--opencx-primary\\)\\)\\,transparent\\)\\]{background-image:radial-gradient(ellipse at top left,hsl(var(--opencx-primary)),transparent),radial-gradient(ellipse at top right,hsl(var(--opencx-primary)),transparent)}.fill-current{fill:currentColor}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3\\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-0{padding-bottom:0}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.text-center{text-align:center}.text-start{text-align:start}.align-middle{vertical-align:middle}.text-\\[1\\.75rem\\]{font-size:1.75rem}.text-\\[10px\\]{font-size:10px}.text-\\[16px\\]{font-size:16px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-none{line-height:1}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-destructive{color:hsl(var(--opencx-destructive))}.text-destructive-foreground{color:hsl(var(--opencx-destructive-foreground))}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--opencx-foreground))}.text-muted-foreground{color:hsl(var(--opencx-muted-foreground))}.text-muted-foreground\\/70{color:hsl(var(--opencx-muted-foreground) / .7)}.text-muted-foreground\\/75{color:hsl(var(--opencx-muted-foreground) / .75)}.text-primary{color:hsl(var(--opencx-primary))}.text-primary-foreground{color:hsl(var(--opencx-primary-foreground))}.text-secondary-foreground{color:hsl(var(--opencx-secondary-foreground))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-95{opacity:.95}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.outline-8{outline-width:8px}.outline-background{outline-color:hsl(var(--opencx-background))}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--opencx-background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.\\[animation-delay\\:-0\\.15s\\]{animation-delay:-.15s}.\\[animation-delay\\:-0\\.3s\\]{animation-delay:-.3s}.\\[field-sizing\\:content\\;\\],.\\[field-sizing\\:content\\]{field-sizing:content}.\\[word-break\\:break-word\\]{word-break:break-word}.required:after{content:" *";color:red}.file\\:border-0::file-selector-button{border-width:0px}.file\\:bg-transparent::file-selector-button{background-color:transparent}.file\\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:font-medium::file-selector-button{font-weight:500}.file\\:text-primary-foreground::file-selector-button{color:hsl(var(--opencx-primary-foreground))}.placeholder\\:text-muted-foreground::placeholder{color:hsl(var(--opencx-muted-foreground))}.placeholder\\:text-muted-foreground\\/75::placeholder{color:hsl(var(--opencx-muted-foreground) / .75)}.focus-within\\:border-primary:focus-within{border-color:hsl(var(--opencx-primary))}.hover\\:scale-\\[var\\(--scale\\)\\]:hover{--tw-scale-x: var(--scale);--tw-scale-y: var(--scale);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:border-primary:hover{border-color:hsl(var(--opencx-primary))}.hover\\:bg-secondary:hover{background-color:hsl(var(--opencx-secondary))}.hover\\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\\:text-primary:hover{color:hsl(var(--opencx-primary))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-100:hover{opacity:1}.focus\\:bg-accent:focus{background-color:hsl(var(--opencx-accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--opencx-accent-foreground))}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-ring:focus{--tw-ring-color: hsl(var(--opencx-ring))}.focus\\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--opencx-ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--opencx-background))}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\\:hover\\:scale-\\[calc\\(var\\(--scale\\)-0\\.02\\)\\]:hover:active{--tw-scale-x: calc(var(--scale) - .02);--tw-scale-y: calc(var(--scale) - .02);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:active\\:scale-95:active:hover{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.group:hover .group-hover\\:active\\:scale-90:active,.group:active .group-active\\:scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--opencx-primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--opencx-accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--opencx-input))}.data-\\[state\\=open\\]\\:text-muted-foreground[data-state=open]{color:hsl(var(--opencx-muted-foreground))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\\[state\\=closed\\]\\:slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\\[state\\=closed\\]\\:slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\\[state\\=open\\]\\:slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\\[state\\=open\\]\\:slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y: -48%}.prose-a\\:underline :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){text-decoration-line:underline}.prose-a\\:decoration-primary :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){text-decoration-color:hsl(var(--opencx-primary))}.rtl\\:-scale-100:where([dir=rtl],[dir=rtl] *){--tw-scale-x: -1;--tw-scale-y: -1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rtl\\:text-right:where([dir=rtl],[dir=rtl] *){text-align:right}.rtl\\:placeholder\\:text-right:where([dir=rtl],[dir=rtl] *)::placeholder{text-align:right}.\\[\\&_span\\]\\:size-1 span{width:.25rem;height:.25rem}.\\[\\&_span\\]\\:bg-secondary-foreground span{background-color:hsl(var(--opencx-secondary-foreground))}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:size-4 svg{width:1rem;height:1rem}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.\\[\\&_svg\\]\\:text-muted-foreground\\/70 svg{color:hsl(var(--opencx-muted-foreground) / .7)}.\\[\\&_svg\\]\\:hover\\:text-primary:hover svg{color:hsl(var(--opencx-primary))}', Wo = ee.Provider, Ho = ee.Root, Ao = ee.Trigger, zt = E.forwardRef(({ className: e, sideOffset: t = 4, ...r }, n) => /* @__PURE__ */ o(
465
+ ee.Content,
466
+ {
467
+ ref: n,
468
+ sideOffset: t,
469
+ className: d(
470
+ "z-50 overflow-hidden max-w-xs rounded-xl bg-primary border text-primary-foreground p-2 text-center align-middle text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
471
+ e
472
+ ),
473
+ ...r
474
+ }
475
+ ));
476
+ zt.displayName = ee.Content.displayName;
477
+ function J({
478
+ children: e,
479
+ content: t,
480
+ side: r,
481
+ align: n
482
+ }) {
483
+ const { disableTooltips: s } = S();
484
+ return !t || s ? e : /* @__PURE__ */ c(Ho, { children: [
485
+ /* @__PURE__ */ o(Ao, { asChild: !0, children: e }),
486
+ /* @__PURE__ */ o(
487
+ zt,
488
+ {
489
+ side: r,
490
+ align: n,
491
+ collisionPadding: 8,
492
+ avoidCollisions: !0,
493
+ children: t
494
+ }
495
+ )
496
+ ] });
497
+ }
498
+ const tt = 450;
499
+ function B() {
500
+ const [e, t] = se.useState(() => (window.top || window).innerWidth < tt);
501
+ return se.useEffect(() => {
502
+ const r = window.top || window, n = () => {
503
+ t(r.innerWidth < tt);
504
+ };
505
+ return n(), r.addEventListener("resize", n), () => {
506
+ r.removeEventListener("resize", n);
507
+ };
508
+ }, []), { isSmallScreen: e };
509
+ }
510
+ const re = {
511
+ transitionTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)",
512
+ transitionDuration: "1000ms"
513
+ };
514
+ function X() {
515
+ var y, b, C, f, h, m, g, _, x, I, M, F, P, W, R, v, k, N, L, oe, Ie, Te, Me, De, Oe, Re, je, Ee, Fe, Pe, We, He, Ae, Be, Le, $e, Ye, qe, Xe, Ue, Ve, Ke, Ge, Ze, Je;
516
+ const { isSmallScreen: e } = B(), { theme: t, inline: r } = S(), n = (G) => r ? "100%" : G, s = (G, he) => e ? `100dv${G}` : he, a = (G, he) => n(s(G, he)), l = {
517
+ zIndex: ((y = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : y.zIndex) ?? 1e7,
518
+ offset: {
519
+ bottom: ((C = (b = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : b.offset) == null ? void 0 : C.bottom) ?? 20,
520
+ right: ((h = (f = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : f.offset) == null ? void 0 : h.right) ?? 20
521
+ },
522
+ size: {
523
+ button: ((g = (m = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : m.size) == null ? void 0 : g.button) ?? 48,
524
+ icon: ((x = (_ = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : _.size) == null ? void 0 : x.icon) ?? 24
525
+ }
526
+ }, i = {
527
+ palette: (t == null ? void 0 : t.palette) ?? "neutral",
528
+ primaryColor: (t == null ? void 0 : t.primaryColor) ?? "hsl(0 0% 9%)",
529
+ widgetTrigger: l,
530
+ widgetContentContainer: {
531
+ borderRadius: e ? "0px" : ((I = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : I.borderRadius) ?? "32px",
532
+ zIndex: ((M = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : M.zIndex) ?? l.zIndex + 1,
533
+ outline: ((F = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : F.outline) ?? "none",
534
+ // was: '1px solid'
535
+ outlineColor: ((P = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : P.outlineColor) ?? "hsl(0 0% 50% / .5)",
536
+ boxShadow: ((W = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : W.boxShadow) ?? "0 0px 100px 0px rgb(0 0 0 / 0.25)",
537
+ transitionProperty: ((R = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : R.transitionProperty) ?? "all",
538
+ transitionTimingFunction: ((v = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : v.transitionTimingFunction) ?? re.transitionTimingFunction,
539
+ transitionDuration: ((k = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : k.transitionDuration) ?? re.transitionDuration,
540
+ offset: {
541
+ side: e ? 0 : l.offset.bottom + l.size.button + U.y * 2 + (((L = (N = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : N.offset) == null ? void 0 : L.side) ?? 10),
542
+ align: e ? 0 : l.offset.right + (((Ie = (oe = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : oe.offset) == null ? void 0 : Ie.align) ?? 0)
543
+ }
544
+ },
545
+ screens: {
546
+ welcome: {
547
+ width: a("w", ((Me = (Te = t == null ? void 0 : t.screens) == null ? void 0 : Te.welcome) == null ? void 0 : Me.width) ?? "400px"),
548
+ // By setting minHeight to 1px, a nice animation will play from 1px to the dynamic height of the content of the screen
549
+ minHeight: a(
550
+ "h",
551
+ ((Oe = (De = t == null ? void 0 : t.screens) == null ? void 0 : De.welcome) == null ? void 0 : Oe.minHeight) ?? "1px"
552
+ )
553
+ },
554
+ sessions: {
555
+ width: a("w", ((je = (Re = t == null ? void 0 : t.screens) == null ? void 0 : Re.sessions) == null ? void 0 : je.width) ?? "450px"),
556
+ height: a("h", ((Fe = (Ee = t == null ? void 0 : t.screens) == null ? void 0 : Ee.sessions) == null ? void 0 : Fe.height) ?? "600px")
557
+ },
558
+ chat: {
559
+ width: a("w", ((We = (Pe = t == null ? void 0 : t.screens) == null ? void 0 : Pe.chat) == null ? void 0 : We.width) ?? "525px"),
560
+ height: a("h", ((Ae = (He = t == null ? void 0 : t.screens) == null ? void 0 : He.chat) == null ? void 0 : Ae.height) ?? "700px"),
561
+ withCanvas: {
562
+ width: a(
563
+ "w",
564
+ (($e = (Le = (Be = t == null ? void 0 : t.screens) == null ? void 0 : Be.chat) == null ? void 0 : Le.withCanvas) == null ? void 0 : $e.width) ?? "min(1050px, 100vw)"
565
+ ),
566
+ height: a(
567
+ "h",
568
+ ((Xe = (qe = (Ye = t == null ? void 0 : t.screens) == null ? void 0 : Ye.chat) == null ? void 0 : qe.withCanvas) == null ? void 0 : Xe.height) ?? "min(800px, 100vh)"
569
+ ),
570
+ transitionTimingFunction: ((Ke = (Ve = (Ue = t == null ? void 0 : t.screens) == null ? void 0 : Ue.chat) == null ? void 0 : Ve.withCanvas) == null ? void 0 : Ke.transitionTimingFunction) ?? re.transitionTimingFunction,
571
+ transitionDuration: ((Je = (Ze = (Ge = t == null ? void 0 : t.screens) == null ? void 0 : Ge.chat) == null ? void 0 : Ze.withCanvas) == null ? void 0 : Je.transitionDuration) ?? re.transitionDuration
572
+ }
573
+ }
574
+ }
575
+ }, p = {
576
+ // Subtract the offset.bottom twice so that it adds a bit of padding to the top
577
+ // Subtract the distance between the trigger and the widget content container
578
+ // Subtract the invisible padding of the trigger (for the wobble effect)
579
+ maxHeight: a(
580
+ "h",
581
+ `calc(
582
+ 100vh
583
+ - ${i.widgetTrigger.offset.bottom}px
584
+ - ${i.widgetContentContainer.offset.side}px
585
+ - ${U.y * 2}px
586
+ )`
587
+ ),
588
+ // Subtract the offset.right twice so that it adds a bit of padding to the left
589
+ maxWidth: a(
590
+ "w",
591
+ `calc(
592
+ 100vw
593
+ - ${i.widgetTrigger.offset.right * 2}px
594
+ )`
595
+ ),
596
+ minHeight: a(
597
+ "h",
598
+ `min(
599
+ ${i.screens.welcome.minHeight},
600
+ ${i.screens.sessions.height},
601
+ ${i.screens.chat.height}
602
+ )`
603
+ ),
604
+ minWidth: a(
605
+ "w",
606
+ `min(
607
+ ${i.screens.welcome.width},
608
+ ${i.screens.sessions.width},
609
+ ${i.screens.chat.width}
610
+ )`
611
+ )
612
+ };
613
+ return {
614
+ theme: i,
615
+ computed: p,
616
+ cssVars: Bo({
617
+ palette: i.palette,
618
+ primary: i.primaryColor
619
+ })
620
+ };
621
+ }
622
+ function Bo({
623
+ palette: e,
624
+ primary: t
625
+ }) {
626
+ const r = Nt(e), n = et(t).toHsl(), s = et(t).isLight() ? r[950] : r[50];
627
+ return {
628
+ "--opencx-primary": `${n.h} ${n.s * 100}% ${n.l * 100}%`,
629
+ "--opencx-primary-foreground": s,
630
+ "--opencx-background": r[100],
631
+ "--opencx-foreground": r[950],
632
+ "--opencx-destructive": "0 72.2% 50.6%",
633
+ "--opencx-destructive-foreground": r[50],
634
+ "--opencx-accent": r[200],
635
+ "--opencx-accent-foreground": "var(--opencx-foreground)",
636
+ "--opencx-secondary": r[200],
637
+ "--opencx-secondary-foreground": "var(--opencx-foreground)",
638
+ "--opencx-muted": r[200],
639
+ "--opencx-muted-foreground": r[500],
640
+ "--opencx-input": r[300],
641
+ "--opencx-border": r[300],
642
+ "--opencx-ring": "var(--opencx-foreground)"
643
+ };
644
+ }
645
+ function Nt(e) {
646
+ const t = {
647
+ 50: "0 0% 98%",
648
+ 100: "0 0% 96.1%",
649
+ 200: "0 0% 89.8%",
650
+ 300: "0 0% 83.1%",
651
+ 400: "0 0% 63.9%",
652
+ 500: "0 0% 45.1%",
653
+ 600: "0 0% 32.2%",
654
+ 700: "0 0% 25.1%",
655
+ 800: "0 0% 14.9%",
656
+ 900: "0 0% 9%",
657
+ 950: "0 0% 3.9%"
658
+ }, r = {
659
+ 50: "60 9.1% 97.8%",
660
+ 100: "60 4.8% 95.9%",
661
+ 200: "20 5.9% 90%",
662
+ 300: "24 5.7% 82.9%",
663
+ 400: "24 5.4% 63.9%",
664
+ 500: "25 5.3% 44.7%",
665
+ 600: "33.3 5.5% 32.4%",
666
+ 700: "30 6.3% 25.1%",
667
+ 800: "12 6.5% 15.1%",
668
+ 900: "24 9.8% 10%",
669
+ 950: "20 14.3% 4.1%"
670
+ }, n = {
671
+ 50: "0 0% 98%",
672
+ 100: "240 4.8% 95.9%",
673
+ 200: "240 5.9% 90%",
674
+ 300: "240 4.9% 83.9%",
675
+ 400: "240 5% 64.9%",
676
+ 500: "240 3.8% 46.1%",
677
+ 600: "240 5.2% 33.9%",
678
+ 700: "240 5.3% 26.1%",
679
+ 800: "240 3.7% 15.9%",
680
+ 900: "240 5.9% 10%",
681
+ 950: "240 10% 3.9%"
682
+ }, s = {
683
+ 50: "210 40% 98%",
684
+ 100: "210 40% 96.1%",
685
+ 200: "214.3 31.8% 91.4%",
686
+ 300: "212.7 26.8% 83.9%",
687
+ 400: "215 20.2% 65.1%",
688
+ 500: "215.4 16.3% 46.9%",
689
+ 600: "215.3 19.3% 34.5%",
690
+ 700: "215.3 25% 26.7%",
691
+ 800: "217.2 32.6% 17.5%",
692
+ 900: "222.2 47.4% 11.2%",
693
+ 950: "222.2 84% 4.9%"
694
+ };
695
+ switch (e) {
696
+ case "neutral":
697
+ return t;
698
+ case "stone":
699
+ return r;
700
+ case "zinc":
701
+ return n;
702
+ case "slate":
703
+ return s;
704
+ default:
705
+ return D(e, Nt.name), t;
706
+ }
707
+ }
708
+ function St() {
709
+ const { contentIframeRef: e } = $(), { inline: t } = S();
710
+ return {
711
+ setWidth: (r) => {
712
+ var n;
713
+ (n = e == null ? void 0 : e.current) == null || n.style.setProperty(
714
+ "--opencx-widget-width",
715
+ t ? "100%" : r
716
+ );
717
+ },
718
+ setHeight: (r) => {
719
+ var n;
720
+ (n = e == null ? void 0 : e.current) == null || n.style.setProperty(
721
+ "--opencx-widget-height",
722
+ t ? "100%" : r
723
+ );
724
+ }
725
+ };
726
+ }
727
+ function Ne({
728
+ width: e,
729
+ height: t
730
+ }) {
731
+ const { isSmallScreen: r } = B(), { setWidth: n, setHeight: s } = St();
732
+ le(() => {
733
+ e && n(e), t && s(t);
734
+ }, [r, t, e, n, s]);
735
+ }
736
+ const ot = Lt;
737
+ function Q({
738
+ name: e,
739
+ className: t
740
+ }) {
741
+ const r = (() => {
742
+ switch (e) {
743
+ case "Check":
744
+ return to;
745
+ case "CheckCheck":
746
+ return eo;
747
+ case "CircleCheck":
748
+ return pt;
749
+ case "CircleCheckBig":
750
+ return Qt;
751
+ case "CircleX":
752
+ return Jt;
753
+ case "Expand":
754
+ return Zt;
755
+ case "Maximize":
756
+ return Gt;
757
+ case "Maximize2":
758
+ return Kt;
759
+ case "Minimize":
760
+ return Vt;
761
+ case "Minimize2":
762
+ return Ut;
763
+ case "Shrink":
764
+ return Xt;
765
+ case "SquareCheck":
766
+ return qt;
767
+ case "SquareCheckBig":
768
+ return Yt;
769
+ case "SquareX":
770
+ return $t;
771
+ case "X":
772
+ return be;
773
+ case void 0:
774
+ return ot;
775
+ default:
776
+ return D(e, Q.name), ot;
777
+ }
778
+ })();
779
+ return /* @__PURE__ */ o(r, { className: d("size-4", t) });
780
+ }
781
+ function _t({
782
+ className: e,
783
+ ...t
784
+ }) {
785
+ return /* @__PURE__ */ o(
786
+ "div",
787
+ {
788
+ className: d("animate-pulse rounded-md bg-secondary", e),
789
+ ...t
790
+ }
791
+ );
792
+ }
793
+ function Se() {
794
+ var s;
795
+ const { data: e } = de(), {
796
+ routerState: { screen: t }
797
+ } = A(), { textContent: r } = S();
798
+ return (() => {
799
+ var a, l;
800
+ switch (t) {
801
+ case "chat":
802
+ return (a = r == null ? void 0 : r.chatScreen) == null ? void 0 : a.headerTitle;
803
+ case "sessions":
804
+ return (l = r == null ? void 0 : r.sessionsScreen) == null ? void 0 : l.headerTitle;
805
+ case "welcome":
806
+ return;
807
+ default:
808
+ D(t, Se.name);
809
+ return;
810
+ }
811
+ })() ?? ((s = e == null ? void 0 : e.data) == null ? void 0 : s.organizationName) ?? "Chat";
812
+ }
813
+ function Lo(e) {
814
+ switch (e) {
815
+ case "chat":
816
+ return w("chat/header");
817
+ case "sessions":
818
+ return w("sessions/header");
819
+ case "welcome":
820
+ return;
821
+ default:
822
+ D(e, Se.name);
823
+ return;
824
+ }
825
+ }
826
+ function $o() {
827
+ const { router: e } = S(), {
828
+ routerState: { screen: t },
829
+ toSessionsScreen: r
830
+ } = A();
831
+ return t !== "chat" || e != null && e.chatScreenOnly ? null : /* @__PURE__ */ o(
832
+ z,
833
+ {
834
+ variant: "ghost",
835
+ size: "fit",
836
+ className: "rounded-full",
837
+ onClick: r,
838
+ children: /* @__PURE__ */ o(oo, { className: "size-4" })
839
+ }
840
+ );
841
+ }
842
+ function Yo({
843
+ button: e
844
+ }) {
845
+ const { setIsOpen: t } = V(), { isSmallScreen: r } = B();
846
+ return r && e.hideOnSmallScreen || !r && e.hideOnLargeScreen ? null : /* @__PURE__ */ o(
847
+ z,
848
+ {
849
+ variant: "ghost",
850
+ size: "fit",
851
+ className: "rounded-full",
852
+ onClick: () => t(!1),
853
+ children: /* @__PURE__ */ o(Q, { name: e.icon })
854
+ }
855
+ );
856
+ }
857
+ function ue({
858
+ button: e
859
+ }) {
860
+ const [t, r] = j(!1), {
861
+ routerState: { screen: n }
862
+ } = A(), { isSmallScreen: s } = B(), { theme: a } = X(), { setWidth: l, setHeight: i } = St();
863
+ if (n !== "chat" && n !== "sessions") return null;
864
+ const p = (() => {
865
+ switch (n) {
866
+ case "chat":
867
+ return a.screens.chat.height;
868
+ case "sessions":
869
+ return a.screens.sessions.height;
870
+ default:
871
+ return D(n, ue.name), a.screens.chat.height;
872
+ }
873
+ })(), y = (() => {
874
+ switch (n) {
875
+ case "chat":
876
+ return a.screens.chat.width;
877
+ case "sessions":
878
+ return a.screens.sessions.width;
879
+ default:
880
+ return D(n, ue.name), a.screens.chat.width;
881
+ }
882
+ })(), b = () => {
883
+ r((C) => {
884
+ const f = !C;
885
+ return i(f ? "100vh" : p), l(f ? `max(40vw, ${y})` : y), f;
886
+ });
887
+ };
888
+ return s && e.hideOnSmallScreen || !s && e.hideOnLargeScreen ? null : /* @__PURE__ */ o(
889
+ z,
890
+ {
891
+ variant: "ghost",
892
+ size: "fit",
893
+ className: "rounded-full",
894
+ onClick: b,
895
+ children: /* @__PURE__ */ o(
896
+ Q,
897
+ {
898
+ name: e.icon || (t ? e.shrinkIcon : e.expandIcon)
899
+ }
900
+ )
901
+ }
902
+ );
903
+ }
904
+ function It({
905
+ button: e
906
+ }) {
907
+ var _, x;
908
+ const [t, r] = j(!1), { widgetCtx: n } = $(), { setIsOpen: s } = V(), { resolveSession: a, sessionState: l } = Y(), { isSmallScreen: i } = B(), p = !l.session, y = ((_ = l.session) == null ? void 0 : _.isOpened) === !1, b = e.onResolved || "stay-in-chat", C = e.behaviorBeforeSessionCreation || "disabled", f = e.behaviorIfSessionIsResolved || "disabled", h = !!(l.isResolvingSession || p && C === "disabled" || y && f === "disabled"), m = async () => {
909
+ const { success: I, error: M } = await a();
910
+ if (r(!1), !I) return console.error(M);
911
+ switch (b) {
912
+ case "stay-in-chat":
913
+ return;
914
+ case "close-widget":
915
+ s(!1);
916
+ break;
917
+ case "reset-chat":
918
+ n.resetChat();
919
+ break;
920
+ case "reset-chat-and-close-widget":
921
+ s(!1), n.resetChat();
922
+ break;
923
+ default:
924
+ D(b, It.name);
925
+ break;
926
+ }
927
+ }, g = () => {
928
+ if (p)
929
+ switch (C) {
930
+ case "disabled":
931
+ return;
932
+ case "close-widget":
933
+ s(!1);
934
+ break;
935
+ default:
936
+ D(
937
+ C,
938
+ g.name
939
+ );
940
+ }
941
+ if (y)
942
+ switch (f) {
943
+ case "disabled":
944
+ return;
945
+ case "close-widget":
946
+ s(!1);
947
+ break;
948
+ case "reset-chat":
949
+ n.resetChat();
950
+ break;
951
+ case "reset-chat-and-close-widget":
952
+ s(!1), n.resetChat();
953
+ break;
954
+ default:
955
+ D(
956
+ f,
957
+ g.name
958
+ );
959
+ }
960
+ };
961
+ return i && e.hideOnSmallScreen || !i && e.hideOnLargeScreen ? null : ((x = e.confirmation) == null ? void 0 : x.type) === "modal" && !y && !p ? /* @__PURE__ */ c(wt, { open: t, onOpenChange: r, children: [
962
+ /* @__PURE__ */ o(gt, { asChild: !0, children: /* @__PURE__ */ o(
963
+ z,
964
+ {
965
+ variant: "ghost",
966
+ size: "fit",
967
+ className: "rounded-full",
968
+ disabled: h,
969
+ children: /* @__PURE__ */ o(Q, { name: e.icon })
970
+ }
971
+ ) }),
972
+ /* @__PURE__ */ c(xe, { children: [
973
+ /* @__PURE__ */ o(ft, { children: /* @__PURE__ */ o(ye, { children: e.confirmation.title || "Close conversation" }) }),
974
+ /* @__PURE__ */ o(vt, { children: /* @__PURE__ */ o(xt, { children: e.confirmation.description || "Are you sure you want to close this conversation?" }) }),
975
+ /* @__PURE__ */ c(bt, { children: [
976
+ /* @__PURE__ */ o(
977
+ z,
978
+ {
979
+ variant: "secondary",
980
+ onClick: () => r(!1),
981
+ disabled: l.isResolvingSession,
982
+ children: e.confirmation.cancelButtonText || "No"
983
+ }
984
+ ),
985
+ /* @__PURE__ */ o(
986
+ z,
987
+ {
988
+ variant: "destructive",
989
+ onClick: m,
990
+ disabled: l.isResolvingSession,
991
+ children: e.confirmation.confirmButtonText || "Yes"
992
+ }
993
+ )
994
+ ] })
995
+ ] })
996
+ ] }) : /* @__PURE__ */ o(
997
+ z,
998
+ {
999
+ variant: "ghost",
1000
+ size: "fit",
1001
+ className: "rounded-full",
1002
+ onClick: y || p ? g : m,
1003
+ disabled: h,
1004
+ children: /* @__PURE__ */ o(Q, { name: e.icon })
1005
+ }
1006
+ );
1007
+ }
1008
+ function fe({ button: e }) {
1009
+ switch (e.functionality) {
1010
+ case "close-widget":
1011
+ return /* @__PURE__ */ o(Yo, { button: e });
1012
+ case "expand-shrink":
1013
+ return /* @__PURE__ */ o(ue, { button: e });
1014
+ case "resolve-session":
1015
+ return /* @__PURE__ */ o(It, { button: e });
1016
+ default:
1017
+ return D(e, fe.name), null;
1018
+ }
1019
+ }
1020
+ const qo = {
1021
+ functionality: "close-widget",
1022
+ hideOnLargeScreen: !0,
1023
+ icon: "X"
1024
+ };
1025
+ function Xo() {
1026
+ const {
1027
+ routerState: { screen: e }
1028
+ } = A(), { headerButtons: t } = S(), r = e === "chat" ? t == null ? void 0 : t.chatScreen : e === "sessions" ? t == null ? void 0 : t.sessionsScreen : [];
1029
+ return !r || r.length === 0 ? /* @__PURE__ */ o(fe, { button: qo }) : /* @__PURE__ */ o(nt, { children: r.map((n) => /* @__PURE__ */ o(
1030
+ fe,
1031
+ {
1032
+ button: n
1033
+ },
1034
+ `${n.functionality}-${n.icon}`
1035
+ )) });
1036
+ }
1037
+ function Tt() {
1038
+ const {
1039
+ routerState: { screen: e }
1040
+ } = A(), { isLoading: t } = de(), r = ve(), n = Lo(e), s = Se();
1041
+ return /* @__PURE__ */ o("header", { ...n, className: "py-2 px-4 shrink-0", children: /* @__PURE__ */ c("div", { dir: r, className: "flex items-center gap-2", children: [
1042
+ /* @__PURE__ */ o($o, {}),
1043
+ /* @__PURE__ */ o(
1044
+ "div",
1045
+ {
1046
+ className: d(
1047
+ "flex-1 h-8 flex items-center",
1048
+ e === "sessions" && "pl-2"
1049
+ ),
1050
+ children: /* @__PURE__ */ o(T, { mode: "wait", children: t ? /* @__PURE__ */ o(u, { snapExit: !0, children: /* @__PURE__ */ o(_t, { className: "h-5 w-1/2" }) }, "skeleton") : /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o("h2", { className: "font-semibold", children: s }) }, "organization-name") })
1051
+ }
1052
+ ),
1053
+ /* @__PURE__ */ o(Xo, {})
1054
+ ] }) });
1055
+ }
1056
+ function Mt({ className: e }) {
1057
+ return /* @__PURE__ */ o(ro, { className: d("size-4 animate-spin", e) });
1058
+ }
1059
+ function Uo() {
1060
+ const {
1061
+ messagesState: { isInitialFetchLoading: e }
1062
+ } = q(), { isSmallScreen: t } = B(), { activeMode: r, Component: n } = it();
1063
+ return {
1064
+ isCanvasOpen: !e && !t && !!r && !!n
1065
+ };
1066
+ }
1067
+ function Vo() {
1068
+ const { activeMode: e, Component: t } = it(), { sendMessage: r } = q(), { createStateCheckpoint: n } = Y(), [s, a] = j(!1), l = async (i) => {
1069
+ try {
1070
+ a(!0), await r(i);
1071
+ } catch (p) {
1072
+ console.error(p);
1073
+ } finally {
1074
+ a(!1);
1075
+ }
1076
+ };
1077
+ return !e || !t ? null : /* @__PURE__ */ o(
1078
+ t,
1079
+ {
1080
+ react: se,
1081
+ mode: e,
1082
+ createStateCheckpoint: n,
1083
+ sendMessage: l,
1084
+ isSendingMessage: s
1085
+ }
1086
+ );
1087
+ }
1088
+ const Ko = {
1089
+ "write-a-message": "اكتب رسالة...",
1090
+ "session-closed-lead": "تم حل مشكلتك!",
1091
+ "new-conversation": "محادثة جديدة",
1092
+ "welcome-title": "مرحبًا بك في دردشة الدعم الخاصة بنا",
1093
+ "welcome-description": "نحن هنا للمساعدة! ابدأ محادثة وسنرد عليك في أقرب وقت ممكن.",
1094
+ "your-name": "اسمك",
1095
+ "your-email": "عنوان بريدك الإلكتروني",
1096
+ "start-chat": "تحدث إلى الدعم",
1097
+ "starting-chat": "جاري الاتصال...",
1098
+ "i-need-more-help": "أحتاج المزيد من المساعدة",
1099
+ "this-was-helpful": "كان هذا مفيدًا",
1100
+ optional: "اختياري",
1101
+ "no-conversations-yet": "لا يوجد محادثات",
1102
+ "back-to-conversations": "العودة إلى المحادثات",
1103
+ "closed-conversations": "المحادثات المغلقة"
1104
+ }, Go = {
1105
+ "write-a-message": "Nachricht schreiben...",
1106
+ "session-closed-lead": "Ihr Problem wurde gelöst!",
1107
+ "new-conversation": "Neue Konversation",
1108
+ "welcome-title": "Willkommen in unserem Support-Chat",
1109
+ "welcome-description": "Wir sind hier, um zu helfen! Beginnen Sie ein Gesprách und wir werden so schnell wie mogelijk antworten.",
1110
+ "your-name": "Ihr Name",
1111
+ "your-email": "Ihre E-Mail-Adresse",
1112
+ "start-chat": "Mit dem Support sprechen",
1113
+ "starting-chat": "Verbindung wird hergestellt...",
1114
+ "i-need-more-help": "Ich brauche weitere Hilfe",
1115
+ "this-was-helpful": "Dies war hilfreich",
1116
+ optional: "Optional",
1117
+ "no-conversations-yet": "noch keine Gespräche",
1118
+ "back-to-conversations": "Zurück zur Konversationen",
1119
+ "closed-conversations": "Geschlossene Konversationen"
1120
+ }, Zo = {
1121
+ "write-a-message": "Write a message...",
1122
+ "session-closed-lead": "Your issue has been resolved!",
1123
+ "new-conversation": "New conversation",
1124
+ "welcome-title": "Welcome to our support chat",
1125
+ "welcome-description": "We're here to help! Start a conversation and we'll get back to you as soon as possible.",
1126
+ "your-name": "Your name",
1127
+ "your-email": "Your email address",
1128
+ "start-chat": "Talk to support",
1129
+ "starting-chat": "Connecting...",
1130
+ "i-need-more-help": "I need more help",
1131
+ "this-was-helpful": "This was helpful",
1132
+ optional: "Optional",
1133
+ "no-conversations-yet": "No conversations yet",
1134
+ "back-to-conversations": "Back to conversations",
1135
+ "closed-conversations": "Closed conversations"
1136
+ }, Jo = {
1137
+ "write-a-message": "Écrivez un message...",
1138
+ "session-closed-lead": "Votre problème a été résolu !",
1139
+ "new-conversation": "Nouvelle conversation",
1140
+ "welcome-title": "Bienvenue dans notre chat de support",
1141
+ "welcome-description": "Nous sommes là pour vous aider ! Commencez une conversation et nous vous répondrons dès que possible.",
1142
+ "your-name": "Votre nom",
1143
+ "your-email": "Votre adresse e-mail",
1144
+ "start-chat": "Parler au support",
1145
+ "starting-chat": "Connexion...",
1146
+ "i-need-more-help": "Je besoin d'aide plus",
1147
+ "this-was-helpful": "C'était utile",
1148
+ optional: "Optionnel",
1149
+ "no-conversations-yet": "Aucune conversation pour le moment",
1150
+ "back-to-conversations": "Retour aux conversations",
1151
+ "closed-conversations": "Conversations fermées"
1152
+ }, Qo = {
1153
+ "write-a-message": "Schrijf een bericht...",
1154
+ "session-closed-lead": "Uw probleem is opgelost!",
1155
+ "new-conversation": "Nieuw gesprek",
1156
+ "welcome-title": "Welkom bij onze supportchat",
1157
+ "welcome-description": "We zijn hier om te helpen! Begin een gesprek en we nemen zo snel mogelijk contact met u op.",
1158
+ "your-name": "Uw naam",
1159
+ "your-email": "Uw e-mailadres",
1160
+ "start-chat": "Praat met ondersteuning",
1161
+ "starting-chat": "Verbinding maken...",
1162
+ "i-need-more-help": "Ik heb nog meer hulp nodig",
1163
+ "this-was-helpful": "Mijn vraag is opgelost",
1164
+ optional: "Optioneel",
1165
+ "no-conversations-yet": "Nog geen gesprekken",
1166
+ "back-to-conversations": "Terug naar gesprekken",
1167
+ "closed-conversations": "Afgesloten gesprekken"
1168
+ }, er = {
1169
+ "write-a-message": "Escreva uma mensagem...",
1170
+ "session-closed-lead": "Seu problema foi resolvido!",
1171
+ "new-conversation": "Nova conversa",
1172
+ "welcome-title": "Bem-vindo ao nosso chat de suporte",
1173
+ "welcome-description": "Estamos aqui para ajudar! Inicie uma conversa e responderemos o mais rápido possível.",
1174
+ "your-name": "Seu nome",
1175
+ "your-email": "Seu endereço de email",
1176
+ "start-chat": "Falar com o suporte",
1177
+ "starting-chat": "Conectando...",
1178
+ "i-need-more-help": "preciso de mais ajuda",
1179
+ "this-was-helpful": "Isso foi útil",
1180
+ optional: "Opcional",
1181
+ "no-conversations-yet": "Nenhuma conversa ainda",
1182
+ "back-to-conversations": "Voltar para conversas",
1183
+ "closed-conversations": "Conversas fechadas"
1184
+ }, tr = {
1185
+ "write-a-message": "Escribe un mensaje...",
1186
+ "session-closed-lead": "¡Tu problema fue resuelto!",
1187
+ "new-conversation": "Nueva conversación",
1188
+ "welcome-title": "Bienvenido a nuestro chat de soporte",
1189
+ "welcome-description": "¡Estamos aquí para ayudarte! Inicia una conversación y responderemos lo antes posible.",
1190
+ "your-name": "Tu nombre",
1191
+ "your-email": "Tu correo electrónico",
1192
+ "start-chat": "Hablar con soporte",
1193
+ "starting-chat": "Conectando...",
1194
+ "i-need-more-help": "Necesito más ayuda",
1195
+ "this-was-helpful": "Esto fue útil",
1196
+ optional: "Opcional",
1197
+ "no-conversations-yet": "Sin conversaciones aún",
1198
+ "back-to-conversations": "Volver a conversaciones",
1199
+ "closed-conversations": "Conversaciones cerradas"
1200
+ }, or = {
1201
+ "write-a-message": "Bir mesaj yazın...",
1202
+ "session-closed-lead": "Sorununuz çözüldü!",
1203
+ "new-conversation": "Yeni konuşma",
1204
+ "welcome-title": "Destek sohbetimize hoş geldiniz",
1205
+ "welcome-description": "Yardım etmek için buradayız! Bir konuşma başlatın, en kısa sürede size geri döneceğiz.",
1206
+ "your-name": "Adınız",
1207
+ "your-email": "E-posta adresiniz",
1208
+ "start-chat": "Destekle konuş",
1209
+ "starting-chat": "Bağlanıyor...",
1210
+ "i-need-more-help": "Daha fazla yardıma ihtiyacım var",
1211
+ "this-was-helpful": "Bu yardımcı oldu",
1212
+ optional: "İsteğe bağlı",
1213
+ "no-conversations-yet": "Henüz konuşma yok",
1214
+ "back-to-conversations": "Konuşmalara geri dön",
1215
+ "closed-conversations": "Kapatılan konuşmalar"
1216
+ }, Dt = {
1217
+ en: Zo,
1218
+ ar: Ko,
1219
+ nl: Qo,
1220
+ fr: Jo,
1221
+ de: Go,
1222
+ pt: er,
1223
+ es: tr,
1224
+ tr: or
1225
+ }, rr = Object.keys(Dt), nr = (e) => rr.includes(e);
1226
+ function sr(e, t) {
1227
+ const r = Dt[t];
1228
+ return r && r[e] || "";
1229
+ }
1230
+ function te() {
1231
+ const {
1232
+ widgetCtx: { config: e }
1233
+ } = $();
1234
+ return at(() => {
1235
+ const r = nr(e.language) ? e.language : "en";
1236
+ return {
1237
+ get: (n) => sr(n, r),
1238
+ lang: r
1239
+ };
1240
+ }, [e.language]);
1241
+ }
1242
+ function _e({
1243
+ suggestion: e,
1244
+ className: t,
1245
+ ...r
1246
+ }) {
1247
+ const { sendMessage: n } = q(), s = () => {
1248
+ const a = e.trim();
1249
+ a && n({ content: a });
1250
+ };
1251
+ return /* @__PURE__ */ o(
1252
+ z,
1253
+ {
1254
+ ...w("chat/suggested_reply_btn"),
1255
+ size: "sm",
1256
+ className: d("rounded-xl w-fit", t),
1257
+ ...r,
1258
+ onClick: s,
1259
+ children: e
1260
+ }
1261
+ );
1262
+ }
1263
+ function ar() {
1264
+ const e = te(), t = [
1265
+ e.get("i-need-more-help"),
1266
+ e.get("this-was-helpful")
1267
+ ];
1268
+ return /* @__PURE__ */ o(
1269
+ "div",
1270
+ {
1271
+ ...w("chat/might_solve_user_issue_suggested_replies_container"),
1272
+ className: "flex items-center gap-2 p-2 pb-0 flex-wrap",
1273
+ children: t.map((r) => /* @__PURE__ */ o(
1274
+ _e,
1275
+ {
1276
+ suggestion: r,
1277
+ className: "flex-1"
1278
+ },
1279
+ r
1280
+ ))
1281
+ }
1282
+ );
1283
+ }
1284
+ function ir({
1285
+ file: { status: e, file: t, error: r },
1286
+ onCancel: n
1287
+ }) {
1288
+ const [s, a] = j(
1289
+ null
1290
+ );
1291
+ le(() => {
1292
+ if (!t.type.startsWith("image/")) return;
1293
+ const p = new FileReader();
1294
+ return p.onload = () => a(p.result), p.onerror = () => console.error("Error reading file"), p.readAsDataURL(t), () => p.abort();
1295
+ }, [t]);
1296
+ const l = () => {
1297
+ switch (e) {
1298
+ case "uploading":
1299
+ return /* @__PURE__ */ o(co, { className: "size-4 animate-spin" });
1300
+ case "error":
1301
+ return /* @__PURE__ */ o(lo, { className: "size-4 text-destructive" });
1302
+ default:
1303
+ return null;
1304
+ }
1305
+ }, i = () => {
1306
+ const p = t.type.split("/")[0];
1307
+ return p === "image" && s ? /* @__PURE__ */ o(
1308
+ "img",
1309
+ {
1310
+ src: typeof s == "string" ? s : "",
1311
+ className: "object-cover bg-secondary size-full",
1312
+ alt: t.name
1313
+ }
1314
+ ) : p === "audio" ? /* @__PURE__ */ o(po, {}) : p === "video" ? /* @__PURE__ */ o(ho, {}) : /* @__PURE__ */ o(mo, {});
1315
+ };
1316
+ return /* @__PURE__ */ o(
1317
+ J,
1318
+ {
1319
+ side: "bottom",
1320
+ content: e === "error" ? /* @__PURE__ */ c("span", { className: "text-destructive", children: [
1321
+ "Failed to upload: ",
1322
+ r
1323
+ ] }) : t.name,
1324
+ children: /* @__PURE__ */ c(
1325
+ "div",
1326
+ {
1327
+ className: d(
1328
+ e === "uploading" && "opacity-50",
1329
+ "group",
1330
+ "size-12 border rounded-2xl overflow-hidden relative",
1331
+ "flex items-center justify-center shrink-0"
1332
+ ),
1333
+ children: [
1334
+ /* @__PURE__ */ o("div", { className: "absolute inset-0 flex items-center justify-center", children: l() }),
1335
+ /* @__PURE__ */ o(
1336
+ "button",
1337
+ {
1338
+ type: "button",
1339
+ className: d(
1340
+ "absolute bg-black/50 inset-0 size-full z-10 opacity-0",
1341
+ "flex items-center justify-center",
1342
+ "opacity-0 group-hover:opacity-100 transition"
1343
+ ),
1344
+ onClick: n,
1345
+ children: /* @__PURE__ */ o(be, { className: "size-4 text-primary-foreground" })
1346
+ }
1347
+ ),
1348
+ /* @__PURE__ */ o(i, {})
1349
+ ]
1350
+ }
1351
+ )
1352
+ }
1353
+ );
1354
+ }
1355
+ function lr() {
1356
+ var R;
1357
+ const { isSmallScreen: e } = B(), t = ce(null), { sendMessage: r } = q(), { sessionState: n } = Y(), s = te(), a = ve(), [l, i] = j(""), {
1358
+ allFiles: p,
1359
+ emptyTheFiles: y,
1360
+ handleCancelUpload: b,
1361
+ appendFiles: C,
1362
+ isUploading: f,
1363
+ successFiles: h
1364
+ } = Pt(), m = !!((R = n.session) != null && R.isHandedOff), { isAwaitingBotReply: g } = lt(), _ = (v) => {
1365
+ C(v);
1366
+ }, x = !l.trim() && h.length === 0, I = async () => {
1367
+ if (g || x) return;
1368
+ f && console.info("please wait for the file(s) to upload");
1369
+ const v = l.trim();
1370
+ r({
1371
+ content: v,
1372
+ attachments: h.flatMap(
1373
+ (k) => k.fileUrl ? [
1374
+ {
1375
+ url: k.fileUrl,
1376
+ type: k.file.type,
1377
+ name: k.file.name,
1378
+ id: k.id,
1379
+ size: k.file.size
1380
+ }
1381
+ ] : []
1382
+ )
1383
+ }), i(""), y();
1384
+ }, {
1385
+ getRootProps: M,
1386
+ getInputProps: F,
1387
+ open: P
1388
+ } = No({
1389
+ onDrop: _,
1390
+ noClick: !0,
1391
+ onDropRejected() {
1392
+ console.error("unsupported file type, or the file is too large");
1393
+ },
1394
+ maxSize: 5 * 1024 * 1024,
1395
+ accept: m ? {
1396
+ "text/*": [".txt"],
1397
+ "image/*": [".png", ".jpg", ".jpeg", ".gif"],
1398
+ "application/pdf": [".pdf"]
1399
+ } : {
1400
+ "image/png": [".png"],
1401
+ "image/jpeg": [".jpg", ".jpeg"],
1402
+ "image/gif": [".gif"],
1403
+ "image/webp": [".webp"]
1404
+ }
1405
+ }), W = (v) => {
1406
+ const k = v.clipboardData;
1407
+ k && k.files.length > 0 && _(Array.from(k.files));
1408
+ };
1409
+ return /* @__PURE__ */ c(
1410
+ "div",
1411
+ {
1412
+ ...w("chat/input_box/root"),
1413
+ className: "p-2 relative space-y-1",
1414
+ ...M(),
1415
+ children: [
1416
+ /* @__PURE__ */ o("input", { ...F() }),
1417
+ /* @__PURE__ */ c(
1418
+ "div",
1419
+ {
1420
+ ...w("chat/input_box/inner_root"),
1421
+ className: d(
1422
+ "transition-all",
1423
+ "bg-white",
1424
+ // 'border',
1425
+ "relative rounded-3xl flex flex-col gap-2 p-2",
1426
+ "hover:border-primary focus-within:border-primary"
1427
+ ),
1428
+ children: [
1429
+ /* @__PURE__ */ c(
1430
+ "div",
1431
+ {
1432
+ ...w("chat/input_box/textarea_and_attachments_container"),
1433
+ className: "flex flex-col gap-2",
1434
+ children: [
1435
+ p.length > 0 && /* @__PURE__ */ o(
1436
+ "div",
1437
+ {
1438
+ ...w("chat/input_box/attachments_container"),
1439
+ className: "flex items-center gap-1",
1440
+ children: /* @__PURE__ */ o(T, { mode: "popLayout", children: p.map((v) => /* @__PURE__ */ o(u, { snapExit: !0, children: /* @__PURE__ */ o(
1441
+ ir,
1442
+ {
1443
+ onCancel: () => b(v.id),
1444
+ file: v
1445
+ }
1446
+ ) }, v.id)) })
1447
+ }
1448
+ ),
1449
+ /* @__PURE__ */ o(
1450
+ "textarea",
1451
+ {
1452
+ ...w("chat/input_box/textarea"),
1453
+ onPaste: W,
1454
+ ref: t,
1455
+ id: "chat-input",
1456
+ dir: a,
1457
+ value: l,
1458
+ rows: 3,
1459
+ className: d(
1460
+ /** Match the border radius of the container */
1461
+ // INPUT_CONTAINER_B_RADIUS,
1462
+ "max-h-16 [field-sizing:content]",
1463
+ "w-full resize-none px-2",
1464
+ p.length === 0 && "pt-1",
1465
+ "bg-transparent outline-none",
1466
+ "placeholder:text-muted-foreground",
1467
+ "rtl:placeholder:text-right",
1468
+ // 16px on mobiles prevents auto-zoom on the input when focused
1469
+ e ? "text-[16px]" : "text-sm"
1470
+ ),
1471
+ onChange: (v) => i(v.target.value),
1472
+ onKeyDown: async (v) => {
1473
+ v.key === "Enter" && !v.shiftKey && (v.preventDefault(), I());
1474
+ },
1475
+ placeholder: s.get("write-a-message")
1476
+ }
1477
+ )
1478
+ ]
1479
+ }
1480
+ ),
1481
+ /* @__PURE__ */ c("div", { dir: a, className: "gap-2 flex justify-between rtl:text-right", children: [
1482
+ /* @__PURE__ */ o(
1483
+ J,
1484
+ {
1485
+ side: "top",
1486
+ align: "start",
1487
+ content: "attach files, (maximum size 5mb)",
1488
+ children: /* @__PURE__ */ o(
1489
+ z,
1490
+ {
1491
+ onClick: P,
1492
+ size: "fit",
1493
+ variant: "ghost",
1494
+ className: d(
1495
+ "rounded-full size-8 flex items-center justify-center p-0 overflow-hidden"
1496
+ ),
1497
+ children: /* @__PURE__ */ o(T, { mode: "wait", children: m ? /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o(no, { className: "size-4" }) }, "paper-clip") : /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o(so, { className: "size-4" }) }, "image-icon") })
1498
+ }
1499
+ )
1500
+ }
1501
+ ),
1502
+ /* @__PURE__ */ o(J, { content: "send message", side: "top", align: "end", children: /* @__PURE__ */ o(
1503
+ z,
1504
+ {
1505
+ size: "fit",
1506
+ onClick: I,
1507
+ disabled: g || f || x,
1508
+ className: "rounded-full size-8 flex items-center justify-center p-0",
1509
+ children: /* @__PURE__ */ o(T, { mode: "wait", children: g || f ? /* @__PURE__ */ o(u, { snapExit: !0, children: /* @__PURE__ */ o(ao, { className: "size-4 animate-spin animate-iteration-infinite" }) }, "loading") : /* @__PURE__ */ o(u, { snapExit: !0, children: /* @__PURE__ */ o(io, { className: "size-4" }) }, "send") })
1510
+ }
1511
+ ) })
1512
+ ] })
1513
+ ]
1514
+ }
1515
+ )
1516
+ ]
1517
+ }
1518
+ );
1519
+ }
1520
+ function cr() {
1521
+ const { widgetCtx: e } = $(), { router: t } = S(), { canCreateNewSession: r } = Y(), { toSessionsScreen: n } = A(), s = te();
1522
+ return /* @__PURE__ */ o("div", { className: "p-2", children: /* @__PURE__ */ c("div", { className: "p-2 bg-muted rounded-3xl space-y-2", children: [
1523
+ /* @__PURE__ */ c("div", { className: "pl-2 flex items-center gap-1", children: [
1524
+ /* @__PURE__ */ o(pt, { className: "size-4 text-emerald-600" }),
1525
+ /* @__PURE__ */ o("h2", { className: "text-sm font-medium", dir: "auto", children: s.get("session-closed-lead") })
1526
+ ] }),
1527
+ /* @__PURE__ */ o("div", { children: r || t != null && t.chatScreenOnly ? /* @__PURE__ */ o(
1528
+ z,
1529
+ {
1530
+ onClick: e.resetChat,
1531
+ className: "rounded-2xl w-full",
1532
+ children: s.get("new-conversation")
1533
+ }
1534
+ ) : /* @__PURE__ */ o(z, { onClick: n, className: "rounded-2xl w-full", children: s.get("back-to-conversations") }) })
1535
+ ] }) });
1536
+ }
1537
+ function dr() {
1538
+ var l;
1539
+ const { initialQuestions: e, initialQuestionsPosition: t, thisWasHelpfulOrNot: r } = S(), { sessionState: n } = Y(), { messagesState: s } = q(), a = s.messages.length === 0;
1540
+ return /* @__PURE__ */ o("footer", { children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(T, { mode: "wait", children: n.session && !((l = n.session) != null && l.isOpened) ? /* @__PURE__ */ o(
1541
+ u,
1542
+ {
1543
+ className: "overflow-hidden",
1544
+ overrides: {
1545
+ initial: { height: 0 },
1546
+ animate: { height: "auto" },
1547
+ exit: { height: 0 }
1548
+ },
1549
+ children: /* @__PURE__ */ o(cr, {})
1550
+ },
1551
+ "session-closed"
1552
+ ) : /* @__PURE__ */ c(
1553
+ u,
1554
+ {
1555
+ className: "overflow-hidden",
1556
+ overrides: {
1557
+ initial: { height: 0 },
1558
+ animate: { height: "auto" },
1559
+ exit: { height: 0 }
1560
+ },
1561
+ children: [
1562
+ s.lastAIResMightSolveUserIssue && (r == null ? void 0 : r.enabled) !== !1 && /* @__PURE__ */ o(ar, {}),
1563
+ a && e && t !== "below-initial-messages" && /* @__PURE__ */ o("div", { className: "flex items-center flex-row justify-end gap-2 flex-wrap px-2", children: e == null ? void 0 : e.map((i, p) => /* @__PURE__ */ o(
1564
+ _e,
1565
+ {
1566
+ suggestion: i
1567
+ },
1568
+ `${i}-${p}`
1569
+ )) }),
1570
+ /* @__PURE__ */ o(lr, {})
1571
+ ]
1572
+ },
1573
+ "chat-input"
1574
+ ) }) }) });
1575
+ }
1576
+ function pr({
1577
+ isFirstInGroup: e,
1578
+ isLastInGroup: t,
1579
+ isAloneInGroup: r,
1580
+ ...n
1581
+ }) {
1582
+ const { componentStore: s } = $();
1583
+ if (n.data.action) {
1584
+ const l = s.getComponent(n.data.action.name);
1585
+ if (l)
1586
+ return /* @__PURE__ */ o(
1587
+ l,
1588
+ {
1589
+ ...n,
1590
+ id: n.id,
1591
+ isFirstInGroup: e,
1592
+ isLastInGroup: t,
1593
+ isAloneInGroup: r
1594
+ }
1595
+ );
1596
+ }
1597
+ const a = s.getComponent(n.component);
1598
+ return a ? /* @__PURE__ */ o(
1599
+ a,
1600
+ {
1601
+ ...n,
1602
+ id: n.id,
1603
+ isFirstInGroup: e,
1604
+ isLastInGroup: t,
1605
+ isAloneInGroup: r
1606
+ }
1607
+ ) : /* @__PURE__ */ o(
1608
+ ae,
1609
+ {
1610
+ ...n,
1611
+ isFirstInGroup: e,
1612
+ isLastInGroup: t,
1613
+ isAloneInGroup: r
1614
+ }
1615
+ );
1616
+ }
1617
+ function we({
1618
+ messages: e,
1619
+ agent: t,
1620
+ suggestedReplies: r
1621
+ }) {
1622
+ return /* @__PURE__ */ c(
1623
+ "div",
1624
+ {
1625
+ ...w("chat/agent_msg_group/root"),
1626
+ className: d("flex items-end gap-2"),
1627
+ children: [
1628
+ /* @__PURE__ */ o(J, { content: t == null ? void 0 : t.name, side: "right", align: "end", children: /* @__PURE__ */ o(
1629
+ ge,
1630
+ {
1631
+ ...w("chat/agent_msg_group/root/avatar"),
1632
+ agent: t,
1633
+ className: "hidden"
1634
+ }
1635
+ ) }),
1636
+ /* @__PURE__ */ c("div", { className: d("flex-1 flex flex-col gap-2"), children: [
1637
+ /* @__PURE__ */ c(
1638
+ "div",
1639
+ {
1640
+ ...w("chat/agent_msg_group/avatar_and_msgs/root"),
1641
+ className: d("flex items-end gap-2"),
1642
+ children: [
1643
+ /* @__PURE__ */ o(J, { content: t == null ? void 0 : t.name, side: "right", align: "end", children: /* @__PURE__ */ o(
1644
+ ge,
1645
+ {
1646
+ ...w("chat/agent_msg_group/avatar_and_msgs/avatar"),
1647
+ agent: t
1648
+ }
1649
+ ) }),
1650
+ /* @__PURE__ */ o(
1651
+ "div",
1652
+ {
1653
+ ...w("chat/agent_msg_group/avatar_and_msgs/msgs"),
1654
+ className: d("flex-1 flex flex-col gap-1"),
1655
+ children: e.map((n, s, a) => /* @__PURE__ */ o(
1656
+ pr,
1657
+ {
1658
+ isFirstInGroup: s === 0,
1659
+ isLastInGroup: s === a.length - 1,
1660
+ isAloneInGroup: a.length === 1,
1661
+ ...n
1662
+ },
1663
+ n.id
1664
+ ))
1665
+ }
1666
+ )
1667
+ ]
1668
+ }
1669
+ ),
1670
+ r && r.length > 0 && /* @__PURE__ */ o(
1671
+ "div",
1672
+ {
1673
+ ...w("chat/agent_msg_group/suggestions"),
1674
+ className: d("flex flex-col gap-1 pl-8"),
1675
+ children: r == null ? void 0 : r.map((n, s) => /* @__PURE__ */ o(
1676
+ _e,
1677
+ {
1678
+ suggestion: n
1679
+ },
1680
+ `${n}-${s}`
1681
+ ))
1682
+ }
1683
+ )
1684
+ ] })
1685
+ ]
1686
+ }
1687
+ );
1688
+ }
1689
+ function hr({
1690
+ message: e,
1691
+ isFirstInGroup: t,
1692
+ isLastInGroup: r,
1693
+ isAloneInGroup: n
1694
+ }) {
1695
+ var s;
1696
+ return /* @__PURE__ */ c(
1697
+ "div",
1698
+ {
1699
+ ...w("chat/user_msg/root"),
1700
+ className: "w-5/6 flex flex-col items-end gap-1",
1701
+ children: [
1702
+ e.attachments && e.attachments.length > 0 && /* @__PURE__ */ o("div", { className: "w-full flex gap-1 flex-wrap justify-end", children: (s = e.attachments) == null ? void 0 : s.map((a) => /* @__PURE__ */ o(yt, { attachment: a }, a.id)) }),
1703
+ e.content.length > 0 && /* @__PURE__ */ o(
1704
+ "div",
1705
+ {
1706
+ ...w("chat/user_msg/msg"),
1707
+ "data-first": t,
1708
+ "data-last": r,
1709
+ "data-alone": n,
1710
+ className: d(
1711
+ "transition-all",
1712
+ "w-fit py-3 px-4 rounded-3xl text-sm",
1713
+ "bg-primary text-primary-foreground",
1714
+ "break-words [word-break:break-word]",
1715
+ // `[word-break:break-word]` is deprecated but works in the browser, while `break-words` which is `[overflow-wrap: break-word]` does not work
1716
+ "whitespace-pre-wrap",
1717
+ // We're using the booleans directly here, not the data attributes, to make any external styling more specific than this
1718
+ t && !n && "rounded-br-md",
1719
+ r && !n && "rounded-tr-md",
1720
+ !t && !r && !n && "rounded-r-md"
1721
+ ),
1722
+ children: e.content
1723
+ }
1724
+ )
1725
+ ]
1726
+ }
1727
+ );
1728
+ }
1729
+ function mr({
1730
+ messages: e
1731
+ }) {
1732
+ return /* @__PURE__ */ o(
1733
+ "div",
1734
+ {
1735
+ ...w("chat/user_msg_group/root"),
1736
+ className: d("group", "flex flex-col gap-1 justify-end items-end"),
1737
+ children: e.map((t, r, n) => /* @__PURE__ */ o(
1738
+ hr,
1739
+ {
1740
+ message: t,
1741
+ isFirstInGroup: r === 0,
1742
+ isLastInGroup: r === n.length - 1,
1743
+ isAloneInGroup: n.length === 1
1744
+ },
1745
+ t.id
1746
+ ))
1747
+ }
1748
+ );
1749
+ }
1750
+ function wr(e) {
1751
+ const t = [];
1752
+ let r = null;
1753
+ return e.forEach((n) => {
1754
+ var s, a, l, i;
1755
+ (!r || ((s = r[0]) == null ? void 0 : s.type) !== n.type) && (r = [], t.push(r)), ((a = r[0]) == null ? void 0 : a.type) === "FROM_AGENT" && n.type === "FROM_AGENT" && ((l = n.agent) == null ? void 0 : l.id) !== ((i = r[0].agent) == null ? void 0 : i.id) && (r = [], t.push(r)), r.push(n);
1756
+ }), t;
1757
+ }
1758
+ function gr(e) {
1759
+ var t;
1760
+ return ((t = e == null ? void 0 : e[0]) == null ? void 0 : t.type) === "FROM_USER";
1761
+ }
1762
+ function ur(e) {
1763
+ var t;
1764
+ return ((t = e == null ? void 0 : e[0]) == null ? void 0 : t.type) === "FROM_BOT";
1765
+ }
1766
+ function fr(e) {
1767
+ var t;
1768
+ return ((t = e == null ? void 0 : e[0]) == null ? void 0 : t.type) === "FROM_AGENT";
1769
+ }
1770
+ function vr() {
1771
+ const {
1772
+ messagesState: { messages: e }
1773
+ } = q(), { isAwaitingBotReply: t } = lt(), { componentStore: r } = $(), n = S(), { initialQuestions: s, initialQuestionsPosition: a } = n, l = at(
1774
+ () => wr(e),
1775
+ [e]
1776
+ ), i = n.persistentInitialMessages || [], p = (() => {
1777
+ var h;
1778
+ return e.length ? ((h = n.advancedInitialMessages) == null ? void 0 : h.filter((m) => !!m.persistent)) || [] : n.advancedInitialMessages || [];
1779
+ })(), y = (() => {
1780
+ var h;
1781
+ return p.length ? [] : e.length ? [] : (h = n.initialMessages) != null && h.length ? n.initialMessages : ["Hello, how can I help you?"];
1782
+ })(), b = r.getComponent(
1783
+ "loading"
1784
+ ), C = ce(null);
1785
+ function f() {
1786
+ setTimeout(() => {
1787
+ const h = C.current;
1788
+ h && (h.scrollTop = h.scrollHeight);
1789
+ }, 0);
1790
+ }
1791
+ return le(() => {
1792
+ f();
1793
+ }, [e]), /* @__PURE__ */ c(
1794
+ "div",
1795
+ {
1796
+ ...w("chat/msgs/root"),
1797
+ ref: C,
1798
+ className: "max-h-full scroll-smooth relative flex-1 py-2 px-4 flex flex-col gap-2 overflow-auto",
1799
+ children: [
1800
+ /* @__PURE__ */ o("div", { ...w("chat/persistent_initial_msgs/root"), children: i.map((h, m, g) => /* @__PURE__ */ o(
1801
+ ae,
1802
+ {
1803
+ component: "bot_message",
1804
+ data: { message: h },
1805
+ id: h,
1806
+ type: "FROM_BOT",
1807
+ timestamp: Date.now().toString(),
1808
+ dataComponentNames: {
1809
+ messageContainer: "chat/persistent_initial_msg/root",
1810
+ message: "chat/persistent_initial_msg/msg"
1811
+ },
1812
+ classNames: {
1813
+ messageContainer: d(
1814
+ "w-full flex flex-col items-center text-center"
1815
+ ),
1816
+ message: "w-full bg-transparent border-none shadow-none text-xs"
1817
+ },
1818
+ isFirstInGroup: m === 0,
1819
+ isLastInGroup: m === g.length - 1,
1820
+ isAloneInGroup: g.length === 1
1821
+ },
1822
+ `${h}-${m}`
1823
+ )) }),
1824
+ p.length > 0 && /* @__PURE__ */ o(
1825
+ we,
1826
+ {
1827
+ messages: p.map(
1828
+ ({ message: h }, m) => ({
1829
+ component: "bot_message",
1830
+ data: { message: h },
1831
+ id: `${m}-${h}`,
1832
+ type: "FROM_BOT",
1833
+ timestamp: Date.now().toString()
1834
+ })
1835
+ ),
1836
+ suggestedReplies: e.length === 0 && a === "below-initial-messages" ? s : void 0,
1837
+ agent: n.bot ? { ...n.bot, isAi: !0, id: null } : void 0
1838
+ }
1839
+ ),
1840
+ e.length === 0 && y.length > 0 && /* @__PURE__ */ o(
1841
+ we,
1842
+ {
1843
+ messages: y.map(
1844
+ (h, m) => ({
1845
+ component: "bot_message",
1846
+ data: { message: h },
1847
+ id: `${m}-${h}`,
1848
+ type: "FROM_BOT",
1849
+ timestamp: Date.now().toString()
1850
+ })
1851
+ ),
1852
+ suggestedReplies: a === "below-initial-messages" ? s : void 0,
1853
+ agent: n.bot ? { ...n.bot, isAi: !0, id: null } : void 0
1854
+ }
1855
+ ),
1856
+ l.map((h) => {
1857
+ var _, x, I;
1858
+ const m = (_ = h == null ? void 0 : h[0]) == null ? void 0 : _.type, g = (x = h[0]) == null ? void 0 : x.id;
1859
+ if (!m || !g) return null;
1860
+ if (gr(h))
1861
+ return /* @__PURE__ */ o(mr, { messages: h }, g);
1862
+ if (ur(h) || fr(h)) {
1863
+ const M = (I = h[0]) == null ? void 0 : I.agent;
1864
+ return /* @__PURE__ */ o(
1865
+ we,
1866
+ {
1867
+ messages: h,
1868
+ agent: M
1869
+ },
1870
+ g
1871
+ );
1872
+ }
1873
+ return null;
1874
+ }),
1875
+ t && b && /* @__PURE__ */ o(b, { agent: n.bot })
1876
+ ]
1877
+ }
1878
+ );
1879
+ }
1880
+ function br() {
1881
+ const {
1882
+ messagesState: { isInitialFetchLoading: e }
1883
+ } = q(), {
1884
+ sessionState: { session: t }
1885
+ } = Y(), { isCanvasOpen: r } = Uo(), { theme: n } = X();
1886
+ Ne({
1887
+ width: r ? n.screens.chat.withCanvas.width : n.screens.chat.width,
1888
+ height: r ? n.screens.chat.withCanvas.height : n.screens.chat.height
1889
+ });
1890
+ const s = ce((t == null ? void 0 : t.id) || "chat").current;
1891
+ return /* @__PURE__ */ o(
1892
+ "div",
1893
+ {
1894
+ ...w("chat/root"),
1895
+ className: d("flex flex-col overflow-hidden"),
1896
+ style: {
1897
+ width: "100vw",
1898
+ // Relative to the iframe
1899
+ maxWidth: "100vw",
1900
+ // Relative to the iframe
1901
+ height: "100vh",
1902
+ // Relative to the iframe
1903
+ maxHeight: "100vh"
1904
+ // Relative to the iframe
1905
+ },
1906
+ children: /* @__PURE__ */ c("div", { className: "size-full justify-between flex flex-col", children: [
1907
+ /* @__PURE__ */ o(Tt, {}),
1908
+ /* @__PURE__ */ o(T, { mode: "wait", children: e ? /* @__PURE__ */ o(
1909
+ u,
1910
+ {
1911
+ className: "flex flex-col items-center justify-center w-full flex-1",
1912
+ children: /* @__PURE__ */ o(Mt, {})
1913
+ },
1914
+ "loading"
1915
+ ) : /* @__PURE__ */ c(
1916
+ u,
1917
+ {
1918
+ className: "flex items-start h-full flex-1 overflow-auto",
1919
+ snapExit: !0,
1920
+ children: [
1921
+ /* @__PURE__ */ c(
1922
+ "div",
1923
+ {
1924
+ ...w("chat/main/root"),
1925
+ className: d(
1926
+ "flex flex-col h-full overflow-auto transition-all",
1927
+ r ? "w-2/5" : "w-full"
1928
+ ),
1929
+ style: {
1930
+ transitionTimingFunction: n.screens.chat.withCanvas.transitionTimingFunction,
1931
+ transitionDuration: n.screens.chat.withCanvas.transitionDuration
1932
+ },
1933
+ children: [
1934
+ /* @__PURE__ */ o(vr, {}),
1935
+ /* @__PURE__ */ o(dr, {})
1936
+ ]
1937
+ }
1938
+ ),
1939
+ /* @__PURE__ */ o(
1940
+ "div",
1941
+ {
1942
+ ...w("chat/canvas/root"),
1943
+ className: d(
1944
+ "h-full overflow-auto transition-all",
1945
+ r ? "w-3/5" : "w-0"
1946
+ ),
1947
+ style: {
1948
+ transitionTimingFunction: n.screens.chat.withCanvas.transitionTimingFunction,
1949
+ transitionDuration: n.screens.chat.withCanvas.transitionDuration
1950
+ },
1951
+ children: /* @__PURE__ */ o(Vo, {})
1952
+ }
1953
+ )
1954
+ ]
1955
+ },
1956
+ s
1957
+ ) })
1958
+ ] })
1959
+ }
1960
+ );
1961
+ }
1962
+ function xr({ className: e }) {
1963
+ return /* @__PURE__ */ o(
1964
+ "svg",
1965
+ {
1966
+ width: "26",
1967
+ height: "32",
1968
+ viewBox: "0 0 26 32",
1969
+ fill: "none",
1970
+ xmlns: "http://www.w3.org/2000/svg",
1971
+ className: d("text-primary-foreground", e),
1972
+ children: /* @__PURE__ */ o(
1973
+ "path",
1974
+ {
1975
+ d: "M1.34103 25.6132H5.44245C5.74203 25.6228 6.02673 25.7462 6.23867 25.9582C6.45062 26.1703 6.5739 26.4551 6.58348 26.7548V30.8584C6.59305 31.1581 6.71634 31.443 6.92828 31.655C7.14023 31.8671 7.42492 31.9904 7.7245 32H18.2894C18.589 31.9904 18.8737 31.8671 19.0856 31.655C19.2976 31.443 19.4209 31.1581 19.4304 30.8584V26.7548C19.4401 26.4545 19.5638 26.1692 19.7765 25.957C19.9892 25.7449 20.2748 25.6219 20.5749 25.6132H24.659C24.9586 25.6036 25.2433 25.4803 25.4552 25.2682C25.6671 25.0562 25.7904 24.7713 25.8 24.4716V7.52839C25.7904 7.22865 25.6671 6.94381 25.4552 6.73176C25.2433 6.5197 24.9586 6.39635 24.659 6.38677H20.561C20.2603 6.37802 19.9742 6.25457 19.7614 6.04169C19.5487 5.82881 19.4253 5.54261 19.4165 5.24168V1.14161C19.4072 0.84419 19.2858 0.561291 19.0768 0.349589C18.8678 0.137887 18.5865 0.0130193 18.2894 0L7.7245 0C7.42492 0.00957792 7.14023 0.132929 6.92828 0.344983C6.71634 0.557036 6.59305 0.841878 6.58348 1.14161V5.24168C6.57477 5.54203 6.45187 5.82773 6.23983 6.04052C6.0278 6.25331 5.74262 6.37715 5.44245 6.38677H1.34103C1.04144 6.39635 0.756749 6.5197 0.544805 6.73176C0.332861 6.94381 0.209574 7.22865 0.200001 7.52839V24.4716C0.209574 24.7713 0.332861 25.0562 0.544805 25.2682C0.756749 25.4803 1.04144 25.6036 1.34103 25.6132ZM6.58348 24.4716V7.52839C6.59305 7.22865 6.71634 6.94381 6.92828 6.73176C7.14023 6.5197 7.42492 6.39635 7.7245 6.38677H18.2894C18.589 6.39635 18.8737 6.5197 19.0856 6.73176C19.2976 6.94381 19.4209 7.22865 19.4304 7.52839V24.4716C19.4209 24.7713 19.2976 25.0562 19.0856 25.2682C18.8737 25.4803 18.589 25.6036 18.2894 25.6132H7.7245C7.42492 25.6036 7.14023 25.4803 6.92828 25.2682C6.71634 25.0562 6.59305 24.7713 6.58348 24.4716Z",
1976
+ fill: "currentColor"
1977
+ }
1978
+ )
1979
+ }
1980
+ );
1981
+ }
1982
+ function Ot({ className: e }) {
1983
+ const { token: t } = S();
1984
+ return /* @__PURE__ */ o(
1985
+ "div",
1986
+ {
1987
+ className: d(
1988
+ "flex items-center justify-center gap-2 p-2 pt-0",
1989
+ e
1990
+ ),
1991
+ children: /* @__PURE__ */ o(H, { children: /* @__PURE__ */ c(
1992
+ "a",
1993
+ {
1994
+ href: `https://open.cx/?ref=${t}`,
1995
+ target: "_blank",
1996
+ rel: "noreferrer",
1997
+ className: d(
1998
+ "text-[10px] flex items-center",
1999
+ "text-muted-foreground/70 [&_svg]:text-muted-foreground/70",
2000
+ "hover:text-primary [&_svg]:hover:text-primary"
2001
+ ),
2002
+ children: [
2003
+ /* @__PURE__ */ o("span", { children: "Powered by" }),
2004
+ /* @__PURE__ */ o("span", { children: " " }),
2005
+ /* @__PURE__ */ c("span", { className: "flex items-center gap-[1px]", children: [
2006
+ /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(xr, { className: "size-3 inline-block" }) }),
2007
+ /* @__PURE__ */ o("span", { className: "font-semibold", children: "open" })
2008
+ ] })
2009
+ ]
2010
+ }
2011
+ ) })
2012
+ }
2013
+ );
2014
+ }
2015
+ function yr({ children: e }) {
2016
+ return /* @__PURE__ */ o("p", { className: "pl-4 text-xs text-muted-foreground/75 uppercase font-semibold tracking-tight", children: e });
2017
+ }
2018
+ function rt({
2019
+ session: e,
2020
+ className: t
2021
+ }) {
2022
+ const { bot: r } = S(), { toChatScreen: n } = A(), s = e.assignee.kind === "human" ? e.assignee.name || "Support Agent" : (r == null ? void 0 : r.name) || "AI Support Agent", a = e.assignee.kind === "human" ? e.assignee.avatarUrl || "" : (r == null ? void 0 : r.avatar) || "";
2023
+ return /* @__PURE__ */ c(
2024
+ z,
2025
+ {
2026
+ variant: "ghost",
2027
+ size: "lg",
2028
+ className: d(
2029
+ "rounded-full p-2 pr-4 flex text-start justify-between w-full whitespace-normal",
2030
+ t
2031
+ ),
2032
+ onClick: () => n(e.id),
2033
+ children: [
2034
+ /* @__PURE__ */ c("div", { className: "flex-1 flex gap-2 items-center", children: [
2035
+ /* @__PURE__ */ o(T, { mode: "wait", children: /* @__PURE__ */ o(u, { snapExit: !0, children: /* @__PURE__ */ c(ke, { className: "size-10", children: [
2036
+ /* @__PURE__ */ o(Ce, { src: a, alt: "Agent Icon" }),
2037
+ /* @__PURE__ */ o(ze, { children: /* @__PURE__ */ o(wo, { className: "size-4" }) })
2038
+ ] }) }) }),
2039
+ /* @__PURE__ */ c("div", { className: "flex-1", children: [
2040
+ /* @__PURE__ */ o(T, { mode: "wait", children: /* @__PURE__ */ o(u, { snapExit: !0, children: s }, s) }),
2041
+ /* @__PURE__ */ o(T, { mode: "wait", children: e.lastMessage ? /* @__PURE__ */ o(u, { snapExit: !0, children: /* @__PURE__ */ o(
2042
+ kt,
2043
+ {
2044
+ remarkPlugins: [dt],
2045
+ rehypePlugins: [ct],
2046
+ className: "line-clamp-1 overflow-hidden text-ellipsis text-xs text-muted-foreground",
2047
+ children: e.lastMessage
2048
+ }
2049
+ ) }, e.lastMessage || "content") : /* @__PURE__ */ o(u, { className: "w-1/2", snapExit: !0, children: /* @__PURE__ */ o(_t, { className: "h-4 w-full" }) }, "skeleton") })
2050
+ ] })
2051
+ ] }),
2052
+ /* @__PURE__ */ o(go, { className: "size-4 text-muted-foreground shrink-0" })
2053
+ ]
2054
+ }
2055
+ );
2056
+ }
2057
+ function kr() {
2058
+ const e = te(), { toChatScreen: t } = A(), {
2059
+ sessionsState: { data: r, isInitialFetchLoading: n },
2060
+ openSessions: s,
2061
+ closedSessions: a,
2062
+ canCreateNewSession: l
2063
+ } = Y();
2064
+ return /* @__PURE__ */ o("div", { className: "flex-1 flex flex-col overflow-scroll py-2 px-2", children: /* @__PURE__ */ o(T, { mode: "wait", children: n ? /* @__PURE__ */ o(
2065
+ u,
2066
+ {
2067
+ className: "flex-1 flex items-center justify-center",
2068
+ children: /* @__PURE__ */ o(Mt, {})
2069
+ },
2070
+ "loading"
2071
+ ) : /* @__PURE__ */ o(
2072
+ u,
2073
+ {
2074
+ className: "flex-1 flex flex-col gap-2 relative",
2075
+ children: r.length ? /* @__PURE__ */ c(nt, { children: [
2076
+ /* @__PURE__ */ c(T, { children: [
2077
+ s.length > 0 && /* @__PURE__ */ o(
2078
+ u,
2079
+ {
2080
+ fadeIn: "up",
2081
+ delay: 0.2,
2082
+ className: "space-y-2",
2083
+ snapExit: !0,
2084
+ children: s.map((i) => /* @__PURE__ */ o(rt, { session: i }, i.id))
2085
+ },
2086
+ "open-sessions"
2087
+ ),
2088
+ a.length > 0 && /* @__PURE__ */ c(
2089
+ u,
2090
+ {
2091
+ className: "space-y-2",
2092
+ delay: 0.2,
2093
+ snapExit: !0,
2094
+ children: [
2095
+ /* @__PURE__ */ o(yr, { children: e.get("closed-conversations") }),
2096
+ a.map((i) => /* @__PURE__ */ o(
2097
+ rt,
2098
+ {
2099
+ session: i,
2100
+ className: "opacity-50 hover:opacity-100"
2101
+ },
2102
+ i.id
2103
+ ))
2104
+ ]
2105
+ },
2106
+ "closed-sessions"
2107
+ )
2108
+ ] }),
2109
+ l && /* @__PURE__ */ o("div", { className: "mt-auto w-full rounded-3xl sticky bottom-0 outline outline-8 outline-background bg-background", children: /* @__PURE__ */ Qe(
2110
+ z,
2111
+ {
2112
+ ...w("sessions/new_conversation_btn"),
2113
+ size: "lg",
2114
+ key: "new-session",
2115
+ className: "w-full",
2116
+ onClick: () => t()
2117
+ },
2118
+ e.get("new-conversation")
2119
+ ) })
2120
+ ] }) : /* @__PURE__ */ c("div", { className: "flex-1 flex flex-col gap-2 items-center", children: [
2121
+ /* @__PURE__ */ o("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ o("p", { className: "text-muted-foreground", children: e.get("no-conversations-yet") }) }),
2122
+ /* @__PURE__ */ Qe(
2123
+ z,
2124
+ {
2125
+ ...w("sessions/new_conversation_btn"),
2126
+ size: "lg",
2127
+ key: "new-session",
2128
+ className: "w-full",
2129
+ onClick: () => t()
2130
+ },
2131
+ e.get("new-conversation")
2132
+ )
2133
+ ] })
2134
+ },
2135
+ "sessions"
2136
+ ) }) });
2137
+ }
2138
+ function Cr() {
2139
+ const { theme: e } = X();
2140
+ return Ne({
2141
+ width: e.screens.sessions.width,
2142
+ height: e.screens.sessions.height
2143
+ }), /* @__PURE__ */ o(
2144
+ "div",
2145
+ {
2146
+ ...w("sessions/root"),
2147
+ className: d("flex flex-col overflow-hidden bg-background"),
2148
+ style: {
2149
+ width: "100vw",
2150
+ // Relative to the iframe
2151
+ maxWidth: "100vw",
2152
+ // Relative to the iframe
2153
+ height: "100vh",
2154
+ // Relative to the iframe
2155
+ maxHeight: "100vh"
2156
+ // Relative to the iframe
2157
+ },
2158
+ children: /* @__PURE__ */ c("div", { className: "size-full flex flex-col", children: [
2159
+ /* @__PURE__ */ o(Tt, {}),
2160
+ /* @__PURE__ */ o(kr, {}),
2161
+ /* @__PURE__ */ o(Ot, {})
2162
+ ] })
2163
+ }
2164
+ );
2165
+ }
2166
+ const ne = E.forwardRef(
2167
+ ({ className: e, type: t, ...r }, n) => {
2168
+ const { isSmallScreen: s } = B(), a = ve();
2169
+ return /* @__PURE__ */ o(H, { ref: n, children: /* @__PURE__ */ o(
2170
+ "input",
2171
+ {
2172
+ dir: a,
2173
+ type: t,
2174
+ className: d(
2175
+ // 16px on mobiles prevents auto-zoom on the input when focused
2176
+ s ? "text-[16px]" : "text-sm",
2177
+ "flex w-full rounded-xl p-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-primary-foreground placeholder:text-muted-foreground/75 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition",
2178
+ "rtl:placeholder:text-right",
2179
+ "rounded-2xl px-4",
2180
+ "border shadow-sm",
2181
+ e
2182
+ ),
2183
+ ...r
2184
+ }
2185
+ ) });
2186
+ }
2187
+ );
2188
+ ne.displayName = "Input";
2189
+ function zr() {
2190
+ const { contentIframeRef: e } = $(), { inline: t } = S(), r = ce(null);
2191
+ return le(() => {
2192
+ const n = e == null ? void 0 : e.current;
2193
+ if (n && r.current) {
2194
+ const s = r.current;
2195
+ let a;
2196
+ const l = new ResizeObserver(() => {
2197
+ a = requestAnimationFrame(() => {
2198
+ const i = s.offsetHeight;
2199
+ n.style.setProperty(
2200
+ "--opencx-widget-height",
2201
+ t ? "100%" : `${i.toFixed(1)}px`
2202
+ );
2203
+ });
2204
+ });
2205
+ return l.observe(s), () => {
2206
+ cancelAnimationFrame(a), l.unobserve(s);
2207
+ };
2208
+ }
2209
+ }, [e, t]), { observedElementRef: r };
2210
+ }
2211
+ const Nr = me.object({
2212
+ name: me.string().min(2),
2213
+ email: me.string().email()
2214
+ });
2215
+ function Sr() {
2216
+ var x, I, M, F, P, W, R, v, k;
2217
+ const { setIsOpen: e } = V(), { createUnverifiedContact: t } = Wt(), { isSmallScreen: r } = B(), n = S(), { theme: s } = X(), a = te(), { data: l } = de(), { observedElementRef: i } = zr();
2218
+ Ne({
2219
+ height: void 0,
2220
+ width: s.screens.welcome.width
2221
+ });
2222
+ const [p, y] = j(((x = n.prefillUserData) == null ? void 0 : x.name) || ""), [b, C] = j(((I = n.prefillUserData) == null ? void 0 : I.email) || ""), f = (n.extraDataCollectionFields || []).filter(
2223
+ (N) => N !== "name" && N !== "email" && !!N
2224
+ ), [h, m] = j({}), [g, _] = So(
2225
+ async (N) => {
2226
+ N.preventDefault();
2227
+ const L = Nr.safeParse({ name: p, email: b });
2228
+ L.success && await t(
2229
+ {
2230
+ email: L.data.email,
2231
+ non_verified_name: L.data.name
2232
+ },
2233
+ // Only pass extra data if there is any
2234
+ Object.values(h).filter(Boolean).length ? h : void 0
2235
+ );
2236
+ },
2237
+ [p, b, h]
2238
+ );
2239
+ return /* @__PURE__ */ o(
2240
+ "div",
2241
+ {
2242
+ style: {
2243
+ width: "100vw",
2244
+ // Relative to the iframe
2245
+ maxWidth: "100vw",
2246
+ // Relative to the iframe
2247
+ minHeight: s.screens.welcome.minHeight,
2248
+ height: "100vh",
2249
+ // Relative to the iframe
2250
+ maxHeight: "100vh",
2251
+ // Relative to the iframe
2252
+ overflowY: "auto"
2253
+ },
2254
+ children: /* @__PURE__ */ c(
2255
+ "div",
2256
+ {
2257
+ ref: i,
2258
+ className: d(
2259
+ "flex flex-col",
2260
+ r && "h-full",
2261
+ "bg-[radial-gradient(ellipse_at_top_left,hsl(var(--opencx-primary)),transparent),radial-gradient(ellipse_at_top_right,hsl(var(--opencx-primary)),transparent)]"
2262
+ ),
2263
+ children: [
2264
+ /* @__PURE__ */ c(
2265
+ "div",
2266
+ {
2267
+ dir: "auto",
2268
+ className: d(
2269
+ "flex-1 flex flex-col px-4 py-12 text-start space-y-4 relative z-10",
2270
+ "text-primary-foreground"
2271
+ ),
2272
+ children: [
2273
+ r && /* @__PURE__ */ o(u, { className: "absolute top-6 right-6", children: /* @__PURE__ */ o(z, { size: "selfless", onClick: () => e(!1), children: /* @__PURE__ */ o(be, { className: "size-4" }) }) }),
2274
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between w-full mb-2", children: (M = n.assets) != null && M.organizationLogo ? /* @__PURE__ */ o(
2275
+ "img",
2276
+ {
2277
+ src: (F = n.assets) == null ? void 0 : F.organizationLogo,
2278
+ alt: "Company Logo",
2279
+ className: "h-8 w-auto object-contain"
2280
+ }
2281
+ ) : /* @__PURE__ */ o("h2", { className: "font-bold text-sm", dir: "auto", children: (P = l == null ? void 0 : l.data) == null ? void 0 : P.organizationName }) }),
2282
+ /* @__PURE__ */ c("div", { className: "space-y-2", children: [
2283
+ /* @__PURE__ */ o(
2284
+ "h1",
2285
+ {
2286
+ className: "text-[1.75rem] font-semibold tracking-tight leading-none",
2287
+ dir: "auto",
2288
+ children: ((R = (W = n.textContent) == null ? void 0 : W.welcomeScreen) == null ? void 0 : R.title) || a.get("welcome-title")
2289
+ }
2290
+ ),
2291
+ /* @__PURE__ */ o("p", { className: "text-sm", dir: "auto", children: ((k = (v = n.textContent) == null ? void 0 : v.welcomeScreen) == null ? void 0 : k.description) || a.get("welcome-description") })
2292
+ ] })
2293
+ ]
2294
+ }
2295
+ ),
2296
+ /* @__PURE__ */ c(
2297
+ "div",
2298
+ {
2299
+ className: d(
2300
+ "z-10 m-2 px-2 pt-2 bp-0 space-y-2",
2301
+ "bg-[white]",
2302
+ "border shadow",
2303
+ "rounded-3xl"
2304
+ ),
2305
+ dir: "auto",
2306
+ children: [
2307
+ /* @__PURE__ */ c("form", { onSubmit: _, className: "space-y-2", children: [
2308
+ /* @__PURE__ */ o(
2309
+ ne,
2310
+ {
2311
+ value: p,
2312
+ onChange: (N) => y(N.target.value),
2313
+ required: !0,
2314
+ placeholder: a.get("your-name"),
2315
+ name: "name"
2316
+ }
2317
+ ),
2318
+ /* @__PURE__ */ o(
2319
+ ne,
2320
+ {
2321
+ required: !0,
2322
+ value: b,
2323
+ onChange: (N) => C(N.target.value),
2324
+ type: "email",
2325
+ placeholder: a.get("your-email"),
2326
+ name: "email"
2327
+ }
2328
+ ),
2329
+ f.map((N) => /* @__PURE__ */ o(
2330
+ ne,
2331
+ {
2332
+ value: h[N],
2333
+ onChange: (L) => m((oe) => ({
2334
+ ...oe,
2335
+ [N]: L.target.value
2336
+ })),
2337
+ placeholder: `${N} (${a.get("optional")})`
2338
+ },
2339
+ N
2340
+ )),
2341
+ /* @__PURE__ */ c(
2342
+ z,
2343
+ {
2344
+ disabled: g.loading,
2345
+ className: "w-full",
2346
+ size: "lg",
2347
+ children: [
2348
+ g.loading ? a.get("starting-chat") : a.get("start-chat"),
2349
+ /* @__PURE__ */ o(uo, { className: "size-4 rtl:-scale-100" })
2350
+ ]
2351
+ }
2352
+ )
2353
+ ] }),
2354
+ /* @__PURE__ */ o(Ot, {})
2355
+ ]
2356
+ }
2357
+ )
2358
+ ]
2359
+ }
2360
+ )
2361
+ }
2362
+ );
2363
+ }
2364
+ function Rt() {
2365
+ de();
2366
+ const {
2367
+ routerState: { screen: e }
2368
+ } = A();
2369
+ return /* @__PURE__ */ c("div", { className: "relative bg-background size-full", children: [
2370
+ /* @__PURE__ */ o(pe.Container, {}),
2371
+ /* @__PURE__ */ o(T, { mode: "wait", children: (() => {
2372
+ switch (e) {
2373
+ case "welcome":
2374
+ return /* @__PURE__ */ o(
2375
+ u,
2376
+ {
2377
+ fadeIn: "right",
2378
+ className: "size-full",
2379
+ snapExit: !0,
2380
+ children: /* @__PURE__ */ o(Sr, {})
2381
+ },
2382
+ e
2383
+ );
2384
+ case "sessions":
2385
+ return /* @__PURE__ */ o(
2386
+ u,
2387
+ {
2388
+ fadeIn: "right",
2389
+ className: "size-full",
2390
+ snapExit: !0,
2391
+ children: /* @__PURE__ */ o(Cr, {})
2392
+ },
2393
+ e
2394
+ );
2395
+ case "chat":
2396
+ return /* @__PURE__ */ o(
2397
+ u,
2398
+ {
2399
+ fadeIn: "right",
2400
+ className: "size-full",
2401
+ snapExit: !0,
2402
+ children: /* @__PURE__ */ o(br, {})
2403
+ },
2404
+ e
2405
+ );
2406
+ default:
2407
+ return D(e, Rt.name), null;
2408
+ }
2409
+ })() })
2410
+ ] });
2411
+ }
2412
+ const _r = `<!DOCTYPE html>
2413
+ <html>
2414
+ <head>
2415
+ <style>
2416
+ ${Ct}
2417
+ html, body {
2418
+ height: 100%;
2419
+ width: 100%;
2420
+ margin: 0;
2421
+ padding: 0;
2422
+ font-size: 16px;
2423
+ }
2424
+ </style>
2425
+ <meta name="viewport" content="width=device-width, initial-scale=1, interactive-widget=resizes-content">
2426
+ </head>
2427
+ <body>
2428
+ </body>
2429
+ </html>`;
2430
+ function jt() {
2431
+ const { isOpen: e } = V(), { version: t, contentIframeRef: r } = $(), { cssOverrides: n, inline: s } = S(), { theme: a, cssVars: l, computed: i } = X();
2432
+ return /* @__PURE__ */ o(
2433
+ Z.div,
2434
+ {
2435
+ animate: e ? "visible" : "hidden",
2436
+ initial: "hidden",
2437
+ variants: {
2438
+ hidden: {
2439
+ opacity: 0,
2440
+ y: 8,
2441
+ transitionEnd: { display: "none" },
2442
+ transition: { duration: 0.15 }
2443
+ },
2444
+ visible: {
2445
+ opacity: 1,
2446
+ y: 0,
2447
+ display: "block",
2448
+ height: s ? "100%" : void 0
2449
+ }
2450
+ },
2451
+ children: /* @__PURE__ */ c(
2452
+ ht,
2453
+ {
2454
+ ref: r,
2455
+ initialContent: _r,
2456
+ allowFullScreen: !0,
2457
+ title: "OpenCX Live Chat",
2458
+ style: {
2459
+ // @ts-expect-error this is a valid css variable
2460
+ "--opencx-widget-width": i.minWidth,
2461
+ "--opencx-widget-height": i.minHeight,
2462
+ minWidth: i.minWidth,
2463
+ width: "var(--opencx-widget-width)",
2464
+ maxWidth: i.maxWidth,
2465
+ // Relative to the viewport
2466
+ minHeight: i.minHeight,
2467
+ height: "var(--opencx-widget-height)",
2468
+ maxHeight: i.maxHeight,
2469
+ // Relative to the viewport
2470
+ overflow: "hidden",
2471
+ /** outline is better than border because of box sizing; the outline wouldn't affect the content inside... the border will mess up how the children's border radius sits with the parent */
2472
+ outline: a.widgetContentContainer.outline,
2473
+ outlineColor: a.widgetContentContainer.outlineColor,
2474
+ borderRadius: a.widgetContentContainer.borderRadius,
2475
+ boxShadow: a.widgetContentContainer.boxShadow,
2476
+ transitionProperty: a.widgetContentContainer.transitionProperty,
2477
+ transitionTimingFunction: a.widgetContentContainer.transitionTimingFunction,
2478
+ transitionDuration: a.widgetContentContainer.transitionDuration,
2479
+ // reset iframe defaults
2480
+ boxSizing: "border-box",
2481
+ borderWidth: "0px"
2482
+ },
2483
+ children: [
2484
+ n && /* @__PURE__ */ o("style", { children: n }),
2485
+ /* @__PURE__ */ o(
2486
+ Wo,
2487
+ {
2488
+ delayDuration: 200,
2489
+ disableHoverableContent: !0,
2490
+ children: /* @__PURE__ */ o(
2491
+ "div",
2492
+ {
2493
+ style: {
2494
+ display: "contents"
2495
+ },
2496
+ children: /* @__PURE__ */ o(
2497
+ "div",
2498
+ {
2499
+ style: {
2500
+ ...l
2501
+ },
2502
+ "data-version": t,
2503
+ className: d(
2504
+ "antialiased font-sans size-full overflow-hidden isolate relative text-secondary-foreground"
2505
+ ),
2506
+ children: /* @__PURE__ */ o(Rt, {})
2507
+ }
2508
+ )
2509
+ }
2510
+ )
2511
+ }
2512
+ )
2513
+ ]
2514
+ }
2515
+ )
2516
+ }
2517
+ );
2518
+ }
2519
+ function Ir() {
2520
+ const { theme: e } = X();
2521
+ return /* @__PURE__ */ o(
2522
+ ie.Content,
2523
+ {
2524
+ onInteractOutside: (t) => t.preventDefault(),
2525
+ forceMount: !0,
2526
+ style: {
2527
+ zIndex: e.widgetContentContainer.zIndex,
2528
+ fontSize: "16px"
2529
+ },
2530
+ side: "top",
2531
+ align: "end",
2532
+ sideOffset: e.widgetContentContainer.offset.side,
2533
+ alignOffset: e.widgetContentContainer.offset.align,
2534
+ avoidCollisions: !1,
2535
+ asChild: !0,
2536
+ children: /* @__PURE__ */ o(jt, {})
2537
+ }
2538
+ );
2539
+ }
2540
+ function Tr({
2541
+ className: e,
2542
+ style: t
2543
+ }) {
2544
+ return /* @__PURE__ */ c(
2545
+ "svg",
2546
+ {
2547
+ width: "32",
2548
+ height: "30",
2549
+ viewBox: "0 0 32 30",
2550
+ fill: "none",
2551
+ xmlns: "http://www.w3.org/2000/svg",
2552
+ className: d("text-primary-foreground", e),
2553
+ style: t,
2554
+ children: [
2555
+ /* @__PURE__ */ o(
2556
+ "path",
2557
+ {
2558
+ d: "M0 6.94263C0 3.62892 2.68629 0.942627 6 0.942627H26C29.3137 0.942627 32 3.62892 32 6.94263V17.9426C32 21.2563 29.3137 23.9426 26 23.9426H6C2.68629 23.9426 0 21.2563 0 17.9426V6.94263Z",
2559
+ fill: "currentColor"
2560
+ }
2561
+ ),
2562
+ /* @__PURE__ */ o(
2563
+ "path",
2564
+ {
2565
+ fillRule: "evenodd",
2566
+ clipRule: "evenodd",
2567
+ d: "M19.9945 23.8935L26.237 23.8934C26.1982 24.3557 26.1712 25.2778 26.1704 26.2318C26.1688 28.2839 26.1376 28.7041 25.974 28.868C25.583 29.2598 25.2686 29.0967 24.0616 27.8754C23.4162 27.2222 22.1141 25.9522 21.1682 25.0531L19.9945 23.8935Z",
2568
+ fill: "currentColor"
2569
+ }
2570
+ )
2571
+ ]
2572
+ }
2573
+ );
2574
+ }
2575
+ const Mr = `<!DOCTYPE html>
2576
+ <html>
2577
+ <head>
2578
+ <style>
2579
+ ${Ct}
2580
+ html, body {
2581
+ height: 100%;
2582
+ width: 100%;
2583
+ margin: 0;
2584
+ padding: 0;
2585
+ font-size: 16px;
2586
+ }
2587
+ </style>
2588
+ </head>
2589
+ <body>
2590
+ </body>
2591
+ </html>`;
2592
+ function Dr() {
2593
+ var a, l;
2594
+ const { isOpen: e } = V(), { cssOverrides: t, assets: r } = S(), { theme: n, cssVars: s } = X();
2595
+ return /* @__PURE__ */ c(
2596
+ ht,
2597
+ {
2598
+ initialContent: Mr,
2599
+ style: {
2600
+ height: `calc(${n.widgetTrigger.size.button}px + ${U.x * 2}px)`,
2601
+ width: `calc(${n.widgetTrigger.size.button}px + ${U.y * 2}px)`,
2602
+ fontSize: "16px",
2603
+ position: "fixed",
2604
+ zIndex: n.widgetTrigger.zIndex,
2605
+ right: n.widgetTrigger.offset.right,
2606
+ bottom: n.widgetTrigger.offset.bottom,
2607
+ // reset iframe defaults
2608
+ boxSizing: "border-box",
2609
+ borderWidth: "0px"
2610
+ },
2611
+ children: [
2612
+ t && /* @__PURE__ */ o("style", { children: t }),
2613
+ /* @__PURE__ */ o(
2614
+ "div",
2615
+ {
2616
+ style: {
2617
+ ...s,
2618
+ width: "100%",
2619
+ height: "100%",
2620
+ display: "flex",
2621
+ alignItems: "center",
2622
+ justifyContent: "center"
2623
+ },
2624
+ children: /* @__PURE__ */ o(
2625
+ ie.PopoverTrigger,
2626
+ {
2627
+ className: d(
2628
+ "font-sans flex items-center justify-center rounded-full"
2629
+ ),
2630
+ style: {
2631
+ height: n.widgetTrigger.size.button,
2632
+ width: n.widgetTrigger.size.button
2633
+ },
2634
+ children: /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(
2635
+ "div",
2636
+ {
2637
+ ...w("trigger/btn"),
2638
+ className: d(
2639
+ "relative size-full rounded-full",
2640
+ "flex items-center justify-center",
2641
+ "overflow-hidden",
2642
+ "transition-all",
2643
+ "bg-primary",
2644
+ "text-primary-foreground"
2645
+ ),
2646
+ children: /* @__PURE__ */ o(T, { mode: "wait", children: e ? /* @__PURE__ */ o(
2647
+ u,
2648
+ {
2649
+ snapExit: !0,
2650
+ fadeIn: "up",
2651
+ overrides: {
2652
+ initial: { rotate: 45 },
2653
+ animate: { rotate: 0 }
2654
+ },
2655
+ children: (a = r == null ? void 0 : r.widgetTrigger) != null && a.closeIcon ? /* @__PURE__ */ o(
2656
+ "img",
2657
+ {
2658
+ src: r.widgetTrigger.closeIcon,
2659
+ alt: "Widget trigger close icon",
2660
+ style: {
2661
+ width: n.widgetTrigger.size.icon,
2662
+ height: n.widgetTrigger.size.icon
2663
+ }
2664
+ }
2665
+ ) : /* @__PURE__ */ o(
2666
+ fo,
2667
+ {
2668
+ style: {
2669
+ width: n.widgetTrigger.size.icon,
2670
+ height: n.widgetTrigger.size.icon
2671
+ }
2672
+ }
2673
+ )
2674
+ },
2675
+ "x-icon"
2676
+ ) : /* @__PURE__ */ o(
2677
+ u,
2678
+ {
2679
+ snapExit: !0,
2680
+ overrides: {
2681
+ initial: { rotate: 45 },
2682
+ animate: { rotate: 0 }
2683
+ },
2684
+ children: (l = r == null ? void 0 : r.widgetTrigger) != null && l.openIcon ? /* @__PURE__ */ o(
2685
+ "img",
2686
+ {
2687
+ src: r.widgetTrigger.openIcon,
2688
+ alt: "Widget trigger open icon",
2689
+ style: {
2690
+ width: n.widgetTrigger.size.icon,
2691
+ height: n.widgetTrigger.size.icon
2692
+ }
2693
+ }
2694
+ ) : /* @__PURE__ */ o(
2695
+ Tr,
2696
+ {
2697
+ style: {
2698
+ width: n.widgetTrigger.size.icon,
2699
+ height: n.widgetTrigger.size.icon
2700
+ },
2701
+ className: "mt-0.5 opacity-95"
2702
+ }
2703
+ )
2704
+ },
2705
+ "message-icon"
2706
+ ) })
2707
+ }
2708
+ ) })
2709
+ }
2710
+ )
2711
+ }
2712
+ )
2713
+ ]
2714
+ }
2715
+ );
2716
+ }
2717
+ function Or() {
2718
+ return /* @__PURE__ */ o(
2719
+ ie.Anchor,
2720
+ {
2721
+ style: { position: "fixed", right: 0, bottom: 0 }
2722
+ }
2723
+ );
2724
+ }
2725
+ function Rr() {
2726
+ const { isOpen: e, setIsOpen: t } = V();
2727
+ return /* @__PURE__ */ c(ie.Root, { open: e, onOpenChange: t, children: [
2728
+ /* @__PURE__ */ o(Or, {}),
2729
+ /* @__PURE__ */ o(Dr, {}),
2730
+ /* @__PURE__ */ o(Ir, {})
2731
+ ] });
2732
+ }
2733
+ const jr = [
2734
+ {
2735
+ key: "loading",
2736
+ component: Po
2737
+ },
2738
+ {
2739
+ key: "fallback",
2740
+ component: Mo
2741
+ },
2742
+ {
2743
+ key: "bot_message",
2744
+ component: ae
2745
+ },
2746
+ {
2747
+ key: "agent_message",
2748
+ component: ae
2749
+ }
2750
+ ], Er = {
2751
+ get: async (e) => localStorage.getItem(e),
2752
+ set: async (e, t) => {
2753
+ localStorage.setItem(e, t);
2754
+ },
2755
+ remove: async (e) => {
2756
+ localStorage.removeItem(e);
2757
+ }
2758
+ };
2759
+ function tn({
2760
+ options: e,
2761
+ components: t = [],
2762
+ loadingComponent: r
2763
+ }) {
2764
+ return /* @__PURE__ */ o(
2765
+ Ht,
2766
+ {
2767
+ components: [...jr, ...t],
2768
+ options: e,
2769
+ storage: Er,
2770
+ loadingComponent: r,
2771
+ children: /* @__PURE__ */ o(At, { children: e.inline ? /* @__PURE__ */ o(jt, {}) : /* @__PURE__ */ o(Rr, {}) })
2772
+ }
2773
+ );
2774
+ }
2775
+ export {
2776
+ tn as Widget
2777
+ };
2778
+ //# sourceMappingURL=index.js.map