@sendbird/ai-agent-messenger-react 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,29 @@
1
1
  import * as n from "react";
2
- import { createContext as _e, useContext as X, useEffect as P, useState as C, useCallback as W, useRef as F, Suspense as Ae, lazy as _, useMemo as ve, Component as er, Fragment as kt, useReducer as tr, useLayoutEffect as ye, forwardRef as nr, useId as rr, Children as or } from "react";
3
- import ar, { SendbirdProduct as sr, DeviceOsPlatform as wt, SendbirdPlatform as ir, SendbirdError as on, SessionHandler as lr, LogLevel as an, ConnectionState as cr, ConnectionHandler as sn } from "@sendbird/chat";
4
- import c, { css as k, ThemeProvider as dr, createGlobalStyle as ur, useTheme as st, StyleSheetManager as mr, keyframes as ln } from "styled-components";
5
- import { format as He, isSameMinute as At, isSameDay as pr } from "date-fns";
6
- import { enUS as gr } from "date-fns/locale/en-US";
7
- import { AIAgentModule as hr, ConversationStatus as j, ConversationType as fr, ConversationListOrder as br } from "@sendbird/chat/aiAgent";
8
- import { renderer as Er, parser as xr, MessageProvider as vr } from "@sendbird/react-uikit-message-template-view";
9
- import { createMessageTemplate as yr } from "@sendbird/uikit-message-template";
10
- import { useGroupChannelMessages as Cr, useForceUpdate as _r, useGroupChannelHandler as cn } from "@sendbird/uikit-tools";
2
+ import { createContext as _e, useContext as te, useEffect as N, useState as y, useId as an, useRef as D, useCallback as F, Suspense as Ie, lazy as _, useMemo as ve, Component as ar, Fragment as At, useReducer as ir, useLayoutEffect as ye, forwardRef as sr, Children as lr } from "react";
3
+ import cr, { SendbirdProduct as dr, DeviceOsPlatform as It, SendbirdPlatform as ur, ConnectionHandler as ct, SendbirdError as mr, SessionHandler as pr, LogLevel as sn, ConnectionState as gr } from "@sendbird/chat";
4
+ import c, { css as k, ThemeProvider as hr, createGlobalStyle as fr, useTheme as dt, StyleSheetManager as br, keyframes as ln } from "styled-components";
5
+ import { format as We, isSameMinute as $t, isSameDay as Er } from "date-fns";
6
+ import { enUS as xr } from "date-fns/locale/en-US";
7
+ import { AIAgentModule as vr, ConversationStatus as z, ConversationListOrder as yr, ConversationType as Cr } from "@sendbird/chat/aiAgent";
8
+ import { renderer as _r, parser as Tr, MessageProvider as Sr } from "@sendbird/react-uikit-message-template-view";
9
+ import { createMessageTemplate as wr } from "@sendbird/uikit-message-template";
10
+ import { useGroupChannelMessages as kr, useForceUpdate as Ar, useGroupChannelHandler as cn } from "@sendbird/uikit-tools";
11
11
  import dn from "dompurify";
12
- import { GroupChannelModule as Tr } from "@sendbird/chat/groupChannel";
13
- import { MessageMetaArray as Sr, SendingStatus as kr } from "@sendbird/chat/message";
14
- import { isSameDay as wr } from "date-fns/isSameDay";
15
- import { createPortal as Ar } from "react-dom";
16
- import Ir from "@emotion/is-prop-valid";
17
- const ee = (e, t) => {
18
- const r = _e(null), o = () => {
19
- const a = X(r);
20
- if (!a)
12
+ import { GroupChannelModule as Ir } from "@sendbird/chat/groupChannel";
13
+ import { MessageMetaArray as $r, SendingStatus as Mr } from "@sendbird/chat/message";
14
+ import { isSameDay as Or } from "date-fns/isSameDay";
15
+ import { createPortal as Rr } from "react-dom";
16
+ import Lr from "@emotion/is-prop-valid";
17
+ const j = (e, t) => {
18
+ const r = _e(null), o = ({ children: i, value: l }) => /* @__PURE__ */ n.createElement(r.Provider, { value: l }, typeof i == "function" ? i(l) : i), a = ({ children: i }) => /* @__PURE__ */ n.createElement(r.Consumer, null, (l) => l ? typeof i == "function" ? i(l) : i : null), s = () => {
19
+ const i = te(r);
20
+ if (!i)
21
21
  throw new Error(`use${e}Context must be used within a ${e}Provider`);
22
- return a;
22
+ return i;
23
23
  };
24
- return r.displayName = `${e}Context`, o.displayName = `use${e}Context`, [r, o];
24
+ return r.displayName = `${e}Context`, o.displayName = `${e}Provider`, a.displayName = `${e}Consumer`, s.displayName = `use${e}Context`, { Context: r, Provider: o, Consumer: a, useContext: s };
25
25
  };
26
- function it(e) {
26
+ function ut(e) {
27
27
  const t = _e({
28
28
  Template: e.template,
29
29
  updateTemplate: () => {
@@ -33,54 +33,51 @@ function it(e) {
33
33
  }
34
34
  });
35
35
  function r({ children: s }) {
36
- const [i, l] = C(() => e.template), [u, m] = C(e.components), g = {
36
+ const [i, l] = y(() => e.template), [u, p] = y(e.components), m = {
37
37
  Template: i,
38
- updateTemplate: (p) => l(() => p),
38
+ updateTemplate: (h) => l(() => h),
39
39
  components: u,
40
- updateComponent: (p, h) => m((f) => ({ ...f, [p]: h }))
40
+ updateComponent: (h, g) => p((b) => ({ ...b, [h]: g }))
41
41
  };
42
- return /* @__PURE__ */ n.createElement(t.Provider, { value: g }, s);
42
+ return /* @__PURE__ */ n.createElement(t.Provider, { value: m }, s);
43
43
  }
44
44
  function o({ template: s, children: i }) {
45
- const { updateTemplate: l } = X(t);
46
- return P(() => {
45
+ const { updateTemplate: l } = te(t);
46
+ return N(() => {
47
47
  s && l(s);
48
48
  }, [s]), /* @__PURE__ */ n.createElement(n.Fragment, null, i);
49
49
  }
50
50
  function a({ children: s }) {
51
51
  return /* @__PURE__ */ n.createElement(r, null, s);
52
52
  }
53
- return a.defaults = e, a.useContext = () => X(t), a.Context = t, a.Template = o, Object.keys(e.components).forEach((s) => {
53
+ return a.defaults = e, a.useContext = () => te(t), a.Context = t, a.Template = o, Object.keys(e.components).forEach((s) => {
54
54
  a[s] = function({
55
55
  component: l
56
56
  }) {
57
- const { updateComponent: u } = X(t);
58
- return P(() => {
57
+ const { updateComponent: u } = te(t);
58
+ return N(() => {
59
59
  l && u(s, l);
60
60
  }, [l]), null;
61
61
  };
62
62
  }), a;
63
63
  }
64
- function Mr(...e) {
64
+ function Nr(...e) {
65
65
  return function({ children: r }) {
66
66
  return e.reduce((o, a) => /* @__PURE__ */ n.createElement(a, null, o), r);
67
67
  };
68
68
  }
69
- function It() {
69
+ function at() {
70
70
  }
71
- function $r() {
71
+ function Br() {
72
72
  const e = /iPad|iPhone|iPod/.test(navigator.userAgent), t = /Android/.test(navigator.userAgent);
73
73
  return e || t;
74
74
  }
75
- function Or(e) {
76
- return JSON.parse(e);
77
- }
78
75
  class un {
79
76
  constructor(t) {
80
77
  this.logger = t, this.subscribers = {};
81
78
  }
82
79
  async send(t) {
83
- const r = Rr(), o = this.subscribers[t.type];
80
+ const r = Dr(), o = this.subscribers[t.type];
84
81
  if (o) {
85
82
  this.logger.debug(`messenger.dispatcher: dispatching command: ${t.type}`, t.payload);
86
83
  const a = o.map((s) => s(t.payload));
@@ -97,12 +94,12 @@ class un {
97
94
  this.subscribers[t] && (this.subscribers[t] = this.subscribers[t].filter((o) => o !== r));
98
95
  }
99
96
  }
100
- const Rr = () => {
101
- let e = It, t = It;
97
+ const Dr = () => {
98
+ let e = at, t = at;
102
99
  return { promise: new Promise((o, a) => {
103
100
  e = o, t = a;
104
101
  }), resolve: e, reject: t };
105
- }, Lr = "1.0.0", ke = "sb-agent", Nr = Lr;
102
+ }, Pr = "1.0.1", ke = "sb-agent", Fr = Pr;
106
103
  var mn = /* @__PURE__ */ ((e) => (e[e.VERBOSE = 0] = "VERBOSE", e[e.DEBUG = 1] = "DEBUG", e[e.INFO = 2] = "INFO", e[e.WARN = 3] = "WARN", e[e.ERROR = 4] = "ERROR", e[e.NONE = 5] = "NONE", e))(mn || {});
107
104
  class pn {
108
105
  constructor(t) {
@@ -125,20 +122,23 @@ class pn {
125
122
  }
126
123
  }
127
124
  function Mt(e, t, r) {
128
- const o = ar.init({
125
+ const o = cr.init({
129
126
  appId: e,
130
- modules: [new Tr(), new hr()],
127
+ modules: [new Ir(), new vr()],
131
128
  localCacheEnabled: !0,
132
129
  ...r
133
130
  });
134
131
  return o.addSendbirdExtensions(
135
- [{ version: Nr, product: sr.AI_AGENT, platform: t.platform }],
132
+ [{ version: Fr, product: dr.AI_AGENT, platform: t.platform }],
136
133
  { platform: t.deviceOSPlatform, version: t.deviceOSVersion },
137
134
  t.customData
138
135
  ) || console.warn("Invalid Sendbird Extensions", t), o;
139
136
  }
140
- const [Br, Dr] = ee("AIAgent");
141
- function Pr({
137
+ const {
138
+ Provider: Ur,
139
+ useContext: Ze
140
+ } = j("AIAgent");
141
+ function Vr({
142
142
  appId: e,
143
143
  aiAgentId: t,
144
144
  language: r,
@@ -148,57 +148,247 @@ function Pr({
148
148
  chatParams: i,
149
149
  dispatcher: l,
150
150
  logger: u,
151
- children: m,
152
- extensions: g = {
153
- platform: ir.JS,
154
- deviceOSPlatform: $r() ? wt.MOBILE_WEB : wt.WEB
151
+ children: p,
152
+ extensions: m = {
153
+ platform: ur.JS,
154
+ deviceOSPlatform: Br() ? It.MOBILE_WEB : It.WEB
155
155
  }
156
156
  }) {
157
- const [p, h] = C(() => {
158
- const f = u ?? new pn(mn.WARN), E = l ?? new un(f);
157
+ const [h, g] = y(() => {
158
+ const b = u ?? new pn(mn.WARN), E = l ?? new un(b);
159
159
  return {
160
160
  appId: e,
161
161
  aiAgentId: t,
162
162
  language: r,
163
163
  countryCode: o,
164
164
  context: a,
165
- chatSDK: s ?? Mt(e, g, i),
166
- logger: f,
165
+ chatSDK: s ?? Mt(e, m, i),
166
+ logger: b,
167
167
  dispatcher: E
168
168
  };
169
169
  });
170
- return (r !== p.language || o !== p.countryCode) && h((f) => ({ ...f, language: r, countryCode: o, context: a })), s && s !== p.chatSDK ? h((f) => ({ ...f, aiAgentId: t, chatSDK: s })) : !s && p.chatSDK.appId !== e && h((f) => ({
171
- ...f,
170
+ return (r !== h.language || o !== h.countryCode) && g((b) => ({ ...b, language: r, countryCode: o, context: a })), s && s !== h.chatSDK ? g((b) => ({ ...b, aiAgentId: t, chatSDK: s })) : !s && h.chatSDK.appId !== e && g((b) => ({
171
+ ...b,
172
172
  aiAgentId: t,
173
- chatSDK: Mt(e, g, { newInstance: !0, ...i })
174
- })), P(() => () => {
175
- p.chatSDK.disconnectWebSocket();
176
- }, [p.chatSDK]), /* @__PURE__ */ n.createElement(Br.Provider, { value: p }, typeof m == "function" ? m(p) : m);
173
+ chatSDK: Mt(e, m, { newInstance: !0, ...i })
174
+ })), N(() => () => {
175
+ h.chatSDK.disconnectWebSocket();
176
+ }, [h.chatSDK]), /* @__PURE__ */ n.createElement(Ur, { value: h }, p);
177
+ }
178
+ const Hr = (e, t, r) => kr(e, t, { ...r, strictStreamingOrder: !0 });
179
+ var it = /* @__PURE__ */ ((e) => (e.ConversationClose = "conv.close", e))(it || {});
180
+ class zr {
181
+ constructor(t = {}) {
182
+ this.payload = t;
183
+ }
184
+ toJSON() {
185
+ return JSON.stringify({ type: this.type, payload: this.payload });
186
+ }
187
+ }
188
+ class Wr extends zr {
189
+ constructor() {
190
+ super(...arguments), this.type = "conv.close";
191
+ }
192
+ }
193
+ const Gr = {
194
+ CloseConversation: () => new Wr()
195
+ }, {
196
+ Provider: jr
197
+ } = j("AIAgentConversation");
198
+ function Kr({
199
+ children: e,
200
+ channelUrl: t,
201
+ onChannelDeleted: r,
202
+ onMessagesUpdated: o,
203
+ onConversationClosedViaDispatcher: a,
204
+ onBeforeSendMessage: s,
205
+ onAfterSendMessage: i = at
206
+ }) {
207
+ var x;
208
+ const { chatSDK: l, logger: u, dispatcher: p } = Ze(), { channel: m, channelFetchError: h, fetchChannel: g } = Zr(t), b = Hr(l, m, {
209
+ shouldCountNewMessages: () => !1,
210
+ onChannelDeleted: r,
211
+ onMessagesReceived: o,
212
+ onMessagesUpdated: o,
213
+ logger: u
214
+ });
215
+ N(() => {
216
+ const f = async () => {
217
+ u.debug("conversation.dispatcher: try to close conversation", m), m != null && m.conversation && m.conversation.status === z.OPEN && (await m.closeConversation(), a == null || a());
218
+ };
219
+ return p.subscribe(it.ConversationClose, f), () => {
220
+ p.unsubscribe(it.ConversationClose, f);
221
+ };
222
+ }, [p, (x = m == null ? void 0 : m.conversation) == null ? void 0 : x.status, a]);
223
+ const E = {
224
+ conversation: (m == null ? void 0 : m.conversation) ?? void 0,
225
+ channelSource: {
226
+ channel: m,
227
+ error: h,
228
+ refetch: () => g()
229
+ },
230
+ messageSource: {
231
+ messages: b.messages,
232
+ initialized: b.initialized,
233
+ loadPrevious: () => b.loadPrevious(),
234
+ loadNext: () => b.loadNext(),
235
+ sendUserMessage: async (f) => {
236
+ s && (f = await s(f));
237
+ const T = await b.sendUserMessage(f, i);
238
+ return i == null || i(T), T;
239
+ },
240
+ sendFileMessage: async (f) => {
241
+ s && (f = await s(f));
242
+ const T = await b.sendFileMessage(f, i);
243
+ return i == null || i(T), T;
244
+ }
245
+ }
246
+ };
247
+ return /* @__PURE__ */ n.createElement(jr, { value: E }, e);
248
+ }
249
+ function Zr(e) {
250
+ const { chatSDK: t, logger: r } = Ze(), [o, a] = y(void 0), [s, i] = y(void 0);
251
+ async function l() {
252
+ if (r.debug("conversation.fetchChannel: start"), a(void 0), i(void 0), e)
253
+ try {
254
+ r.debug("conversation.fetchChannel: get channel", e);
255
+ const u = await t.groupChannel.getChannel(e);
256
+ a(u);
257
+ const p = new ct({ onReconnectSucceeded: () => u.refresh() });
258
+ t.addConnectionHandler("sba-refresh", p), r.debug("conversation.fetchChannel: fetched channel", u);
259
+ } catch (u) {
260
+ u instanceof mr && i(u), r.error("conversation.fetchChannel: error", u);
261
+ }
262
+ }
263
+ return N(() => {
264
+ l();
265
+ }, [e, t]), {
266
+ channel: o,
267
+ channelFetchError: s,
268
+ fetchChannel: l
269
+ };
270
+ }
271
+ const Yr = (e, t) => {
272
+ const r = an(), [o, a] = y(!1), [s, i] = y(null), [l, u] = y([]), [p, m] = y(null), h = D(!1), g = F(async () => {
273
+ if (!h.current && e.currentUser) {
274
+ h.current = !0, a(!1), i(null), u([]);
275
+ try {
276
+ const E = e.aiAgent.createConversationListQuery(t), x = await E.next();
277
+ u(x), m(E), i(null);
278
+ } catch (E) {
279
+ m(null), i(E);
280
+ } finally {
281
+ a(!0), h.current = !1;
282
+ }
283
+ }
284
+ }, [e, t.aiAgentId, t.status, t.limit, t.order, t.reverse]), b = F(async () => {
285
+ p && p.next().then((E) => {
286
+ u((x) => [...x, ...E]);
287
+ }).catch(() => {
288
+ });
289
+ }, [p]);
290
+ return N(() => (e.addConnectionHandler(r, new ct({ onConnected: () => g() })), () => e.removeConnectionHandler(r)), [e, r, g]), N(() => {
291
+ g();
292
+ }, [g]), {
293
+ initialized: o,
294
+ error: s,
295
+ conversations: l,
296
+ loadMore: b
297
+ };
298
+ }, {
299
+ Provider: qr
300
+ } = j("AIAgentConversationList");
301
+ function Jr({ children: e }) {
302
+ const { chatSDK: t, aiAgentId: r } = Ze(), o = Yr(t, {
303
+ aiAgentId: r,
304
+ status: z.CLOSED,
305
+ order: yr.UPDATED_AT,
306
+ reverse: !0
307
+ }), a = {
308
+ listSource: {
309
+ initialized: o.initialized,
310
+ error: o.error ?? void 0,
311
+ conversations: o.conversations,
312
+ loadMore: () => o.loadMore()
313
+ }
314
+ };
315
+ return /* @__PURE__ */ n.createElement(qr, { value: a }, e);
316
+ }
317
+ const gn = (e) => {
318
+ try {
319
+ const t = JSON.parse(e);
320
+ return typeof t == "string" ? JSON.stringify(t).slice(1, -1) : e.trim();
321
+ } catch {
322
+ return JSON.stringify(e).slice(1, -1);
323
+ }
324
+ }, Oe = (e) => JSON.parse(e), Ye = (e) => JSON.parse(e);
325
+ function Xr(e, t) {
326
+ const [r, o] = t.split(",").map((a) => a.trim());
327
+ return e === "dark" && o || r;
328
+ }
329
+ function Qr(e) {
330
+ const t = {};
331
+ function r(o, a = "") {
332
+ for (const [s, i] of Object.entries(o)) {
333
+ const l = a ? `${a}.${s}` : s;
334
+ i && typeof i == "object" && !Array.isArray(i) ? r(i, l) : t[l] = i;
335
+ }
336
+ }
337
+ return r(e), t;
338
+ }
339
+ function mt({
340
+ template: e,
341
+ variables: t,
342
+ variableKeyPattern: r,
343
+ variableValueTransformer: o
344
+ }) {
345
+ return Object.entries(t).reduce((a, [s, i]) => {
346
+ if (!o && !["number", "boolean", "string"].includes(typeof i))
347
+ throw new Error("If transformer is not provided, value must be a {string, number, or boolean}");
348
+ const l = o ? o(i) : String(i), u = r(s);
349
+ return a.replace(u, gn(l));
350
+ }, e);
351
+ }
352
+ async function eo({
353
+ template: e,
354
+ variables: t,
355
+ variableKeyPattern: r,
356
+ variableValueTransformer: o
357
+ }) {
358
+ return (await Promise.all(
359
+ Object.entries(t).map(async ([s, i]) => {
360
+ const l = await o(i);
361
+ return { regex: r(s), transformedValue: l };
362
+ })
363
+ )).reduce((s, { regex: i, transformedValue: l }) => s.replace(i, gn(l)), e);
177
364
  }
178
- const Fr = (e) => ({
365
+ const to = (e) => ({
179
366
  setTemplate: (t, r) => e.onSetTemplate(t, r),
180
367
  getTemplate: (t) => e.onGetTemplate(t),
181
368
  setCachedToken: (t) => e.onSetCachedToken(t),
182
369
  getCachedToken: () => e.onGetCachedToken(),
183
370
  clear: () => e.onClear()
184
- }), [Ur, gn] = ee("MessageCacheTemplate");
185
- function Vr({ logger: e, storage: t, children: r }) {
186
- const o = W(
371
+ }), {
372
+ Provider: no,
373
+ useContext: hn
374
+ } = j("MessageCacheTemplate");
375
+ function ro({ logger: e, storage: t, children: r }) {
376
+ const o = F(
187
377
  (i) => {
188
- var m, g;
189
- const l = (g = (m = i.appInfo) == null ? void 0 : m.aiAgentInfo) == null ? void 0 : g.templateListToken;
378
+ var p, m;
379
+ const l = (m = (p = i.appInfo) == null ? void 0 : p.aiAgentInfo) == null ? void 0 : m.templateListToken;
190
380
  if (!l) return !1;
191
381
  const u = t.getCachedToken();
192
382
  return u ? l !== u : !0;
193
383
  },
194
384
  [t]
195
- ), a = W(
385
+ ), a = F(
196
386
  async (i) => {
197
387
  try {
198
388
  const { templates: l, token: u } = await i.aiAgent.getMessageTemplates({ limit: 20 });
199
- for (const { template: m } of l) {
200
- const { key: g } = Or(m);
201
- t.setTemplate(g, m);
389
+ for (const { template: p } of l) {
390
+ const { key: m } = Oe(p);
391
+ t.setTemplate(m, p);
202
392
  }
203
393
  t.setCachedToken(u);
204
394
  } catch (l) {
@@ -206,87 +396,255 @@ function Vr({ logger: e, storage: t, children: r }) {
206
396
  }
207
397
  },
208
398
  [t, e]
209
- ), s = W(() => {
399
+ ), s = F(() => {
210
400
  t.clear();
211
401
  }, [t]);
212
- return /* @__PURE__ */ n.createElement(
213
- Ur.Provider,
214
- {
215
- value: {
216
- shouldSyncCachedTemplate: o,
217
- syncCachedTemplates: a,
218
- clearCachedTemplates: s,
219
- storage: t
220
- }
221
- },
222
- r
223
- );
402
+ return /* @__PURE__ */ n.createElement(no, { value: { shouldSyncCachedTemplate: o, syncCachedTemplates: a, clearCachedTemplates: s, storage: t } }, r);
224
403
  }
225
- const Hr = (e, t, r) => Cr(e, t, r), Wr = (e, t) => {
226
- const r = () => {
227
- const f = e.aiAgent.createConversationListQuery(t);
228
- return f.next().then((E) => {
229
- p(E);
230
- }).catch((E) => {
231
- E instanceof on && l(E);
232
- }).finally(() => {
233
- s(!0);
234
- }), f;
235
- }, o = F(!1), [a, s] = C(!1), [i, l] = C(null), [u, m] = C(() => r()), [g, p] = C([]), h = W(() => {
236
- u.next().then((f) => {
237
- p((E) => [...E, ...f]);
238
- }).catch(() => {
239
- });
240
- }, [u]);
241
- return P(() => {
242
- o.current ? m(r()) : o.current = !0;
243
- }, [e, t.status, t.aiAgentId, t.limit]), {
244
- initialized: a,
245
- error: i,
246
- conversations: g,
247
- loadMore: h
404
+ function oo(e) {
405
+ let t = "pending", r = e.then((o) => {
406
+ t = "resolved", r = o;
407
+ }).catch((o) => {
408
+ t = "rejected", r = o;
409
+ });
410
+ return {
411
+ get value() {
412
+ if (t === "resolved")
413
+ return r;
414
+ throw r;
415
+ }
248
416
  };
417
+ }
418
+ const {
419
+ Provider: ao,
420
+ useContext: fn
421
+ } = j("MessageTemplateFetching");
422
+ function io({ children: e, internalVariables: t }) {
423
+ const r = D({}), o = D({}), [a, s] = y({}), i = F((p, m) => {
424
+ s((h) => ({
425
+ ...h,
426
+ [p]: { fetching: !1, error: !1, ...h[p], ...m }
427
+ }));
428
+ }, []), l = F(
429
+ async ({
430
+ onRequestTemplate: p,
431
+ onGetCachedTemplate: m,
432
+ templateKey: h,
433
+ suspense: g = !1
434
+ }) => {
435
+ const b = m(h);
436
+ if (b) return b;
437
+ const E = o.current[h];
438
+ if (E) return E;
439
+ g || i(h, { fetching: !0 });
440
+ const x = p(h).catch((f) => {
441
+ throw g || i(h, { error: !0 }), f;
442
+ }).finally(() => {
443
+ g || i(h, { fetching: !1 }), delete o.current[h];
444
+ });
445
+ return o.current[h] = x, x;
446
+ },
447
+ [i]
448
+ ), u = {
449
+ internalVariables: t,
450
+ fetchTemplate: l,
451
+ suspend: (p, m) => {
452
+ if (r.current[p])
453
+ return r.current[p];
454
+ const h = oo(m());
455
+ return r.current[p] = h, h;
456
+ },
457
+ getIsFetching: (p) => {
458
+ var m;
459
+ return ((m = a[p]) == null ? void 0 : m.fetching) ?? !1;
460
+ },
461
+ getHasError: (p) => {
462
+ var m;
463
+ return ((m = a[p]) == null ? void 0 : m.error) ?? !1;
464
+ }
465
+ };
466
+ return /* @__PURE__ */ n.createElement(ao, { value: u }, e);
467
+ }
468
+ const qe = {
469
+ VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
470
+ VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")
249
471
  };
250
- var rt = /* @__PURE__ */ ((e) => (e.ConversationClose = "conv.close", e))(rt || {});
251
- class zr {
252
- constructor(t = {}) {
253
- this.payload = t;
254
- }
255
- toJSON() {
256
- return JSON.stringify({ type: this.type, payload: this.payload });
257
- }
472
+ function oe({ uiTemplateString: e, variables: t = {} }) {
473
+ const r = Qr(t);
474
+ return mt({
475
+ template: e,
476
+ variables: r,
477
+ variableKeyPattern: (o) => qe.VARIABLE(o)
478
+ });
258
479
  }
259
- class Gr extends zr {
260
- constructor() {
261
- super(...arguments), this.type = "conv.close";
262
- }
480
+ function ae({
481
+ theme: e,
482
+ uiTemplateString: t,
483
+ colorVariables: r = {}
484
+ }) {
485
+ return mt({
486
+ template: t,
487
+ variables: r,
488
+ variableKeyPattern: (o) => qe.VARIABLE(o),
489
+ variableValueTransformer: (o) => Xr(e, o)
490
+ });
491
+ }
492
+ function so({
493
+ theme: e,
494
+ uiTemplateString: t,
495
+ viewVariables: r = {},
496
+ aiAgentColorVariables: o,
497
+ internalVariables: a,
498
+ onRequestTemplate: s
499
+ }) {
500
+ const l = Object.values(r).flat().map((p) => p.key);
501
+ return [...new Set(l)].some((p) => !s(p)) ? null : mt({
502
+ template: t,
503
+ variables: r,
504
+ variableKeyPattern: (p) => qe.VIEW_VARIABLE(p),
505
+ variableValueTransformer: (p) => {
506
+ const m = p.map(({ key: h, variables: g }) => {
507
+ const b = s(h), { ui_template: E, color_variables: x } = Oe(b);
508
+ let f = JSON.stringify(E);
509
+ return f = oe({
510
+ uiTemplateString: f,
511
+ variables: a
512
+ }), f = ae({
513
+ theme: e,
514
+ uiTemplateString: f,
515
+ colorVariables: x
516
+ }), f = ae({
517
+ theme: e,
518
+ uiTemplateString: f,
519
+ colorVariables: o
520
+ }), f = oe({
521
+ uiTemplateString: f,
522
+ variables: g
523
+ }), Ye(f);
524
+ });
525
+ return JSON.stringify(m);
526
+ }
527
+ });
263
528
  }
264
- const jr = {
265
- CloseConversation: () => new Gr()
266
- }, J = "sb-agent", Q = {
267
- ENTRY: `${J}-entry`,
268
- MODAL_ROOT: `${J}-modal-root`,
269
- WINDOW: `${J}-window`,
270
- LAUNCHER: `${J}-launcher`
271
- }, Ne = 2147483647, fe = {
272
- MODAL: Ne - 1,
529
+ async function lo({
530
+ theme: e,
531
+ uiTemplateString: t,
532
+ viewVariables: r = {},
533
+ aiAgentColorVariables: o,
534
+ internalVariables: a,
535
+ onRequestTemplate: s
536
+ }) {
537
+ return eo({
538
+ template: t,
539
+ variables: r,
540
+ variableKeyPattern: (i) => qe.VIEW_VARIABLE(i),
541
+ variableValueTransformer: async (i) => {
542
+ const l = i.map(async ({ key: p, variables: m }) => {
543
+ const h = await s(p), { ui_template: g, color_variables: b } = Oe(h);
544
+ let E = JSON.stringify(g);
545
+ return E = oe({
546
+ uiTemplateString: E,
547
+ variables: a
548
+ }), E = ae({
549
+ theme: e,
550
+ uiTemplateString: E,
551
+ colorVariables: b
552
+ }), E = ae({
553
+ theme: e,
554
+ uiTemplateString: E,
555
+ colorVariables: o
556
+ }), E = oe({
557
+ uiTemplateString: E,
558
+ variables: m
559
+ }), Ye(E);
560
+ }), u = await Promise.all(l);
561
+ return JSON.stringify(u);
562
+ }
563
+ });
564
+ }
565
+ const co = ({
566
+ rawTemplate: e,
567
+ aiAgentColorVariables: t,
568
+ internalVariables: r,
569
+ ...o
570
+ }) => {
571
+ const { ui_template: a, color_variables: s } = Oe(e);
572
+ let i = JSON.stringify(a);
573
+ if (Object.keys(o.viewVariables ?? {}).length > 0) {
574
+ const u = so({
575
+ ...o,
576
+ uiTemplateString: i,
577
+ aiAgentColorVariables: t,
578
+ internalVariables: r
579
+ });
580
+ if (u === null) return null;
581
+ i = u;
582
+ }
583
+ return i = oe({ ...o, uiTemplateString: i, variables: r }), i = ae({ ...o, uiTemplateString: i, colorVariables: s }), i = ae({ ...o, uiTemplateString: i, colorVariables: t }), i = oe({ ...o, uiTemplateString: i }), Ye(i);
584
+ }, uo = async ({
585
+ rawTemplate: e,
586
+ aiAgentColorVariables: t,
587
+ internalVariables: r,
588
+ ...o
589
+ }) => {
590
+ const { ui_template: a, color_variables: s } = Oe(e);
591
+ let i = JSON.stringify(a);
592
+ return Object.keys(o.viewVariables ?? {}).length > 0 && (i = await lo({
593
+ ...o,
594
+ uiTemplateString: i,
595
+ aiAgentColorVariables: t,
596
+ internalVariables: r
597
+ })), i = oe({ ...o, uiTemplateString: i, variables: r }), i = ae({ ...o, uiTemplateString: i, colorVariables: s }), i = ae({ ...o, uiTemplateString: i, colorVariables: t }), i = oe({ ...o, uiTemplateString: i }), Ye(i);
598
+ }, mo = (e) => {
599
+ const { aiAgentColorVariables: t = {} } = e, { internalVariables: r } = fn();
600
+ return y(() => {
601
+ const o = e.onGetCachedTemplate(e.templateKey);
602
+ return o ? co({
603
+ ...e,
604
+ rawTemplate: o,
605
+ aiAgentColorVariables: t,
606
+ internalVariables: r,
607
+ onRequestTemplate: e.onGetCachedTemplate
608
+ }) : null;
609
+ });
610
+ }, po = (e) => {
611
+ const [t] = mo(e);
612
+ if (t) return t;
613
+ const { aiAgentColorVariables: r = {} } = e, { internalVariables: o, fetchTemplate: a, suspend: s } = fn();
614
+ return s(e.templateKey, async () => {
615
+ const l = await a({ ...e, suspense: !0 });
616
+ return await uo({
617
+ ...e,
618
+ rawTemplate: l,
619
+ aiAgentColorVariables: r,
620
+ internalVariables: o
621
+ });
622
+ }).value;
623
+ }, go = '@import"https://fonts.googleapis.com/css?family=Roboto:400,500,600,700&display=swap";.sb-message-template__border{position:relative}.sb-message-template__border:after{content:"";position:absolute;top:0;bottom:0;left:0;right:0;z-index:1;box-shadow:inset 0 0 0 var(--border-width) var(--border-color);border-radius:var(--border-radius);pointer-events:none}.sb-message-template__action{cursor:pointer}.sb-message-template__parent{font-family:Roboto,serif}.sb-message-template__text{font-family:inherit;font-size:14px;font-weight:400;font-stretch:normal;font-style:normal;letter-spacing:normal;text-align:left}.sb-message-template__text-button{font-family:inherit;background-color:#e0e0e0;text-align:center;padding:10px;border-radius:6px;font-size:14px;font-weight:600;font-stretch:normal;font-style:normal;letter-spacing:normal}.sendbird-theme--light .sb-message-template__text-button{color:#742ddd}.sendbird-theme--dark .sb-message-template__text-button{color:#c2a9fa}.sb-message-template__text-button:hover{opacity:1;box-shadow:#0000001a 0 1px 3px,#0000000f 0 1px 2px}.sb-message-template__text-button,.sb-message-template__image-button{cursor:pointer;border-style:none}.sb-message-template__parent{border-radius:unset;background-color:transparent;overflow:hidden}.sb-message-template__parent *{box-sizing:border-box;line-height:1.3}.sb-message-template__carousel{display:flex;width:100%;box-sizing:border-box;touch-action:pan-y}', Y = "sb-agent", ne = {
624
+ ENTRY: `${Y}-entry`,
625
+ MODAL_ROOT: `${Y}-modal-root`,
626
+ WINDOW: `${Y}-window`,
627
+ LAUNCHER: `${Y}-launcher`
628
+ }, De = 2147483647, ge = {
629
+ MODAL: De - 1,
273
630
  // FIXME: need to cover the case where the tooltip is on the top of the modal
274
- TOOLTIP: Ne - 2,
275
- WINDOW: Ne - 3,
276
- LAUNCHER: Ne - 4
277
- }, Kr = {
278
- SESSION: `@${J}-session`
279
- }, me = {
631
+ TOOLTIP: De - 2,
632
+ WINDOW: De - 3,
633
+ LAUNCHER: De - 4
634
+ }, bn = {
635
+ SESSION: `@${Y}-session`,
636
+ USER_DATA: `@${Y}-udata`
637
+ }, de = {
280
638
  DEFAULT_PRIMARY: "#742ddd",
281
639
  DEFAULT_BOT_MSG_BG: "#eeeeee",
282
640
  WHITE: "#ffffff",
283
641
  BLACK: "#000000"
284
- }, hn = 36, Zr = 100, Yr = 25 * 1024 * 1024, fn = ["application/pdf", "image/jpeg", "image/jpg", "image/png"], lt = "noopener noreferrer nofollow";
285
- function bn(e) {
642
+ }, En = 36, ho = 100, fo = 25 * 1024 * 1024, xn = ["application/pdf", "image/jpeg", "image/jpg", "image/png"], pt = "noopener noreferrer nofollow";
643
+ function vn(e) {
286
644
  return e.length === 4 ? `#${[...e.slice(1)].map((t) => t + t).join("")}` : e;
287
645
  }
288
- function qr(e) {
289
- const t = bn(e);
646
+ function bo(e) {
647
+ const t = vn(e);
290
648
  return [
291
649
  parseInt(t.slice(1, 3), 16),
292
650
  // r
@@ -296,54 +654,54 @@ function qr(e) {
296
654
  // b
297
655
  ];
298
656
  }
299
- function Jr(e) {
657
+ function Eo(e) {
300
658
  return `#${e.map((t) => t.toString(16).padStart(2, "0")).join("")}`;
301
659
  }
302
- function Xr(e, t, r) {
660
+ function xo(e, t, r) {
303
661
  e /= 255, t /= 255, r /= 255;
304
662
  const o = Math.max(e, t, r), a = Math.min(e, t, r), s = o - a;
305
663
  let i = 0, l = 0;
306
664
  const u = (o + a) / 2;
307
665
  return o !== a && (l = u > 0.5 ? s / (2 - o - a) : s / (o + a)), o === e ? i = (t - r) / s + (t < r ? 6 : 0) : o === t ? i = (r - e) / s + 2 : o === r && (i = (e - t) / s + 4), i /= 6, [i, l, u];
308
666
  }
309
- function Qr(e, t, r) {
667
+ function vo(e, t, r) {
310
668
  let o, a, s;
311
669
  if (t === 0)
312
670
  o = a = s = r;
313
671
  else {
314
- const i = function(g, p, h) {
315
- return h < 0 && (h += 1), h > 1 && (h -= 1), h < 0.16666666666666666 ? g + (p - g) * 6 * h : h < 0.5 ? p : h < 0.6666666666666666 ? g + (p - g) * (0.6666666666666666 - h) * 6 : g;
672
+ const i = function(m, h, g) {
673
+ return g < 0 && (g += 1), g > 1 && (g -= 1), g < 0.16666666666666666 ? m + (h - m) * 6 * g : g < 0.5 ? h : g < 0.6666666666666666 ? m + (h - m) * (0.6666666666666666 - g) * 6 : m;
316
674
  }, l = r < 0.5 ? r * (1 + t) : r + t - r * t, u = 2 * r - l;
317
675
  o = i(u, l, e + 1 / 3), a = i(u, l, e), s = i(u, l, e - 1 / 3);
318
676
  }
319
677
  return [Math.round(o * 255), Math.round(a * 255), Math.round(s * 255)];
320
678
  }
321
- function Be(e, t, r) {
322
- const [o, a, s] = qr(e), [i, l, u] = Xr(o, a, s), m = Math.max(0, Math.min(1, u * t)), g = Math.max(0, Math.min(1, l * r)), [p, h, f] = Qr(i, g, m);
323
- return Jr([Math.round(p), Math.round(h), Math.round(f)]);
679
+ function Pe(e, t, r) {
680
+ const [o, a, s] = bo(e), [i, l, u] = xo(o, a, s), p = Math.max(0, Math.min(1, u * t)), m = Math.max(0, Math.min(1, l * r)), [h, g, b] = vo(i, m, p);
681
+ return Eo([Math.round(h), Math.round(g), Math.round(b)]);
324
682
  }
325
- function eo(e, t = "light") {
326
- return e === me.DEFAULT_PRIMARY ? { extraDark: "#491389", dark: "#6211c8", main: "#742ddd", light: "#c2a9fa", extraLight: "#dbd1ff" } : {
327
- extraDark: Be(e, 0.6, 1.2),
328
- dark: Be(e, 0.85, 1.1),
683
+ function yo(e, t = "light") {
684
+ return e === de.DEFAULT_PRIMARY ? { extraDark: "#491389", dark: "#6211c8", main: "#742ddd", light: "#c2a9fa", extraLight: "#dbd1ff" } : {
685
+ extraDark: Pe(e, 0.6, 1.2),
686
+ dark: Pe(e, 0.85, 1.1),
329
687
  main: e,
330
- light: Be(e, t === "dark" ? 1.1 : 1.5, t === "dark" ? 0.95 : 0.9),
331
- extraLight: Be(e, t === "dark" ? 1.2 : 1.75, t === "dark" ? 0.9 : 0.8)
688
+ light: Pe(e, t === "dark" ? 1.1 : 1.5, t === "dark" ? 0.95 : 0.9),
689
+ extraLight: Pe(e, t === "dark" ? 1.2 : 1.75, t === "dark" ? 0.9 : 0.8)
332
690
  };
333
691
  }
334
- function We(e) {
335
- const t = bn(e), r = 149, o = +`0x${t[1]}${t[2]}`, a = +`0x${t[3]}${t[4]}`, s = +`0x${t[5]}${t[6]}`;
336
- return o * 0.299 + a * 0.587 + s * 0.114 > r ? me.BLACK : me.WHITE;
692
+ function Ge(e) {
693
+ const t = vn(e), r = 149, o = +`0x${t[1]}${t[2]}`, a = +`0x${t[3]}${t[4]}`, s = +`0x${t[5]}${t[6]}`;
694
+ return o * 0.299 + a * 0.587 + s * 0.114 > r ? de.BLACK : de.WHITE;
337
695
  }
338
- const Ie = "data-sb-agent-theme", $t = (e) => (t, ...r) => {
696
+ const $e = "data-sb-agent-theme", Ot = (e) => (t, ...r) => {
339
697
  let o = "";
340
698
  return t.forEach((a, s) => {
341
699
  o += a + (r[s] ?? "");
342
- }), `[${Ie}='${e}'] & { ${o} }`;
343
- }, V = {
344
- light: $t("light"),
345
- dark: $t("dark")
346
- }, to = k`:root,:host{--sendbird-primary-extra-dark:${(e) => e.theme.palette.primary.extraDark};--sendbird-primary-dark:${(e) => e.theme.palette.primary.dark};--sendbird-primary-main:${(e) => e.theme.palette.primary.main};--sendbird-primary-light:${(e) => e.theme.palette.primary.light};--sendbird-primary-extra-light:${(e) => e.theme.palette.primary.extraLight};--sendbird-secondary-extra-dark:#066858;--sendbird-secondary-dark:#027d69;--sendbird-secondary-main:#259c72;--sendbird-secondary-light:#69c085;--sendbird-secondary-extra-light:#a8e2ab;--sendbird-information-extra-dark:#241389;--sendbird-information-dark:#362ca9;--sendbird-information-main:#4a48cd;--sendbird-information-light:#a9bbfa;--sendbird-information-extra-light:#d1dbff;--sendbird-highlight-100:#fff2b6;--sendbird-error-extra-dark:#9d091e;--sendbird-error-dark:#bf0711;--sendbird-error-main:#de360b;--sendbird-error-light:#f66161;--sendbird-error-extra-light:#fdaaaa;--sendbird-background-700:#000000;--sendbird-background-600:#161616;--sendbird-background-500:#2c2c2c;--sendbird-background-400:#393939;--sendbird-background-300:#bdbdbd;--sendbird-background-200:#e0e0e0;--sendbird-background-100:#eeeeee;--sendbird-background-50:#ffffff;--sendbird-onlight-01:rgba(0,0,0,0.88);--sendbird-onlight-02:rgba(0,0,0,0.5);--sendbird-onlight-03:rgba(0,0,0,0.38);--sendbird-onlight-04:rgba(0,0,0,0.12);--sendbird-ondark-01:rgba(255,255,255,0.88);--sendbird-ondark-02:rgba(255,255,255,0.5);--sendbird-ondark-03:rgba(255,255,255,0.38);--sendbird-ondark-04:rgba(255,255,255,0.12);--sendbird-overlay-01:rgba(0,0,0,0.55);--sendbird-overlay-02:rgba(0,0,0,0.32);--sendbird-shadow-01:0 1px 5px 0 rgba(33,34,66,0.04),0 0 3px 0 rgba(0,0,0,0.08),0 2px 1px 0 rgba(0,0,0,0.12);--sendbird-shadow-02:0 3px 5px -3px rgba(33,34,66,0.04),0 3px 14px 2px rgba(0,0,0,0.08),0 8px 10px 1px rgba(0,0,0,0.12);--sendbird-shadow-03:0 6px 10px -5px rgba(0,0,0,0.04),0 6px 30px 5px rgba(0,0,0,0.08),0 16px 24px 2px rgba(0,0,0,0.12);--sendbird-shadow-04:0 9px 15px -7px rgba(0,0,0,0.04),0 9px 46px 8px rgba(0,0,0,0.08),0 24px 38px 3px rgba(0,0,0,0.12);--sendbird-shadow-05:0 2px 8px 0 rgba(0,0,0,0.08),0 4px 6px 0 rgba(0,0,0,0.12);--sendbird-shadow-message-input:0 1px 5px 0 rgba(33,34,66,0.12),0 0 1px 0 rgba(33,34,66,0.16),0 2px 1px 0 rgba(33,34,66,0.08),0 1px 5px 0 rgba(0,0,0,0.12);}`, no = k`[${Ie}='light'] &{--sb-on-bg-1:var(--sendbird-onlight-01);--sb-on-bg-2:var(--sendbird-onlight-02);--sb-on-bg-3:var(--sendbird-onlight-03);--sb-on-bg-4:var(--sendbird-onlight-04);--sb-bg-1:var(--sendbird-background-50);--sb-bg-2:var(--sendbird-background-100);--sb-bg-3:var(--sendbird-background-200);--sb-on-content-1:var(--sendbird-ondark-01);--sb-on-content-2:var(--sendbird-ondark-02);--sb-on-content-inverse-1:var(--sendbird-onlight-01);--sb-on-content-inverse-2:var(--sendbird-onlight-02);--sb-primary:var(--sendbird-primary-main);--sb-secondary:var(--sendbird-secondary-main);--sb-error:var(--sendbird-error-main);--sb-information:var(--sendbird-information-light);}[${Ie}='dark'] &{--sb-on-bg-1:var(--sendbird-ondark-01);--sb-on-bg-2:var(--sendbird-ondark-02);--sb-on-bg-3:var(--sendbird-ondark-03);--sb-on-bg-4:var(--sendbird-ondark-04);--sb-bg-1:var(--sendbird-background-600);--sb-bg-2:var(--sendbird-background-500);--sb-bg-3:var(--sendbird-background-400);--sb-on-content-1:var(--sendbird-onlight-01);--sb-on-content-2:var(--sendbird-onlight-02);--sb-on-content-inverse-1:var(--sendbird-ondark-01);--sb-on-content-inverse-2:var(--sendbird-ondark-02);--sb-primary:var(--sendbird-primary-light);--sb-secondary:var(--sendbird-secondary-light);--sb-error:var(--sendbird-error-light);--sb-information:var(--sendbird-information-light);}`, d = {
700
+ }), `[${$e}='${e}'] & { ${o} }`;
701
+ }, U = {
702
+ light: Ot("light"),
703
+ dark: Ot("dark")
704
+ }, Co = k`:root,:host{--sendbird-primary-extra-dark:${(e) => e.theme.palette.primary.extraDark};--sendbird-primary-dark:${(e) => e.theme.palette.primary.dark};--sendbird-primary-main:${(e) => e.theme.palette.primary.main};--sendbird-primary-light:${(e) => e.theme.palette.primary.light};--sendbird-primary-extra-light:${(e) => e.theme.palette.primary.extraLight};--sendbird-secondary-extra-dark:#066858;--sendbird-secondary-dark:#027d69;--sendbird-secondary-main:#259c72;--sendbird-secondary-light:#69c085;--sendbird-secondary-extra-light:#a8e2ab;--sendbird-information-extra-dark:#241389;--sendbird-information-dark:#362ca9;--sendbird-information-main:#4a48cd;--sendbird-information-light:#a9bbfa;--sendbird-information-extra-light:#d1dbff;--sendbird-highlight-100:#fff2b6;--sendbird-error-extra-dark:#9d091e;--sendbird-error-dark:#bf0711;--sendbird-error-main:#de360b;--sendbird-error-light:#f66161;--sendbird-error-extra-light:#fdaaaa;--sendbird-background-700:#000000;--sendbird-background-600:#161616;--sendbird-background-500:#2c2c2c;--sendbird-background-400:#393939;--sendbird-background-300:#bdbdbd;--sendbird-background-200:#e0e0e0;--sendbird-background-100:#eeeeee;--sendbird-background-50:#ffffff;--sendbird-onlight-01:rgba(0,0,0,0.88);--sendbird-onlight-02:rgba(0,0,0,0.5);--sendbird-onlight-03:rgba(0,0,0,0.38);--sendbird-onlight-04:rgba(0,0,0,0.12);--sendbird-ondark-01:rgba(255,255,255,0.88);--sendbird-ondark-02:rgba(255,255,255,0.5);--sendbird-ondark-03:rgba(255,255,255,0.38);--sendbird-ondark-04:rgba(255,255,255,0.12);--sendbird-overlay-01:rgba(0,0,0,0.55);--sendbird-overlay-02:rgba(0,0,0,0.32);--sendbird-shadow-01:0 1px 5px 0 rgba(33,34,66,0.04),0 0 3px 0 rgba(0,0,0,0.08),0 2px 1px 0 rgba(0,0,0,0.12);--sendbird-shadow-02:0 3px 5px -3px rgba(33,34,66,0.04),0 3px 14px 2px rgba(0,0,0,0.08),0 8px 10px 1px rgba(0,0,0,0.12);--sendbird-shadow-03:0 6px 10px -5px rgba(0,0,0,0.04),0 6px 30px 5px rgba(0,0,0,0.08),0 16px 24px 2px rgba(0,0,0,0.12);--sendbird-shadow-04:0 9px 15px -7px rgba(0,0,0,0.04),0 9px 46px 8px rgba(0,0,0,0.08),0 24px 38px 3px rgba(0,0,0,0.12);--sendbird-shadow-05:0 2px 8px 0 rgba(0,0,0,0.08),0 4px 6px 0 rgba(0,0,0,0.12);--sendbird-shadow-message-input:0 1px 5px 0 rgba(33,34,66,0.12),0 0 1px 0 rgba(33,34,66,0.16),0 2px 1px 0 rgba(33,34,66,0.08),0 1px 5px 0 rgba(0,0,0,0.12);}`, _o = k`[${$e}='light'] &{--sb-on-bg-1:var(--sendbird-onlight-01);--sb-on-bg-2:var(--sendbird-onlight-02);--sb-on-bg-3:var(--sendbird-onlight-03);--sb-on-bg-4:var(--sendbird-onlight-04);--sb-bg-1:var(--sendbird-background-50);--sb-bg-2:var(--sendbird-background-100);--sb-bg-3:var(--sendbird-background-200);--sb-on-content-1:var(--sendbird-ondark-01);--sb-on-content-2:var(--sendbird-ondark-02);--sb-on-content-inverse-1:var(--sendbird-onlight-01);--sb-on-content-inverse-2:var(--sendbird-onlight-02);--sb-primary:var(--sendbird-primary-main);--sb-secondary:var(--sendbird-secondary-main);--sb-error:var(--sendbird-error-main);--sb-information:var(--sendbird-information-light);}[${$e}='dark'] &{--sb-on-bg-1:var(--sendbird-ondark-01);--sb-on-bg-2:var(--sendbird-ondark-02);--sb-on-bg-3:var(--sendbird-ondark-03);--sb-on-bg-4:var(--sendbird-ondark-04);--sb-bg-1:var(--sendbird-background-600);--sb-bg-2:var(--sendbird-background-500);--sb-bg-3:var(--sendbird-background-400);--sb-on-content-1:var(--sendbird-onlight-01);--sb-on-content-2:var(--sendbird-onlight-02);--sb-on-content-inverse-1:var(--sendbird-ondark-01);--sb-on-content-inverse-2:var(--sendbird-ondark-02);--sb-primary:var(--sendbird-primary-light);--sb-secondary:var(--sendbird-secondary-light);--sb-error:var(--sendbird-error-light);--sb-information:var(--sendbird-information-light);}`, d = {
347
705
  color: {
348
706
  primary: {
349
707
  dark: "var(--sendbird-primary-dark)",
@@ -393,23 +751,23 @@ const Ie = "data-sb-agent-theme", $t = (e) => (t, ...r) => {
393
751
  error: "var(--sb-error)"
394
752
  }
395
753
  };
396
- function Ot(e = "light", t) {
754
+ function Rt(e = "light", t) {
397
755
  const r = {
398
- primary: (t == null ? void 0 : t.primary) || me.DEFAULT_PRIMARY,
399
- botMessageBackground: (t == null ? void 0 : t.botMessageBackground) || me.DEFAULT_BOT_MSG_BG,
756
+ primary: (t == null ? void 0 : t.primary) || de.DEFAULT_PRIMARY,
757
+ botMessageBackground: (t == null ? void 0 : t.botMessageBackground) || de.DEFAULT_BOT_MSG_BG,
400
758
  primaryContrast: t == null ? void 0 : t.primaryContrast,
401
759
  botMessageBackgroundContrast: t == null ? void 0 : t.botMessageBackgroundContrast
402
- }, { contrastColors: o, aiAgentColorVariables: a } = ao(r), i = (e === "light" ? ro : oo)(r, o);
760
+ }, { contrastColors: o, aiAgentColorVariables: a } = wo(r), i = (e === "light" ? To : So)(r, o);
403
761
  return {
404
762
  selected: e,
405
763
  palette: {
406
- primary: eo(r.primary)
764
+ primary: yo(r.primary)
407
765
  },
408
766
  colors: i,
409
767
  aiAgentColorVariables: a
410
768
  };
411
769
  }
412
- const ro = (e, t) => ({
770
+ const To = (e, t) => ({
413
771
  base: {
414
772
  primary: e.primary,
415
773
  primaryContrastContent: t.primary,
@@ -435,7 +793,7 @@ const ro = (e, t) => ({
435
793
  csat: {
436
794
  background: d.color.background100
437
795
  }
438
- }), oo = (e, t) => ({
796
+ }), So = (e, t) => ({
439
797
  base: {
440
798
  primary: e.primary,
441
799
  primaryContrastContent: t.primary,
@@ -462,10 +820,10 @@ const ro = (e, t) => ({
462
820
  background: d.color.background400
463
821
  }
464
822
  });
465
- function ao(e) {
823
+ function wo(e) {
466
824
  const t = {
467
- primary: e.primaryContrast ?? We(e.primary),
468
- botMessageBackground: e.botMessageBackgroundContrast ?? We(e.botMessageBackground)
825
+ primary: e.primaryContrast ?? Ge(e.primary),
826
+ botMessageBackground: e.botMessageBackgroundContrast ?? Ge(e.botMessageBackground)
469
827
  };
470
828
  return {
471
829
  contrastColors: t,
@@ -477,34 +835,37 @@ function ao(e) {
477
835
  }
478
836
  };
479
837
  }
480
- const [so, je] = ee("AgentTheme");
481
- function io({
838
+ const {
839
+ Provider: ko,
840
+ useContext: yn
841
+ } = j("AgentTheme");
842
+ function Ao({
482
843
  appearance: e,
483
844
  rootElement: t = document.body,
484
845
  logger: r,
485
846
  children: o
486
847
  }) {
487
- const a = e == null ? void 0 : e.theme, s = e == null ? void 0 : e.primaryColor, i = e == null ? void 0 : e.botMessageBackgroundColor, [l, u] = C(() => (t.setAttribute(Ie, a ?? "light"), Ot(a, {
848
+ const a = e == null ? void 0 : e.theme, s = e == null ? void 0 : e.primaryColor, i = e == null ? void 0 : e.botMessageBackgroundColor, [l, u] = y(() => (t.setAttribute($e, a ?? "light"), Rt(a, {
488
849
  primary: s,
489
850
  botMessageBackground: i
490
- }))), m = W(
491
- (g, p) => {
492
- const h = p == null ? void 0 : p(a), f = a ?? g, E = {
493
- primary: s ?? (h == null ? void 0 : h.primary),
494
- botMessageBackground: i ?? (h == null ? void 0 : h.botMessageBackground),
495
- primaryContrast: h == null ? void 0 : h.primaryContrast,
496
- botMessageBackgroundContrast: h == null ? void 0 : h.botMessageBackgroundContrast
851
+ }))), p = F(
852
+ (m, h) => {
853
+ const g = h == null ? void 0 : h(a), b = a ?? m, E = {
854
+ primary: s ?? (g == null ? void 0 : g.primary),
855
+ botMessageBackground: i ?? (g == null ? void 0 : g.botMessageBackground),
856
+ primaryContrast: g == null ? void 0 : g.primaryContrast,
857
+ botMessageBackgroundContrast: g == null ? void 0 : g.botMessageBackgroundContrast
497
858
  };
498
- s && delete E.primaryContrast, i && delete E.botMessageBackgroundContrast, t.setAttribute(Ie, f), u(Ot(f, E)), r == null || r.info("theme.update:", f, E);
859
+ s && delete E.primaryContrast, i && delete E.botMessageBackgroundContrast, t.setAttribute($e, b), u(Rt(b, E)), r == null || r.info("theme.update:", b, E);
499
860
  },
500
861
  [t, a, s, i]
501
862
  );
502
- return P(() => {
503
- (a || s || i) && m(l.selected);
504
- }, [a, s, i]), /* @__PURE__ */ n.createElement(dr, { theme: l }, /* @__PURE__ */ n.createElement(so.Provider, { value: { theme: l, updateTheme: m } }, o));
863
+ return N(() => {
864
+ (a || s || i) && p(l.selected);
865
+ }, [a, s, i]), /* @__PURE__ */ n.createElement(hr, { theme: l }, /* @__PURE__ */ n.createElement(ko, { value: { theme: l, updateTheme: p } }, o));
505
866
  }
506
- const $e = "en", lo = /* @__PURE__ */ new Set([
507
- $e,
867
+ const Re = "en", Io = /* @__PURE__ */ new Set([
868
+ Re,
508
869
  "ko",
509
870
  "es",
510
871
  "pt",
@@ -514,7 +875,7 @@ const $e = "en", lo = /* @__PURE__ */ new Set([
514
875
  "de",
515
876
  "tr",
516
877
  "ja"
517
- ]), co = (e, t, r) => {
878
+ ]), $o = (e, t, r) => {
518
879
  const o = e[t];
519
880
  return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((a, s) => {
520
881
  (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
@@ -526,7 +887,7 @@ const $e = "en", lo = /* @__PURE__ */ new Set([
526
887
  )
527
888
  );
528
889
  });
529
- }, uo = gr, mo = {
890
+ }, Mo = xr, Oo = {
530
891
  // Channel - Common
531
892
  CHANNEL_FROZEN: "Channel frozen",
532
893
  PLACE_HOLDER__WRONG: "Something went wrong",
@@ -577,153 +938,83 @@ const $e = "en", lo = /* @__PURE__ */ new Set([
577
938
  CONVERSATION_LIST__NO_CONVERSATIONS: "No conversations yet",
578
939
  DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE: "MM/dd/yyyy",
579
940
  DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION: "h:mma"
580
- }, ct = { language: "en", dateLocale: uo, stringSet: mo }, po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
941
+ }, gt = { language: "en", dateLocale: Mo, stringSet: Oo }, Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
581
942
  __proto__: null,
582
- default: ct
583
- }, Symbol.toStringTag, { value: "Module" })), Ve = /* @__PURE__ */ new Map([[$e, ct]]);
584
- async function go(e) {
585
- if (Ve.has(e))
586
- return Ve.get(e);
587
- const t = lo.has(e) ? e : $e;
943
+ default: gt
944
+ }, Symbol.toStringTag, { value: "Module" })), ze = /* @__PURE__ */ new Map([[Re, gt]]);
945
+ async function Lo(e) {
946
+ if (ze.has(e))
947
+ return ze.get(e);
948
+ const t = Io.has(e) ? e : Re;
588
949
  try {
589
- const { default: r } = await co(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./DvjrAXLD.js"), "./languages/en.ts": () => Promise.resolve().then(() => po), "./languages/es.ts": () => import("./zI14HLvP.js"), "./languages/fr.ts": () => import("./B9V0T5ZP.js"), "./languages/hi.ts": () => import("./YRQ0vk5Q.js"), "./languages/it.ts": () => import("./BQWJPfGp.js"), "./languages/ja.ts": () => import("./sl-YrKkN.js"), "./languages/ko.ts": () => import("./B8c_rqvH.js"), "./languages/pt.ts": () => import("./BSz49qaD.js"), "./languages/tr.ts": () => import("./D_eZyIAR.js") }), `./languages/${t}.ts`, 3);
590
- return Ve.set(e, r), r;
950
+ const { default: r } = await $o(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./DvjrAXLD.js"), "./languages/en.ts": () => Promise.resolve().then(() => Ro), "./languages/es.ts": () => import("./zI14HLvP.js"), "./languages/fr.ts": () => import("./B9V0T5ZP.js"), "./languages/hi.ts": () => import("./YRQ0vk5Q.js"), "./languages/it.ts": () => import("./BQWJPfGp.js"), "./languages/ja.ts": () => import("./sl-YrKkN.js"), "./languages/ko.ts": () => import("./B8c_rqvH.js"), "./languages/pt.ts": () => import("./BSz49qaD.js"), "./languages/tr.ts": () => import("./D_eZyIAR.js") }), `./languages/${t}.ts`, 3);
951
+ return ze.set(e, r), r;
591
952
  } catch {
592
- return ct;
953
+ return gt;
593
954
  }
594
955
  }
595
- const [ho, M] = ee("Localization");
596
- function fo(e) {
956
+ const {
957
+ Provider: No,
958
+ useContext: M
959
+ } = j("Localization");
960
+ function Bo(e) {
597
961
  var t;
598
- return ((t = e.split("-")) == null ? void 0 : t[0]) ?? $e;
962
+ return ((t = e.split("-")) == null ? void 0 : t[0]) ?? Re;
599
963
  }
600
- function bo({
964
+ function Do({
601
965
  language: e = navigator.language,
602
966
  logger: t,
603
967
  stringSet: r,
604
968
  children: o
605
969
  }) {
606
- const [a, s] = C(Ve.get($e));
607
- return P(() => {
608
- const i = fo(e);
609
- a.language !== i && (t == null || t.debug("localization.useEffect: update language", `${a.language} -> ${i}`), go(i).then(s));
970
+ const [a, s] = y(ze.get(Re));
971
+ return N(() => {
972
+ const i = Bo(e);
973
+ a.language !== i && (t == null || t.debug("localization.useEffect: update language", `${a.language} -> ${i}`), Lo(i).then(s));
610
974
  }, [e]), /* @__PURE__ */ n.createElement(
611
- ho.Provider,
975
+ No,
612
976
  {
613
977
  value: {
614
978
  language: a.language,
615
979
  stringSet: { ...a.stringSet, ...r },
616
980
  dateLocale: a.dateLocale,
617
- format: (i, l, u) => He(i, l, { locale: a.dateLocale, ...u })
981
+ format: (i, l, u) => We(i, l, { locale: a.dateLocale, ...u })
618
982
  }
619
983
  },
620
984
  o
621
985
  );
622
986
  }
623
- const Eo = '@import"https://fonts.googleapis.com/css?family=Roboto:400,500,600,700&display=swap";.sb-message-template__border{position:relative}.sb-message-template__border:after{content:"";position:absolute;top:0;bottom:0;left:0;right:0;z-index:1;box-shadow:inset 0 0 0 var(--border-width) var(--border-color);border-radius:var(--border-radius);pointer-events:none}.sb-message-template__action{cursor:pointer}.sb-message-template__parent{font-family:Roboto,serif}.sb-message-template__text{font-family:inherit;font-size:14px;font-weight:400;font-stretch:normal;font-style:normal;letter-spacing:normal;text-align:left}.sb-message-template__text-button{font-family:inherit;background-color:#e0e0e0;text-align:center;padding:10px;border-radius:6px;font-size:14px;font-weight:600;font-stretch:normal;font-style:normal;letter-spacing:normal}.sendbird-theme--light .sb-message-template__text-button{color:#742ddd}.sendbird-theme--dark .sb-message-template__text-button{color:#c2a9fa}.sb-message-template__text-button:hover{opacity:1;box-shadow:#0000001a 0 1px 3px,#0000000f 0 1px 2px}.sb-message-template__text-button,.sb-message-template__image-button{cursor:pointer;border-style:none}.sb-message-template__parent{border-radius:unset;background-color:transparent;overflow:hidden}.sb-message-template__parent *{box-sizing:border-box;line-height:1.3}.sb-message-template__carousel{display:flex;width:100%;box-sizing:border-box;touch-action:pan-y}';
624
- function pe(e, t) {
987
+ function ue(e, t) {
625
988
  const r = e.getRootNode({ composed: t });
626
989
  return r instanceof ShadowRoot || r instanceof Document ? r : document;
627
990
  }
628
- const xo = (e, t) => {
629
- P(() => {
630
- const r = pe(t) instanceof ShadowRoot, o = pe(t, !0);
991
+ const Po = (e, t) => {
992
+ N(() => {
993
+ const r = ue(t) instanceof ShadowRoot, o = ue(t, !0);
631
994
  if (!(r ? t : o).querySelector(`link[href*='${e}']`)) {
632
995
  const s = o.createElement("link");
633
996
  s.rel = "stylesheet", s.href = e, (r ? t : o.head).appendChild(s);
634
997
  }
635
998
  }, [e, t]);
636
- }, vo = (e, t = document.body) => {
637
- P(() => {
638
- const r = pe(t), a = r instanceof ShadowRoot ? t : r.head;
999
+ }, Fo = (e, t = document.body) => {
1000
+ N(() => {
1001
+ const r = ue(t), a = r instanceof ShadowRoot ? t : r.head;
639
1002
  if (!a) return;
640
1003
  const s = `sba-${btoa(e).slice(0, 10)}`;
641
1004
  let i = a.querySelector(`style#${s}`);
642
1005
  i ? i.textContent !== e && (i.textContent = e) : (i = a.ownerDocument.createElement("style"), i.id = s, i.textContent = e, a.appendChild(i));
643
1006
  }, [e, t]);
644
- }, [yo, En] = ee("MessageTemplateFetching");
645
- function Co({
646
- children: e,
647
- rootElement: t,
648
- internalVariables: r
649
- }) {
650
- vo(Eo, t);
651
- const o = F({}), a = F({}), [s, i] = C({}), l = W((m, g) => {
652
- i((p) => ({
653
- ...p,
654
- [m]: { fetching: !1, error: !1, ...p[m], ...g }
655
- }));
656
- }, []), u = W(
657
- async ({
658
- onRequestTemplate: m,
659
- onGetCachedTemplate: g,
660
- templateKey: p,
661
- suspense: h = !1
662
- }) => {
663
- const f = g(p);
664
- if (f) return f;
665
- const E = a.current[p];
666
- if (E) return E;
667
- h || l(p, { fetching: !0 });
668
- const x = m(p).catch((b) => {
669
- throw h || l(p, { error: !0 }), b;
670
- }).finally(() => {
671
- h || l(p, { fetching: !1 }), delete a.current[p];
672
- });
673
- return a.current[p] = x, x;
674
- },
675
- [l]
676
- );
677
- return /* @__PURE__ */ n.createElement(
678
- yo.Provider,
679
- {
680
- value: {
681
- internalVariables: r,
682
- fetchTemplate: u,
683
- suspend: (m, g) => {
684
- if (o.current[m])
685
- return o.current[m];
686
- const p = _o(g());
687
- return o.current[m] = p, p;
688
- },
689
- getIsFetching: (m) => {
690
- var g;
691
- return ((g = s[m]) == null ? void 0 : g.fetching) ?? !1;
692
- },
693
- getHasError: (m) => {
694
- var g;
695
- return ((g = s[m]) == null ? void 0 : g.error) ?? !1;
696
- }
697
- }
698
- },
699
- e
700
- );
701
- }
702
- function _o(e) {
703
- let t = "pending", r = e.then((o) => {
704
- t = "resolved", r = o;
705
- }).catch((o) => {
706
- t = "rejected", r = o;
707
- });
708
- return {
709
- get value() {
710
- if (t === "resolved")
711
- return r;
712
- throw r;
713
- }
714
- };
715
- }
716
- const To = k`#${Q.ENTRY}{*:not(code *){font-family:'Roboto',sans-serif;box-sizing:border-box;}}`, So = [To, to, no], ko = (e, ...t) => ur(e, ...So, ...t), Oe = 244, xn = 640, Me = 26, vn = 4, Z = 12, Ke = 2, wo = 16, ie = `${J}-incoming-msg`, Ao = `${J}-marked-text`;
717
- function dt(e) {
1007
+ }, Uo = k`#${ne.ENTRY}{*:not(code *){font-family:'Roboto',sans-serif;box-sizing:border-box;}}`, Vo = [Uo, Co, _o], Ho = (e, ...t) => fr(e, ...Vo, ...t), Le = 244, Cn = 640, Me = 26, _n = 4, q = 12, Te = 2, zo = 16, ie = `${Y}-incoming-msg`, Wo = `${Y}-marked-text`;
1008
+ function ht(e) {
718
1009
  switch (e) {
719
1010
  case "top":
720
1011
  case "middle":
721
- return Ke;
1012
+ return Te;
722
1013
  default:
723
- return wo;
1014
+ return zo;
724
1015
  }
725
1016
  }
726
- function ut(e, t) {
1017
+ function ft(e, t) {
727
1018
  if (t) {
728
1019
  const [, r] = t.split("/");
729
1020
  if (r)
@@ -736,10 +1027,13 @@ function ut(e, t) {
736
1027
  }
737
1028
  return "FILE";
738
1029
  }
739
- const ge = (e) => {
1030
+ function Tn(e) {
1031
+ return e.messageType === "file" ? e.message.length > 0 && e.file.name !== e.message : e.message.length > 0;
1032
+ }
1033
+ const me = (e) => {
740
1034
  const t = e;
741
1035
  return typeof t == "number" ? `${t}px` : t;
742
- }, Io = /* @__PURE__ */ new Set(["send", "chat", "message", "chevron-right"]), Mo = {
1036
+ }, Go = /* @__PURE__ */ new Set(["send", "chat", "message", "chevron-right"]), jo = {
743
1037
  spinner: _(() => import("./BcUGcaq2.js")),
744
1038
  chat: _(() => import("./DcFCGVBm.js")),
745
1039
  message: _(() => import("./DsGXnanX.js")),
@@ -773,19 +1067,19 @@ const ge = (e) => {
773
1067
  website: _(() => import("./BgGVGNdg.js")),
774
1068
  snippet: _(() => import("./BFcXPuf5.js")),
775
1069
  template: _(() => import("./awO7aBCv.js"))
776
- }, A = ({ type: e, size: t = 24, className: r, color: o }) => {
777
- const a = Mo[e];
1070
+ }, $ = ({ type: e, size: t = 24, className: r, color: o }) => {
1071
+ const a = jo[e];
778
1072
  return /* @__PURE__ */ n.createElement(
779
- Oo,
1073
+ Zo,
780
1074
  {
781
1075
  className: r,
782
- $rtlFlip: Io.has(e),
1076
+ $rtlFlip: Go.has(e),
783
1077
  $size: t,
784
1078
  $color: o ?? d.color.primary.main
785
1079
  },
786
- /* @__PURE__ */ n.createElement(Ae, { fallback: null }, /* @__PURE__ */ n.createElement(a, null))
1080
+ /* @__PURE__ */ n.createElement(Ie, { fallback: null }, /* @__PURE__ */ n.createElement(a, null))
787
1081
  );
788
- }, $o = k`[dir='rtl'] &{transform:scaleX(-1);}`, Oo = c.div`width:${({ $size: e }) => ge(e)};height:${({ $size: e }) => ge(e)};display:inline-block;&:focus{outline:none;}svg{display:block;}[class*='fill']{fill:${({ $color: e }) => e};}[class*='stroke']{stroke:${({ $color: e }) => e};stroke-width:2px;stroke-linejoin:round;}${({ $rtlFlip: e }) => e && $o};`, T = ({ as: e, variant: t, color: r, className: o, ...a }) => /* @__PURE__ */ n.createElement(Lo, { as: e, $variant: t, className: o, $color: r, ...a }), Rt = {
1082
+ }, Ko = k`[dir='rtl'] &{transform:scaleX(-1);}`, Zo = c.div`width:${({ $size: e }) => me(e)};height:${({ $size: e }) => me(e)};display:inline-block;&:focus{outline:none;}svg{display:block;}[class*='fill']{fill:${({ $color: e }) => e};}[class*='stroke']{stroke:${({ $color: e }) => e};stroke-width:2px;stroke-linejoin:round;}${({ $rtlFlip: e }) => e && Ko};`, S = ({ as: e, variant: t, color: r, className: o, ...a }) => /* @__PURE__ */ n.createElement(qo, { as: e, $variant: t, className: o, $color: r, ...a }), Lt = {
789
1083
  h1: { fs: "18px", fw: 700 },
790
1084
  h2: { fs: "16px", fw: 700 },
791
1085
  subtitle1: { fs: "16px", fw: 500 },
@@ -798,32 +1092,46 @@ const ge = (e) => {
798
1092
  caption2: { fs: "12px", fw: 400 },
799
1093
  caption3: { fs: "11px", fw: 700 },
800
1094
  caption4: { fs: "11px", fw: 400 }
801
- }, Qe = /* @__PURE__ */ new Map();
802
- function Ro(e) {
803
- if (!e || !Rt[e]) return "";
804
- if (Qe.has(e)) return Qe.get(e);
805
- const { fs: t, fw: r } = Rt[e], o = k`font-size:${t};font-weight:${r};`;
806
- return Qe.set(e, o), o;
807
- }
808
- const Lo = c.span`font-stretch:normal;font-style:normal;letter-spacing:normal;line-height:100%;${({ $variant: e }) => Ro(e)}color:${({ $color: e }) => e};`;
809
- function mt({ name: e, type: t = "FILE", iconColor: r, iconBackgroundColor: o }) {
810
- const { colors: a } = st();
811
- return /* @__PURE__ */ n.createElement(No, null, /* @__PURE__ */ n.createElement(Bo, { $bgColor: o ?? a.base.primary }, /* @__PURE__ */ n.createElement(A, { type: "file-document", size: 24, color: r ?? a.base.primaryContrastContent })), /* @__PURE__ */ n.createElement(Do, null, /* @__PURE__ */ n.createElement(Po, { variant: "button", color: d.themedColor.onbackground1 }, e), /* @__PURE__ */ n.createElement(T, { color: d.themedColor.onbackground2, variant: "caption3" }, t)));
812
- }
813
- const No = c.div`border-radius:12px;gap:8px;width:${Oe}px;height:64px;display:flex;align-items:center;padding:12px;box-sizing:border-box;border:1px solid ${d.themedColor.onbackground4};background-color:${d.themedColor.background1};`, Bo = c.div`border-radius:8px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;background-color:${({ $bgColor: e }) => e};`, Do = c.div`display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;`, Po = c(T)`text-overflow:ellipsis;white-space:nowrap;overflow:hidden;`;
814
- function Fo({ file: e }) {
815
- return /* @__PURE__ */ n.createElement(mt, { name: e.name, type: ut(e.name, e.type) });
816
- }
817
- function Uo({ file: e, onClickMedia: t }) {
818
- const r = () => e.type.startsWith("image") ? /* @__PURE__ */ n.createElement(Ho, { src: e.url, alt: "image-message" }) : e.type.startsWith("video") ? /* @__PURE__ */ n.createElement(Wo, { controls: !0 }, /* @__PURE__ */ n.createElement("source", { src: e.url }), /* @__PURE__ */ n.createElement("track", { kind: "captions" })) : null;
819
- return r ? /* @__PURE__ */ n.createElement(Vo, { id: `${ie}-media-body`, onClick: () => t == null ? void 0 : t(e) }, r()) : null;
820
- }
821
- const Vo = c.div`width:${Oe}px;height:160px;border-radius:12px;overflow:hidden;background-color:${({ theme: e }) => e.colors.messageIncoming.background};cursor:pointer;`, Ho = c.img`width:100%;height:100%;object-fit:cover;`, Wo = c.video`width:100%;height:100%;object-fit:cover;`, zo = "✱";
822
- function yn(e) {
823
- const t = new RegExp(`${zo}+`, "g");
824
- return e.replace(t, (r) => `<span id=${Ao} aria-label="marked-text">${r}</span>`);
825
- }
826
- function Go(e) {
1095
+ }, et = /* @__PURE__ */ new Map();
1096
+ function Yo(e) {
1097
+ if (!e || !Lt[e]) return "";
1098
+ if (et.has(e)) return et.get(e);
1099
+ const { fs: t, fw: r } = Lt[e], o = k`font-size:${t};font-weight:${r};`;
1100
+ return et.set(e, o), o;
1101
+ }
1102
+ const qo = c.span`font-stretch:normal;font-style:normal;letter-spacing:normal;line-height:100%;${({ $variant: e }) => Yo(e)}color:${({ $color: e }) => e};`;
1103
+ function bt({
1104
+ name: e,
1105
+ type: t = "FILE",
1106
+ iconColor: r,
1107
+ iconBackgroundColor: o,
1108
+ onClick: a
1109
+ }) {
1110
+ const { colors: s } = dt();
1111
+ return /* @__PURE__ */ n.createElement(Jo, { onClick: a, $clickable: !!a }, /* @__PURE__ */ n.createElement(Qo, { $bgColor: o ?? s.base.primary }, /* @__PURE__ */ n.createElement($, { type: "file-document", size: 24, color: r ?? s.base.primaryContrastContent })), /* @__PURE__ */ n.createElement(ea, null, /* @__PURE__ */ n.createElement(ta, { variant: "button", color: d.themedColor.onbackground1 }, e), /* @__PURE__ */ n.createElement(S, { color: d.themedColor.onbackground2, variant: "caption3" }, t)));
1112
+ }
1113
+ const Jo = c.div`border-radius:12px;gap:8px;width:${Le}px;height:64px;display:flex;align-items:center;padding:12px;box-sizing:border-box;border:1px solid ${d.themedColor.onbackground4};background-color:${d.themedColor.background1};${({ $clickable: e }) => e && Xo}`, Xo = k`cursor:pointer;&:hover{background-color:${d.themedColor.background2};}`, Qo = c.div`border-radius:8px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;background-color:${({ $bgColor: e }) => e};`, ea = c.div`display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;`, ta = c(S)`text-overflow:ellipsis;white-space:nowrap;overflow:hidden;`;
1114
+ function na({ file: e, children: t, onClickFile: r }) {
1115
+ return /* @__PURE__ */ n.createElement(ra, null, /* @__PURE__ */ n.createElement(
1116
+ bt,
1117
+ {
1118
+ name: e.name,
1119
+ type: ft(e.name, e.type),
1120
+ onClick: r && (() => r == null ? void 0 : r(e))
1121
+ }
1122
+ ), t);
1123
+ }
1124
+ const ra = c.div`display:flex;flex-direction:column;align-items:flex-start;gap:${Te}px;`;
1125
+ function oa({ file: e, onClickMedia: t, children: r }) {
1126
+ const o = () => e.type.startsWith("image") ? /* @__PURE__ */ n.createElement(sa, { src: e.url, alt: "image-message" }) : e.type.startsWith("video") ? /* @__PURE__ */ n.createElement(la, { controls: !0 }, /* @__PURE__ */ n.createElement("source", { src: e.url }), /* @__PURE__ */ n.createElement("track", { kind: "captions" })) : null;
1127
+ return o ? /* @__PURE__ */ n.createElement(aa, null, /* @__PURE__ */ n.createElement(ia, { id: `${ie}-media-body`, onClick: () => t == null ? void 0 : t(e) }, o()), r) : null;
1128
+ }
1129
+ const aa = c.div`display:flex;flex-direction:column;align-items:flex-start;gap:${Te}px;`, ia = c.div`width:${Le}px;height:160px;background-color:${({ theme: e }) => e.colors.messageIncoming.background};border-radius:12px;overflow:hidden;cursor:pointer;`, sa = c.img`width:100%;height:100%;object-fit:cover;`, la = c.video`width:100%;height:100%;object-fit:cover;`, ca = "✱";
1130
+ function Sn(e) {
1131
+ const t = new RegExp(`${ca}+`, "g");
1132
+ return e.replace(t, (r) => `<span id=${Wo} aria-label="marked-text">${r}</span>`);
1133
+ }
1134
+ function da(e) {
827
1135
  const t = /```(\w+)?\n([\s\S]*?)```/g, r = [];
828
1136
  let o = 0;
829
1137
  return e.replace(t, (a, ...s) => {
@@ -839,292 +1147,88 @@ function Go(e) {
839
1147
  }), o < e.length && r.push({
840
1148
  type: "text",
841
1149
  value: e.slice(o).trim()
842
- }), r.map((a) => a.type !== "text" ? a : { ...a, value: yn(a.value) });
1150
+ }), r.map((a) => a.type !== "text" ? a : { ...a, value: Sn(a.value) });
843
1151
  }
844
- const jo = _(async () => ({ default: (await import("./DiXu6nm5.js")).MarkdownText })), Ko = _(async () => ({ default: (await import("./DH2PekOm.js")).CodeBlock }));
845
- function Lt(e) {
846
- const t = e.maxBodyWidth ?? Oe, r = ve(() => Go(e.message), [e.message]), o = {
1152
+ const ua = _(async () => ({ default: (await import("./Cc9Mb_d1.js")).MarkdownText })), ma = _(async () => ({ default: (await import("./DH2PekOm.js")).CodeBlock }));
1153
+ function Nt(e) {
1154
+ const t = e.maxBodyWidth ?? Le, r = ve(() => da(e.message), [e.message]), o = {
847
1155
  id: `${ie}-text-body`,
848
1156
  $maxWidth: t
849
1157
  };
850
- return r.length === 0 ? e.children ? /* @__PURE__ */ n.createElement(Nt, { ...o }, e.children) : null : /* @__PURE__ */ n.createElement(Nt, { ...o }, r.map((a, s) => a.type === "text" ? /* @__PURE__ */ n.createElement(Bt, { key: s, variant: "body3" }, /* @__PURE__ */ n.createElement(Ae, { fallback: a.value }, /* @__PURE__ */ n.createElement(jo, null, a.value))) : a.type === "code" ? /* @__PURE__ */ n.createElement(Ae, { key: s, fallback: /* @__PURE__ */ n.createElement(Bt, { variant: "body3" }, a.value) }, /* @__PURE__ */ n.createElement(Ko, { code: a.value, language: a.language })) : null), e.children);
1158
+ return r.length === 0 ? e.children ? /* @__PURE__ */ n.createElement(Bt, { ...o }, e.children) : null : /* @__PURE__ */ n.createElement(Bt, { ...o }, r.map((a, s) => a.type === "text" ? /* @__PURE__ */ n.createElement(Dt, { key: s, variant: "body3" }, /* @__PURE__ */ n.createElement(Ie, { fallback: a.value }, /* @__PURE__ */ n.createElement(ua, null, a.value))) : a.type === "code" ? /* @__PURE__ */ n.createElement(Ie, { key: s, fallback: /* @__PURE__ */ n.createElement(Dt, { variant: "body3" }, a.value) }, /* @__PURE__ */ n.createElement(ma, { code: a.value, language: a.language })) : null), e.children);
851
1159
  }
852
- const Nt = c.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e }) => k`
1160
+ const Bt = c.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e }) => k`
853
1161
  color: ${e.colors.messageIncoming.text};
854
1162
  background-color: ${e.colors.messageIncoming.background};
855
1163
  `}
856
1164
  padding: 12px 0;
857
1165
  transition: max-width 0.3s;
858
1166
  overflow-wrap: break-word;
859
- `, Bt = c(T)`align-items:flex-start;line-height:18px;white-space:pre-wrap;padding:0 12px;`;
860
- function Zo(e) {
861
- const { stringSet: t } = M();
1167
+ `, Dt = c(S)`align-items:flex-start;line-height:18px;white-space:pre-wrap;padding:0 12px;`;
1168
+ function pa(e) {
1169
+ const { stringSet: t } = M(), r = Tn(e) ? /* @__PURE__ */ n.createElement(Nt, { ...e }) : null;
862
1170
  if (e.messageType === "user")
863
- return /* @__PURE__ */ n.createElement(Lt, { ...e });
1171
+ return r;
864
1172
  if (e.messageType === "file") {
865
- const r = e.file;
866
- return r.type.startsWith("image") || r.type.startsWith("video") ? /* @__PURE__ */ n.createElement(Uo, { ...e }) : /* @__PURE__ */ n.createElement(Fo, { ...e });
1173
+ const o = e.file;
1174
+ return o.type.startsWith("image") || o.type.startsWith("video") ? /* @__PURE__ */ n.createElement(oa, { ...e }, r) : /* @__PURE__ */ n.createElement(na, { ...e }, r);
867
1175
  }
868
- return /* @__PURE__ */ n.createElement(Lt, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
1176
+ return /* @__PURE__ */ n.createElement(Nt, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
869
1177
  }
870
- const pt = (e) => /* @__PURE__ */ n.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.0008 0.973633C10.6172 0.973633 9.49558 2.09527 9.49558 3.47888C9.49558 4.50705 10.115 5.39055 11.0009 5.77664V7.47887H13.0009V5.77653C13.8868 5.3904 14.5061 4.50696 14.5061 3.47888C14.5061 2.09527 13.3844 0.973633 12.0008 0.973633ZM0.250977 16.5788L0.250977 10.5789H2.25098L2.25098 16.5788H0.250977ZM21.7511 10.5789V16.5788H23.7511V10.5789H21.7511ZM18.251 7.47888H3.25097V18.9789C3.25097 20.3596 4.37026 21.4789 5.75097 21.4789H18.251C19.6317 21.4789 20.751 20.3596 20.751 18.9789V9.97887C20.751 8.59816 19.6317 7.47888 18.251 7.47888ZM9.78434 11.9539V15.2038C9.78434 15.7561 9.33663 16.2038 8.78434 16.2038C8.23206 16.2038 7.78434 15.7561 7.78434 15.2038V11.9539C7.78434 11.4016 8.23206 10.9539 8.78434 10.9539C9.33663 10.9539 9.78434 11.4016 9.78434 11.9539ZM16.2677 11.9539V15.2038C16.2677 15.7561 15.82 16.2038 15.2677 16.2038C14.7154 16.2038 14.2677 15.7561 14.2677 15.2038V11.9539C14.2677 11.4016 14.7154 10.9539 15.2677 10.9539C15.82 10.9539 16.2677 11.4016 16.2677 11.9539Z", fill: "#0D0D0D" }));
871
- function gt({ id: e, src: t, size: r = 56, onClick: o, style: a }) {
872
- return /* @__PURE__ */ n.createElement(Yo, { id: e, tabIndex: 0, onClick: o, $size: ge(r), style: a }, t ? /* @__PURE__ */ n.createElement(qo, { src: t }) : /* @__PURE__ */ n.createElement(A, { type: "user", size: r }));
1178
+ const Et = (e) => /* @__PURE__ */ n.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.0008 0.973633C10.6172 0.973633 9.49558 2.09527 9.49558 3.47888C9.49558 4.50705 10.115 5.39055 11.0009 5.77664V7.47887H13.0009V5.77653C13.8868 5.3904 14.5061 4.50696 14.5061 3.47888C14.5061 2.09527 13.3844 0.973633 12.0008 0.973633ZM0.250977 16.5788L0.250977 10.5789H2.25098L2.25098 16.5788H0.250977ZM21.7511 10.5789V16.5788H23.7511V10.5789H21.7511ZM18.251 7.47888H3.25097V18.9789C3.25097 20.3596 4.37026 21.4789 5.75097 21.4789H18.251C19.6317 21.4789 20.751 20.3596 20.751 18.9789V9.97887C20.751 8.59816 19.6317 7.47888 18.251 7.47888ZM9.78434 11.9539V15.2038C9.78434 15.7561 9.33663 16.2038 8.78434 16.2038C8.23206 16.2038 7.78434 15.7561 7.78434 15.2038V11.9539C7.78434 11.4016 8.23206 10.9539 8.78434 10.9539C9.33663 10.9539 9.78434 11.4016 9.78434 11.9539ZM16.2677 11.9539V15.2038C16.2677 15.7561 15.82 16.2038 15.2677 16.2038C14.7154 16.2038 14.2677 15.7561 14.2677 15.2038V11.9539C14.2677 11.4016 14.7154 10.9539 15.2677 10.9539C15.82 10.9539 16.2677 11.4016 16.2677 11.9539Z", fill: "#0D0D0D" }));
1179
+ function xt({ id: e, src: t, size: r = 56, onClick: o, style: a }) {
1180
+ return /* @__PURE__ */ n.createElement(ga, { id: e, tabIndex: 0, onClick: o, $size: me(r), style: a }, t ? /* @__PURE__ */ n.createElement(ha, { src: t }) : /* @__PURE__ */ n.createElement($, { type: "user", size: r }));
873
1181
  }
874
- const Yo = c.div`border-radius:50%;display:inline-block;overflow:hidden;position:relative;flex-shrink:0;height:${(e) => e.$size};width:${(e) => e.$size};background-color:${d.themedColor.background2};&:focus{outline:none;}`, qo = c.img`object-fit:cover;width:100%;height:100%;position:absolute;`;
875
- function Jo({ sender: e, isBotMessage: t }) {
1182
+ const ga = c.div`border-radius:50%;display:inline-block;overflow:hidden;position:relative;flex-shrink:0;height:${(e) => e.$size};width:${(e) => e.$size};background-color:${d.themedColor.background2};&:focus{outline:none;}`, ha = c.img`object-fit:cover;width:100%;height:100%;position:absolute;`;
1183
+ function fa({ sender: e, isBotMessage: t }) {
876
1184
  const r = `${ie}-sender-avatar`;
877
- return !e.profileUrl && t ? /* @__PURE__ */ n.createElement(Xo, { id: r }, /* @__PURE__ */ n.createElement(pt, null)) : /* @__PURE__ */ n.createElement(gt, { id: r, size: Me, src: e.profileUrl });
1185
+ return !e.profileUrl && t ? /* @__PURE__ */ n.createElement(ba, { id: r }, /* @__PURE__ */ n.createElement(Et, null)) : /* @__PURE__ */ n.createElement(xt, { id: r, size: Me, src: e.profileUrl });
878
1186
  }
879
- const Xo = c.div`flex-shrink:0;width:${Me}px;height:${Me}px;box-sizing:border-box;padding:6px;border-radius:50%;display:flex;justify-content:center;align-items:center;background-color:${({ theme: e }) => e.colors.base.primary};path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent};}}`;
880
- function Qo({ sender: e }) {
881
- return /* @__PURE__ */ n.createElement(ea, { id: `${ie}-sender-name`, variant: "caption1", color: d.themedColor.textMidEmphasis }, e.nickname);
1187
+ const ba = c.div`flex-shrink:0;width:${Me}px;height:${Me}px;box-sizing:border-box;padding:6px;border-radius:50%;display:flex;justify-content:center;align-items:center;background-color:${({ theme: e }) => e.colors.base.primary};path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent};}}`;
1188
+ function Ea({ sender: e }) {
1189
+ return /* @__PURE__ */ n.createElement(xa, { id: `${ie}-sender-name`, variant: "caption1", color: d.themedColor.textMidEmphasis }, e.nickname);
882
1190
  }
883
- const ea = c(T)`text-align:start;width:100%;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:5px;padding-inline:0 7px;`;
884
- function ta({ createdAt: e }) {
1191
+ const xa = c(S)`text-align:start;width:100%;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:5px;padding-inline:0 7px;`;
1192
+ function va({ createdAt: e }) {
885
1193
  const { stringSet: t, format: r } = M();
886
- return /* @__PURE__ */ n.createElement(T, { id: `${ie}-sent-time`, variant: "caption4", color: d.themedColor.textLowEmphasis }, r(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP));
887
- }
888
- function ze() {
889
- }
890
- async function na(e) {
891
- let t = e;
892
- t && (!t.startsWith("http://") && !t.startsWith("https://") && (t = "https://" + t), window.open(t, "_blank", "noopener,noreferrer"));
893
- }
894
- function Dt(e) {
895
- try {
896
- return JSON.parse(e === "" ? "{}" : e);
897
- } catch {
898
- return {};
899
- }
900
- }
901
- function Cn(e) {
902
- return !e || !e.conversation ? !1 : e.conversation.status === j.CLOSED;
1194
+ return /* @__PURE__ */ n.createElement(S, { id: `${ie}-sent-time`, variant: "caption4", color: d.themedColor.textLowEmphasis }, r(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP));
903
1195
  }
904
- function ht(e) {
905
- return !e || !e.conversation ? !1 : e.conversation.status === j.OPEN;
1196
+ function je() {
906
1197
  }
907
- function ra(e) {
908
- var o;
909
- const t = (o = e == null ? void 0 : e.conversation) == null ? void 0 : o.handoff, r = !!(t != null && t.timestamp);
910
- return ht(e) && !r;
911
- }
912
- function oa({
913
- extendedMessagePayload: e,
914
- onClickCTA: t = ({ url: r }) => na(r)
915
- }) {
916
- const r = e == null ? void 0 : e.cta_button;
917
- return r ? /* @__PURE__ */ n.createElement(aa, { id: `${ie}-ext-cta-button`, role: "button", onClick: () => t(r) }, /* @__PURE__ */ n.createElement(sa, { variant: "button" }, r.label)) : null;
918
- }
919
- const aa = c.div`display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:6px;padding:8px;background-color:${d.color.primary.main};color:${({ theme: e }) => e.colors.base.primaryContrastContent};&:hover{background-color:${d.color.primary.dark};}`, sa = c(T)`overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`;
920
- function ia(e) {
921
- return /* @__PURE__ */ n.createElement(n.Fragment, null);
1198
+ async function wn(e) {
1199
+ let t = e;
1200
+ t && (!t.startsWith("http://") && !t.startsWith("https://") && (t = "https://" + t), window.open(t, "_blank", "noopener,noreferrer"));
922
1201
  }
923
- const _n = (e) => {
1202
+ function Pt(e) {
924
1203
  try {
925
- const t = JSON.parse(e);
926
- return typeof t == "string" ? JSON.stringify(t).slice(1, -1) : e.trim();
1204
+ return JSON.parse(e === "" ? "{}" : e);
927
1205
  } catch {
928
- return JSON.stringify(e).slice(1, -1);
929
- }
930
- }, Ze = (e) => JSON.parse(e), Ye = (e) => JSON.parse(e);
931
- function la(e, t) {
932
- const [r, o] = t.split(",").map((a) => a.trim());
933
- return e === "dark" && o || r;
934
- }
935
- function ca(e) {
936
- const t = {};
937
- function r(o, a = "") {
938
- for (const [s, i] of Object.entries(o)) {
939
- const l = a ? `${a}.${s}` : s;
940
- i && typeof i == "object" && !Array.isArray(i) ? r(i, l) : t[l] = i;
941
- }
1206
+ return {};
942
1207
  }
943
- return r(e), t;
944
- }
945
- function ft({
946
- template: e,
947
- variables: t,
948
- variableKeyPattern: r,
949
- variableValueTransformer: o
950
- }) {
951
- return Object.entries(t).reduce((a, [s, i]) => {
952
- if (!o && !["number", "boolean", "string"].includes(typeof i))
953
- throw new Error("If transformer is not provided, value must be a {string, number, or boolean}");
954
- const l = o ? o(i) : String(i), u = r(s);
955
- return a.replace(u, _n(l));
956
- }, e);
957
1208
  }
958
- async function da({
959
- template: e,
960
- variables: t,
961
- variableKeyPattern: r,
962
- variableValueTransformer: o
963
- }) {
964
- return (await Promise.all(
965
- Object.entries(t).map(async ([s, i]) => {
966
- const l = await o(i);
967
- return { regex: r(s), transformedValue: l };
968
- })
969
- )).reduce((s, { regex: i, transformedValue: l }) => s.replace(i, _n(l)), e);
1209
+ function kn(e) {
1210
+ return !e || !e.conversation ? !1 : e.conversation.status === z.CLOSED;
970
1211
  }
971
- const qe = {
972
- VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
973
- VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")
974
- };
975
- function ae({ uiTemplateString: e, variables: t = {} }) {
976
- const r = ca(t);
977
- return ft({
978
- template: e,
979
- variables: r,
980
- variableKeyPattern: (o) => qe.VARIABLE(o)
981
- });
1212
+ function An(e) {
1213
+ return !e || !e.conversation ? !1 : e.conversation.status === z.OPEN;
982
1214
  }
983
- function se({
984
- theme: e,
985
- uiTemplateString: t,
986
- colorVariables: r = {}
987
- }) {
988
- return ft({
989
- template: t,
990
- variables: r,
991
- variableKeyPattern: (o) => qe.VARIABLE(o),
992
- variableValueTransformer: (o) => la(e, o)
993
- });
1215
+ function ya(e) {
1216
+ var o;
1217
+ const t = (o = e == null ? void 0 : e.conversation) == null ? void 0 : o.handoff, r = !!(t != null && t.timestamp);
1218
+ return An(e) && !r;
994
1219
  }
995
- function ua({
996
- theme: e,
997
- uiTemplateString: t,
998
- viewVariables: r = {},
999
- aiAgentColorVariables: o,
1000
- internalVariables: a,
1001
- onRequestTemplate: s
1220
+ function Ca({
1221
+ extendedMessagePayload: e,
1222
+ onClickCTA: t = ({ url: r }) => wn(r)
1002
1223
  }) {
1003
- const l = Object.values(r).flat().map((m) => m.key);
1004
- return [...new Set(l)].some((m) => !s(m)) ? null : ft({
1005
- template: t,
1006
- variables: r,
1007
- variableKeyPattern: (m) => qe.VIEW_VARIABLE(m),
1008
- variableValueTransformer: (m) => {
1009
- const g = m.map(({ key: p, variables: h }) => {
1010
- const f = s(p), { ui_template: E, color_variables: x } = Ze(f);
1011
- let b = JSON.stringify(E);
1012
- return b = ae({
1013
- uiTemplateString: b,
1014
- variables: a
1015
- }), b = se({
1016
- theme: e,
1017
- uiTemplateString: b,
1018
- colorVariables: x
1019
- }), b = se({
1020
- theme: e,
1021
- uiTemplateString: b,
1022
- colorVariables: o
1023
- }), b = ae({
1024
- uiTemplateString: b,
1025
- variables: h
1026
- }), Ye(b);
1027
- });
1028
- return JSON.stringify(g);
1029
- }
1030
- });
1224
+ const r = e == null ? void 0 : e.cta_button;
1225
+ return r ? /* @__PURE__ */ n.createElement(_a, { id: `${ie}-ext-cta-button`, role: "button", onClick: () => t(r) }, /* @__PURE__ */ n.createElement(Ta, { variant: "button" }, r.label)) : null;
1031
1226
  }
1032
- async function ma({
1033
- theme: e,
1034
- uiTemplateString: t,
1035
- viewVariables: r = {},
1036
- aiAgentColorVariables: o,
1037
- internalVariables: a,
1038
- onRequestTemplate: s
1039
- }) {
1040
- return da({
1041
- template: t,
1042
- variables: r,
1043
- variableKeyPattern: (i) => qe.VIEW_VARIABLE(i),
1044
- variableValueTransformer: async (i) => {
1045
- const l = i.map(async ({ key: m, variables: g }) => {
1046
- const p = await s(m), { ui_template: h, color_variables: f } = Ze(p);
1047
- let E = JSON.stringify(h);
1048
- return E = ae({
1049
- uiTemplateString: E,
1050
- variables: a
1051
- }), E = se({
1052
- theme: e,
1053
- uiTemplateString: E,
1054
- colorVariables: f
1055
- }), E = se({
1056
- theme: e,
1057
- uiTemplateString: E,
1058
- colorVariables: o
1059
- }), E = ae({
1060
- uiTemplateString: E,
1061
- variables: g
1062
- }), Ye(E);
1063
- }), u = await Promise.all(l);
1064
- return JSON.stringify(u);
1065
- }
1066
- });
1227
+ const _a = c.div`display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:6px;padding:8px;background-color:${d.color.primary.main};color:${({ theme: e }) => e.colors.base.primaryContrastContent};&:hover{background-color:${d.color.primary.dark};}`, Ta = c(S)`overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`;
1228
+ function Sa(e) {
1229
+ return /* @__PURE__ */ n.createElement(n.Fragment, null);
1067
1230
  }
1068
- const pa = ({
1069
- rawTemplate: e,
1070
- aiAgentColorVariables: t,
1071
- internalVariables: r,
1072
- ...o
1073
- }) => {
1074
- const { ui_template: a, color_variables: s } = Ze(e);
1075
- let i = JSON.stringify(a);
1076
- if (Object.keys(o.viewVariables ?? {}).length > 0) {
1077
- const u = ua({
1078
- ...o,
1079
- uiTemplateString: i,
1080
- aiAgentColorVariables: t,
1081
- internalVariables: r
1082
- });
1083
- if (u === null) return null;
1084
- i = u;
1085
- }
1086
- return i = ae({ ...o, uiTemplateString: i, variables: r }), i = se({ ...o, uiTemplateString: i, colorVariables: s }), i = se({ ...o, uiTemplateString: i, colorVariables: t }), i = ae({ ...o, uiTemplateString: i }), Ye(i);
1087
- }, ga = async ({
1088
- rawTemplate: e,
1089
- aiAgentColorVariables: t,
1090
- internalVariables: r,
1091
- ...o
1092
- }) => {
1093
- const { ui_template: a, color_variables: s } = Ze(e);
1094
- let i = JSON.stringify(a);
1095
- return Object.keys(o.viewVariables ?? {}).length > 0 && (i = await ma({
1096
- ...o,
1097
- uiTemplateString: i,
1098
- aiAgentColorVariables: t,
1099
- internalVariables: r
1100
- })), i = ae({ ...o, uiTemplateString: i, variables: r }), i = se({ ...o, uiTemplateString: i, colorVariables: s }), i = se({ ...o, uiTemplateString: i, colorVariables: t }), i = ae({ ...o, uiTemplateString: i }), Ye(i);
1101
- }, ha = (e) => {
1102
- const { aiAgentColorVariables: t } = je().theme, { internalVariables: r } = En();
1103
- return C(() => {
1104
- const o = e.onGetCachedTemplate(e.templateKey);
1105
- return o ? pa({
1106
- ...e,
1107
- rawTemplate: o,
1108
- aiAgentColorVariables: t,
1109
- internalVariables: r,
1110
- onRequestTemplate: e.onGetCachedTemplate
1111
- }) : null;
1112
- });
1113
- }, fa = (e) => {
1114
- const [t] = ha(e);
1115
- if (t) return t;
1116
- const { aiAgentColorVariables: r } = je().theme, { internalVariables: o, fetchTemplate: a, suspend: s } = En();
1117
- return s(e.templateKey, async () => {
1118
- const l = await a({ ...e, suspense: !0 });
1119
- return await ga({
1120
- ...e,
1121
- rawTemplate: l,
1122
- aiAgentColorVariables: r,
1123
- internalVariables: o
1124
- });
1125
- }).value;
1126
- };
1127
- class ba extends er {
1231
+ class wa extends ar {
1128
1232
  constructor(t) {
1129
1233
  super(t), this.state = {
1130
1234
  hasError: !1
@@ -1134,50 +1238,51 @@ class ba extends er {
1134
1238
  return { hasError: !0 };
1135
1239
  }
1136
1240
  render() {
1137
- return this.state.hasError ? this.props.errorFallback : /* @__PURE__ */ n.createElement(Ae, { fallback: this.props.loadingFallback }, this.props.children);
1241
+ return this.state.hasError ? this.props.errorFallback : /* @__PURE__ */ n.createElement(Ie, { fallback: this.props.loadingFallback }, this.props.children);
1138
1242
  }
1139
1243
  }
1140
- const Ea = /* @__PURE__ */ new Set(["default"]), { MessageTemplate: xa } = yr({
1141
- parser: xr,
1142
- renderer: Er,
1244
+ const ka = /* @__PURE__ */ new Set(["default"]), { MessageTemplate: Aa } = wr({
1245
+ parser: Tr,
1246
+ renderer: _r,
1143
1247
  Container: (e) => /* @__PURE__ */ n.createElement("div", { ...e })
1144
1248
  });
1145
- function va(e) {
1249
+ function Ia(e) {
1146
1250
  return /* @__PURE__ */ n.createElement(
1147
- ba,
1251
+ wa,
1148
1252
  {
1149
1253
  errorFallback: e.messageTemplateErrorFallback,
1150
1254
  loadingFallback: e.messageTemplateLoadingFallback
1151
1255
  },
1152
- /* @__PURE__ */ n.createElement(ya, { ...e })
1256
+ /* @__PURE__ */ n.createElement($a, { ...e })
1153
1257
  );
1154
1258
  }
1155
- const ya = ({
1259
+ const $a = ({
1156
1260
  extendedMessagePayload: e,
1157
1261
  onGetCachedMessageTemplate: t = () => null,
1158
1262
  onRequestMessageTemplate: r
1159
1263
  }) => {
1160
1264
  const o = e == null ? void 0 : e.message_template;
1161
- if (!Ea.has((o == null ? void 0 : o.type) ?? "default")) throw new Error("Unsupported template type");
1265
+ if (!ka.has((o == null ? void 0 : o.type) ?? "default")) throw new Error("Unsupported template type");
1162
1266
  if (!r) throw new Error("onRequestMessageTemplate is required");
1163
- const { theme: s } = je(), i = fa({
1267
+ const { theme: s } = yn(), i = po({
1164
1268
  onRequestTemplate: r,
1165
1269
  onGetCachedTemplate: t,
1166
1270
  theme: s.selected,
1167
1271
  templateKey: (o == null ? void 0 : o.key) ?? "invalid",
1168
1272
  variables: o == null ? void 0 : o.variables,
1169
- viewVariables: o == null ? void 0 : o.view_variables
1273
+ viewVariables: o == null ? void 0 : o.view_variables,
1274
+ aiAgentColorVariables: s.aiAgentColorVariables
1170
1275
  });
1171
- return /* @__PURE__ */ n.createElement(Ca, { id: `${ie}-ext-message-template` }, /* @__PURE__ */ n.createElement(vr, { message: {} }, /* @__PURE__ */ n.createElement(xa, { templateItems: i.body.items, templateVersion: i.version })));
1172
- }, Ca = c.div`box-sizing:border-box;overflow:hidden;width:100%;`;
1173
- function _a({
1276
+ return /* @__PURE__ */ n.createElement(Ma, { id: `${ie}-ext-message-template` }, /* @__PURE__ */ n.createElement(Sr, { message: {} }, /* @__PURE__ */ n.createElement(Aa, { templateItems: i.body.items, templateVersion: i.version })));
1277
+ }, Ma = c.div`box-sizing:border-box;overflow:hidden;width:100%;`;
1278
+ function Oa({
1174
1279
  extendedMessagePayload: e,
1175
1280
  onClickSuggestedReply: t,
1176
1281
  suggestedRepliesDirection: r = "vertical"
1177
1282
  }) {
1178
- const [o, a] = C(!1), s = (e == null ? void 0 : e.suggested_replies) ?? [];
1179
- return s.length === 0 || o ? null : /* @__PURE__ */ n.createElement(Ta, { id: `${ie}-ext-suggested-replies`, $type: r }, s.map((i, l) => /* @__PURE__ */ n.createElement(
1180
- Sa,
1283
+ const [o, a] = y(!1), s = (e == null ? void 0 : e.suggested_replies) ?? [];
1284
+ return s.length === 0 || o ? null : /* @__PURE__ */ n.createElement(Ra, { id: `${ie}-ext-suggested-replies`, $type: r }, s.map((i, l) => /* @__PURE__ */ n.createElement(
1285
+ La,
1181
1286
  {
1182
1287
  key: l,
1183
1288
  $type: r,
@@ -1189,140 +1294,147 @@ function _a({
1189
1294
  i
1190
1295
  )));
1191
1296
  }
1192
- const Ta = c.div`margin:16px 0;padding:0 ${Z}px;position:relative;display:flex;gap:8px;${({ $type: e }) => e === "vertical" ? ka : wa};`, Sa = c(T)`box-sizing:border-box;padding:8px 12px;display:flex;align-items:center;border-radius:100px;cursor:pointer;word-break:break-word;color:${d.color.primary.main};border:1px solid ${d.color.primary.main};background-color:${d.themedColor.background1};&:hover{background-color:${d.themedColor.background2};}${({ $type: e, theme: t }) => k`
1193
- ${e === "vertical" ? Aa : Ia};
1297
+ const Ra = c.div`margin:16px 0;padding:0 ${q}px;position:relative;display:flex;gap:8px;${({ $type: e }) => e === "vertical" ? Na : Ba};`, La = c(S)`box-sizing:border-box;padding:8px 12px;display:flex;align-items:center;border-radius:100px;cursor:pointer;word-break:break-word;color:${d.color.primary.main};border:1px solid ${d.color.primary.main};background-color:${d.themedColor.background1};&:hover{background-color:${d.themedColor.background2};}${({ $type: e, theme: t }) => k`
1298
+ ${e === "vertical" ? Da : Pa};
1194
1299
  &:active {
1195
1300
  background-color: ${t.colors.base.primary};
1196
1301
  color: ${t.colors.base.primaryContrastContent};
1197
1302
  }
1198
1303
  `}
1199
- `, ka = k`flex-direction:column;align-items:flex-end;`, wa = k`flex-direction:row;overflow-x:scroll;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}`, Aa = k`max-width:calc(100% - 70px);white-space:pre-wrap;`, Ia = k`white-space:nowrap;`, Tn = ({ className: e }) => /* @__PURE__ */ n.createElement(Ma, { className: e }, [0, 1, 2].map((t) => /* @__PURE__ */ n.createElement($a, { key: t }))), Ma = c.div`align-items:center;border-radius:12px;display:flex;gap:6px;justify-content:center;padding:16px 12px;background-color:${({ theme: e }) => e.colors.messageIncoming.background};`, $a = c.span`animation:blink 1.4s infinite;animation-fill-mode:both;border-radius:50%;height:8px;width:8px;background:${({ theme: e }) => e.colors.messageIncoming.text};@keyframes blink{0%{opacity:0.12;transform:scale(1);}21.43%{opacity:0.38;transform:scale(1.2);}42.86%{opacity:0.12;transform:scale(1);}100%{opacity:0.12;transform:scale(1);}}&:nth-child(1){animation-delay:0.4s;}&:nth-child(2){animation-delay:0.6s;}&:nth-child(3){animation-delay:0.8s;}`;
1200
- function Sn(e) {
1304
+ `, Na = k`flex-direction:column;align-items:flex-end;`, Ba = k`flex-direction:row;overflow-x:scroll;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}`, Da = k`max-width:calc(100% - 70px);white-space:pre-wrap;`, Pa = k`white-space:nowrap;`, In = ({ className: e }) => /* @__PURE__ */ n.createElement(Fa, { className: e }, [0, 1, 2].map((t) => /* @__PURE__ */ n.createElement(Ua, { key: t }))), Fa = c.div`align-items:center;border-radius:12px;display:flex;gap:6px;justify-content:center;padding:16px 12px;background-color:${({ theme: e }) => e.colors.messageIncoming.background};`, Ua = c.span`animation:blink 1.4s infinite;animation-fill-mode:both;border-radius:50%;height:8px;width:8px;background:${({ theme: e }) => e.colors.messageIncoming.text};@keyframes blink{0%{opacity:0.12;transform:scale(1);}21.43%{opacity:0.38;transform:scale(1.2);}42.86%{opacity:0.12;transform:scale(1);}100%{opacity:0.12;transform:scale(1);}}&:nth-child(1){animation-delay:0.4s;}&:nth-child(2){animation-delay:0.6s;}&:nth-child(3){animation-delay:0.8s;}`;
1305
+ function $n(e) {
1201
1306
  return e();
1202
1307
  }
1203
- const he = it({
1204
- template: Oa,
1308
+ const pe = ut({
1309
+ template: Va,
1205
1310
  components: {
1206
- SenderName: Qo,
1207
- SenderAvatar: Jo,
1208
- SentTime: ta,
1209
- MessageBody: Zo,
1210
- SuggestedReplies: _a,
1211
- MessageTemplate: va,
1212
- CTAButton: oa,
1213
- MessageLogs: ia
1311
+ SenderName: Ea,
1312
+ SenderAvatar: fa,
1313
+ SentTime: va,
1314
+ MessageBody: pa,
1315
+ SuggestedReplies: Oa,
1316
+ MessageTemplate: Ia,
1317
+ CTAButton: Ca,
1318
+ MessageLogs: Sa
1214
1319
  }
1215
1320
  });
1216
- function Oa(e) {
1217
- return /* @__PURE__ */ n.createElement(kn, { ...e, testerMode: !1 });
1321
+ function Va(e) {
1322
+ return /* @__PURE__ */ n.createElement(Mn, { ...e, testerMode: !1 });
1218
1323
  }
1219
- function kn(e) {
1220
- var m, g, p, h;
1221
- const { components: t } = he.useContext(), r = e.testerMode, o = !!((m = e.extendedMessagePayload) != null && m.message_template), a = !!((g = e.extendedMessagePayload) != null && g.cta_button), s = Sn(() => e.messageType === "user" ? e.message.length > 0 : !0), i = e.groupType === "top" || e.groupType === "single", l = e.groupType === "bottom" || e.groupType === "single", u = r ? 0 : Me;
1222
- return /* @__PURE__ */ n.createElement(Ra, { $marginBottom: dt(e.groupType) }, i && /* @__PURE__ */ n.createElement(La, null, !r && /* @__PURE__ */ n.createElement(t.SenderAvatar, { ...e }), /* @__PURE__ */ n.createElement(t.SenderName, { ...e })), /* @__PURE__ */ n.createElement(kt, null, /* @__PURE__ */ n.createElement(et, { $extraStartPadding: u }, /* @__PURE__ */ n.createElement(t.MessageBody, { ...e }, a && /* @__PURE__ */ n.createElement("div", { style: { marginTop: 12, marginInline: 12 } }, /* @__PURE__ */ n.createElement(t.CTAButton, { ...e })))), o && /* @__PURE__ */ n.createElement(Pt, { $startPadding: 0, $endPadding: 0, style: { marginTop: s ? Ke : 0 } }, /* @__PURE__ */ n.createElement(
1324
+ function Mn(e) {
1325
+ var p, m, h, g;
1326
+ const { components: t } = pe.useContext(), r = e.testerMode, o = !!((p = e.extendedMessagePayload) != null && p.message_template), a = !!((m = e.extendedMessagePayload) != null && m.cta_button), s = $n(() => e.messageType === "user" ? e.message.length > 0 : !0), i = e.groupType === "top" || e.groupType === "single", l = e.groupType === "bottom" || e.groupType === "single", u = r ? 0 : Me;
1327
+ return /* @__PURE__ */ n.createElement(Ha, { $marginBottom: ht(e.groupType) }, i && /* @__PURE__ */ n.createElement(za, null, !r && /* @__PURE__ */ n.createElement(t.SenderAvatar, { ...e }), /* @__PURE__ */ n.createElement(t.SenderName, { ...e })), /* @__PURE__ */ n.createElement(At, null, /* @__PURE__ */ n.createElement(tt, { $extraStartPadding: u }, /* @__PURE__ */ n.createElement(t.MessageBody, { ...e }, a && /* @__PURE__ */ n.createElement("div", { style: { marginTop: 12, marginInline: 12 } }, /* @__PURE__ */ n.createElement(t.CTAButton, { ...e })))), o && /* @__PURE__ */ n.createElement(Ft, { $startPadding: 0, $endPadding: 0, style: { marginTop: s ? Te : 0 } }, /* @__PURE__ */ n.createElement(
1223
1328
  t.MessageTemplate,
1224
1329
  {
1225
1330
  ...e,
1226
- messageTemplateErrorFallback: e.messageTemplateErrorFallback ?? /* @__PURE__ */ n.createElement(et, { $extraStartPadding: u }, /* @__PURE__ */ n.createElement(
1331
+ messageTemplateErrorFallback: e.messageTemplateErrorFallback ?? /* @__PURE__ */ n.createElement(tt, { $extraStartPadding: u }, /* @__PURE__ */ n.createElement(
1227
1332
  t.MessageBody,
1228
1333
  {
1229
1334
  ...e,
1230
1335
  messageType: "user",
1231
- message: ((h = (p = e.extendedMessagePayload) == null ? void 0 : p.message_template) == null ? void 0 : h.fallback_message) ?? "Cannot read this template."
1336
+ message: ((g = (h = e.extendedMessagePayload) == null ? void 0 : h.message_template) == null ? void 0 : g.fallback_message) ?? "Cannot read this template."
1232
1337
  }
1233
1338
  )),
1234
- messageTemplateLoadingFallback: e.messageTemplateLoadingFallback ?? /* @__PURE__ */ n.createElement(et, { $extraStartPadding: u }, /* @__PURE__ */ n.createElement(Tn, null))
1339
+ messageTemplateLoadingFallback: e.messageTemplateLoadingFallback ?? /* @__PURE__ */ n.createElement(tt, { $extraStartPadding: u }, /* @__PURE__ */ n.createElement(In, null))
1235
1340
  }
1236
- ))), l && /* @__PURE__ */ n.createElement(Na, { $extraStartPadding: u + 8 }, /* @__PURE__ */ n.createElement(t.SentTime, { ...e })), /* @__PURE__ */ n.createElement(kt, null, e.suggestedRepliesVisible && /* @__PURE__ */ n.createElement(Pt, null, /* @__PURE__ */ n.createElement(t.SuggestedReplies, { ...e })), /* @__PURE__ */ n.createElement(t.MessageLogs, { ...e })));
1341
+ ))), l && /* @__PURE__ */ n.createElement(Wa, { $extraStartPadding: u + 8 }, /* @__PURE__ */ n.createElement(t.SentTime, { ...e })), /* @__PURE__ */ n.createElement(At, null, e.suggestedRepliesVisible && /* @__PURE__ */ n.createElement(Ft, null, /* @__PURE__ */ n.createElement(t.SuggestedReplies, { ...e })), /* @__PURE__ */ n.createElement(t.MessageLogs, { ...e })));
1237
1342
  }
1238
- const Ra = c.div`display:flex;flex-direction:column;align-items:flex-start;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
1239
- `, Je = c.div`display:flex;align-self:stretch;justify-content:flex-start;${({ $startPadding: e = Z, $endPadding: t = Z, $extraStartPadding: r = 0 }) => `
1343
+ const Ha = c.div`display:flex;flex-direction:column;align-items:flex-start;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
1344
+ `, Je = c.div`display:flex;align-self:stretch;justify-content:flex-start;${({ $startPadding: e = q, $endPadding: t = q, $extraStartPadding: r = 0 }) => `
1240
1345
  padding-inline: ${e + r}px ${t}px;
1241
1346
  `}
1242
- `, La = c(Je)`display:flex;flex-direction:row;align-items:center;gap:8px;`, et = c(Je)`display:flex;`, Na = c(Je)`margin-top:${vn}px;display:flex;align-items:flex-start;justify-content:flex-start;`, Pt = c(Je)`display:flex;flex-direction:column;${({ $startPadding: e = Z, $endPadding: t = Z, $extraStartPadding: r = 0 }) => `
1347
+ `, za = c(Je)`display:flex;flex-direction:row;align-items:center;gap:8px;`, tt = c(Je)`display:flex;`, Wa = c(Je)`margin-top:${_n}px;display:flex;align-items:flex-start;justify-content:flex-start;`, Ft = c(Je)`display:flex;flex-direction:column;${({ $startPadding: e = q, $endPadding: t = q, $extraStartPadding: r = 0 }) => `
1243
1348
  padding-inline: ${e + r}px ${t}px;
1244
1349
  `}
1245
1350
  `;
1246
- function Ba({ file: e, children: t }) {
1247
- return /* @__PURE__ */ n.createElement(Da, null, /* @__PURE__ */ n.createElement(mt, { name: e.name, type: ut(e.name, e.type) }), t);
1351
+ function Ga({ file: e, children: t, onClickFile: r }) {
1352
+ return /* @__PURE__ */ n.createElement(ja, null, /* @__PURE__ */ n.createElement(
1353
+ bt,
1354
+ {
1355
+ name: e.name,
1356
+ type: ft(e.name, e.type),
1357
+ onClick: r && (() => r == null ? void 0 : r(e))
1358
+ }
1359
+ ), t);
1248
1360
  }
1249
- const Da = c.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Ke}px;`, wn = ({ className: e, children: t, size: r = 26 }) => /* @__PURE__ */ n.createElement(Pa, { className: e, $size: r }, t ?? /* @__PURE__ */ n.createElement(A, { type: "spinner", size: r })), Pa = c.div`display:flex;align-items:center;justify-content:center;width:${({ $size: e }) => ge(e)};height:${({ $size: e }) => ge(e)};animation:1s infinite linear;animation-name:rotate;@keyframes rotate{from{transform:rotate(0);}to{transform:rotate(360deg);}}`;
1250
- function Fa({ file: e, metadata: t, onClickMedia: r, children: o }) {
1251
- const { aspectRatio: a, localFile: s } = t, [i] = C(() => s instanceof File ? URL.createObjectURL(s) : e.url), [l, u] = C(!1);
1252
- return /* @__PURE__ */ n.createElement(Ua, null, /* @__PURE__ */ n.createElement(Va, { $ratio: a, onClick: () => r == null ? void 0 : r(e) }, !l && /* @__PURE__ */ n.createElement(wn, { size: 26 }, /* @__PURE__ */ n.createElement(A, { type: "spinner", color: "onbackground3", size: 26 })), /* @__PURE__ */ n.createElement(Ha, { $loaded: l, src: i, alt: "image-message", onLoad: () => u(!0) })), o);
1361
+ const ja = c.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Te}px;`, On = ({ className: e, children: t, size: r = 26 }) => /* @__PURE__ */ n.createElement(Ka, { className: e, $size: r }, t ?? /* @__PURE__ */ n.createElement($, { type: "spinner", size: r })), Ka = c.div`display:flex;align-items:center;justify-content:center;width:${({ $size: e }) => me(e)};height:${({ $size: e }) => me(e)};animation:1s infinite linear;animation-name:rotate;@keyframes rotate{from{transform:rotate(0);}to{transform:rotate(360deg);}}`;
1362
+ function Za({ file: e, metadata: t, onClickMedia: r, children: o }) {
1363
+ const { aspectRatio: a, localFile: s } = t, [i] = y(() => s instanceof File ? URL.createObjectURL(s) : e.url), [l, u] = y(!1);
1364
+ return /* @__PURE__ */ n.createElement(Ya, null, /* @__PURE__ */ n.createElement(qa, { $ratio: a, onClick: () => r == null ? void 0 : r(e) }, !l && /* @__PURE__ */ n.createElement(On, { size: 26 }, /* @__PURE__ */ n.createElement($, { type: "spinner", color: "onbackground3", size: 26 })), /* @__PURE__ */ n.createElement(Ja, { $loaded: l, src: i, alt: "image-message", onLoad: () => u(!0) })), o);
1253
1365
  }
1254
- const Ua = c.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Ke}px;`, Va = c.div`width:${Oe}px;border-radius:12px;overflow:hidden;cursor:pointer;height:auto;aspect-ratio:${(e) => e.$ratio};position:relative;display:flex;align-items:center;justify-content:center;${V.light`
1366
+ const Ya = c.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Te}px;`, qa = c.div`width:${Le}px;border-radius:12px;overflow:hidden;cursor:pointer;height:auto;aspect-ratio:${(e) => e.$ratio};position:relative;display:flex;align-items:center;justify-content:center;${U.light`
1255
1367
  background-color: ${d.color.background100};
1256
1368
  `}
1257
- ${V.dark`
1369
+ ${U.dark`
1258
1370
  background-color: ${d.color.background400};
1259
1371
  `}
1260
- `, Ha = c.img`position:absolute;width:100%;height:100%;inset-block-start:0;inset-inline-start:0;object-fit:cover;opacity:${(e) => e.$loaded ? 1 : 0};transition:opacity 0.5s ease;`;
1261
- function Ft(e) {
1262
- const t = ve(() => dn.sanitize(yn(e.message)), [e.message]);
1263
- return /* @__PURE__ */ n.createElement(Wa, { $maxWidth: e.maxBodyWidth ?? Oe }, /* @__PURE__ */ n.createElement(za, { variant: "body3", dangerouslySetInnerHTML: { __html: t } }));
1372
+ `, Ja = c.img`position:absolute;width:100%;height:100%;inset-block-start:0;inset-inline-start:0;object-fit:cover;opacity:${(e) => e.$loaded ? 1 : 0};transition:opacity 0.5s ease;`;
1373
+ function Ut(e) {
1374
+ const t = ve(() => dn.sanitize(Sn(e.message)), [e.message]);
1375
+ return /* @__PURE__ */ n.createElement(Xa, { $maxWidth: e.maxBodyWidth ?? Le }, /* @__PURE__ */ n.createElement(Qa, { variant: "body3", dangerouslySetInnerHTML: { __html: t } }));
1264
1376
  }
1265
- const Wa = c.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e }) => k`
1377
+ const Xa = c.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e }) => k`
1266
1378
  color: ${e.colors.messageOutgoing.text};
1267
1379
  background-color: ${e.colors.messageOutgoing.background};
1268
1380
  `}
1269
1381
  padding: 12px 0;
1270
1382
  transition: max-width 0.3s;
1271
1383
  overflow-wrap: break-word;
1272
- `, za = c(T)`align-items:flex-start;line-height:18px;white-space:pre-wrap;padding:0 12px;`;
1273
- function Ga(e) {
1274
- const { stringSet: t } = M(), r = e.message.length > 0 ? /* @__PURE__ */ n.createElement(Ft, { ...e }) : null;
1275
- return e.messageType === "user" ? r : e.messageType === "file" ? e.file.type.startsWith("image") ? /* @__PURE__ */ n.createElement(Fa, { ...e }, r) : /* @__PURE__ */ n.createElement(Ba, { ...e }, r) : /* @__PURE__ */ n.createElement(Ft, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
1384
+ `, Qa = c(S)`align-items:flex-start;line-height:18px;white-space:pre-wrap;padding:0 12px;`;
1385
+ function ei(e) {
1386
+ const { stringSet: t } = M(), r = Tn(e) ? /* @__PURE__ */ n.createElement(Ut, { ...e }) : null;
1387
+ return e.messageType === "user" ? r : e.messageType === "file" ? e.file.type.startsWith("image") ? /* @__PURE__ */ n.createElement(Za, { ...e }, r) : /* @__PURE__ */ n.createElement(Ga, { ...e }, r) : /* @__PURE__ */ n.createElement(Ut, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
1276
1388
  }
1277
- function ja({ sendingStatus: e }) {
1278
- const t = st();
1389
+ function ti({ sendingStatus: e }) {
1390
+ const t = dt();
1279
1391
  switch (e) {
1280
1392
  case "pending":
1281
- return /* @__PURE__ */ n.createElement(Ka, { size: 16 }, /* @__PURE__ */ n.createElement(A, { type: "spinner", color: t.colors.messageOutgoing.background, size: 16 }));
1393
+ return /* @__PURE__ */ n.createElement(ni, { size: 16 }, /* @__PURE__ */ n.createElement($, { type: "spinner", color: t.colors.messageOutgoing.background, size: 16 }));
1282
1394
  case "failed":
1283
- return /* @__PURE__ */ n.createElement("div", { style: { marginBottom: 2 } }, /* @__PURE__ */ n.createElement(A, { type: "error", color: d.themedColor.error, size: 16 }));
1395
+ return /* @__PURE__ */ n.createElement("div", { style: { marginBottom: 2 } }, /* @__PURE__ */ n.createElement($, { type: "error", color: d.themedColor.error, size: 16 }));
1284
1396
  case "scheduled":
1285
1397
  case "canceled":
1286
1398
  return null;
1287
1399
  default:
1288
- return /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement(A, { type: "chevron-down" }));
1400
+ return /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement($, { type: "chevron-down" }));
1289
1401
  }
1290
1402
  }
1291
- const Ka = c(wn)`margin-bottom:2px;width:16px;height:16px;`;
1292
- function Za({ createdAt: e }) {
1403
+ const ni = c(On)`margin-bottom:2px;width:16px;height:16px;`;
1404
+ function ri({ createdAt: e }) {
1293
1405
  const { stringSet: t, format: r } = M();
1294
- return /* @__PURE__ */ n.createElement(T, { variant: "caption4", color: d.themedColor.textLowEmphasis }, r(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP));
1406
+ return /* @__PURE__ */ n.createElement(S, { variant: "caption4", color: d.themedColor.textLowEmphasis }, r(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP));
1295
1407
  }
1296
- const bt = it({
1297
- template: Ya,
1408
+ const vt = ut({
1409
+ template: oi,
1298
1410
  components: {
1299
- SendingStatus: ja,
1300
- SentTime: Za,
1301
- MessageBody: Ga
1411
+ SendingStatus: ti,
1412
+ SentTime: ri,
1413
+ MessageBody: ei
1302
1414
  }
1303
1415
  });
1304
- function Ya(e) {
1305
- const { components: t } = bt.useContext(), r = e.sendingStatus === "succeeded", o = e.groupType === "bottom" || e.groupType === "single";
1306
- return /* @__PURE__ */ n.createElement(qa, { $marginBottom: dt(e.groupType) }, /* @__PURE__ */ n.createElement(Ja, null, /* @__PURE__ */ n.createElement(t.MessageBody, { ...e })), o && /* @__PURE__ */ n.createElement(Xa, { $extraEndPadding: 8 }, r ? /* @__PURE__ */ n.createElement(t.SentTime, { ...e }) : /* @__PURE__ */ n.createElement(t.SendingStatus, { ...e })));
1416
+ function oi(e) {
1417
+ const { components: t } = vt.useContext(), r = e.sendingStatus === "succeeded", o = e.groupType === "bottom" || e.groupType === "single";
1418
+ return /* @__PURE__ */ n.createElement(ai, { $marginBottom: ht(e.groupType) }, /* @__PURE__ */ n.createElement(ii, null, /* @__PURE__ */ n.createElement(t.MessageBody, { ...e })), o && /* @__PURE__ */ n.createElement(si, { $extraEndPadding: 8 }, r ? /* @__PURE__ */ n.createElement(t.SentTime, { ...e }) : /* @__PURE__ */ n.createElement(t.SendingStatus, { ...e })));
1307
1419
  }
1308
- const qa = c.div`display:flex;flex:1;flex-direction:column;align-items:flex-end;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
1309
- `, An = c.div`display:flex;align-self:stretch;justify-content:flex-end;${({ $startPadding: e = Z, $endPadding: t = Z, $extraEndPadding: r = 0 }) => `padding-inline: ${e}px ${t + r}px;`};
1310
- `, Ja = c(An)``, Xa = c(An)`margin-top:${vn}px;`;
1311
- function Qa(e) {
1312
- return e.messageType !== "admin" ? null : /* @__PURE__ */ n.createElement(es, null, /* @__PURE__ */ n.createElement(T, { variant: "caption2", color: d.themedColor.textMidEmphasis }, ts(dn.sanitize(e.message))));
1420
+ const ai = c.div`display:flex;flex:1;flex-direction:column;align-items:flex-end;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
1421
+ `, Rn = c.div`display:flex;align-self:stretch;justify-content:flex-end;${({ $startPadding: e = q, $endPadding: t = q, $extraEndPadding: r = 0 }) => `padding-inline: ${e}px ${t + r}px;`};
1422
+ `, ii = c(Rn)``, si = c(Rn)`margin-top:${_n}px;`;
1423
+ function li(e) {
1424
+ return e.messageType !== "admin" ? null : /* @__PURE__ */ n.createElement(ci, null, /* @__PURE__ */ n.createElement(S, { variant: "caption2", color: d.themedColor.textMidEmphasis }, di(dn.sanitize(e.message))));
1313
1425
  }
1314
- const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color:inherit;}`, ts = (e) => {
1426
+ const ci = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color:inherit;}`, di = (e) => {
1315
1427
  const t = /\[([^\]]+)\]\((https?:\/\/[^\s]+)\)/g, r = [];
1316
1428
  let o = 0;
1317
1429
  return e.replace(t, (a, s, i, l) => (r.push(e.slice(o, l)), r.push(
1318
- /* @__PURE__ */ n.createElement("a", { key: i, href: i, target: "_blank", rel: lt }, s)
1430
+ /* @__PURE__ */ n.createElement("a", { key: i, href: i, target: "_blank", rel: pt }, s)
1319
1431
  ), o = l + a.length, a)), r.push(e.slice(o)), r;
1320
- }, ns = ({ submitted: e, defaultValue: t, value: r, onChange: o }) => {
1432
+ }, ui = ({ submitted: e, defaultValue: t, value: r, onChange: o }) => {
1321
1433
  const { stringSet: a } = M();
1322
- return P(() => {
1434
+ return N(() => {
1323
1435
  typeof r > "u" && typeof t == "boolean" && (o == null || o(t));
1324
- }, [r, t]), /* @__PURE__ */ n.createElement(rs, null, /* @__PURE__ */ n.createElement(T, { variant: "caption2", color: d.themedColor.textMidEmphasis }, a.CSAT_CRE_TITLE), /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement(
1325
- Ut,
1436
+ }, [r, t]), /* @__PURE__ */ n.createElement(mi, null, /* @__PURE__ */ n.createElement(S, { variant: "caption2", color: d.themedColor.textMidEmphasis }, a.CSAT_CRE_TITLE), /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement(
1437
+ Vt,
1326
1438
  {
1327
1439
  checked: r === !0,
1328
1440
  label: a.CSAT_CRE_SOLVED,
@@ -1330,7 +1442,7 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1330
1442
  onClick: () => o == null ? void 0 : o(!0)
1331
1443
  }
1332
1444
  ), /* @__PURE__ */ n.createElement(
1333
- Ut,
1445
+ Vt,
1334
1446
  {
1335
1447
  checked: r === !1,
1336
1448
  label: a.CSAT_CRE_NOT_SOLVED,
@@ -1338,17 +1450,17 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1338
1450
  onClick: () => o == null ? void 0 : o(!1)
1339
1451
  }
1340
1452
  )));
1341
- }, Ut = ({ onClick: e, checked: t, label: r, disabled: o }) => {
1453
+ }, Vt = ({ onClick: e, checked: t, label: r, disabled: o }) => {
1342
1454
  const a = t ? d.color.primary.main : o ? d.themedColor.textDisabled : d.themedColor.textLowEmphasis, s = t ? d.themedColor.textHighEmphasis : o ? d.themedColor.textLowEmphasis : d.themedColor.textHighEmphasis;
1343
- return /* @__PURE__ */ n.createElement(os, { onClick: e, disabled: o }, /* @__PURE__ */ n.createElement(A, { size: 24, type: t ? "radio-on" : "radio-off", color: a }), /* @__PURE__ */ n.createElement(T, { variant: "caption2", color: s }, r));
1344
- }, rs = c.div`display:flex;flex-direction:column;gap:8px;`, os = c.button`all:unset;display:flex;align-items:center;justify-content:flex-start;gap:2px;span{line-height:initial;}&:enabled{cursor:pointer;}`, as = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", id: "csat1", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.08301 20C2.08301 10.1049 10.1046 2.08334 19.9997 2.08334C29.8948 2.08334 37.9163 10.1049 37.9163 20C37.9163 29.8952 29.8948 37.9167 19.9997 37.9167C10.1046 37.9167 2.08301 29.8952 2.08301 20Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.5824 29.3328C13.1344 29.7473 13.918 29.636 14.3326 29.084C15.6269 27.3607 17.6835 26.25 19.9997 26.25C22.316 26.25 24.3727 27.3607 25.6668 29.084C26.0815 29.636 26.865 29.7473 27.4172 29.3328C27.9692 28.9182 28.0805 28.1347 27.6658 27.5825C25.9198 25.2577 23.1357 23.75 19.9997 23.75C16.8638 23.75 14.0797 25.2577 12.3336 27.5825C11.919 28.1347 12.0304 28.9182 12.5824 29.3328Z", fill: "black", fillOpacity: 0.12 }), /* @__PURE__ */ n.createElement("path", { d: "M28.4449 13.7707C29.1324 13.8328 29.64 14.4406 29.578 15.1281C29.516 15.8153 28.909 16.3221 28.2219 16.2608C28.2219 16.2608 28.0282 16.2502 27.9267 16.2487C27.7224 16.2457 27.4382 16.2509 27.1224 16.2833C26.7864 16.3177 26.4644 16.3782 26.1799 16.4662L26.304 16.86C26.7792 18.3675 25.5094 19.5813 24.2057 19.5813C23.504 19.5813 22.8319 19.2617 22.4295 18.6857C22.0025 18.0745 21.9417 17.241 22.4075 16.5344C22.7505 16.0143 23.2444 15.3831 23.8959 14.8657C24.8355 14.1195 26.0435 13.8809 26.867 13.7963C27.3024 13.7517 28.0149 13.7319 28.4449 13.7707Z", fill: "black", fillOpacity: 0.12 }), /* @__PURE__ */ n.createElement("path", { d: "M11.5553 13.7707C10.8677 13.8328 10.3601 14.4406 10.4221 15.1281C10.4842 15.8153 11.0912 16.3221 11.7782 16.2608C11.7782 16.2608 11.972 16.2502 12.0734 16.2487C12.2778 16.2457 12.562 16.2509 12.8778 16.2833C13.2137 16.3177 13.5357 16.3782 13.8203 16.4662L13.6962 16.86C13.2209 18.3675 14.4907 19.5813 15.7944 19.5813C16.4962 19.5813 17.1683 19.2617 17.5707 18.6857C17.9975 18.0745 18.0585 17.241 17.5925 16.5344C17.2497 16.0143 16.7557 15.3831 16.1043 14.8657C15.1646 14.1195 13.9566 13.8809 13.1331 13.7963C12.6978 13.7517 11.9853 13.7319 11.5553 13.7707Z", fill: "black", fillOpacity: 0.12 })), ss = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.08337 19.9999C2.08337 10.1048 10.1049 2.08325 20 2.08325C29.8952 2.08325 37.9167 10.1048 37.9167 19.9999C37.9167 29.8951 29.8952 37.9166 20 37.9166C10.1049 37.9166 2.08337 29.8951 2.08337 19.9999Z", fill: "url(#paint0_linear_159_173206)" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.5828 29.3328C13.1348 29.7473 13.9184 29.636 14.3329 29.084C15.6272 27.3607 17.6839 26.25 20 26.25C22.3164 26.25 24.373 27.3607 25.6672 29.084C26.0819 29.636 26.8654 29.7473 27.4175 29.3328C27.9695 28.9182 28.0809 28.1347 27.6662 27.5825C25.9202 25.2577 23.136 23.75 20 23.75C16.8642 23.75 14.0801 25.2577 12.334 27.5825C11.9194 28.1347 12.0308 28.9182 12.5828 29.3328Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { d: "M28.4454 13.7707C29.1329 13.8328 29.6405 14.4406 29.5785 15.1281C29.5165 15.8153 28.9095 16.3221 28.2224 16.2608C28.2224 16.2608 28.0287 16.2502 27.9272 16.2487C27.7229 16.2457 27.4387 16.2509 27.1229 16.2833C26.7869 16.3177 26.4649 16.3782 26.1804 16.4662L26.3045 16.86C26.7797 18.3675 25.5099 19.5813 24.2062 19.5813C23.5045 19.5813 22.8324 19.2617 22.43 18.6857C22.003 18.0745 21.9422 17.241 22.408 16.5344C22.751 16.0143 23.2449 15.3831 23.8964 14.8657C24.836 14.1195 26.044 13.8809 26.8675 13.7963C27.3029 13.7517 28.0154 13.7319 28.4454 13.7707Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { d: "M11.5549 13.7707C10.8674 13.8328 10.3597 14.4406 10.4218 15.1281C10.4838 15.8153 11.0908 16.3221 11.7779 16.2608C11.7779 16.2608 11.9716 16.2502 12.073 16.2487C12.2774 16.2457 12.5616 16.2509 12.8774 16.2833C13.2134 16.3177 13.5353 16.3782 13.8199 16.4662L13.6958 16.86C13.2205 18.3675 14.4904 19.5813 15.794 19.5813C16.4958 19.5813 17.168 19.2617 17.5703 18.6857C17.9971 18.0745 18.0581 17.241 17.5921 16.5344C17.2493 16.0143 16.7553 15.3831 16.1039 14.8657C15.1643 14.1195 13.9562 13.8809 13.1327 13.7963C12.6974 13.7517 11.9849 13.7319 11.5549 13.7707Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("defs", null, /* @__PURE__ */ n.createElement("linearGradient", { id: "paint0_linear_159_173206", x1: 20, y1: 2.08325, x2: 20, y2: 37.9166, gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ n.createElement("stop", { stopColor: "#FF2D1D" }), /* @__PURE__ */ n.createElement("stop", { offset: 1, stopColor: "#FFA540" })))), is = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { d: "M15 28.333C16.3927 27.2867 18.124 26.6667 20 26.6667C21.876 26.6667 23.6073 27.2867 25 28.333", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("path", { d: "M11.667 13.3511C11.667 13.3511 14.0161 13.139 15.3268 14.18M15.3268 14.18L14.8882 15.5711C14.7153 16.1199 15.1675 16.6667 15.7943 16.6667C16.4531 16.6667 16.8882 16.0723 16.549 15.5579C16.2483 15.102 15.8388 14.5866 15.3268 14.18ZM23.3337 13.3511C23.3337 13.3511 25.6827 13.139 26.9935 14.18M26.9935 14.18L26.555 15.5711C26.382 16.1199 26.8342 16.6667 27.461 16.6667C28.1198 16.6667 28.5548 16.0723 28.2157 15.5579C27.915 15.102 27.5055 14.5866 26.9935 14.18Z", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), ls = (e) => /* @__PURE__ */ n.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ n.createElement("path", { d: "M14.249 27.334C15.851 26.13 17.844 25.417 20 25.417c2.156 0 4.149.714 5.751 1.917.553.415.664 1.199.25 1.751-.415.552-1.199.664-1.751.25-1.183-.889-2.652-1.416-4.25-1.416s-3.067.527-4.25 1.416c-.553.414-1.336.302-1.751-.25-.415-.552-.303-1.336.249-1.751Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { d: "M23.445 14.596c-.687.062-1.294-.445-1.356-1.132-.062-.687.445-1.295 1.132-1.357.082-.005.342-.02.482-.022.277-.004.662.002 1.097.047.823.085 2.031.323 2.97 1.07.652.518 1.146 1.15 1.489 1.67.466.706.405 1.54-.022 2.15-.402.576-1.074.896-1.775.896-1.304 0-2.573-1.214-2.098-2.722l.125-.394c-.285-.088-.607-.148-.942-.182-.316-.033-.6-.038-.804-.035-.101.002-.242.01-.294.013Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { d: "M11.779 14.596c-.687.062-1.294-.445-1.356-1.132-.062-.687.445-1.295 1.132-1.357.082-.005.342-.02.482-.022.277-.004.662.002 1.097.047.823.085 2.031.323 2.97 1.07.652.518 1.146 1.15 1.489 1.67.466.706.405 1.54-.022 2.15-.402.576-1.074.896-1.775.896-1.304 0-2.573-1.214-2.098-2.722l.124-.394c-.284-.088-.606-.148-.941-.182-.316-.033-.6-.038-.804-.035-.101.002-.243.01-.294.013Z", fill: "#141B34" })), cs = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { d: "M13.348 15H13.333M26.6663 15H26.6513", stroke: "black", strokeOpacity: 0.12, strokeWidth: 3.33333, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("path", { d: "M15 26.6667H25", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), ds = (e) => /* @__PURE__ */ n.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.25 15c0-1.151.933-2.083 2.083-2.083h.015c1.151 0 2.084.933 2.084 2.083 0 1.151-.933 2.083-2.084 2.083h-.015c-1.15 0-2.083-.933-2.083-2.083ZM24.568 15c0-1.151.933-2.083 2.084-2.083h.015c1.151 0 2.083.933 2.083 2.083 0 1.151-.932 2.083-2.083 2.083h-.015c-1.151 0-2.084-.933-2.084-2.083Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M13.75 26.667c0-.691.56-1.25 1.25-1.25h10c.69 0 1.25.559 1.25 1.25 0 .691-.56 1.25-1.25 1.25h-10c-.69 0-1.25-.559-1.25-1.25Z", fill: "#141B34" })), us = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { d: "M13.333 25C14.8532 27.024 17.2735 28.3333 19.9997 28.3333C22.7258 28.3333 25.1462 27.024 26.6663 25", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("path", { d: "M13.348 15H13.333M26.6663 15H26.6513", stroke: "black", strokeOpacity: 0.12, strokeWidth: 3.33333, strokeLinecap: "round", strokeLinejoin: "round" })), ms = (e) => /* @__PURE__ */ n.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.583 24.001c.552-.414 1.335-.302 1.75.25 1.294 1.723 3.35 2.834 5.667 2.834s4.373-1.11 5.667-2.834c.415-.552 1.199-.664 1.751-.25.552.415.664 1.199.25 1.751C25.92 28.076 23.136 29.584 20 29.584s-5.92-1.508-7.666-3.832c-.415-.552-.303-1.336.249-1.751Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.25 15c0-1.151.933-2.083 2.083-2.083h.015c1.151 0 2.084.933 2.084 2.083 0 1.151-.933 2.083-2.084 2.083h-.015c-1.15 0-2.083-.933-2.083-2.083ZM24.568 15c0-1.151.933-2.083 2.084-2.083h.015c1.151 0 2.083.933 2.083 2.083 0 1.151-.932 2.083-2.083 2.083h-.015c-1.151 0-2.084-.933-2.084-2.083Z", fill: "#141B34" })), ps = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M19.9997 36.6663C29.2044 36.6663 36.6663 29.2044 36.6663 19.9997C36.6663 10.7949 29.2044 3.33301 19.9997 3.33301C10.7949 3.33301 3.33301 10.7949 3.33301 19.9997C3.33301 29.2044 10.7949 36.6663 19.9997 36.6663Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { d: "M19.9997 30C23.16 30 25.8145 27.867 26.56 24.9832C26.9068 23.6413 26.4033 23.3333 25.0765 23.3333H14.9228C13.5959 23.3333 13.0925 23.6413 13.4393 24.9832C14.1848 27.867 16.8393 30 19.9997 30Z", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("path", { d: "M11.667 15.8333C11.667 14.4526 12.7863 13.3333 14.167 13.3333C15.5477 13.3333 16.667 14.4526 16.667 15.8333M23.3337 15.8333C23.3337 14.4526 24.453 13.3333 25.8337 13.3333C27.2143 13.3333 28.3337 14.4526 28.3337 15.8333", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), gs = (e) => /* @__PURE__ */ n.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ n.createElement("g", { clipPath: "url(#clip0_159_173224)" }, /* @__PURE__ */ n.createElement("g", { clipPath: "url(#clip1_159_173224)" }, /* @__PURE__ */ n.createElement("path", { d: "M20 30.624c3.752 0 6.904-2.532 7.789-5.956.412-1.593-.185-1.959-1.76-1.959H13.973c-1.575 0-2.173.366-1.761 1.959.885 3.424 4.037 5.956 7.788 5.956Z", fill: "#141B34" })), /* @__PURE__ */ n.createElement("mask", { id: "mask0_159_173224", style: {
1455
+ return /* @__PURE__ */ n.createElement(pi, { onClick: e, disabled: o }, /* @__PURE__ */ n.createElement($, { size: 24, type: t ? "radio-on" : "radio-off", color: a }), /* @__PURE__ */ n.createElement(S, { variant: "caption2", color: s }, r));
1456
+ }, mi = c.div`display:flex;flex-direction:column;gap:8px;`, pi = c.button`all:unset;display:flex;align-items:center;justify-content:flex-start;gap:2px;span{line-height:initial;}&:enabled{cursor:pointer;}`, gi = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", id: "csat1", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.08301 20C2.08301 10.1049 10.1046 2.08334 19.9997 2.08334C29.8948 2.08334 37.9163 10.1049 37.9163 20C37.9163 29.8952 29.8948 37.9167 19.9997 37.9167C10.1046 37.9167 2.08301 29.8952 2.08301 20Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.5824 29.3328C13.1344 29.7473 13.918 29.636 14.3326 29.084C15.6269 27.3607 17.6835 26.25 19.9997 26.25C22.316 26.25 24.3727 27.3607 25.6668 29.084C26.0815 29.636 26.865 29.7473 27.4172 29.3328C27.9692 28.9182 28.0805 28.1347 27.6658 27.5825C25.9198 25.2577 23.1357 23.75 19.9997 23.75C16.8638 23.75 14.0797 25.2577 12.3336 27.5825C11.919 28.1347 12.0304 28.9182 12.5824 29.3328Z", fill: "black", fillOpacity: 0.12 }), /* @__PURE__ */ n.createElement("path", { d: "M28.4449 13.7707C29.1324 13.8328 29.64 14.4406 29.578 15.1281C29.516 15.8153 28.909 16.3221 28.2219 16.2608C28.2219 16.2608 28.0282 16.2502 27.9267 16.2487C27.7224 16.2457 27.4382 16.2509 27.1224 16.2833C26.7864 16.3177 26.4644 16.3782 26.1799 16.4662L26.304 16.86C26.7792 18.3675 25.5094 19.5813 24.2057 19.5813C23.504 19.5813 22.8319 19.2617 22.4295 18.6857C22.0025 18.0745 21.9417 17.241 22.4075 16.5344C22.7505 16.0143 23.2444 15.3831 23.8959 14.8657C24.8355 14.1195 26.0435 13.8809 26.867 13.7963C27.3024 13.7517 28.0149 13.7319 28.4449 13.7707Z", fill: "black", fillOpacity: 0.12 }), /* @__PURE__ */ n.createElement("path", { d: "M11.5553 13.7707C10.8677 13.8328 10.3601 14.4406 10.4221 15.1281C10.4842 15.8153 11.0912 16.3221 11.7782 16.2608C11.7782 16.2608 11.972 16.2502 12.0734 16.2487C12.2778 16.2457 12.562 16.2509 12.8778 16.2833C13.2137 16.3177 13.5357 16.3782 13.8203 16.4662L13.6962 16.86C13.2209 18.3675 14.4907 19.5813 15.7944 19.5813C16.4962 19.5813 17.1683 19.2617 17.5707 18.6857C17.9975 18.0745 18.0585 17.241 17.5925 16.5344C17.2497 16.0143 16.7557 15.3831 16.1043 14.8657C15.1646 14.1195 13.9566 13.8809 13.1331 13.7963C12.6978 13.7517 11.9853 13.7319 11.5553 13.7707Z", fill: "black", fillOpacity: 0.12 })), hi = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.08337 19.9999C2.08337 10.1048 10.1049 2.08325 20 2.08325C29.8952 2.08325 37.9167 10.1048 37.9167 19.9999C37.9167 29.8951 29.8952 37.9166 20 37.9166C10.1049 37.9166 2.08337 29.8951 2.08337 19.9999Z", fill: "url(#paint0_linear_159_173206)" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.5828 29.3328C13.1348 29.7473 13.9184 29.636 14.3329 29.084C15.6272 27.3607 17.6839 26.25 20 26.25C22.3164 26.25 24.373 27.3607 25.6672 29.084C26.0819 29.636 26.8654 29.7473 27.4175 29.3328C27.9695 28.9182 28.0809 28.1347 27.6662 27.5825C25.9202 25.2577 23.136 23.75 20 23.75C16.8642 23.75 14.0801 25.2577 12.334 27.5825C11.9194 28.1347 12.0308 28.9182 12.5828 29.3328Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { d: "M28.4454 13.7707C29.1329 13.8328 29.6405 14.4406 29.5785 15.1281C29.5165 15.8153 28.9095 16.3221 28.2224 16.2608C28.2224 16.2608 28.0287 16.2502 27.9272 16.2487C27.7229 16.2457 27.4387 16.2509 27.1229 16.2833C26.7869 16.3177 26.4649 16.3782 26.1804 16.4662L26.3045 16.86C26.7797 18.3675 25.5099 19.5813 24.2062 19.5813C23.5045 19.5813 22.8324 19.2617 22.43 18.6857C22.003 18.0745 21.9422 17.241 22.408 16.5344C22.751 16.0143 23.2449 15.3831 23.8964 14.8657C24.836 14.1195 26.044 13.8809 26.8675 13.7963C27.3029 13.7517 28.0154 13.7319 28.4454 13.7707Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { d: "M11.5549 13.7707C10.8674 13.8328 10.3597 14.4406 10.4218 15.1281C10.4838 15.8153 11.0908 16.3221 11.7779 16.2608C11.7779 16.2608 11.9716 16.2502 12.073 16.2487C12.2774 16.2457 12.5616 16.2509 12.8774 16.2833C13.2134 16.3177 13.5353 16.3782 13.8199 16.4662L13.6958 16.86C13.2205 18.3675 14.4904 19.5813 15.794 19.5813C16.4958 19.5813 17.168 19.2617 17.5703 18.6857C17.9971 18.0745 18.0581 17.241 17.5921 16.5344C17.2493 16.0143 16.7553 15.3831 16.1039 14.8657C15.1643 14.1195 13.9562 13.8809 13.1327 13.7963C12.6974 13.7517 11.9849 13.7319 11.5549 13.7707Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("defs", null, /* @__PURE__ */ n.createElement("linearGradient", { id: "paint0_linear_159_173206", x1: 20, y1: 2.08325, x2: 20, y2: 37.9166, gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ n.createElement("stop", { stopColor: "#FF2D1D" }), /* @__PURE__ */ n.createElement("stop", { offset: 1, stopColor: "#FFA540" })))), fi = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { d: "M15 28.333C16.3927 27.2867 18.124 26.6667 20 26.6667C21.876 26.6667 23.6073 27.2867 25 28.333", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("path", { d: "M11.667 13.3511C11.667 13.3511 14.0161 13.139 15.3268 14.18M15.3268 14.18L14.8882 15.5711C14.7153 16.1199 15.1675 16.6667 15.7943 16.6667C16.4531 16.6667 16.8882 16.0723 16.549 15.5579C16.2483 15.102 15.8388 14.5866 15.3268 14.18ZM23.3337 13.3511C23.3337 13.3511 25.6827 13.139 26.9935 14.18M26.9935 14.18L26.555 15.5711C26.382 16.1199 26.8342 16.6667 27.461 16.6667C28.1198 16.6667 28.5548 16.0723 28.2157 15.5579C27.915 15.102 27.5055 14.5866 26.9935 14.18Z", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), bi = (e) => /* @__PURE__ */ n.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ n.createElement("path", { d: "M14.249 27.334C15.851 26.13 17.844 25.417 20 25.417c2.156 0 4.149.714 5.751 1.917.553.415.664 1.199.25 1.751-.415.552-1.199.664-1.751.25-1.183-.889-2.652-1.416-4.25-1.416s-3.067.527-4.25 1.416c-.553.414-1.336.302-1.751-.25-.415-.552-.303-1.336.249-1.751Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { d: "M23.445 14.596c-.687.062-1.294-.445-1.356-1.132-.062-.687.445-1.295 1.132-1.357.082-.005.342-.02.482-.022.277-.004.662.002 1.097.047.823.085 2.031.323 2.97 1.07.652.518 1.146 1.15 1.489 1.67.466.706.405 1.54-.022 2.15-.402.576-1.074.896-1.775.896-1.304 0-2.573-1.214-2.098-2.722l.125-.394c-.285-.088-.607-.148-.942-.182-.316-.033-.6-.038-.804-.035-.101.002-.242.01-.294.013Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { d: "M11.779 14.596c-.687.062-1.294-.445-1.356-1.132-.062-.687.445-1.295 1.132-1.357.082-.005.342-.02.482-.022.277-.004.662.002 1.097.047.823.085 2.031.323 2.97 1.07.652.518 1.146 1.15 1.489 1.67.466.706.405 1.54-.022 2.15-.402.576-1.074.896-1.775.896-1.304 0-2.573-1.214-2.098-2.722l.124-.394c-.284-.088-.606-.148-.941-.182-.316-.033-.6-.038-.804-.035-.101.002-.243.01-.294.013Z", fill: "#141B34" })), Ei = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { d: "M13.348 15H13.333M26.6663 15H26.6513", stroke: "black", strokeOpacity: 0.12, strokeWidth: 3.33333, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("path", { d: "M15 26.6667H25", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), xi = (e) => /* @__PURE__ */ n.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.25 15c0-1.151.933-2.083 2.083-2.083h.015c1.151 0 2.084.933 2.084 2.083 0 1.151-.933 2.083-2.084 2.083h-.015c-1.15 0-2.083-.933-2.083-2.083ZM24.568 15c0-1.151.933-2.083 2.084-2.083h.015c1.151 0 2.083.933 2.083 2.083 0 1.151-.932 2.083-2.083 2.083h-.015c-1.151 0-2.084-.933-2.084-2.083Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M13.75 26.667c0-.691.56-1.25 1.25-1.25h10c.69 0 1.25.559 1.25 1.25 0 .691-.56 1.25-1.25 1.25h-10c-.69 0-1.25-.559-1.25-1.25Z", fill: "#141B34" })), vi = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { d: "M13.333 25C14.8532 27.024 17.2735 28.3333 19.9997 28.3333C22.7258 28.3333 25.1462 27.024 26.6663 25", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("path", { d: "M13.348 15H13.333M26.6663 15H26.6513", stroke: "black", strokeOpacity: 0.12, strokeWidth: 3.33333, strokeLinecap: "round", strokeLinejoin: "round" })), yi = (e) => /* @__PURE__ */ n.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.583 24.001c.552-.414 1.335-.302 1.75.25 1.294 1.723 3.35 2.834 5.667 2.834s4.373-1.11 5.667-2.834c.415-.552 1.199-.664 1.751-.25.552.415.664 1.199.25 1.751C25.92 28.076 23.136 29.584 20 29.584s-5.92-1.508-7.666-3.832c-.415-.552-.303-1.336.249-1.751Z", fill: "#141B34" }), /* @__PURE__ */ n.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.25 15c0-1.151.933-2.083 2.083-2.083h.015c1.151 0 2.084.933 2.084 2.083 0 1.151-.933 2.083-2.084 2.083h-.015c-1.15 0-2.083-.933-2.083-2.083ZM24.568 15c0-1.151.933-2.083 2.084-2.083h.015c1.151 0 2.083.933 2.083 2.083 0 1.151-.932 2.083-2.083 2.083h-.015c-1.151 0-2.084-.933-2.084-2.083Z", fill: "#141B34" })), Ci = (e) => /* @__PURE__ */ n.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M19.9997 36.6663C29.2044 36.6663 36.6663 29.2044 36.6663 19.9997C36.6663 10.7949 29.2044 3.33301 19.9997 3.33301C10.7949 3.33301 3.33301 10.7949 3.33301 19.9997C3.33301 29.2044 10.7949 36.6663 19.9997 36.6663Z", fill: "#E0E0E0" }), /* @__PURE__ */ n.createElement("path", { d: "M19.9997 30C23.16 30 25.8145 27.867 26.56 24.9832C26.9068 23.6413 26.4033 23.3333 25.0765 23.3333H14.9228C13.5959 23.3333 13.0925 23.6413 13.4393 24.9832C14.1848 27.867 16.8393 30 19.9997 30Z", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("path", { d: "M11.667 15.8333C11.667 14.4526 12.7863 13.3333 14.167 13.3333C15.5477 13.3333 16.667 14.4526 16.667 15.8333M23.3337 15.8333C23.3337 14.4526 24.453 13.3333 25.8337 13.3333C27.2143 13.3333 28.3337 14.4526 28.3337 15.8333", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), _i = (e) => /* @__PURE__ */ n.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ n.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ n.createElement("g", { clipPath: "url(#clip0_159_173224)" }, /* @__PURE__ */ n.createElement("g", { clipPath: "url(#clip1_159_173224)" }, /* @__PURE__ */ n.createElement("path", { d: "M20 30.624c3.752 0 6.904-2.532 7.789-5.956.412-1.593-.185-1.959-1.76-1.959H13.973c-1.575 0-2.173.366-1.761 1.959.885 3.424 4.037 5.956 7.788 5.956Z", fill: "#141B34" })), /* @__PURE__ */ n.createElement("mask", { id: "mask0_159_173224", style: {
1345
1457
  maskType: "alpha"
1346
- }, maskUnits: "userSpaceOnUse", x: 12, y: 22, width: 16, height: 9 }, /* @__PURE__ */ n.createElement("path", { d: "M20 30.624c3.752 0 6.904-2.532 7.789-5.956.412-1.593-.185-1.959-1.76-1.959H13.973c-1.575 0-2.173.366-1.761 1.959.885 3.424 4.037 5.956 7.788 5.956Z", fill: "#141B34" })), /* @__PURE__ */ n.createElement("g", { mask: "url(#mask0_159_173224)" }, /* @__PURE__ */ n.createElement("path", { d: "M20 32.998c3.278 0 5.936-1.594 5.936-3.561 0-1.968-2.658-3.562-5.936-3.562-3.278 0-5.936 1.594-5.936 3.562 0 1.967 2.658 3.561 5.936 3.561Z", fill: "#FF493B" }))), /* @__PURE__ */ n.createElement("path", { d: "M11.667 15.833c0-1.381 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5M23.333 15.833c0-1.381 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5", stroke: "#141B34", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("defs", null, /* @__PURE__ */ n.createElement("clipPath", { id: "clip0_159_173224" }, /* @__PURE__ */ n.createElement("rect", { width: 15.83, height: 7.915, fill: "white", transform: "translate(12.085 22.709)" })), /* @__PURE__ */ n.createElement("clipPath", { id: "clip1_159_173224" }, /* @__PURE__ */ n.createElement("rect", { width: 15.83, height: 7.915, fill: "white", transform: "translate(12.085 22.709)" })))), hs = [
1458
+ }, maskUnits: "userSpaceOnUse", x: 12, y: 22, width: 16, height: 9 }, /* @__PURE__ */ n.createElement("path", { d: "M20 30.624c3.752 0 6.904-2.532 7.789-5.956.412-1.593-.185-1.959-1.76-1.959H13.973c-1.575 0-2.173.366-1.761 1.959.885 3.424 4.037 5.956 7.788 5.956Z", fill: "#141B34" })), /* @__PURE__ */ n.createElement("g", { mask: "url(#mask0_159_173224)" }, /* @__PURE__ */ n.createElement("path", { d: "M20 32.998c3.278 0 5.936-1.594 5.936-3.561 0-1.968-2.658-3.562-5.936-3.562-3.278 0-5.936 1.594-5.936 3.562 0 1.967 2.658 3.561 5.936 3.561Z", fill: "#FF493B" }))), /* @__PURE__ */ n.createElement("path", { d: "M11.667 15.833c0-1.381 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5M23.333 15.833c0-1.381 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5", stroke: "#141B34", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ n.createElement("defs", null, /* @__PURE__ */ n.createElement("clipPath", { id: "clip0_159_173224" }, /* @__PURE__ */ n.createElement("rect", { width: 15.83, height: 7.915, fill: "white", transform: "translate(12.085 22.709)" })), /* @__PURE__ */ n.createElement("clipPath", { id: "clip1_159_173224" }, /* @__PURE__ */ n.createElement("rect", { width: 15.83, height: 7.915, fill: "white", transform: "translate(12.085 22.709)" })))), Ti = [
1347
1459
  {
1348
1460
  value: 1,
1349
1461
  Icon: {
1350
- Active: ss,
1351
- Inactive: as
1462
+ Active: hi,
1463
+ Inactive: gi
1352
1464
  },
1353
1465
  isActive: (e) => e <= 1,
1354
1466
  getTooltip: (e) => e.CSAT5_RATING_SCORE_1
@@ -1356,8 +1468,8 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1356
1468
  {
1357
1469
  value: 2,
1358
1470
  Icon: {
1359
- Active: ls,
1360
- Inactive: is
1471
+ Active: bi,
1472
+ Inactive: fi
1361
1473
  },
1362
1474
  isActive: (e) => e === 2,
1363
1475
  getTooltip: (e) => e.CSAT5_RATING_SCORE_2
@@ -1365,8 +1477,8 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1365
1477
  {
1366
1478
  value: 3,
1367
1479
  Icon: {
1368
- Active: ds,
1369
- Inactive: cs
1480
+ Active: xi,
1481
+ Inactive: Ei
1370
1482
  },
1371
1483
  isActive: (e) => e === 3,
1372
1484
  getTooltip: (e) => e.CSAT5_RATING_SCORE_3
@@ -1374,8 +1486,8 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1374
1486
  {
1375
1487
  value: 4,
1376
1488
  Icon: {
1377
- Active: ms,
1378
- Inactive: us
1489
+ Active: yi,
1490
+ Inactive: vi
1379
1491
  },
1380
1492
  isActive: (e) => e === 4,
1381
1493
  getTooltip: (e) => e.CSAT5_RATING_SCORE_4
@@ -1383,16 +1495,16 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1383
1495
  {
1384
1496
  value: 5,
1385
1497
  Icon: {
1386
- Active: gs,
1387
- Inactive: ps
1498
+ Active: _i,
1499
+ Inactive: Ci
1388
1500
  },
1389
1501
  isActive: (e) => 5 <= e,
1390
1502
  getTooltip: (e) => e.CSAT5_RATING_SCORE_5
1391
1503
  }
1392
- ], fs = () => hs, In = ({ label: e, children: t, position: r = "top", disabled: o }) => {
1393
- const [a, s] = C(!1);
1394
- return o ? t : /* @__PURE__ */ n.createElement("div", { style: { position: "relative" }, onMouseEnter: () => s(!0), onMouseLeave: () => s(!1) }, t, /* @__PURE__ */ n.createElement(xs, { $visible: a, $position: r }, /* @__PURE__ */ n.createElement(vs, { variant: "caption1" }, e), /* @__PURE__ */ n.createElement(bs, { $position: r })));
1395
- }, bs = ({ $position: e }) => /* @__PURE__ */ n.createElement(
1504
+ ], Si = () => Ti, Ln = ({ label: e, children: t, position: r = "top", disabled: o }) => {
1505
+ const [a, s] = y(!1);
1506
+ return o ? t : /* @__PURE__ */ n.createElement("div", { style: { position: "relative" }, onMouseEnter: () => s(!0), onMouseLeave: () => s(!1) }, t, /* @__PURE__ */ n.createElement(Ai, { $visible: a, $position: r }, /* @__PURE__ */ n.createElement(Ii, { variant: "caption1" }, e), /* @__PURE__ */ n.createElement(wi, { $position: r })));
1507
+ }, wi = ({ $position: e }) => /* @__PURE__ */ n.createElement(
1396
1508
  "svg",
1397
1509
  {
1398
1510
  style: { transform: e === "top" ? "rotate(0)" : "rotate(180deg)" },
@@ -1403,13 +1515,13 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1403
1515
  fill: "none"
1404
1516
  },
1405
1517
  /* @__PURE__ */ n.createElement("path", { d: "M6 6L0 0h12L6 6Z", fill: d.themedColor.oncontent_inverse1 })
1406
- ), Es = {
1518
+ ), ki = {
1407
1519
  top: k`flex-direction:column;top:0;transform:translate(-50%,-100%);`,
1408
1520
  bottom: k`flex-direction:column-reverse;bottom:0;transform:translate(-50%,100%);`
1409
- }, xs = c.div`display:${({ $visible: e }) => e ? "flex" : "none"};align-items:center;position:absolute;left:50%;z-index:${fe.TOOLTIP};${({ $position: e }) => Es[e]}`, vs = c(T)`padding:6px 8px;color:${d.themedColor.oncontent1};background:${d.themedColor.oncontent_inverse1};border-radius:4px;font-size:12px;white-space:nowrap;`, ys = ({ submitted: e, value: t, onChange: r }) => {
1410
- const { stringSet: o } = M(), a = fs(), s = typeof t == "number";
1411
- return /* @__PURE__ */ n.createElement(Cs, null, /* @__PURE__ */ n.createElement(T, { variant: "caption2", color: d.themedColor.textMidEmphasis }, o.CSAT_RATING_TITLE), /* @__PURE__ */ n.createElement(_s, null, a.map((i) => /* @__PURE__ */ n.createElement(In, { disabled: e, key: i.value, label: i.getTooltip(o) }, /* @__PURE__ */ n.createElement(
1412
- Ts,
1521
+ }, Ai = c.div`display:${({ $visible: e }) => e ? "flex" : "none"};align-items:center;position:absolute;left:50%;z-index:${ge.TOOLTIP};${({ $position: e }) => ki[e]}`, Ii = c(S)`padding:6px 8px;color:${d.themedColor.oncontent1};background:${d.themedColor.oncontent_inverse1};border-radius:4px;font-size:12px;white-space:nowrap;`, $i = ({ submitted: e, value: t, onChange: r }) => {
1522
+ const { stringSet: o } = M(), a = Si(), s = typeof t == "number";
1523
+ return /* @__PURE__ */ n.createElement(Mi, null, /* @__PURE__ */ n.createElement(S, { variant: "caption2", color: d.themedColor.textMidEmphasis }, o.CSAT_RATING_TITLE), /* @__PURE__ */ n.createElement(Oi, null, a.map((i) => /* @__PURE__ */ n.createElement(Ln, { disabled: e, key: i.value, label: i.getTooltip(o) }, /* @__PURE__ */ n.createElement(
1524
+ Ri,
1413
1525
  {
1414
1526
  disabled: e,
1415
1527
  onClick: () => r(i.value),
@@ -1417,16 +1529,16 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1417
1529
  },
1418
1530
  s ? i.isActive(t) ? /* @__PURE__ */ n.createElement(i.Icon.Active, null) : /* @__PURE__ */ n.createElement(i.Icon.Inactive, null) : /* @__PURE__ */ n.createElement(i.Icon.Active, null)
1419
1531
  )))));
1420
- }, Cs = c.div`display:flex;flex-direction:column;gap:8px;`, _s = c.div`display:flex;justify-content:space-between;width:100%;max-width:320px;`, Ts = c.button`background-color:transparent;border:none;border-radius:4px;padding:0;display:flex;align-items:center;justify-content:center;box-sizing:border-box;&:enabled:hover{cursor:pointer;background-color:${d.color.background200};${V.dark`
1532
+ }, Mi = c.div`display:flex;flex-direction:column;gap:8px;`, Oi = c.div`display:flex;justify-content:space-between;width:100%;max-width:320px;`, Ri = c.button`background-color:transparent;border:none;border-radius:4px;padding:0;display:flex;align-items:center;justify-content:center;box-sizing:border-box;&:enabled:hover{cursor:pointer;background-color:${d.color.background200};${U.dark`
1421
1533
  background-color: ${d.color.background500};
1422
1534
  `}
1423
1535
  }
1424
1536
 
1425
- ${({ $inactive: e, theme: t }) => e && t.selected === "dark" && Ss};
1426
- `, Ss = k`[fill]{fill:white;fill-opacity:0.12;}[stroke]{stroke:white;stroke-opacity:0.12;}`, ks = ({ submitted: e, value: t = "", onChange: r }) => {
1537
+ ${({ $inactive: e, theme: t }) => e && t.selected === "dark" && Li};
1538
+ `, Li = k`[fill]{fill:white;fill-opacity:0.12;}[stroke]{stroke:white;stroke-opacity:0.12;}`, Ni = ({ submitted: e, value: t = "", onChange: r }) => {
1427
1539
  const { stringSet: o } = M();
1428
1540
  return e && !t ? null : /* @__PURE__ */ n.createElement(
1429
- ws,
1541
+ Bi,
1430
1542
  {
1431
1543
  disabled: e,
1432
1544
  maxLength: 255,
@@ -1435,7 +1547,7 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1435
1547
  placeholder: o.CSAT_REASON_PLACEHOLDER
1436
1548
  }
1437
1549
  );
1438
- }, ws = c.input`box-sizing:border-box;width:100%;border-radius:4px;padding:10px 16px;font-size:14px;font-weight:400;font-style:normal;border:unset;&:focus{outline:none;}color:${d.themedColor.textHighEmphasis};&::placeholder{color:${d.themedColor.onbackground3};}background-color:${d.color.background50};${V.dark`
1550
+ }, Bi = c.input`box-sizing:border-box;width:100%;border-radius:4px;padding:10px 16px;font-size:14px;font-weight:400;font-style:normal;border:unset;&:focus{outline:none;}color:${d.themedColor.textHighEmphasis};&::placeholder{color:${d.themedColor.onbackground3};}background-color:${d.color.background50};${U.dark`
1439
1551
  background-color: ${d.themedColor.textDisabled};
1440
1552
  `}
1441
1553
 
@@ -1443,88 +1555,88 @@ const es = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
1443
1555
  cursor: not-allowed;
1444
1556
  color: ${d.themedColor.textLowEmphasis};
1445
1557
  background-color: ${d.color.background200};
1446
- ${V.dark`
1558
+ ${U.dark`
1447
1559
  color: ${d.color.ondark04};
1448
1560
  background-color: ${d.themedColor.textDisabled};
1449
1561
  `}
1450
1562
  }
1451
- `, As = ({ submitted: e }) => {
1563
+ `, Di = ({ submitted: e }) => {
1452
1564
  const { stringSet: t } = M();
1453
- return e ? /* @__PURE__ */ n.createElement(T, { variant: "h2", color: d.themedColor.onbackground1 }, t.CSAT_TITLE_SUBMITTED) : /* @__PURE__ */ n.createElement(T, { variant: "h2", color: d.themedColor.onbackground1 }, t.CSAT_TITLE_UNSUBMITTED);
1565
+ return e ? /* @__PURE__ */ n.createElement(S, { variant: "h2", color: d.themedColor.onbackground1 }, t.CSAT_TITLE_SUBMITTED) : /* @__PURE__ */ n.createElement(S, { variant: "h2", color: d.themedColor.onbackground1 }, t.CSAT_TITLE_UNSUBMITTED);
1454
1566
  };
1455
- var ue = /* @__PURE__ */ ((e) => (e.AI_AGENT_CSAT_5 = "AI_AGENT_CSAT_5", e.AI_AGENT_CSAT_5_WITH_CRE = "AI_AGENT_CSAT_5_WITH_CRE", e))(ue || {});
1456
- const Is = (e) => tr((t, r) => ({ ...t, ...r }), e), Vt = ({
1567
+ var ce = /* @__PURE__ */ ((e) => (e.AI_AGENT_CSAT_5 = "AI_AGENT_CSAT_5", e.AI_AGENT_CSAT_5_WITH_CRE = "AI_AGENT_CSAT_5_WITH_CRE", e))(ce || {});
1568
+ const Pi = (e) => ir((t, r) => ({ ...t, ...r }), e), Ht = ({
1457
1569
  type: e,
1458
1570
  renderSubmitButton: t,
1459
1571
  initialCsat: r,
1460
1572
  initialCsatReason: o,
1461
1573
  initialIsResolved: a
1462
1574
  }) => {
1463
- const [s, i] = Is({
1575
+ const [s, i] = Pi({
1464
1576
  csatType: e,
1465
1577
  csat: r,
1466
1578
  csatReason: o,
1467
1579
  isResolved: a
1468
- }), l = typeof r == "number" ? "submitted" : e === ue.AI_AGENT_CSAT_5 && typeof s.csat == "number" || e === ue.AI_AGENT_CSAT_5_WITH_CRE && typeof s.csat == "number" && typeof s.isResolved == "boolean" ? "submittable" : "unsubmittable", u = { state: l, submitted: l === "submitted" };
1469
- return /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(Ms, null, /* @__PURE__ */ n.createElement(As, { ...u }), e === ue.AI_AGENT_CSAT_5_WITH_CRE && /* @__PURE__ */ n.createElement(
1470
- ns,
1580
+ }), l = typeof r == "number" ? "submitted" : e === ce.AI_AGENT_CSAT_5 && typeof s.csat == "number" || e === ce.AI_AGENT_CSAT_5_WITH_CRE && typeof s.csat == "number" && typeof s.isResolved == "boolean" ? "submittable" : "unsubmittable", u = { state: l, submitted: l === "submitted" };
1581
+ return /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(Fi, null, /* @__PURE__ */ n.createElement(Di, { ...u }), e === ce.AI_AGENT_CSAT_5_WITH_CRE && /* @__PURE__ */ n.createElement(
1582
+ ui,
1471
1583
  {
1472
1584
  ...u,
1473
1585
  defaultValue: a,
1474
1586
  value: s.isResolved,
1475
- onChange: (m) => i({ isResolved: m })
1587
+ onChange: (p) => i({ isResolved: p })
1476
1588
  }
1477
- ), /* @__PURE__ */ n.createElement(ys, { ...u, value: s.csat, onChange: (m) => i({ csat: m }) }), s.csat && /* @__PURE__ */ n.createElement(
1478
- ks,
1589
+ ), /* @__PURE__ */ n.createElement($i, { ...u, value: s.csat, onChange: (p) => i({ csat: p }) }), s.csat && /* @__PURE__ */ n.createElement(
1590
+ Ni,
1479
1591
  {
1480
1592
  ...u,
1481
1593
  value: s.csatReason,
1482
- onChange: (m) => i({ csatReason: m })
1594
+ onChange: (p) => i({ csatReason: p })
1483
1595
  }
1484
1596
  )), l !== "submitted" && t({ state: l, params: s }));
1485
- }, Ms = c.div`display:flex;flex-direction:column;gap:12px;`, $s = () => {
1597
+ }, Fi = c.div`display:flex;flex-direction:column;gap:12px;`, Ui = () => {
1486
1598
  const { stringSet: e } = M();
1487
- return /* @__PURE__ */ n.createElement(T, { variant: "body2", color: d.themedColor.textMidEmphasis, style: { textAlign: "center" } }, e.CSAT_SUBMISSION_EXPIRED);
1488
- }, Os = (e) => {
1599
+ return /* @__PURE__ */ n.createElement(S, { variant: "body2", color: d.themedColor.textMidEmphasis, style: { textAlign: "center" } }, e.CSAT_SUBMISSION_EXPIRED);
1600
+ }, Vi = (e) => {
1489
1601
  if (e.messageType !== "admin.csat")
1490
1602
  throw new Error("Invalid message type");
1491
- const t = _r(), { stringSet: r } = M(), { extendedMessagePayload: o, csat: a, csatReason: s, csatExpireAt: i, isResolvedWhenDeterminedByUser: l, onSubmitCSAT: u } = e, { visibility: m, type: g } = (o == null ? void 0 : o.csat) ?? {};
1492
- if (!m || !g || !ue[g]) return null;
1493
- const p = g === ue.AI_AGENT_CSAT_5 || g === ue.AI_AGENT_CSAT_5_WITH_CRE ? Vt : () => null, h = (f) => {
1494
- f.csat && !Ht(i) ? u({
1495
- csatType: f.csatType,
1496
- csat: f.csat,
1497
- csatReason: f.csatReason,
1498
- isResolved: f.isResolved
1603
+ const t = Ar(), { stringSet: r } = M(), { extendedMessagePayload: o, csat: a, csatReason: s, csatExpireAt: i, isResolvedWhenDeterminedByUser: l, onSubmitCSAT: u } = e, { visibility: p, type: m } = (o == null ? void 0 : o.csat) ?? {};
1604
+ if (!p || !m || !ce[m]) return null;
1605
+ const h = m === ce.AI_AGENT_CSAT_5 || m === ce.AI_AGENT_CSAT_5_WITH_CRE ? Ht : () => null, g = (b) => {
1606
+ b.csat && !zt(i) ? u({
1607
+ csatType: b.csatType,
1608
+ csat: b.csat,
1609
+ csatReason: b.csatReason,
1610
+ isResolved: b.isResolved
1499
1611
  }) : t();
1500
1612
  };
1501
- return /* @__PURE__ */ n.createElement(Rs, null, !a && Ht(i) ? /* @__PURE__ */ n.createElement($s, null) : /* @__PURE__ */ n.createElement(
1502
- p,
1613
+ return /* @__PURE__ */ n.createElement(Hi, null, !a && zt(i) ? /* @__PURE__ */ n.createElement(Ui, null) : /* @__PURE__ */ n.createElement(
1614
+ h,
1503
1615
  {
1504
- type: g,
1616
+ type: m,
1505
1617
  initialCsat: a,
1506
1618
  initialCsatReason: s,
1507
1619
  initialIsResolved: l,
1508
- renderSubmitButton: ({ state: f, params: E }) => /* @__PURE__ */ n.createElement(Ls, { disabled: f !== "submittable", onClick: () => h(E) }, /* @__PURE__ */ n.createElement(T, { variant: "button" }, r.CSAT_SUBMIT_LABEL))
1620
+ renderSubmitButton: ({ state: b, params: E }) => /* @__PURE__ */ n.createElement(zi, { disabled: b !== "submittable", onClick: () => g(E) }, /* @__PURE__ */ n.createElement(S, { variant: "button" }, r.CSAT_SUBMIT_LABEL))
1509
1621
  }
1510
1622
  ));
1511
- }, Rs = c.div`display:flex;flex-direction:column;background-color:${({ theme: e }) => e.colors.csat.background};border-radius:16px;gap:16px;padding:24px;`, Ls = c.button`all:unset;background-color:${({ theme: e }) => e.colors.base.primary};color:${({ theme: e }) => e.colors.base.primaryContrastContent};border-radius:6px;padding:10px 20px;display:flex;align-items:center;justify-content:center;cursor:pointer;&:hover{background-color:${d.color.primary.dark};}&:disabled{color:${d.color.ondark03};background-color:${d.themedColor.textDisabled};cursor:not-allowed;}`;
1512
- function Ht(e) {
1623
+ }, Hi = c.div`display:flex;flex-direction:column;background-color:${({ theme: e }) => e.colors.csat.background};border-radius:16px;gap:16px;padding:24px;`, zi = c.button`all:unset;background-color:${({ theme: e }) => e.colors.base.primary};color:${({ theme: e }) => e.colors.base.primaryContrastContent};border-radius:6px;padding:10px 20px;display:flex;align-items:center;justify-content:center;cursor:pointer;&:hover{background-color:${d.color.primary.dark};}&:disabled{color:${d.color.ondark03};background-color:${d.themedColor.textDisabled};cursor:not-allowed;}`;
1624
+ function zt(e) {
1513
1625
  return !!e && e < Date.now();
1514
1626
  }
1515
- const Et = it({
1516
- template: Ns,
1627
+ const yt = ut({
1628
+ template: Wi,
1517
1629
  components: {
1518
- AdminMessage: Qa,
1519
- CSATMessage: Os
1630
+ AdminMessage: li,
1631
+ CSATMessage: Vi
1520
1632
  }
1521
1633
  });
1522
- function Ns(e) {
1523
- const { components: t } = Et.useContext(), r = Sn(() => e.messageType === "admin" ? /* @__PURE__ */ n.createElement(t.AdminMessage, { ...e }) : e.messageType === "admin.csat" ? /* @__PURE__ */ n.createElement(t.CSATMessage, { ...e }) : null);
1524
- return /* @__PURE__ */ n.createElement(Bs, { $marginBottom: dt(e.groupType) }, r);
1634
+ function Wi(e) {
1635
+ const { components: t } = yt.useContext(), r = $n(() => e.messageType === "admin" ? /* @__PURE__ */ n.createElement(t.AdminMessage, { ...e }) : e.messageType === "admin.csat" ? /* @__PURE__ */ n.createElement(t.CSATMessage, { ...e }) : null);
1636
+ return /* @__PURE__ */ n.createElement(Gi, { $marginBottom: ht(e.groupType) }, r);
1525
1637
  }
1526
- const Bs = c.div`padding-inline:${Z}px;margin-bottom:${({ $marginBottom: e }) => e}px;`, Ds = ko``, Ps = Mr(he, bt, Et);
1527
- function Fs({
1638
+ const Gi = c.div`padding-inline:${q}px;margin-bottom:${({ $marginBottom: e }) => e}px;`, ji = Ho``, Ki = Nr(pe, vt, yt);
1639
+ function Zi({
1528
1640
  appearance: e,
1529
1641
  rootElement: t,
1530
1642
  logger: r,
@@ -1533,15 +1645,50 @@ function Fs({
1533
1645
  children: s,
1534
1646
  messageTemplate: i
1535
1647
  }) {
1536
- var u, m;
1648
+ var u, p;
1649
+ Fo(go, t);
1537
1650
  const l = ve(() => {
1538
- const g = {}, { carousel_padding_left: p, carousel_padding_right: h } = (i == null ? void 0 : i.__internalVariables) || {}, f = p, E = h;
1539
- return typeof f == "number" && (g.carousel_padding_left = f), typeof E == "number" && (g.carousel_padding_right = E), Object.keys(g).length > 0 ? g : void 0;
1651
+ const m = {}, { carousel_padding_left: h, carousel_padding_right: g } = (i == null ? void 0 : i.__internalVariables) || {}, b = h, E = g;
1652
+ return typeof b == "number" && (m.carousel_padding_left = b), typeof E == "number" && (m.carousel_padding_right = E), Object.keys(m).length > 0 ? m : void 0;
1540
1653
  }, [
1541
1654
  (u = i == null ? void 0 : i.__internalVariables) == null ? void 0 : u.carousel_padding_left,
1542
- (m = i == null ? void 0 : i.__internalVariables) == null ? void 0 : m.carousel_padding_right
1655
+ (p = i == null ? void 0 : i.__internalVariables) == null ? void 0 : p.carousel_padding_right
1543
1656
  ]);
1544
- return /* @__PURE__ */ n.createElement(mr, { target: t }, /* @__PURE__ */ n.createElement(io, { rootElement: t, logger: r, appearance: e }, /* @__PURE__ */ n.createElement(Co, { rootElement: t, internalVariables: l }, /* @__PURE__ */ n.createElement(bo, { stringSet: a, logger: r, language: o }, /* @__PURE__ */ n.createElement(Ps, null, s, /* @__PURE__ */ n.createElement(Ds, null))))));
1657
+ return /* @__PURE__ */ n.createElement(br, { target: t }, /* @__PURE__ */ n.createElement(Ao, { rootElement: t, logger: r, appearance: e }, /* @__PURE__ */ n.createElement(io, { internalVariables: l }, /* @__PURE__ */ n.createElement(Do, { stringSet: a, logger: r, language: o }, /* @__PURE__ */ n.createElement(Ki, null, s, /* @__PURE__ */ n.createElement(ji, null))))));
1658
+ }
1659
+ const {
1660
+ Provider: Yi,
1661
+ Consumer: Nn,
1662
+ useContext: B
1663
+ } = j("Agent");
1664
+ function qi({
1665
+ children: e,
1666
+ state: t,
1667
+ enableCloseConversationButton: r = !1,
1668
+ enableExpandButton: o = !0,
1669
+ enableAutoDisconnectInLauncher: a = !0,
1670
+ ...s
1671
+ }) {
1672
+ const i = Ze(), [l, u] = y(!1), [p, m] = y(!1), h = {
1673
+ opened: (t == null ? void 0 : t.opened) ?? l,
1674
+ setOpened: (t == null ? void 0 : t.setOpened) ?? u,
1675
+ expanded: (t == null ? void 0 : t.expanded) ?? p,
1676
+ setExpanded: (t == null ? void 0 : t.setExpanded) ?? m
1677
+ };
1678
+ return /* @__PURE__ */ n.createElement(
1679
+ Yi,
1680
+ {
1681
+ value: {
1682
+ ...s,
1683
+ ...i,
1684
+ state: h,
1685
+ enableCloseConversationButton: r,
1686
+ enableExpandButton: o,
1687
+ enableAutoDisconnectInLauncher: a
1688
+ }
1689
+ },
1690
+ e
1691
+ );
1545
1692
  }
1546
1693
  const Wt = {
1547
1694
  key_payment_plan_container: {
@@ -1728,56 +1875,26 @@ const Wt = {
1728
1875
  }
1729
1876
  }
1730
1877
  }
1731
- }, [Mn, B] = ee("Agent"), $n = ({ children: e }) => /* @__PURE__ */ n.createElement(Mn.Consumer, null, (t) => t ? e(t) : null);
1732
- function Us({
1733
- children: e,
1734
- state: t,
1735
- enableCloseConversationButton: r = !1,
1736
- enableExpandButton: o = !0,
1737
- enableAutoDisconnectInLauncher: a = !0,
1738
- ...s
1739
- }) {
1740
- const i = Dr(), [l, u] = C(!1), [m, g] = C(!1), p = {
1741
- opened: (t == null ? void 0 : t.opened) ?? l,
1742
- setOpened: (t == null ? void 0 : t.setOpened) ?? u,
1743
- expanded: (t == null ? void 0 : t.expanded) ?? m,
1744
- setExpanded: (t == null ? void 0 : t.setExpanded) ?? g
1745
- };
1746
- return /* @__PURE__ */ n.createElement(
1747
- Mn.Provider,
1748
- {
1749
- value: {
1750
- ...s,
1751
- ...i,
1752
- state: p,
1753
- enableCloseConversationButton: r,
1754
- enableExpandButton: o,
1755
- enableAutoDisconnectInLauncher: a
1756
- }
1757
- },
1758
- e
1759
- );
1760
- }
1761
- const De = {}, q = {
1878
+ }, Fe = {}, ee = {
1762
1879
  getItem: (e) => {
1763
1880
  try {
1764
1881
  return localStorage.getItem(e);
1765
1882
  } catch {
1766
- return De[e] ?? null;
1883
+ return Fe[e] ?? null;
1767
1884
  }
1768
1885
  },
1769
1886
  setItem: (e, t) => {
1770
1887
  try {
1771
1888
  localStorage.setItem(e, t);
1772
1889
  } catch {
1773
- De[e] = t;
1890
+ Fe[e] = t;
1774
1891
  }
1775
1892
  },
1776
1893
  deleteItem: (e) => {
1777
1894
  try {
1778
1895
  localStorage.removeItem(e);
1779
1896
  } catch {
1780
- delete De[e];
1897
+ delete Fe[e];
1781
1898
  }
1782
1899
  },
1783
1900
  getKeys: (e) => {
@@ -1789,37 +1906,65 @@ const De = {}, q = {
1789
1906
  }
1790
1907
  return t;
1791
1908
  } catch {
1792
- return Object.keys(De).filter((t) => t.startsWith(e));
1909
+ return Object.keys(Fe).filter((t) => t.startsWith(e));
1793
1910
  }
1794
1911
  }
1795
- }, xt = /iPad|iPhone|iPod/.test(navigator.userAgent), Vs = /Android/.test(navigator.userAgent), Re = (e) => xt || Vs, vt = (e, t) => `${Kr.SESSION}/${e}/${t}`, tt = {
1796
- get: Hs,
1797
- set: Ws,
1798
- clear: zs
1799
1912
  };
1800
- function Hs(e) {
1801
- const t = vt(e.appId, e.aiAgentId), r = q.getItem(t);
1802
- try {
1803
- return r ? JSON.parse(r) : null;
1804
- } catch {
1805
- return null;
1913
+ function Bn(e) {
1914
+ const { keyGenerator: t, keyParamsValidator: r } = e;
1915
+ function o(i) {
1916
+ try {
1917
+ r && r(i);
1918
+ const l = t(i), u = ee.getItem(l);
1919
+ return u ? JSON.parse(u) : null;
1920
+ } catch {
1921
+ return null;
1922
+ }
1806
1923
  }
1924
+ function a(i, l) {
1925
+ try {
1926
+ r && r(i);
1927
+ const u = t(i), p = JSON.stringify(l);
1928
+ ee.setItem(u, p);
1929
+ } catch {
1930
+ }
1931
+ }
1932
+ function s(i) {
1933
+ try {
1934
+ r && r(i);
1935
+ const l = t(i);
1936
+ ee.deleteItem(l);
1937
+ } catch {
1938
+ }
1939
+ }
1940
+ return { get: o, set: a, clear: s };
1807
1941
  }
1808
- function Ws(e) {
1809
- const t = vt(e.appId, e.aiAgentId), r = JSON.stringify(e.data);
1810
- q.setItem(t, r);
1811
- }
1812
- function zs(e) {
1813
- const t = vt(e.appId, e.aiAgentId);
1814
- q.deleteItem(t);
1815
- }
1816
- function Gs() {
1817
- const { chatSDK: e, logger: t } = B(), { shouldSyncCachedTemplate: r, syncCachedTemplates: o, clearCachedTemplates: a } = gn(), s = W(
1942
+ const Ct = /iPad|iPhone|iPod/.test(navigator.userAgent), Ji = /Android/.test(navigator.userAgent), Ne = (e) => Ct || Ji, nt = Bn({
1943
+ keyGenerator: ({ appId: e, aiAgentId: t, userId: r }) => {
1944
+ const o = Xi(`${e}/${t}/${r}`);
1945
+ return `${bn.USER_DATA}/${o}`;
1946
+ },
1947
+ keyParamsValidator: ({ appId: e, aiAgentId: t, userId: r }) => {
1948
+ if (!e || !t || !r)
1949
+ throw new Error("Invalid parameters for user data cache");
1950
+ }
1951
+ });
1952
+ function Xi(e) {
1953
+ let t = 0;
1954
+ for (let r = 0; r < e.length; r++)
1955
+ t = (t << 5) - t + e.charCodeAt(r), t |= 0;
1956
+ return t.toString(16);
1957
+ }
1958
+ const rt = Bn({
1959
+ keyGenerator: ({ appId: e, aiAgentId: t }) => `${bn.SESSION}/${e}/${t}`
1960
+ });
1961
+ function Qi() {
1962
+ const { chatSDK: e, logger: t } = B(), { shouldSyncCachedTemplate: r, syncCachedTemplates: o, clearCachedTemplates: a } = hn(), s = F(
1818
1963
  async (l, u) => {
1819
- t.debug("authManager.authenticate: session:", l.userId), u && e.setSessionHandler(new lr(u)), await e.connect(l.userId, l.authToken), t.debug("authManager.authenticate: user:", e.currentUser), r(e) && await o(e);
1964
+ t.debug("authManager.authenticate: session:", l.userId), u && e.setSessionHandler(new pr(u)), await e.connect(l.userId, l.authToken), t.debug("authManager.authenticate: user:", e.currentUser), r(e) && await o(e);
1820
1965
  },
1821
1966
  [e, t, r, o]
1822
- ), i = W(async () => {
1967
+ ), i = F(async () => {
1823
1968
  t.debug("authManager.deauthenticate: disconnect"), await e.disconnect(), a();
1824
1969
  }, [e, t, a]);
1825
1970
  return {
@@ -1827,132 +1972,160 @@ function Gs() {
1827
1972
  deauthenticate: i
1828
1973
  };
1829
1974
  }
1830
- const js = 24 * 60 * 60 * 1e3, [Ks, U] = ee("MessengerSession");
1831
- function Zs({
1975
+ const es = 24 * 60 * 60 * 1e3, {
1976
+ Provider: ts,
1977
+ useContext: P
1978
+ } = j("MessengerSession");
1979
+ function ns({
1832
1980
  userSessionInfo: e,
1833
1981
  children: t
1834
1982
  }) {
1835
- const { appId: r, aiAgentId: o, chatSDK: a, agentPreviewConfigs: s, state: i, logger: l, language: u, countryCode: m, context: g, handlers: p } = B(), { updateTheme: h } = je(), { authenticate: f, deauthenticate: E } = Gs(), [x, b] = C(
1983
+ const { appId: r, aiAgentId: o, chatSDK: a, agentPreviewConfigs: s, state: i, logger: l, language: u, countryCode: p, context: m, handlers: h } = B(), { updateTheme: g } = yn(), { authenticate: b, deauthenticate: E } = Qi(), [x, f] = y(
1836
1984
  void 0
1837
- ), [S, v] = C(void 0), [$, N] = C(null), [w, D] = C(null), [te, y] = C(null), I = (s == null ? void 0 : s.forceCreateChannel) ?? !1;
1838
- function H() {
1985
+ ), [T, C] = y(void 0), [w, O] = y(null), [J, X] = y(null), [v, Q] = y(null), L = s == null ? void 0 : s.forceCreateChannel;
1986
+ function V() {
1839
1987
  if (e) {
1840
1988
  l.debug("messengerSession.initialize: manual session info detected");
1841
- const R = ["userId", "authToken", "sessionHandler"].filter((L) => !(L in e));
1842
- return R.length > 0 && l.error(
1843
- `messengerSession.initialize: missing required keys in userSessionInfo: ${R.join(", ")}`
1989
+ const A = ["userId", "authToken", "sessionHandler"].filter((R) => !(R in e));
1990
+ return A.length > 0 && l.error(
1991
+ `messengerSession.initialize: missing required keys in userSessionInfo: ${A.join(", ")}`
1844
1992
  ), e;
1845
1993
  }
1846
- const O = tt.get({ appId: r, aiAgentId: o });
1847
- return O ? O.expireAt - js <= Date.now() ? (l.debug("messengerSession.initialize: auto session expired, clear cache"), tt.clear({ appId: r, aiAgentId: o }), null) : (l.debug("messengerSession.initialize: auto session info detected"), O) : null;
1994
+ const I = rt.get({ appId: r, aiAgentId: o });
1995
+ return I ? I.expireAt - es <= Date.now() ? (l.debug("messengerSession.initialize: auto session expired, clear cache"), rt.clear({ appId: r, aiAgentId: o }), nt.clear({ appId: r, aiAgentId: o, userId: I.userId }), null) : (l.debug("messengerSession.initialize: auto session info detected"), I) : null;
1848
1996
  }
1849
- const be = W(async () => {
1850
- if ($) {
1851
- l.debug("messengerSession.refreshActiveChannel: try to refresh active channel"), b(void 0);
1852
- const O = await a.aiAgent.requestMessengerSettings({
1997
+ const Se = F(
1998
+ (I, A) => {
1999
+ nt.set({ appId: r, aiAgentId: o, userId: I }, { knownActiveChannelUrl: A });
2000
+ },
2001
+ [r, o]
2002
+ ), we = F(
2003
+ (I) => {
2004
+ const A = nt.get({ appId: r, aiAgentId: o, userId: I });
2005
+ return A == null ? void 0 : A.knownActiveChannelUrl;
2006
+ },
2007
+ [r, o]
2008
+ ), Qe = F(async () => {
2009
+ if (w) {
2010
+ l.debug("messengerSession.refreshActiveChannel: try to refresh active channel"), f(void 0);
2011
+ const I = await a.aiAgent.requestMessengerSettings({
1853
2012
  aiAgentId: o,
1854
- userId: $.userId,
2013
+ userId: w.userId,
1855
2014
  language: u,
1856
- country: m,
1857
- context: g,
1858
- forceCreateChannel: I
2015
+ country: p,
2016
+ context: m,
2017
+ forceCreateChannel: L,
2018
+ knownActiveChannelUrl: we(w.userId)
1859
2019
  });
1860
- return b({ url: O.active_channel.channel_url, status: j.OPEN }), l.info(
2020
+ return Se(w.userId, I.active_channel.channel_url), f({ url: I.active_channel.channel_url, status: z.OPEN }), l.info(
1861
2021
  "messengerSession.refreshActiveChannel: refreshed active channel",
1862
- O.active_channel.channel_url
1863
- ), O.active_channel.channel_url;
2022
+ I.active_channel.channel_url
2023
+ ), I.active_channel.channel_url;
1864
2024
  } else
1865
2025
  throw l.error("messengerSession.refreshActiveChannel: userSession is not ready"), new Error("userSession is not ready");
1866
- }, [a, o, $ == null ? void 0 : $.userId, u, m, g, I]);
2026
+ }, [
2027
+ a,
2028
+ r,
2029
+ o,
2030
+ w == null ? void 0 : w.userId,
2031
+ u,
2032
+ p,
2033
+ m,
2034
+ L,
2035
+ we,
2036
+ Se
2037
+ ]);
1867
2038
  return cn(a, {
1868
- onChannelChanged: (O) => {
1869
- var R;
1870
- O.isGroupChannel() && O.url === (x == null ? void 0 : x.url) && (l.info("messengerSession.channelChanged: channel.conversation", O.conversation), b({ url: O.url, status: ((R = O.conversation) == null ? void 0 : R.status) ?? j.OPEN }));
2039
+ onChannelChanged: (I) => {
2040
+ var A;
2041
+ I.isGroupChannel() && I.url === (x == null ? void 0 : x.url) && (l.info("messengerSession.channelChanged: channel.conversation", I.conversation), f({ url: I.url, status: ((A = I.conversation) == null ? void 0 : A.status) ?? z.OPEN }));
1871
2042
  },
1872
- async onUserJoined(O, R) {
1873
- var Y, Ee;
1874
- if (O.conversation && O.conversation.type === fr.PROACTIVE && R.userId === ((Y = a.currentUser) == null ? void 0 : Y.userId)) {
1875
- l.info("messengerSession.onUserJoined: proactive channel joined", O.url);
1876
- const Te = ((Ee = O.conversation) == null ? void 0 : Ee.status) ?? j.OPEN;
1877
- b({ url: O.url, status: Te }), i.setOpened(!0), Ys({
2043
+ async onUserJoined(I, A) {
2044
+ var Z, he;
2045
+ if (I.conversation && I.conversation.type === Cr.PROACTIVE && A.userId === ((Z = a.currentUser) == null ? void 0 : Z.userId)) {
2046
+ l.info("messengerSession.onUserJoined: proactive channel joined", I.url);
2047
+ const re = ((he = I.conversation) == null ? void 0 : he.status) ?? z.OPEN;
2048
+ f({ url: I.url, status: re }), i.setOpened(!0), rs({
1878
2049
  sound: document.hidden || !i.opened
1879
2050
  });
1880
2051
  }
1881
2052
  }
1882
- }), P(() => {
1883
- async function O() {
2053
+ }), N(() => {
2054
+ async function I() {
1884
2055
  l.debug("messengerSession.initialize: start");
1885
- const R = H(), L = await a.aiAgent.requestMessengerSettings({
2056
+ const A = V(), R = await a.aiAgent.requestMessengerSettings({
1886
2057
  aiAgentId: o,
1887
- userId: R == null ? void 0 : R.userId,
2058
+ userId: A == null ? void 0 : A.userId,
1888
2059
  language: u,
1889
- country: m,
1890
- context: g,
1891
- forceCreateChannel: I
2060
+ country: p,
2061
+ context: m,
2062
+ forceCreateChannel: L,
2063
+ knownActiveChannelUrl: we(A == null ? void 0 : A.userId)
1892
2064
  });
1893
- l.debug("messengerSession.initialize: messenger settings response", L);
1894
- let Y = null;
1895
- if (L.auto_created_user) {
1896
- const { user_id: z, session_token: ne, expire_at: Se } = L.auto_created_user;
1897
- tt.set({ appId: r, aiAgentId: o, data: { userId: z, authToken: ne, expireAt: Se } }), Y = { userId: z, authToken: ne };
2065
+ l.debug("messengerSession.initialize: messenger settings response", R);
2066
+ let Z = null;
2067
+ if (R.auto_created_user) {
2068
+ const { user_id: W, session_token: fe, expire_at: be } = R.auto_created_user;
2069
+ rt.set({ appId: r, aiAgentId: o }, { userId: W, authToken: fe, expireAt: be }), Z = { userId: W, authToken: fe };
1898
2070
  } else
1899
- Y = {
1900
- userId: (R == null ? void 0 : R.userId) ?? "",
1901
- authToken: (R == null ? void 0 : R.authToken) ?? ""
2071
+ Z = {
2072
+ userId: (A == null ? void 0 : A.userId) ?? "",
2073
+ authToken: (A == null ? void 0 : A.authToken) ?? ""
1902
2074
  };
1903
- function Ee() {
1904
- const z = L.appearance.selected_theme;
1905
- h(z, (Se) => {
1906
- const le = L.appearance.themes[Se ?? z];
2075
+ Se(Z.userId, R.active_channel.channel_url);
2076
+ function he() {
2077
+ const W = R.appearance.selected_theme;
2078
+ g(W, (be) => {
2079
+ const H = R.appearance.themes[be ?? W];
1907
2080
  return {
1908
- primary: le.primary_color,
1909
- botMessageBackground: le.bot_message_bg_color,
1910
- primaryContrast: le.primary_contrast_color,
1911
- botMessageBackgroundContrast: le.bot_message_bg_contrast_color
2081
+ primary: H.primary_color,
2082
+ botMessageBackground: H.bot_message_bg_color,
2083
+ primaryContrast: H.primary_contrast_color,
2084
+ botMessageBackgroundContrast: H.bot_message_bg_contrast_color
1912
2085
  };
1913
- }), v(void 0), N(Y), D({
1914
- userId: L.bot.bot_userid,
1915
- profileUrl: L.bot.bot_profile_url,
1916
- nickname: L.bot.bot_nickname,
1917
- replyToFile: L.bot.reply_to_file,
1918
- specialNotice: L.bot.special_notice,
1919
- specialNoticeEnabled: L.bot.is_special_notice_enabled,
1920
- showHandoffButton: L.bot.show_handoff_button ?? !0
1921
- }), y({
1922
- type: L.launcher.image_type || "default_icon",
1923
- imageUrl: L.launcher.image_url
1924
- }), L.launcher.auto_open && !Re() && setTimeout(() => i.setOpened(!0), 500);
2086
+ }), C(void 0), O(Z), X({
2087
+ userId: R.bot.bot_userid,
2088
+ profileUrl: R.bot.bot_profile_url,
2089
+ nickname: R.bot.bot_nickname,
2090
+ replyToFile: R.bot.reply_to_file,
2091
+ specialNotice: R.bot.special_notice,
2092
+ specialNoticeEnabled: R.bot.is_special_notice_enabled,
2093
+ showHandoffButton: R.bot.show_handoff_button ?? !0
2094
+ }), Q({
2095
+ type: R.launcher.image_type || "default_icon",
2096
+ imageUrl: R.launcher.image_url
2097
+ }), R.launcher.auto_open && !Ne() && setTimeout(() => i.setOpened(!0), 500);
1925
2098
  }
1926
- function Te() {
1927
- b({ url: L.active_channel.channel_url, status: j.OPEN });
2099
+ function re() {
2100
+ f({ url: R.active_channel.channel_url, status: z.OPEN });
1928
2101
  }
1929
2102
  try {
1930
- Ee(), await f(Y, e == null ? void 0 : e.sessionHandler), Te();
1931
- } catch (z) {
1932
- z instanceof Error && (l.error("messengerSession.initialize: failed to connect", z), v(z));
2103
+ he(), await b(Z, e == null ? void 0 : e.sessionHandler), re();
2104
+ } catch (W) {
2105
+ W instanceof Error && (l.error("messengerSession.initialize: failed to connect", W), C(W));
1933
2106
  }
1934
2107
  }
1935
- O().catch((R) => {
1936
- l.error("messengerSession: failed to initialize", R);
2108
+ I().catch((A) => {
2109
+ l.error("messengerSession: failed to initialize", A);
1937
2110
  });
1938
- }, [a, o, e == null ? void 0 : e.userId, e == null ? void 0 : e.authToken]), P(() => {
1939
- p != null && p.onRegisterDeauthenticateHandler && (l.debug("messengerSession: registering deauthenticate handler"), p.onRegisterDeauthenticateHandler(E));
1940
- }, [p == null ? void 0 : p.onRegisterDeauthenticateHandler, E]), !$ || !w || !te ? null : /* @__PURE__ */ n.createElement(
1941
- Ks.Provider,
2111
+ }, [a, r, o, e == null ? void 0 : e.userId, e == null ? void 0 : e.authToken]), N(() => {
2112
+ h != null && h.onRegisterDeauthenticateHandler && (l.debug("messengerSession: registering deauthenticate handler"), h.onRegisterDeauthenticateHandler(E));
2113
+ }, [h == null ? void 0 : h.onRegisterDeauthenticateHandler, E]), !w || !J || !v ? null : /* @__PURE__ */ n.createElement(
2114
+ ts,
1942
2115
  {
1943
2116
  value: {
1944
- userSession: $,
2117
+ userSession: w,
1945
2118
  activeChannel: x,
1946
- refreshActiveChannel: be,
1947
- connectionError: S,
1948
- aiAgentInfo: { ...w, ...s == null ? void 0 : s.bot },
1949
- launcherInfo: { ...te, ...s == null ? void 0 : s.launcher }
2119
+ refreshActiveChannel: Qe,
2120
+ connectionError: T,
2121
+ aiAgentInfo: { ...J, ...s == null ? void 0 : s.bot },
2122
+ launcherInfo: { ...v, ...s == null ? void 0 : s.launcher }
1950
2123
  }
1951
2124
  },
1952
2125
  t
1953
2126
  );
1954
2127
  }
1955
- function Ys({ sound: e }) {
2128
+ function rs({ sound: e }) {
1956
2129
  const t = "🔔You have received a new message", r = document.title, o = setInterval(() => {
1957
2130
  document.title = document.title === t ? r : t;
1958
2131
  }, 750);
@@ -1960,7 +2133,7 @@ function Ys({ sound: e }) {
1960
2133
  new Audio(a.default).play();
1961
2134
  });
1962
2135
  }
1963
- const zt = {
2136
+ const Gt = {
1964
2137
  file: "attach",
1965
2138
  snippet: "snippet",
1966
2139
  site: "website",
@@ -1970,7 +2143,7 @@ const zt = {
1970
2143
  sb_zendesk: "zendesk",
1971
2144
  sb_desk: "snippet"
1972
2145
  // TODO: request icon
1973
- }, qs = ({
2146
+ }, os = ({
1974
2147
  actionbook: e,
1975
2148
  functionCalls: t,
1976
2149
  groundedness: r,
@@ -1980,84 +2153,84 @@ const zt = {
1980
2153
  onClickFunctionCallDetail: i,
1981
2154
  onClickGroundedness: l,
1982
2155
  onClickAgentMessageTemplate: u,
1983
- bottomContent: m,
1984
- renderCustomGroundednessIcon: g = (h) => h.default,
1985
- style: p = {}
2156
+ bottomContent: p,
2157
+ renderCustomGroundednessIcon: m = (g) => g.default,
2158
+ style: h = {}
1986
2159
  }) => {
1987
2160
  const {
1988
2161
  // Note: This component is used with the dashboard, so cssVars should not be used.
1989
- iconColor: h = "#000000",
1990
- textColor: f = "#000000",
1991
- highlightColor: E = me.DEFAULT_PRIMARY
1992
- } = p;
1993
- return /* @__PURE__ */ n.createElement(Gt, null, e && /* @__PURE__ */ n.createElement(Gt, null, /* @__PURE__ */ n.createElement(Ge, null, /* @__PURE__ */ n.createElement(Fe, null, /* @__PURE__ */ n.createElement(A, { size: 16, type: "actionbook", color: h })), /* @__PURE__ */ n.createElement(
1994
- Pe,
2162
+ iconColor: g = "#000000",
2163
+ textColor: b = "#000000",
2164
+ highlightColor: E = de.DEFAULT_PRIMARY
2165
+ } = h;
2166
+ return /* @__PURE__ */ n.createElement(jt, null, e && /* @__PURE__ */ n.createElement(jt, null, /* @__PURE__ */ n.createElement(Ke, null, /* @__PURE__ */ n.createElement(Ve, null, /* @__PURE__ */ n.createElement($, { size: 16, type: "actionbook", color: g })), /* @__PURE__ */ n.createElement(
2167
+ Ue,
1995
2168
  {
1996
2169
  $clickable: !!a,
1997
2170
  $highlightColor: E,
1998
2171
  variant: "body2",
1999
- color: f,
2172
+ color: b,
2000
2173
  onClick: () => a == null ? void 0 : a(e)
2001
2174
  },
2002
2175
  e.name
2003
- ))), t == null ? void 0 : t.map((x) => /* @__PURE__ */ n.createElement(nt, { key: x.key }, /* @__PURE__ */ n.createElement(Fe, null, /* @__PURE__ */ n.createElement(A, { size: 16, type: "function", color: h })), /* @__PURE__ */ n.createElement(Ge, null, /* @__PURE__ */ n.createElement(
2004
- Pe,
2176
+ ))), t == null ? void 0 : t.map((x) => /* @__PURE__ */ n.createElement(ot, { key: x.key }, /* @__PURE__ */ n.createElement(Ve, null, /* @__PURE__ */ n.createElement($, { size: 16, type: "function", color: g })), /* @__PURE__ */ n.createElement(Ke, null, /* @__PURE__ */ n.createElement(
2177
+ Ue,
2005
2178
  {
2006
2179
  $clickable: !!a,
2007
2180
  $highlightColor: E,
2008
2181
  variant: "body2",
2009
- color: f,
2182
+ color: b,
2010
2183
  onClick: () => s == null ? void 0 : s(x)
2011
2184
  },
2012
2185
  x.name
2013
- ), /* @__PURE__ */ n.createElement(Xs, { role: "button", onClick: () => i == null ? void 0 : i(x) }, /* @__PURE__ */ n.createElement(T, { variant: "body2", color: E }, "View details"), /* @__PURE__ */ n.createElement(A, { type: "chevron-right", size: 16, color: E }))))), r == null ? void 0 : r.map((x) => /* @__PURE__ */ n.createElement(nt, { key: x.id }, /* @__PURE__ */ n.createElement(Fe, null, g({
2014
- default: /* @__PURE__ */ n.createElement(A, { size: 16, type: zt[x.source_type] ?? zt.snippet, color: h }),
2186
+ ), /* @__PURE__ */ n.createElement(is, { role: "button", onClick: () => i == null ? void 0 : i(x) }, /* @__PURE__ */ n.createElement(S, { variant: "body2", color: E }, "View details"), /* @__PURE__ */ n.createElement($, { type: "chevron-right", size: 16, color: E }))))), r == null ? void 0 : r.map((x) => /* @__PURE__ */ n.createElement(ot, { key: x.id }, /* @__PURE__ */ n.createElement(Ve, null, m({
2187
+ default: /* @__PURE__ */ n.createElement($, { size: 16, type: Gt[x.source_type] ?? Gt.snippet, color: g }),
2015
2188
  sourceType: x.source_type
2016
2189
  })), /* @__PURE__ */ n.createElement(
2017
- Pe,
2190
+ Ue,
2018
2191
  {
2019
2192
  $clickable: !!l,
2020
2193
  $highlightColor: E,
2021
2194
  variant: "body2",
2022
- color: f,
2195
+ color: b,
2023
2196
  onClick: () => l == null ? void 0 : l(x)
2024
2197
  },
2025
2198
  x.preview_title
2026
- ))), o == null ? void 0 : o.map((x) => /* @__PURE__ */ n.createElement(nt, { key: x.key }, /* @__PURE__ */ n.createElement(Fe, null, /* @__PURE__ */ n.createElement(A, { size: 16, type: "template", color: h })), /* @__PURE__ */ n.createElement(
2027
- Pe,
2199
+ ))), o == null ? void 0 : o.map((x) => /* @__PURE__ */ n.createElement(ot, { key: x.key }, /* @__PURE__ */ n.createElement(Ve, null, /* @__PURE__ */ n.createElement($, { size: 16, type: "template", color: g })), /* @__PURE__ */ n.createElement(
2200
+ Ue,
2028
2201
  {
2029
2202
  $clickable: !!u,
2030
2203
  $highlightColor: E,
2031
2204
  variant: "body2",
2032
- color: f,
2205
+ color: b,
2033
2206
  onClick: () => u == null ? void 0 : u(x)
2034
2207
  },
2035
2208
  x.name
2036
- ))), m);
2037
- }, Js = c(T)`font-weight:400;`, Pe = c(Js)`${({ $clickable: e, $highlightColor: t }) => e && k`
2209
+ ))), p);
2210
+ }, as = c(S)`font-weight:400;`, Ue = c(as)`${({ $clickable: e, $highlightColor: t }) => e && k`
2038
2211
  cursor: pointer;
2039
2212
  text-decoration: underline;
2040
2213
  &:hover {
2041
2214
  color: ${t};
2042
2215
  }
2043
2216
  `}
2044
- `, Fe = c.div`display:flex;align-items:center;justify-content:center;flex-shrink:0;`, Ge = c.div`display:flex;gap:8px;align-items:center;`, Xs = c(Ge)`cursor:pointer;gap:4px;`, nt = c(Ge)`flex-direction:row;align-items:center;`, Gt = c.div`display:flex;gap:4px;flex-direction:column;align-items:flex-start;`, On = _e(
2217
+ `, Ve = c.div`display:flex;align-items:center;justify-content:center;flex-shrink:0;`, Ke = c.div`display:flex;gap:8px;align-items:center;`, is = c(Ke)`cursor:pointer;gap:4px;`, ot = c(Ke)`flex-direction:row;align-items:center;`, jt = c.div`display:flex;gap:4px;flex-direction:column;align-items:flex-start;`, Dn = _e(
2045
2218
  null
2046
2219
  );
2047
- function Qs({
2220
+ function ss({
2048
2221
  isDashboardActionbookTester: e = !1,
2049
2222
  children: t
2050
2223
  }) {
2051
- return /* @__PURE__ */ n.createElement(On.Provider, { value: { isDashboardActionbookTester: e } }, e && /* @__PURE__ */ n.createElement(ei, null), t);
2224
+ return /* @__PURE__ */ n.createElement(Dn.Provider, { value: { isDashboardActionbookTester: e } }, e && /* @__PURE__ */ n.createElement(ls, null), t);
2052
2225
  }
2053
2226
  const Xe = () => {
2054
- const e = X(On);
2227
+ const e = te(Dn);
2055
2228
  if (!e) throw new Error("_UNSAFE_INTERNAL_DashboardActionbookTesterProvider not found");
2056
2229
  return e;
2057
- }, ei = () => /* @__PURE__ */ n.createElement(he.Template, { template: ti }, /* @__PURE__ */ n.createElement(he.MessageLogs, { component: ni })), ti = (e) => /* @__PURE__ */ n.createElement(kn, { ...e, testerMode: !0, maxBodyWidth: xn }), ni = ({ extendedMessagePayload: e = {} }) => {
2230
+ }, ls = () => /* @__PURE__ */ n.createElement(pe.Template, { template: cs }, /* @__PURE__ */ n.createElement(pe.MessageLogs, { component: ds })), cs = (e) => /* @__PURE__ */ n.createElement(Mn, { ...e, testerMode: !0, maxBodyWidth: Cn }), ds = ({ extendedMessagePayload: e = {} }) => {
2058
2231
  const { handlers: t } = B(), { manual: r, groundedness: o, function_calls: a, agent_message_templates: s, is_thinking: i } = e;
2059
- return i || !r && !o && !a && !s ? /* @__PURE__ */ n.createElement(n.Fragment, null) : /* @__PURE__ */ n.createElement(ri, null, /* @__PURE__ */ n.createElement(oi, { width: 4 }), /* @__PURE__ */ n.createElement(
2060
- qs,
2232
+ return i || !r && !(o != null && o.length) && !(a != null && a.length) && !(s != null && s.length) ? /* @__PURE__ */ n.createElement(n.Fragment, null) : /* @__PURE__ */ n.createElement(us, null, /* @__PURE__ */ n.createElement(ms, { width: 4 }), /* @__PURE__ */ n.createElement(
2233
+ os,
2061
2234
  {
2062
2235
  actionbook: r,
2063
2236
  functionCalls: a,
@@ -2069,21 +2242,21 @@ const Xe = () => {
2069
2242
  textColor: d.themedColor.textHighEmphasis,
2070
2243
  barColor: d.themedColor.textDisabled
2071
2244
  },
2072
- bottomContent: /* @__PURE__ */ n.createElement(ai, { variant: "caption2", color: d.themedColor.textLowEmphasis }, "Only visible in the tester")
2245
+ bottomContent: /* @__PURE__ */ n.createElement(ps, { variant: "caption2", color: d.themedColor.textLowEmphasis }, "Only visible in the tester")
2073
2246
  }
2074
2247
  ));
2075
- }, ri = c.div`display:flex;gap:16px;margin:16px ${Z}px 0;align-self:stretch;`, oi = c.div`width:${({ width: e }) => e}px;background-color:${d.themedColor.textDisabled};border-radius:100px;flex-shrink:0;`, ai = c(T)`margin-top:5px;`;
2076
- function Rn({
2248
+ }, us = c.div`display:flex;gap:16px;margin:16px ${q}px 0;align-self:stretch;`, ms = c.div`width:${({ width: e }) => e}px;background-color:${d.themedColor.textDisabled};border-radius:100px;flex-shrink:0;`, ps = c(S)`margin-top:5px;`;
2249
+ function Pn({
2077
2250
  rootElement: e = document.body,
2078
- logLevel: t = an.WARN,
2251
+ logLevel: t = sn.WARN,
2079
2252
  language: r = navigator.language,
2080
2253
  userSessionInfo: o,
2081
2254
  children: a,
2082
2255
  ...s
2083
2256
  }) {
2084
2257
  var i;
2085
- return xe.level !== t && (xe.level = t), xo("https://fonts.googleapis.com/css2?family=Roboto&display=swap", e), /* @__PURE__ */ n.createElement("div", { id: Q.ENTRY, style: { width: "fit-content", height: "fit-content" } }, /* @__PURE__ */ n.createElement(Vr, { logger: xe, storage: si }, /* @__PURE__ */ n.createElement(
2086
- Fs,
2258
+ return xe.level !== t && (xe.level = t), Po("https://fonts.googleapis.com/css2?family=Roboto&display=swap", e), /* @__PURE__ */ n.createElement("div", { id: ne.ENTRY, style: { width: "fit-content", height: "fit-content" } }, /* @__PURE__ */ n.createElement(ro, { logger: xe, storage: hs }, /* @__PURE__ */ n.createElement(
2259
+ Zi,
2087
2260
  {
2088
2261
  logger: xe,
2089
2262
  rootElement: e,
@@ -2093,7 +2266,7 @@ function Rn({
2093
2266
  messageTemplate: s.messageTemplate
2094
2267
  },
2095
2268
  /* @__PURE__ */ n.createElement(
2096
- Pr,
2269
+ Vr,
2097
2270
  {
2098
2271
  appId: s.appId,
2099
2272
  aiAgentId: s.aiAgentId,
@@ -2101,46 +2274,47 @@ function Rn({
2101
2274
  countryCode: s.countryCode,
2102
2275
  context: s.context,
2103
2276
  logger: xe,
2277
+ dispatcher: gs,
2104
2278
  chatParams: { customApiHost: s.customApiHost, customWebSocketHost: s.customWebSocketHost }
2105
2279
  },
2106
- /* @__PURE__ */ n.createElement(Us, { rootElement: e, ...s }, /* @__PURE__ */ n.createElement(Zs, { userSessionInfo: o }, /* @__PURE__ */ n.createElement(
2107
- Qs,
2280
+ /* @__PURE__ */ n.createElement(qi, { rootElement: e, ...s }, /* @__PURE__ */ n.createElement(ns, { userSessionInfo: o }, /* @__PURE__ */ n.createElement(
2281
+ ss,
2108
2282
  {
2109
2283
  isDashboardActionbookTester: s._UNSAFE_INTERNAL_isActionbookTester
2110
2284
  },
2111
2285
  a,
2112
- /* @__PURE__ */ n.createElement("div", { id: Q.MODAL_ROOT })
2286
+ /* @__PURE__ */ n.createElement("div", { id: ne.MODAL_ROOT })
2113
2287
  )))
2114
2288
  )
2115
2289
  )));
2116
2290
  }
2117
- const xe = new pn(an.WARN), cd = new un(xe), yt = "@sba/message-template", jt = (e) => `${yt}/templates/${e}`, Kt = () => `${yt}/token`, si = Fr({
2291
+ const xe = new pn(sn.WARN), gs = new un(xe), _t = "@sba/message-template", Kt = (e) => `${_t}/templates/${e}`, Zt = () => `${_t}/token`, hs = to({
2118
2292
  onSetTemplate: (e, t) => {
2119
- Wt[e] || q.setItem(jt(e), t);
2293
+ Wt[e] || ee.setItem(Kt(e), t);
2120
2294
  },
2121
2295
  onGetTemplate: (e) => {
2122
2296
  const t = Wt[e];
2123
- return t ? JSON.stringify(t) : q.getItem(jt(e));
2297
+ return t ? JSON.stringify(t) : ee.getItem(Kt(e));
2124
2298
  },
2125
2299
  onSetCachedToken(e) {
2126
- q.setItem(Kt(), e);
2300
+ ee.setItem(Zt(), e);
2127
2301
  },
2128
2302
  onGetCachedToken() {
2129
- return q.getItem(Kt());
2303
+ return ee.getItem(Zt());
2130
2304
  },
2131
2305
  onClear: () => {
2132
- q.getKeys(yt).forEach(q.deleteItem);
2306
+ ee.getKeys(_t).forEach(ee.deleteItem);
2133
2307
  }
2134
- }), Ln = ({ children: e, isOpened: t }) => {
2135
- const { dir: r, rootElement: o } = B(), a = pe(o, !0);
2136
- return P(() => {
2308
+ }), Fn = ({ children: e, isOpened: t }) => {
2309
+ const { dir: r, rootElement: o } = B(), a = ue(o, !0);
2310
+ return N(() => {
2137
2311
  const s = "sb-agent-block-scroll";
2138
2312
  return t ? a.body.classList.add(s) : a.body.classList.remove(s), () => {
2139
2313
  a.body.classList.remove(s);
2140
2314
  };
2141
- }, [a, t]), /* @__PURE__ */ n.createElement(ii, { dir: r, $visible: t }, e);
2142
- }, ii = c.div`width:100%;height:100%;position:fixed;top:0;left:0;z-index:${fe.WINDOW};visibility:${({ $visible: e }) => e ? "visible" : "hidden"};`;
2143
- function li({
2315
+ }, [a, t]), /* @__PURE__ */ n.createElement(fs, { dir: r, $visible: t }, e);
2316
+ }, fs = c.div`width:100%;height:100%;position:fixed;top:0;left:0;z-index:${ge.WINDOW};visibility:${({ $visible: e }) => e ? "visible" : "hidden"};`;
2317
+ function bs({
2144
2318
  className: e,
2145
2319
  isOpened: t,
2146
2320
  onClick: r,
@@ -2150,23 +2324,23 @@ function li({
2150
2324
  animated: i = !0,
2151
2325
  backgroundColor: l
2152
2326
  }) {
2153
- const u = We(l);
2327
+ const u = Ge(l);
2154
2328
  return /* @__PURE__ */ n.createElement(
2155
- ui,
2329
+ vs,
2156
2330
  {
2157
2331
  dir: s,
2158
- id: Q.LAUNCHER,
2332
+ id: ne.LAUNCHER,
2159
2333
  className: e,
2160
2334
  "aria-label": "Sendbird AIAgent Launcher",
2161
2335
  onClick: r,
2162
2336
  $animated: i,
2163
2337
  $backgroundColor: l
2164
2338
  },
2165
- /* @__PURE__ */ n.createElement(mi, { $isOpened: t, $animated: i, $fillColor: u }, /* @__PURE__ */ n.createElement(Zt.Open, { url: a, isDefaultIcon: o === "default_icon" })),
2166
- /* @__PURE__ */ n.createElement(pi, { $isOpened: t, $animated: i, $fillColor: u }, /* @__PURE__ */ n.createElement(Zt.Close, null))
2339
+ /* @__PURE__ */ n.createElement(ys, { $isOpened: t, $animated: i, $fillColor: u }, /* @__PURE__ */ n.createElement(Yt.Open, { url: a, isDefaultIcon: o === "default_icon" })),
2340
+ /* @__PURE__ */ n.createElement(Cs, { $isOpened: t, $animated: i, $fillColor: u }, /* @__PURE__ */ n.createElement(Yt.Close, null))
2167
2341
  );
2168
2342
  }
2169
- const ci = k`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transform:scale(1.1);}&:active{transform:scale(0.8);}`, di = k`img{width:100%;height:100%;object-fit:cover;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-drag:none;&[data-default-icon='true']{width:32px;height:32px;filter:${({ $fillColor: e }) => e === me.WHITE ? "grayscale(100%) brightness(2000%)" : "grayscale(100%) invert(100%) saturate(0%) brightness(0%) contrast(1000%)"};}}`, Nn = k`svg{width:32px;height:32px;${({ $fillColor: e }) => k`
2343
+ const Es = k`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transform:scale(1.1);}&:active{transform:scale(0.8);}`, xs = k`img{width:100%;height:100%;object-fit:cover;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-drag:none;&[data-default-icon='true']{width:32px;height:32px;filter:${({ $fillColor: e }) => e === de.WHITE ? "grayscale(100%) brightness(2000%)" : "grayscale(100%) invert(100%) saturate(0%) brightness(0%) contrast(1000%)"};}}`, Un = k`svg{width:32px;height:32px;${({ $fillColor: e }) => k`
2170
2344
  path {
2171
2345
  fill: ${e};
2172
2346
  }
@@ -2175,14 +2349,14 @@ const ci = k`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transfo
2175
2349
  }
2176
2350
  `}
2177
2351
  }
2178
- `, ui = c.button`position:relative;padding:0;width:48px;height:48px;background:${({ $backgroundColor: e }) => e};border-radius:50%;transition:all 0.3s cubic-bezier(0.31,-0.105,0.43,1.4);border:none;display:flex;justify-content:center;align-items:center;box-shadow:0 16px 24px 2px rgba(33,33,33,0.12),0 6px 30px 5px rgba(33,33,33,0.08),0 6px 10px -5px rgba(33,33,33,0.04);${({ $animated: e }) => e && ci}`, Bn = c.span`position:absolute;width:100%;height:100%;border-radius:50%;overflow:hidden;transition:transform 0.16s linear,opacity 0.08s linear,scale 0.16s linear;user-select:none;display:flex;justify-content:center;align-items:center;`, mi = c(Bn)`opacity:${({ $isOpened: e }) => e ? 0 : 1};transform:${({ $animated: e, $isOpened: t }) => e && (t ? "rotate(-90deg) scale(0)" : "rotate(0deg)")};${di}${Nn}`, pi = c(Bn)`scale:${({ $isOpened: e }) => e ? 1 : 0};transform:${({ $animated: e, $isOpened: t }) => e && (t ? "rotate(0deg)" : "rotate(-90deg)")};${Nn}`, Zt = {
2179
- Open: (e) => e.url ? /* @__PURE__ */ n.createElement("img", { src: e.url, alt: "launcher-img", "data-default-icon": e.isDefaultIcon }) : /* @__PURE__ */ n.createElement(pt, null),
2180
- Close: () => /* @__PURE__ */ n.createElement(A, { size: 32, type: "chevron-down" })
2352
+ `, vs = c.button`position:relative;padding:0;width:48px;height:48px;background:${({ $backgroundColor: e }) => e};border-radius:50%;transition:all 0.3s cubic-bezier(0.31,-0.105,0.43,1.4);border:none;display:flex;justify-content:center;align-items:center;box-shadow:0 16px 24px 2px rgba(33,33,33,0.12),0 6px 30px 5px rgba(33,33,33,0.08),0 6px 10px -5px rgba(33,33,33,0.04);${({ $animated: e }) => e && Es}`, Vn = c.span`position:absolute;width:100%;height:100%;border-radius:50%;overflow:hidden;transition:transform 0.16s linear,opacity 0.08s linear,scale 0.16s linear;user-select:none;display:flex;justify-content:center;align-items:center;`, ys = c(Vn)`opacity:${({ $isOpened: e }) => e ? 0 : 1};transform:${({ $animated: e, $isOpened: t }) => e && (t ? "rotate(-90deg) scale(0)" : "rotate(0deg)")};${xs}${Un}`, Cs = c(Vn)`scale:${({ $isOpened: e }) => e ? 1 : 0};transform:${({ $animated: e, $isOpened: t }) => e && (t ? "rotate(0deg)" : "rotate(-90deg)")};${Un}`, Yt = {
2353
+ Open: (e) => e.url ? /* @__PURE__ */ n.createElement("img", { src: e.url, alt: "launcher-img", "data-default-icon": e.isDefaultIcon }) : /* @__PURE__ */ n.createElement(Et, null),
2354
+ Close: () => /* @__PURE__ */ n.createElement($, { size: 32, type: "chevron-down" })
2181
2355
  };
2182
- function Dn({ className: e }) {
2183
- const { colors: t } = st(), { dir: r, state: o } = B(), { launcherInfo: a } = U();
2184
- return hi(), /* @__PURE__ */ n.createElement(
2185
- li,
2356
+ function Hn({ className: e }) {
2357
+ const { colors: t } = dt(), { dir: r, state: o } = B(), { launcherInfo: a } = P();
2358
+ return Ts(), /* @__PURE__ */ n.createElement(
2359
+ bs,
2186
2360
  {
2187
2361
  dir: r,
2188
2362
  className: e,
@@ -2194,26 +2368,26 @@ function Dn({ className: e }) {
2194
2368
  }
2195
2369
  );
2196
2370
  }
2197
- const gi = 1e3 * 60;
2198
- function hi() {
2199
- const { chatSDK: e, state: t, logger: r, enableAutoDisconnectInLauncher: o } = B(), a = F(null);
2200
- P(() => {
2371
+ const _s = 1e3 * 60;
2372
+ function Ts() {
2373
+ const { chatSDK: e, state: t, logger: r, enableAutoDisconnectInLauncher: o } = B(), a = D(null);
2374
+ N(() => {
2201
2375
  if (!o) return;
2202
2376
  function s() {
2203
2377
  a.current && (clearTimeout(a.current), a.current = null);
2204
2378
  }
2205
2379
  function i() {
2206
- e.connectionState === cr.CLOSED && (e.reconnect(), r.debug("useSDKInactivityTimeout: reconnected")), s(), r.debug("useSDKInactivityTimeout: clear disconnect schedule");
2380
+ e.connectionState === gr.CLOSED && (e.reconnect(), r.debug("useSDKInactivityTimeout: reconnected")), s(), r.debug("useSDKInactivityTimeout: clear disconnect schedule");
2207
2381
  }
2208
2382
  function l() {
2209
2383
  s(), a.current = setTimeout(async () => {
2210
2384
  await e.disconnectWebSocket(), r.debug("useSDKInactivityTimeout: disconnected");
2211
- }, gi);
2385
+ }, _s);
2212
2386
  }
2213
2387
  t.opened ? i() : (l(), r.debug("useSDKInactivityTimeout: schedule disconnect"));
2214
2388
  }, [o, e, t.opened]);
2215
2389
  }
2216
- const fi = ({ publishSynchronous: e = !1 }) => {
2390
+ const Ss = ({ publishSynchronous: e = !1 }) => {
2217
2391
  const t = /* @__PURE__ */ new Set();
2218
2392
  return {
2219
2393
  publish: (r) => {
@@ -2224,19 +2398,19 @@ const fi = ({ publishSynchronous: e = !1 }) => {
2224
2398
  subscribe: (r) => (t.add(r), () => t.delete(r))
2225
2399
  };
2226
2400
  };
2227
- function bi(e, t = []) {
2228
- const r = F(null), o = F(0), a = F(0), [s] = C(() => fi({ publishSynchronous: !0 })), [i, l] = C(!0);
2401
+ function ws(e, t = []) {
2402
+ const r = D(null), o = D(0), a = D(0), [s] = y(() => Ss({ publishSynchronous: !0 })), [i, l] = y(!0);
2229
2403
  return ye(() => {
2230
2404
  o.current = 0, a.current = 0, l(!0), r.current && (r.current.scrollTop = r.current.scrollHeight);
2231
- }, t), ye(() => s.subscribe(({ type: u, data: m }) => {
2232
- const { resolve: g, animated: p } = m ?? {};
2233
- if (!r.current) return g == null ? void 0 : g();
2405
+ }, t), ye(() => s.subscribe(({ type: u, data: p }) => {
2406
+ const { resolve: m, animated: h } = p ?? {};
2407
+ if (!r.current) return m == null ? void 0 : m();
2234
2408
  if (u === "scrollToBottom" && (r.current.scroll ? r.current.scroll({
2235
2409
  top: r.current.scrollHeight,
2236
- behavior: Yt(e, p)
2237
- }) : r.current.scrollTop = r.current.scrollHeight, a.current = 0, l(!0), g == null || g()), u === "scroll") {
2238
- const h = m == null ? void 0 : m.top, { scrollTop: f, scrollHeight: E, clientHeight: x } = r.current;
2239
- r.current.scroll ? r.current.scroll({ top: h, behavior: Yt(e, p) }) : typeof h == "number" && (r.current.scrollTop = h), a.current = Math.max(0, E - f - x), l(a.current === 0), g == null || g();
2410
+ behavior: qt(e, h)
2411
+ }) : r.current.scrollTop = r.current.scrollHeight, a.current = 0, l(!0), m == null || m()), u === "scroll") {
2412
+ const g = p == null ? void 0 : p.top, { scrollTop: b, scrollHeight: E, clientHeight: x } = r.current;
2413
+ r.current.scroll ? r.current.scroll({ top: g, behavior: qt(e, h) }) : typeof g == "number" && (r.current.scrollTop = g), a.current = Math.max(0, E - b - x), l(a.current === 0), m == null || m();
2240
2414
  }
2241
2415
  }), [e]), {
2242
2416
  scrollRef: r,
@@ -2247,10 +2421,10 @@ function bi(e, t = []) {
2247
2421
  scrollPositionRef: o
2248
2422
  };
2249
2423
  }
2250
- function Yt(e, t) {
2424
+ function qt(e, t) {
2251
2425
  return typeof t == "boolean" ? t ? "smooth" : "auto" : e;
2252
2426
  }
2253
- function Ei(e) {
2427
+ function ks(e) {
2254
2428
  return new Promise((t) => {
2255
2429
  const r = new Image();
2256
2430
  r.onload = function() {
@@ -2259,95 +2433,73 @@ function Ei(e) {
2259
2433
  }, r.src = URL.createObjectURL(e);
2260
2434
  });
2261
2435
  }
2262
- async function xi(e) {
2436
+ async function As(e) {
2263
2437
  if ("file" in e && e.file instanceof File && e.file.type.startsWith("image/")) {
2264
- const { width: t, height: r } = await Ei(e.file);
2265
- return new Sr({
2266
- key: Pn,
2438
+ const { width: t, height: r } = await ks(e.file);
2439
+ return new $r({
2440
+ key: zn,
2267
2441
  value: [t, r]
2268
2442
  });
2269
2443
  }
2270
2444
  }
2271
- const Pn = "KEY_IMG_ASPECT_RATIO", vi = ({ onScroll: e }) => {
2272
- const { agentPreviewConfigs: t, handlers: r } = B(), o = F(t == null ? void 0 : t.agentAttributes);
2445
+ const zn = "KEY_IMG_ASPECT_RATIO", Is = ({ onScroll: e }) => {
2446
+ const { agentPreviewConfigs: t, handlers: r } = B(), o = D(t == null ? void 0 : t.agentAttributes);
2273
2447
  return o.current = t == null ? void 0 : t.agentAttributes, {
2274
2448
  onBeforeSendMessage: async (a) => {
2275
- var g, p;
2276
- const s = await xi(a), i = {
2449
+ const s = await As(a), i = {
2277
2450
  ...a,
2278
2451
  metaArrays: s ? [s] : void 0
2279
- }, l = ((g = o.current) == null ? void 0 : g.ai) ?? {}, u = ((p = o.current) == null ? void 0 : p.safeguard) ?? {};
2280
- return Object.keys(l).length > 0 || Object.keys(u).length > 0 ? { ...i, data: JSON.stringify({ ai_attrs: l, safeguard_attrs: u }) } : i;
2452
+ }, l = $s(o.current);
2453
+ return l ? { ...i, data: JSON.stringify(l) } : i;
2281
2454
  },
2282
2455
  onAfterSendMessage: (a) => {
2283
2456
  var s;
2284
2457
  e(), (s = r == null ? void 0 : r.onMessageSend) == null || s.call(r, a.message);
2285
2458
  }
2286
2459
  };
2287
- }, [yi, K] = ee("Conversation");
2288
- function Ci({
2289
- children: e,
2290
- closedChannelUrl: t,
2291
- onClearClosedChannelUrl: r,
2292
- onNavigateToConversationList: o
2293
- }) {
2294
- const { logger: a, chatSDK: s, dispatcher: i } = B(), { activeChannel: l, refreshActiveChannel: u } = U(), m = t || (l == null ? void 0 : l.url), g = async () => {
2295
- await u(), t && (r == null || r());
2296
- }, p = bi("smooth"), h = () => {
2297
- setTimeout(() => p.scrollPubSub.publish({ type: "scrollToBottom" }), 25);
2298
- }, { onBeforeSendMessage: f, onAfterSendMessage: E } = vi({ onScroll: h }), [x, b] = C(), [S, v] = C(), $ = Hr(s, x, {
2299
- shouldCountNewMessages: () => !1,
2300
- onChannelDeleted: () => g(),
2301
- onMessagesReceived: h,
2302
- onMessagesUpdated: h,
2303
- logger: a
2304
- });
2305
- async function N() {
2306
- if (a.debug("conversation.fetchChannel: start"), b(void 0), v(void 0), m)
2307
- try {
2308
- a.debug("conversation.fetchChannel: get channel", m);
2309
- const w = await s.groupChannel.getChannel(m);
2310
- b(w);
2311
- const D = new sn({ onReconnectSucceeded: () => w.refresh() });
2312
- s.addConnectionHandler("sba-refresh", D), a.debug("conversation.fetchChannel: fetched channel", w);
2313
- } catch (w) {
2314
- w instanceof on && v(w), a.error("conversation.fetchChannel: error", w);
2315
- }
2316
- }
2317
- return P(() => {
2318
- N();
2319
- }, [m]), P(() => {
2320
- const w = async () => {
2321
- a.debug("conversation.dispatcher: try to close conversation", x), x != null && x.conversation && ht(x) && (await x.closeConversation(), await u());
2322
- };
2323
- return i.subscribe(rt.ConversationClose, w), () => {
2324
- i.unsubscribe(rt.ConversationClose, w);
2325
- };
2326
- }, [i, x, u]), /* @__PURE__ */ n.createElement(
2327
- yi.Provider,
2460
+ }, $s = (e) => {
2461
+ if (!e) return null;
2462
+ const t = {};
2463
+ return e.ai && Object.keys(e.ai).length > 0 && (t.ai_attrs = e.ai), e.safeguard && Object.keys(e.safeguard).length > 0 && (t.safeguard_attrs = e.safeguard), typeof e.use_prompt_cache == "boolean" && (t.use_prompt_cache = e.use_prompt_cache), Object.keys(t).length > 0 ? t : null;
2464
+ }, {
2465
+ Provider: Ms,
2466
+ useContext: K
2467
+ } = j("Conversation"), Os = ({
2468
+ closedChannelUrl: e,
2469
+ onClearClosedChannelUrl: t,
2470
+ onNavigateToConversationList: r,
2471
+ children: o
2472
+ }) => {
2473
+ const { activeChannel: a, refreshActiveChannel: s } = P(), i = ws("smooth"), l = () => {
2474
+ setTimeout(() => i.scrollPubSub.publish({ type: "scrollToBottom" }), 25);
2475
+ }, { onBeforeSendMessage: u, onAfterSendMessage: p } = Is({ onScroll: l }), m = F(async () => {
2476
+ await s(), e && (t == null || t());
2477
+ }, [s, e, t]);
2478
+ return /* @__PURE__ */ n.createElement(
2479
+ Kr,
2328
2480
  {
2329
- value: {
2330
- channel: x,
2331
- channelFetchError: S,
2332
- fetchChannel: N,
2333
- dataSource: $,
2334
- scrollSource: p,
2335
- goToActiveConversation: g,
2336
- onBeforeSendMessage: f,
2337
- onAfterSendMessage: E,
2338
- onNavigateToConversationList: o
2339
- }
2481
+ channelUrl: e || (a == null ? void 0 : a.url),
2482
+ onBeforeSendMessage: u,
2483
+ onAfterSendMessage: p,
2484
+ onMessagesUpdated: l,
2485
+ onChannelDeleted: m,
2486
+ onConversationClosedViaDispatcher: m
2340
2487
  },
2341
- e
2488
+ (h) => /* @__PURE__ */ n.createElement(
2489
+ Ms,
2490
+ {
2491
+ value: { ...h, scrollSource: i, goToActiveConversation: m, onNavigateToConversationList: r }
2492
+ },
2493
+ o
2494
+ )
2342
2495
  );
2343
- }
2344
- const Ct = _e({
2345
- onDrop: ze,
2346
- subscribe: () => ze
2347
- }), ot = ({ children: e }) => {
2348
- const t = F(/* @__PURE__ */ new Set());
2496
+ }, Tt = _e({
2497
+ onDrop: je,
2498
+ subscribe: () => je
2499
+ }), st = ({ children: e }) => {
2500
+ const t = D(/* @__PURE__ */ new Set());
2349
2501
  return /* @__PURE__ */ n.createElement(
2350
- Ct.Provider,
2502
+ Tt.Provider,
2351
2503
  {
2352
2504
  value: {
2353
2505
  onDrop: (r) => {
@@ -2362,25 +2514,25 @@ const Ct = _e({
2362
2514
  },
2363
2515
  e
2364
2516
  );
2365
- }, _i = ({ onDropFiles: e }) => {
2366
- const { subscribe: t } = X(Ct);
2367
- P(() => t(e), [e]);
2517
+ }, Rs = ({ onDropFiles: e }) => {
2518
+ const { subscribe: t } = te(Tt);
2519
+ N(() => t(e), [e]);
2368
2520
  };
2369
- ot.Consumer = ({ children: e }) => {
2370
- const { onDrop: t } = X(Ct);
2521
+ st.Consumer = ({ children: e }) => {
2522
+ const { onDrop: t } = te(Tt);
2371
2523
  return e({ onDrop: t, onDragOver: (a) => a.preventDefault() });
2372
2524
  };
2373
- const dd = ({ iconSize: e = 64, icon: t, className: r, label: o, children: a }) => /* @__PURE__ */ n.createElement(Si, { className: r }, /* @__PURE__ */ n.createElement(A, { type: t, size: e, color: d.themedColor.onbackground3 }), /* @__PURE__ */ n.createElement(T, { variant: "body1", color: d.themedColor.onbackground2 }, o), a), Ti = c.div`position:relative;display:flex;justify-content:center;align-items:center;width:100%;height:100%;`, Si = c.div`display:flex;flex-direction:column;min-height:104px;align-items:center;gap:20px;text-align:center;`, ki = {
2374
- loading: _(() => import("./DnKaqbmp.js")),
2375
- error: _(() => import("./DfJKEre2.js")),
2376
- noChannels: _(() => import("./BLrqIqwk.js")),
2377
- noMessages: _(() => import("./DAMSBm7t.js"))
2525
+ const xd = ({ iconSize: e = 64, icon: t, className: r, label: o, children: a }) => /* @__PURE__ */ n.createElement(Ns, { className: r }, /* @__PURE__ */ n.createElement($, { type: t, size: e, color: d.themedColor.onbackground3 }), /* @__PURE__ */ n.createElement(S, { variant: "body1", color: d.themedColor.onbackground2 }, o), a), Ls = c.div`position:relative;display:flex;justify-content:center;align-items:center;width:100%;height:100%;`, Ns = c.div`display:flex;flex-direction:column;min-height:104px;align-items:center;gap:20px;text-align:center;`, Bs = {
2526
+ loading: _(() => import("./BadiWqxO.js")),
2527
+ error: _(() => import("./eeqIVbCW.js")),
2528
+ noChannels: _(() => import("./ZtOVM8hp.js")),
2529
+ noMessages: _(() => import("./NuQQJV2A.js"))
2378
2530
  }, Ce = ({ className: e, type: t = "loading", ...r }) => {
2379
- const o = ki[t];
2380
- return /* @__PURE__ */ n.createElement(Ti, { className: e }, /* @__PURE__ */ n.createElement(Ae, { fallback: null }, /* @__PURE__ */ n.createElement(o, { ...r })));
2381
- }, _t = {
2531
+ const o = Bs[t];
2532
+ return /* @__PURE__ */ n.createElement(Ls, { className: e }, /* @__PURE__ */ n.createElement(Ie, { fallback: null }, /* @__PURE__ */ n.createElement(o, { ...r })));
2533
+ }, St = {
2382
2534
  isStreaming(e) {
2383
- const t = Dt(e.data);
2535
+ const t = Pt(e.data);
2384
2536
  return typeof t == "object" ? !!t.stream : !1;
2385
2537
  },
2386
2538
  isWelcomeMessage(e, t) {
@@ -2388,81 +2540,81 @@ const dd = ({ iconSize: e = 64, icon: t, className: r, label: o, children: a })
2388
2540
  if (((r = e.extendedMessagePayload) == null ? void 0 : r.bot_message_type) === "welcome")
2389
2541
  return !0;
2390
2542
  if ((e.isUserMessage() || e.isFileMessage()) && e.sender.userId === t) {
2391
- const o = Dt(e.data);
2543
+ const o = Pt(e.data);
2392
2544
  return !(o != null && o.respond_mesg_id) && !(o != null && o.stream);
2393
2545
  }
2394
2546
  return !1;
2395
2547
  }
2396
2548
  };
2397
- function wi(e) {
2549
+ function Ds(e) {
2398
2550
  return "sendingStatus" in e ? e.sendingStatus === "succeeded" ? String(e.messageId) : e.reqId : String(e.messageId);
2399
2551
  }
2400
- const Ai = (e, t, r, o = !0) => {
2552
+ const Ps = (e, t, r, o = !0) => {
2401
2553
  if (!o || !e.isUserMessage() && !e.isFileMessage())
2402
2554
  return "single";
2403
2555
  const a = () => {
2404
2556
  if (!t || !t.isUserMessage() && !t.isFileMessage()) return !1;
2405
- const u = t.sender.userId === e.sender.userId, m = At(t.createdAt, e.createdAt);
2406
- return u && m;
2557
+ const u = t.sender.userId === e.sender.userId, p = $t(t.createdAt, e.createdAt);
2558
+ return u && p;
2407
2559
  }, s = () => {
2408
2560
  if (!r || !r.isUserMessage() && !r.isFileMessage()) return !1;
2409
- const u = r.sender.userId === e.sender.userId, m = At(r.createdAt, e.createdAt);
2410
- return u && m;
2561
+ const u = r.sender.userId === e.sender.userId, p = $t(r.createdAt, e.createdAt);
2562
+ return u && p;
2411
2563
  }, i = a(), l = s();
2412
2564
  return i && l ? "middle" : i ? "bottom" : l ? "top" : "single";
2413
2565
  };
2414
- function Ii(e, t) {
2415
- return e.filter((r) => _t.isWelcomeMessage(r, t));
2566
+ function Fs(e, t) {
2567
+ return e.filter((r) => St.isWelcomeMessage(r, t));
2416
2568
  }
2417
- function Fn(e, t) {
2418
- return Mi(e) === t;
2569
+ function Wn(e, t) {
2570
+ return Us(e) === t;
2419
2571
  }
2420
- function Mi(e) {
2572
+ function Us(e) {
2421
2573
  var t;
2422
2574
  if (e)
2423
2575
  return e.isUserMessage() || e.isFileMessage() || e.isMultipleFilesMessage() ? e.sender.userId : ((t = e == null ? void 0 : e.sender) == null ? void 0 : t.userId) ?? void 0;
2424
2576
  }
2425
- function $i(e) {
2577
+ function Vs(e) {
2426
2578
  return e.isAdminMessage() ? e.message === "The channel's custom_type was updated." : !1;
2427
2579
  }
2428
- const qt = (e) => !!e && "sender" in e, Un = (e) => e.startsWith("image/"), Vn = (e) => e.startsWith("video/"), Jt = (e) => Un(e) || Vn(e), Ue = {
2580
+ const Jt = (e) => !!e && "sender" in e, Gn = (e) => e.startsWith("image/"), jn = (e) => e.startsWith("video/"), Xt = (e) => Gn(e) || jn(e), He = {
2429
2581
  isAdmin: (e) => e.isAdminMessage(),
2430
2582
  isCSAT: (e) => {
2431
2583
  var t;
2432
2584
  return e.isAdminMessage() && !!((t = e.extendedMessagePayload) != null && t.csat);
2433
2585
  },
2434
- isIncoming: (e, t) => qt(e) && e.sender.userId !== t,
2435
- isOutgoing: (e, t) => qt(e) && (e.sender.userId === t || e.sendingStatus === kr.PENDING)
2436
- }, Hn = ({ rootElementId: e, visible: t, onClose: r, children: o }) => {
2586
+ isIncoming: (e, t) => Jt(e) && e.sender.userId !== t,
2587
+ isOutgoing: (e, t) => Jt(e) && (e.sender.userId === t || e.sendingStatus === Mr.PENDING)
2588
+ }, Kn = ({ rootElementId: e, visible: t, onClose: r, children: o }) => {
2437
2589
  if (!t) return null;
2438
- const { rootElement: a } = B(), s = pe(a), i = pe(a, !0);
2439
- return Ar(
2440
- /* @__PURE__ */ n.createElement(Oi, { onClick: r }, /* @__PURE__ */ n.createElement(Ri, { onClick: (l) => l.stopPropagation() }, o)),
2441
- s.getElementById(e) ?? s.getElementById(Q.MODAL_ROOT) ?? i.body
2590
+ const { rootElement: a } = B(), s = ue(a), i = ue(a, !0);
2591
+ return Rr(
2592
+ /* @__PURE__ */ n.createElement(Hs, { onClick: r }, /* @__PURE__ */ n.createElement(zs, { onClick: (l) => l.stopPropagation() }, o)),
2593
+ s.getElementById(e) ?? s.getElementById(ne.MODAL_ROOT) ?? i.body
2442
2594
  );
2443
- }, Oi = c.div`position:fixed;top:0;left:0;width:100%;height:100%;background:${d.color.overlay01};display:flex;justify-content:center;align-items:center;z-index:${fe.MODAL};`, Ri = c.div`border-radius:4px;overflow:hidden;box-shadow:0 16px 24px 2px rgba(13,13,13,0.12),0 6px 30px 5px rgba(13,13,13,0.08),0 6px 10px -5px rgba(13,13,13,0.04);z-index:${fe.MODAL};`, Li = c.div`flex-shrink:0;width:${({ $size: e }) => ge(e)};height:${({ $size: e }) => ge(e)};background-color:${({ theme: e }) => e.colors.base.primary};box-sizing:border-box;padding:6px;border-radius:50%;display:flex;justify-content:center;align-items:center;}`, Ni = c(pt)`path{fill:${({ theme: e }) => We(e.colors.base.primary)};}`;
2444
- function Wn({ size: e }) {
2445
- const { aiAgentInfo: t } = U();
2446
- return t.profileUrl ? /* @__PURE__ */ n.createElement(gt, { size: e, src: t.profileUrl }) : /* @__PURE__ */ n.createElement(Li, { $size: e }, /* @__PURE__ */ n.createElement(Ni, null));
2595
+ }, Hs = c.div`position:fixed;top:0;left:0;width:100%;height:100%;background:${d.color.overlay01};display:flex;justify-content:center;align-items:center;z-index:${ge.MODAL};`, zs = c.div`border-radius:4px;overflow:hidden;box-shadow:0 16px 24px 2px rgba(13,13,13,0.12),0 6px 30px 5px rgba(13,13,13,0.08),0 6px 10px -5px rgba(13,13,13,0.04);z-index:${ge.MODAL};`, Ws = c.div`flex-shrink:0;width:${({ $size: e }) => me(e)};height:${({ $size: e }) => me(e)};background-color:${({ theme: e }) => e.colors.base.primary};box-sizing:border-box;padding:6px;border-radius:50%;display:flex;justify-content:center;align-items:center;}`, Gs = c(Et)`path{fill:${({ theme: e }) => Ge(e.colors.base.primary)};}`;
2596
+ function Zn({ size: e }) {
2597
+ const { aiAgentInfo: t } = P();
2598
+ return t.profileUrl ? /* @__PURE__ */ n.createElement(xt, { size: e, src: t.profileUrl }) : /* @__PURE__ */ n.createElement(Ws, { $size: e }, /* @__PURE__ */ n.createElement(Gs, null));
2447
2599
  }
2448
- const Bi = c.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none;`, Di = c.div`height:64px;min-height:64px;box-sizing:border-box;display:flex;justify-content:space-between;border-bottom:1px solid ${d.themedColor.onbackground4};background-color:${d.themedColor.background1};@media screen and (max-width:768px){position:relative;}`, Pi = c.div`box-sizing:border-box;display:flex;flex-direction:row;align-items:center;height:64px;padding:16px 20px;width:calc(100% - 128px);`, Fi = c.div`margin-inline-end:8px;`, Ui = c.div`max-width:500px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;@media screen and (max-width:768px){position:absolute;inset-inline-start:64px;top:10px;display:block;max-width:calc(100vw - 240px);}`, Vi = c.div`display:inline-block;margin-inline-start:8px;padding-top:5px;@media screen and (max-width:768px){position:absolute;inset-inline-start:56px;top:24px;}`, Hi = c.div`display:flex;width:160px;justify-content:flex-end;`, Wi = c.div`inset-inline-end:0;display:flex;flex-direction:row;`, at = c.div`width:64px;padding:21px;box-sizing:border-box;cursor:${(e) => e.disabled ? "not-allowed" : "pointer"};`, zi = c(at)`border-inline-start:1px solid ${d.themedColor.onbackground4};`, Gi = c.div`width:100%;height:100%;display:flex;align-items:center;justify-content:center;`, ji = c.video`max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;`, Ki = c.img`max-width:90%;max-height:90%;user-select:none;-webkit-user-drag:none;`, Zi = c.div`max-width:100%;max-height:100%;display:flex;justify-content:center;align-items:center;`, Yi = ({ message: e, onClose: t, onDownloadClick: r }) => {
2449
- const { sender: o, type: a, url: s, name: i = "", threadInfo: l } = e, { profileUrl: u, nickname: m, userId: g } = o, { userSession: p, aiAgentInfo: h } = U();
2600
+ const js = c.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none;`, Ks = c.div`height:64px;min-height:64px;box-sizing:border-box;display:flex;justify-content:space-between;border-bottom:1px solid ${d.themedColor.onbackground4};background-color:${d.themedColor.background1};@media screen and (max-width:768px){position:relative;}`, Zs = c.div`box-sizing:border-box;display:flex;flex-direction:row;align-items:center;height:64px;padding:16px 20px;width:calc(100% - 128px);`, Ys = c.div`margin-inline-end:8px;`, qs = c.div`max-width:500px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;@media screen and (max-width:768px){position:absolute;inset-inline-start:64px;top:10px;display:block;max-width:calc(100vw - 240px);}`, Js = c.div`display:inline-block;margin-inline-start:8px;padding-top:5px;@media screen and (max-width:768px){position:absolute;inset-inline-start:56px;top:24px;}`, Xs = c.div`display:flex;width:160px;justify-content:flex-end;`, Qs = c.div`inset-inline-end:0;display:flex;flex-direction:row;`, lt = c.div`width:64px;padding:21px;box-sizing:border-box;cursor:${(e) => e.disabled ? "not-allowed" : "pointer"};`, el = c(lt)`border-inline-start:1px solid ${d.themedColor.onbackground4};`, tl = c.div`width:100%;height:100%;display:flex;align-items:center;justify-content:center;`, nl = c.video`max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;`, rl = c.img`max-width:90%;max-height:90%;user-select:none;-webkit-user-drag:none;`, ol = c.div`max-width:100%;max-height:100%;display:flex;justify-content:center;align-items:center;`, al = ({ message: e, onClose: t, onDownloadClick: r }) => {
2601
+ const { sender: o, type: a, url: s, name: i = "", threadInfo: l } = e, { profileUrl: u, nickname: p, userId: m } = o, { userSession: h, aiAgentInfo: g } = P();
2450
2602
  return /* @__PURE__ */ n.createElement(
2451
- Ji,
2603
+ sl,
2452
2604
  {
2453
2605
  profileUrl: u,
2454
- nickname: m,
2606
+ nickname: p,
2455
2607
  type: a,
2456
2608
  url: s,
2457
2609
  name: i,
2458
2610
  onClose: t,
2459
- isBotMessage: g === h.userId,
2460
- isByMe: p.userId === g,
2611
+ isBotMessage: m === g.userId,
2612
+ isByMe: h.userId === m,
2461
2613
  disableDelete: l != null && l.replyCount ? l.replyCount > 0 : !1,
2462
2614
  onDownloadClick: r
2463
2615
  }
2464
2616
  );
2465
- }, qi = ({ profileUrl: e, isBotMessage: t }) => !e && t ? /* @__PURE__ */ n.createElement(Wn, { size: 32 }) : /* @__PURE__ */ n.createElement(gt, { size: 32, src: e }), Ji = ({
2617
+ }, il = ({ profileUrl: e, isBotMessage: t }) => !e && t ? /* @__PURE__ */ n.createElement(Zn, { size: 32 }) : /* @__PURE__ */ n.createElement(xt, { size: 32, src: e }), sl = ({
2466
2618
  profileUrl: e,
2467
2619
  isBotMessage: t,
2468
2620
  nickname: r,
@@ -2472,34 +2624,34 @@ const Bi = c.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
2472
2624
  isByMe: i,
2473
2625
  onClose: l,
2474
2626
  onDelete: u,
2475
- disableDelete: m,
2476
- onDownloadClick: g
2627
+ disableDelete: p,
2628
+ onDownloadClick: m
2477
2629
  }) => {
2478
- const { stringSet: p } = M();
2479
- return /* @__PURE__ */ n.createElement(Hn, { onClose: l, visible: !0, rootElementId: Q.MODAL_ROOT }, /* @__PURE__ */ n.createElement(Bi, null, /* @__PURE__ */ n.createElement(Di, null, /* @__PURE__ */ n.createElement(Pi, null, /* @__PURE__ */ n.createElement(Fi, null, /* @__PURE__ */ n.createElement(qi, { profileUrl: e, isBotMessage: t })), /* @__PURE__ */ n.createElement(Ui, null, /* @__PURE__ */ n.createElement(T, { variant: "h2", color: d.themedColor.onbackground1 }, o)), /* @__PURE__ */ n.createElement(Vi, null, /* @__PURE__ */ n.createElement(T, { variant: "body1", color: d.color.ondark02 }, r))), /* @__PURE__ */ n.createElement(Hi, null, Jt(a) && /* @__PURE__ */ n.createElement(Wi, null, /* @__PURE__ */ n.createElement(at, { as: "a", href: s, target: "_blank", rel: lt, onClick: g }, /* @__PURE__ */ n.createElement(A, { type: "download", color: d.themedColor.onbackground1, size: 24 })), u && i && /* @__PURE__ */ n.createElement(
2480
- at,
2630
+ const { stringSet: h } = M();
2631
+ return /* @__PURE__ */ n.createElement(Kn, { onClose: l, visible: !0, rootElementId: ne.MODAL_ROOT }, /* @__PURE__ */ n.createElement(js, null, /* @__PURE__ */ n.createElement(Ks, null, /* @__PURE__ */ n.createElement(Zs, null, /* @__PURE__ */ n.createElement(Ys, null, /* @__PURE__ */ n.createElement(il, { profileUrl: e, isBotMessage: t })), /* @__PURE__ */ n.createElement(qs, null, /* @__PURE__ */ n.createElement(S, { variant: "h2", color: d.themedColor.onbackground1 }, o)), /* @__PURE__ */ n.createElement(Js, null, /* @__PURE__ */ n.createElement(S, { variant: "body1", color: d.color.ondark02 }, r))), /* @__PURE__ */ n.createElement(Xs, null, Xt(a) && /* @__PURE__ */ n.createElement(Qs, null, /* @__PURE__ */ n.createElement(lt, { as: "a", href: s, target: "_blank", rel: pt, onClick: m }, /* @__PURE__ */ n.createElement($, { type: "download", color: d.themedColor.onbackground1, size: 24 })), u && i && /* @__PURE__ */ n.createElement(
2632
+ lt,
2481
2633
  {
2482
- disabled: m,
2634
+ disabled: p,
2483
2635
  onClick: () => {
2484
- m || u();
2636
+ p || u();
2485
2637
  }
2486
2638
  },
2487
2639
  /* @__PURE__ */ n.createElement(
2488
- A,
2640
+ $,
2489
2641
  {
2490
2642
  type: "delete",
2491
- color: m ? "gray" : d.themedColor.onbackground1,
2643
+ color: p ? "gray" : d.themedColor.onbackground1,
2492
2644
  size: 24
2493
2645
  }
2494
2646
  )
2495
- )), /* @__PURE__ */ n.createElement(zi, { onClick: l }, /* @__PURE__ */ n.createElement(A, { type: "close", color: d.themedColor.onbackground1, size: 24 })))), /* @__PURE__ */ n.createElement(Gi, { onClick: (h) => h.currentTarget === h.target && l() }, Vn(a) && /* @__PURE__ */ n.createElement(ji, { controls: !0 }, /* @__PURE__ */ n.createElement("source", { src: s, type: a })), Un(a) && /* @__PURE__ */ n.createElement(Ki, { src: s, alt: o }), !Jt(a) && /* @__PURE__ */ n.createElement(Zi, null, /* @__PURE__ */ n.createElement(T, { variant: "h1", color: d.themedColor.onbackground1 }, p.FILE_VIEWER__UNSUPPORT)))));
2496
- }, zn = ({
2647
+ )), /* @__PURE__ */ n.createElement(el, { onClick: l }, /* @__PURE__ */ n.createElement($, { type: "close", color: d.themedColor.onbackground1, size: 24 })))), /* @__PURE__ */ n.createElement(tl, { onClick: (g) => g.currentTarget === g.target && l() }, jn(a) && /* @__PURE__ */ n.createElement(nl, { controls: !0 }, /* @__PURE__ */ n.createElement("source", { src: s, type: a })), Gn(a) && /* @__PURE__ */ n.createElement(rl, { src: s, alt: o }), !Xt(a) && /* @__PURE__ */ n.createElement(ol, null, /* @__PURE__ */ n.createElement(S, { variant: "h1", color: d.themedColor.onbackground1 }, h.FILE_VIEWER__UNSUPPORT)))));
2648
+ }, Yn = ({
2497
2649
  className: e,
2498
2650
  locale: t,
2499
2651
  date: r = Date.now(),
2500
2652
  formatString: o = "MMMM dd, yyyy",
2501
2653
  style: a
2502
- }) => /* @__PURE__ */ n.createElement(Xi, { style: a, className: e }, /* @__PURE__ */ n.createElement(T, { variant: "caption4", color: d.themedColor.textMidEmphasis }, He(r, o, { locale: t }))), Xi = c.div`display:flex;justify-content:center;align-items:center;`, Qi = nr(function(t, r) {
2654
+ }) => /* @__PURE__ */ n.createElement(ll, { style: a, className: e }, /* @__PURE__ */ n.createElement(S, { variant: "caption4", color: d.themedColor.textMidEmphasis }, We(r, o, { locale: t }))), ll = c.div`display:flex;justify-content:center;align-items:center;`, cl = sr(function(t, r) {
2503
2655
  const {
2504
2656
  messages: o,
2505
2657
  renderMessage: a,
@@ -2507,32 +2659,32 @@ const Bi = c.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
2507
2659
  messageBottomArea: i,
2508
2660
  overlayArea: l,
2509
2661
  onLoadPrev: u,
2510
- onLoadNext: m,
2511
- loadThreshold: g = 0.05,
2512
- onScrollPosition: p = ze,
2513
- depsForResetScrollPositionToBottom: h,
2514
- scrollPositionRef: f,
2662
+ onLoadNext: p,
2663
+ loadThreshold: m = 0.05,
2664
+ onScrollPosition: h = je,
2665
+ depsForResetScrollPositionToBottom: g,
2666
+ scrollPositionRef: b,
2515
2667
  scrollDistanceFromBottomRef: E,
2516
2668
  stackDirection: x = "top"
2517
- } = t, b = r && "current" in r ? r : { current: null }, S = F(!1), v = F(void 0), $ = F(0), N = F(0), w = F(0), D = f ?? N, te = E ?? w;
2669
+ } = t, f = r && "current" in r ? r : { current: null }, T = D(!1), C = D(void 0), w = D(0), O = D(0), J = D(0), X = b ?? O, v = E ?? J;
2518
2670
  ye(() => {
2519
- b.current && (b.current.scrollTop = b.current.scrollHeight);
2520
- }, h), ye(() => {
2521
- b.current && (v.current === "top" && (b.current.scrollTop = b.current.scrollHeight - D.current), v.current === "bottom" && (b.current.scrollTop = $.current), v.current = void 0);
2522
- }, [b.current, o.length]);
2523
- const y = async () => {
2524
- if (!b.current) return;
2525
- const I = b.current;
2526
- if (p(el(I)), D.current = I.scrollHeight - I.scrollTop, te.current = D.current - I.clientHeight, $.current = I.scrollTop, S.current) return;
2527
- const H = I.clientHeight * Math.min(Math.max(0, g), 1);
2528
- I.scrollTop <= H ? (S.current = !0, v.current = "top", await u(), S.current = !1) : I.scrollHeight - I.scrollTop - I.clientHeight <= H ? (S.current = !0, v.current = "bottom", await m(), S.current = !1) : v.current = void 0;
2671
+ f.current && (f.current.scrollTop = f.current.scrollHeight);
2672
+ }, g), ye(() => {
2673
+ f.current && (C.current === "top" && (f.current.scrollTop = f.current.scrollHeight - X.current), C.current === "bottom" && (f.current.scrollTop = w.current), C.current = void 0);
2674
+ }, [f.current, o.length]);
2675
+ const Q = async () => {
2676
+ if (!f.current) return;
2677
+ const L = f.current;
2678
+ if (h(dl(L)), X.current = L.scrollHeight - L.scrollTop, v.current = X.current - L.clientHeight, w.current = L.scrollTop, T.current) return;
2679
+ const V = L.clientHeight * Math.min(Math.max(0, m), 1);
2680
+ L.scrollTop <= V ? (T.current = !0, C.current = "top", await u(), T.current = !1) : L.scrollHeight - L.scrollTop - L.clientHeight <= V ? (T.current = !0, C.current = "bottom", await p(), T.current = !1) : C.current = void 0;
2529
2681
  };
2530
- return /* @__PURE__ */ n.createElement(tl, { id: "infinite-list-container" }, /* @__PURE__ */ n.createElement(nl, { id: "infinite-list-inner", ref: b, onScroll: y }, x === "bottom" && /* @__PURE__ */ n.createElement("div", { style: { flexGrow: 1 } }), s, o.map((I, H) => a({ message: I, index: H })), i), /* @__PURE__ */ n.createElement(rl, { id: "infinite-list-overlay-container" }, /* @__PURE__ */ n.createElement(ol, { id: "infinite-list-overlay" }, l)));
2682
+ return /* @__PURE__ */ n.createElement(ul, { id: "infinite-list-container" }, /* @__PURE__ */ n.createElement(ml, { id: "infinite-list-inner", ref: f, onScroll: Q }, x === "bottom" && /* @__PURE__ */ n.createElement("div", { style: { flexGrow: 1 } }), s, o.map((L, V) => a({ message: L, index: V })), i), /* @__PURE__ */ n.createElement(pl, { id: "infinite-list-overlay-container" }, /* @__PURE__ */ n.createElement(gl, { id: "infinite-list-overlay" }, l)));
2531
2683
  });
2532
- function el(e) {
2684
+ function dl(e) {
2533
2685
  return e.scrollTop <= 10 ? "top" : e.scrollHeight - (e.scrollTop + e.clientHeight) <= 10 ? "bottom" : "middle";
2534
2686
  }
2535
- const tl = c.div`display:flex;position:relative;flex:1;overflow:hidden;`, nl = c.div`display:flex;flex:1;flex-direction:column;overflow-y:auto;scrollbar-color:${d.themedColor.onbackground3}transparent;&::-webkit-scrollbar-thumb:hover{background-color:transparent;}`, rl = c.div`position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;`, ol = c.div`pointer-events:auto;`, al = ({ className: e, onClick: t }) => /* @__PURE__ */ n.createElement(sl, { className: e, onClick: t, tabIndex: 0 }, /* @__PURE__ */ n.createElement(A, { size: 24, type: "chevron-down", color: d.color.primary.main })), sl = c.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:24px;box-shadow:${d.color.shadow05};${V.light`
2687
+ const ul = c.div`display:flex;position:relative;flex:1;overflow:hidden;`, ml = c.div`display:flex;flex:1;flex-direction:column;overflow-y:auto;scrollbar-color:${d.themedColor.onbackground3}transparent;&::-webkit-scrollbar-thumb:hover{background-color:transparent;}`, pl = c.div`position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;`, gl = c.div`pointer-events:auto;`, hl = ({ className: e, onClick: t }) => /* @__PURE__ */ n.createElement(fl, { className: e, onClick: t, tabIndex: 0 }, /* @__PURE__ */ n.createElement($, { size: 24, type: "chevron-down", color: d.color.primary.main })), fl = c.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:24px;box-shadow:${d.color.shadow05};${U.light`
2536
2688
  background-color: ${d.color.background50};
2537
2689
  &:hover {
2538
2690
  background-color: ${d.color.background100};
@@ -2541,7 +2693,7 @@ const tl = c.div`display:flex;position:relative;flex:1;overflow:hidden;`, nl = c
2541
2693
  background-color: ${d.color.background200};
2542
2694
  }
2543
2695
  `}
2544
- ${V.dark`
2696
+ ${U.dark`
2545
2697
  background-color: ${d.color.background400};
2546
2698
  &:hover {
2547
2699
  background-color: ${d.color.background500};
@@ -2554,98 +2706,99 @@ const tl = c.div`display:flex;position:relative;flex:1;overflow:hidden;`, nl = c
2554
2706
  &:focus {
2555
2707
  outline: none;
2556
2708
  }
2557
- `, il = () => {
2558
- const { agentPreviewConfigs: e = {}, aiAgentId: t } = B(), { aiAgentInfo: r } = U(), { stringSet: o, dateLocale: a } = M(), { dataSource: s, onAfterSendMessage: i, onBeforeSendMessage: l } = K(), { Template: u } = he.useContext(), m = e.welcomeMessages ?? [], { messages: g } = s, p = Ii(g, t), h = g[p.length + 1], f = p[0] ?? h;
2709
+ `, bl = () => {
2710
+ const { agentPreviewConfigs: e = {}, aiAgentId: t } = B(), { aiAgentInfo: r } = P(), { stringSet: o, dateLocale: a } = M(), { messageSource: s } = K(), { Template: i } = pe.useContext(), l = e.welcomeMessages ?? [], u = s.messages, p = Fs(u, t), m = u[p.length + 1], h = p[0] ?? m;
2559
2711
  return {
2560
2712
  /**
2561
2713
  * Returns a list of messages filtered according to business requirements.
2562
2714
  */
2563
- filteredMessages: g.filter((E) => $i(E) ? !1 : m.length > 0 ? !_t.isWelcomeMessage(E, t) : !0),
2715
+ filteredMessages: u.filter((g) => Vs(g) ? !1 : l.length > 0 ? !St.isWelcomeMessage(g, t) : !0),
2564
2716
  /**
2565
2717
  * Determines whether to display the DateSeparator in the data list by comparing it with the welcome messages from Bot Studio.
2566
2718
  */
2567
- shouldShowOriginalDate: (E) => E > 0 || m.length === 0 ? !0 : h && !pr(h.createdAt, (f == null ? void 0 : f.createdAt) ?? 0),
2719
+ shouldShowOriginalDate: (g) => g > 0 || l.length === 0 ? !0 : m && !Er(m.createdAt, (h == null ? void 0 : h.createdAt) ?? 0),
2568
2720
  /**
2569
2721
  * Renders the list of welcome messages from Bot Studio.
2570
2722
  */
2571
- renderAgentPreviewWelcomeMessages: () => m.length === 0 ? null : /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
2572
- zn,
2723
+ renderAgentPreviewWelcomeMessages: () => l.length === 0 ? null : /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
2724
+ Yn,
2573
2725
  {
2574
2726
  style: { margin: "16px 0" },
2575
- date: f == null ? void 0 : f.createdAt,
2727
+ date: h == null ? void 0 : h.createdAt,
2576
2728
  locale: a,
2577
2729
  formatString: o.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
2578
2730
  }
2579
- ), m.map((E, x) => {
2580
- const b = x === m.length - 1, S = p.length !== g.length, v = m.length === 1 ? "single" : x === 0 ? "top" : b || S ? "bottom" : "middle";
2731
+ ), l.map((g, b) => {
2732
+ const E = b === l.length - 1, x = p.length !== u.length, f = l.length === 1 ? "single" : b === 0 ? "top" : E || x ? "bottom" : "middle";
2581
2733
  return /* @__PURE__ */ n.createElement(
2582
- u,
2734
+ i,
2583
2735
  {
2584
2736
  messageType: "user",
2585
- message: E.message,
2737
+ message: g.message,
2586
2738
  sender: r,
2587
- groupType: v,
2588
- createdAt: (f == null ? void 0 : f.createdAt) ?? Date.now(),
2589
- extendedMessagePayload: { suggested_replies: E.suggestedReplies },
2739
+ groupType: f,
2740
+ createdAt: (h == null ? void 0 : h.createdAt) ?? Date.now(),
2741
+ extendedMessagePayload: { suggested_replies: g.suggestedReplies },
2590
2742
  suggestedRepliesDirection: e.suggestedRepliesDirection,
2591
- suggestedRepliesVisible: b && !S,
2743
+ suggestedRepliesVisible: E && !x,
2592
2744
  isBotMessage: !0,
2593
- onClickSuggestedReply: async ({ reply: $ }) => {
2594
- const N = await l({ message: $ });
2595
- s.sendUserMessage(N, i).then(i);
2745
+ onClickSuggestedReply: async ({ reply: T }) => {
2746
+ s.sendUserMessage({ message: T });
2596
2747
  }
2597
2748
  }
2598
2749
  );
2599
2750
  }))
2600
2751
  };
2601
- }, Gn = () => {
2602
- const { chatSDK: e } = B(), { channel: t } = K(), [r, o] = C([]);
2752
+ }, qn = () => {
2753
+ const { chatSDK: e } = B(), { channelSource: t } = K(), [r, o] = y([]);
2603
2754
  return cn(e, {
2604
2755
  onTypingStatusUpdated(a) {
2605
- if (a.url === (t == null ? void 0 : t.url)) {
2606
- const s = a.getTypingUsers();
2607
- o(s);
2756
+ var s;
2757
+ if (a.url === ((s = t.channel) == null ? void 0 : s.url)) {
2758
+ const i = a.getTypingUsers();
2759
+ o(i);
2608
2760
  }
2609
2761
  }
2610
2762
  }), r;
2611
2763
  };
2612
- function ll() {
2613
- const { isDashboardActionbookTester: e } = Xe(), { aiAgentInfo: t } = U(), { scrollSource: r } = K(), o = Gn(), { components: a } = he.useContext(), [s] = o, i = !!s, l = e ? 0 : Me, u = (s == null ? void 0 : s.userId) === t.userId;
2614
- return P(() => {
2764
+ function El() {
2765
+ const { isDashboardActionbookTester: e } = Xe(), { aiAgentInfo: t } = P(), { scrollSource: r } = K(), o = qn(), { components: a } = pe.useContext(), [s] = o, i = !!s, l = e ? 0 : Me, u = (s == null ? void 0 : s.userId) === t.userId;
2766
+ return N(() => {
2615
2767
  i && setTimeout(() => r.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } }), 25);
2616
- }, [i]), i ? /* @__PURE__ */ n.createElement(cl, null, /* @__PURE__ */ n.createElement(dl, null, !e && /* @__PURE__ */ n.createElement(a.SenderAvatar, { isBotMessage: u, sender: u ? t : s }), /* @__PURE__ */ n.createElement(a.SenderName, { sender: s })), /* @__PURE__ */ n.createElement(ul, { $startPadding: l }, /* @__PURE__ */ n.createElement(Tn, null))) : null;
2768
+ }, [i]), i ? /* @__PURE__ */ n.createElement(xl, null, /* @__PURE__ */ n.createElement(vl, null, !e && /* @__PURE__ */ n.createElement(a.SenderAvatar, { isBotMessage: u, sender: u ? t : s }), /* @__PURE__ */ n.createElement(a.SenderName, { sender: s })), /* @__PURE__ */ n.createElement(yl, { $startPadding: l }, /* @__PURE__ */ n.createElement(In, null))) : null;
2617
2769
  }
2618
- const cl = c.div`display:flex;flex-direction:column;padding:0 ${Z}px;`, dl = c.div`display:flex;align-items:center;gap:8px;`, ul = c.div`display:flex;padding-inline-start:${({ $startPadding: e }) => `${e}px`};
2619
- `, ml = (e) => c(e).withConfig({ shouldForwardProp: Ir });
2620
- function pl(e) {
2770
+ const xl = c.div`display:flex;flex-direction:column;padding:0 ${q}px;`, vl = c.div`display:flex;align-items:center;gap:8px;`, yl = c.div`display:flex;padding-inline-start:${({ $startPadding: e }) => `${e}px`};
2771
+ `, Cl = (e) => c(e).withConfig({ shouldForwardProp: Lr });
2772
+ function _l(e) {
2621
2773
  var o;
2622
2774
  const t = "remove_powered_by", r = (o = e == null ? void 0 : e.appInfo) == null ? void 0 : o.applicationAttributes;
2623
2775
  return Array.isArray(r) && r.includes(t);
2624
2776
  }
2625
- const gl = ({ style: e }) => {
2777
+ const Tl = ({ style: e }) => {
2626
2778
  const { stringSet: t } = M(), { chatSDK: r } = B(), { isDashboardActionbookTester: o } = Xe();
2627
- return pl(r) || o ? null : /* @__PURE__ */ n.createElement(hl, { variant: "caption2", style: e }, t.POWERED_BY + " ", /* @__PURE__ */ n.createElement(
2628
- fl,
2779
+ return _l(r) || o ? null : /* @__PURE__ */ n.createElement(Sl, { variant: "caption2", style: e }, t.POWERED_BY + " ", /* @__PURE__ */ n.createElement(
2780
+ wl,
2629
2781
  {
2630
2782
  variant: "caption2",
2631
2783
  as: "a",
2632
2784
  href: "https://sendbird.com?utm_medium=product&utm_source=aiagent&utm_campaign=fy26-glbl-ai-agent-poweredby",
2633
2785
  "aria-label": "Learn more about Sendbird",
2634
- rel: lt,
2786
+ rel: pt,
2635
2787
  target: "_blank"
2636
2788
  },
2637
2789
  "Sendbird"
2638
2790
  ));
2639
- }, hl = c(T)`color:${d.themedColor.onbackground3};text-align:center;`, fl = ml(T)`
2791
+ }, Sl = c(S)`color:${d.themedColor.onbackground3};text-align:center;`, wl = Cl(S)`
2640
2792
  color: ${d.themedColor.onbackground3};
2641
2793
  cursor: pointer;
2642
2794
  text-decoration: none;
2643
- `, bl = () => {
2644
- const { stringSet: e } = M(), { activeChannel: t } = U(), { channel: r, goToActiveConversation: o, scrollSource: a } = K(), s = Cn(r), l = t && (r == null ? void 0 : r.url) === (t == null ? void 0 : t.url) && s;
2795
+ `, kl = () => {
2796
+ var u;
2797
+ const { stringSet: e } = M(), { activeChannel: t } = P(), { channelSource: r, goToActiveConversation: o, scrollSource: a } = K(), s = kn(r.channel), l = t && ((u = r.channel) == null ? void 0 : u.url) === (t == null ? void 0 : t.url) && s;
2645
2798
  return ye(() => {
2646
2799
  l && a.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } });
2647
- }, [l]), l ? /* @__PURE__ */ n.createElement(El, null, /* @__PURE__ */ n.createElement(
2648
- xl,
2800
+ }, [l]), l ? /* @__PURE__ */ n.createElement(Al, null, /* @__PURE__ */ n.createElement(
2801
+ Il,
2649
2802
  {
2650
2803
  variant: "button",
2651
2804
  role: "button",
@@ -2654,225 +2807,231 @@ const gl = ({ style: e }) => {
2654
2807
  },
2655
2808
  e.START_NEW_CONVERSATION
2656
2809
  )) : null;
2657
- }, El = c.div`display:flex;justify-content:center;margin:16px 0;`, xl = c(T)`border-radius:6px;box-sizing:border-box;padding:10px 20px;border:1px solid ${d.themedColor.onbackground4};cursor:pointer;user-select:none;`, vl = !0, yl = () => {
2658
- const [e, t] = C(null), { userSession: r, aiAgentInfo: o } = U(), { agentPreviewConfigs: a, chatSDK: s, state: i } = B(), { stringSet: l, dateLocale: u } = M(), { channel: m, dataSource: g, scrollSource: p, onAfterSendMessage: h, onBeforeSendMessage: f } = K(), { isDashboardActionbookTester: E } = Xe(), { filteredMessages: x, shouldShowOriginalDate: b, renderAgentPreviewWelcomeMessages: S } = il(), { storage: v } = gn(), { Template: $ } = bt.useContext(), { Template: N } = he.useContext(), { Template: w } = Et.useContext(), D = (y, I = !1) => I ? o : (m == null ? void 0 : m.members.find((H) => H.userId === y.sender.userId)) ?? y.sender, te = () => {
2659
- if (!g.initialized)
2810
+ }, Al = c.div`display:flex;justify-content:center;margin:16px 0;`, Il = c(S)`border-radius:6px;box-sizing:border-box;padding:10px 20px;border:1px solid ${d.themedColor.onbackground4};cursor:pointer;user-select:none;`, $l = !0, Ml = () => {
2811
+ const [e, t] = y(null), { userSession: r, aiAgentInfo: o } = P(), { agentPreviewConfigs: a, chatSDK: s, state: i } = B(), { stringSet: l, dateLocale: u } = M(), { conversation: p, channelSource: m, messageSource: h, scrollSource: g } = K(), { isDashboardActionbookTester: b } = Xe(), { filteredMessages: E, shouldShowOriginalDate: x, renderAgentPreviewWelcomeMessages: f } = bl(), { storage: T } = hn(), { Template: C } = vt.useContext(), { Template: w } = pe.useContext(), { Template: O } = yt.useContext(), J = (v, Q = !1) => {
2812
+ var L;
2813
+ return Q ? o : ((L = m.channel) == null ? void 0 : L.members.find((V) => V.userId === v.sender.userId)) ?? v.sender;
2814
+ }, X = () => {
2815
+ if (!h.initialized)
2660
2816
  return /* @__PURE__ */ n.createElement(Ce, { type: "loading" });
2661
- if (g.messages.length === 0) {
2662
- const y = S();
2663
- return y ? /* @__PURE__ */ n.createElement("div", { style: { width: "100%" } }, y) : /* @__PURE__ */ n.createElement(Ce, { type: "noMessages", label: l.PLACE_HOLDER__NO_MESSAGES });
2817
+ if (h.messages.length === 0) {
2818
+ const v = f();
2819
+ return v ? /* @__PURE__ */ n.createElement("div", { style: { width: "100%" } }, v) : /* @__PURE__ */ n.createElement(Ce, { type: "noMessages", label: l.PLACE_HOLDER__NO_MESSAGES });
2664
2820
  }
2665
2821
  return /* @__PURE__ */ n.createElement(
2666
- Qi,
2822
+ cl,
2667
2823
  {
2668
- ref: p.scrollRef,
2669
- scrollPositionRef: p.scrollPositionRef,
2670
- scrollDistanceFromBottomRef: p.scrollDistanceFromBottomRef,
2671
- onScrollPosition: (y) => p.setIsScrollBottomReached(y === "bottom"),
2824
+ ref: g.scrollRef,
2825
+ scrollPositionRef: g.scrollPositionRef,
2826
+ scrollDistanceFromBottomRef: g.scrollDistanceFromBottomRef,
2827
+ onScrollPosition: (v) => g.setIsScrollBottomReached(v === "bottom"),
2672
2828
  stackDirection: a == null ? void 0 : a.messageStackDirection,
2673
- messages: x,
2674
- onLoadPrev: g.loadPrevious,
2675
- onLoadNext: g.loadNext,
2676
- depsForResetScrollPositionToBottom: [g.initialized, g.messages.length !== 0],
2677
- messageTopArea: /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(gl, { style: { marginTop: 16 } }), S()),
2678
- messageBottomArea: /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(ll, null), /* @__PURE__ */ n.createElement(bl, null)),
2679
- overlayArea: /* @__PURE__ */ n.createElement(n.Fragment, null, !p.isScrollBottomReached && /* @__PURE__ */ n.createElement(_l, { onClick: () => p.scrollPubSub.publish({ type: "scrollToBottom" }) })),
2680
- renderMessage: ({ message: y, index: I }) => {
2681
- const H = wi(y), be = x[I - 1], O = x[I + 1], R = x[x.length - 1], L = y === R, Y = Ai(y, be, O, vl), Ee = !wr((be == null ? void 0 : be.createdAt) ?? 0, y.createdAt) && b(I) && !E, Te = () => {
2682
- y.isFileMessage() && t(y);
2683
- }, z = Ee ? /* @__PURE__ */ n.createElement(
2684
- zn,
2829
+ messages: E,
2830
+ onLoadPrev: h.loadPrevious,
2831
+ onLoadNext: h.loadNext,
2832
+ depsForResetScrollPositionToBottom: [h.initialized, h.messages.length !== 0],
2833
+ messageTopArea: /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(Tl, { style: { marginTop: 16 } }), f()),
2834
+ messageBottomArea: /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(El, null), /* @__PURE__ */ n.createElement(kl, null)),
2835
+ overlayArea: /* @__PURE__ */ n.createElement(n.Fragment, null, !g.isScrollBottomReached && /* @__PURE__ */ n.createElement(Rl, { onClick: () => g.scrollPubSub.publish({ type: "scrollToBottom" }) })),
2836
+ renderMessage: ({ message: v, index: Q }) => {
2837
+ const L = Ds(v), V = E[Q - 1], Se = E[Q + 1], we = E[E.length - 1], Qe = v === we, I = Ps(v, V, Se, $l), A = !Or((V == null ? void 0 : V.createdAt) ?? 0, v.createdAt) && x(Q) && !b, R = () => {
2838
+ v.isFileMessage() && t(v);
2839
+ }, Z = () => {
2840
+ v.isFileMessage() && wn(v.url);
2841
+ }, he = A ? /* @__PURE__ */ n.createElement(
2842
+ Yn,
2685
2843
  {
2686
2844
  style: { margin: "16px 0" },
2687
- date: y.createdAt,
2845
+ date: v.createdAt,
2688
2846
  locale: u,
2689
2847
  formatString: l.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
2690
2848
  }
2691
- ) : null, ne = {
2692
- maxBodyWidth: i.expanded ? xn : void 0,
2693
- extendedMessagePayload: y.extendedMessagePayload,
2694
- createdAt: y.createdAt,
2695
- groupType: Y,
2696
- onClickMedia: Te
2697
- }, Se = (() => {
2698
- var le, St;
2699
- if (Ue.isAdmin(y))
2700
- return Ue.isCSAT(y) ? m != null && m.conversation ? /* @__PURE__ */ n.createElement(
2701
- w,
2849
+ ) : null, re = {
2850
+ maxBodyWidth: i.expanded ? Cn : void 0,
2851
+ extendedMessagePayload: v.extendedMessagePayload,
2852
+ createdAt: v.createdAt,
2853
+ groupType: I,
2854
+ onClickMedia: R,
2855
+ onClickFile: Z
2856
+ }, W = (() => {
2857
+ var fe, be;
2858
+ if (He.isAdmin(v))
2859
+ return He.isCSAT(v) ? p ? /* @__PURE__ */ n.createElement(
2860
+ O,
2702
2861
  {
2703
- ...ne,
2704
- ...m.conversation,
2705
- isResolvedWhenDeterminedByUser: Tl(m.conversation),
2862
+ ...re,
2863
+ ...p,
2864
+ isResolvedWhenDeterminedByUser: Ll(p),
2706
2865
  messageType: "admin.csat",
2707
- onSubmitCSAT: ({ csat: re, csatType: ce, csatReason: G, isResolved: oe }) => {
2708
- re && m.submitCSAT({ csat: re, csatType: ce, csatReason: G, isResolved: oe });
2866
+ onSubmitCSAT: ({ csat: H, csatType: se, csatReason: G, isResolved: Ee }) => {
2867
+ var kt;
2868
+ H && ((kt = m.channel) == null || kt.submitCSAT({ csat: H, csatType: se, csatReason: G, isResolved: Ee }));
2709
2869
  }
2710
2870
  }
2711
- ) : null : /* @__PURE__ */ n.createElement(w, { ...ne, messageType: "admin", message: y.message });
2712
- if (Ue.isOutgoing(y, r.userId)) {
2713
- const re = {
2714
- ...ne,
2715
- message: y.message,
2716
- sender: D(y),
2717
- sendingStatus: y.sendingStatus
2871
+ ) : null : /* @__PURE__ */ n.createElement(O, { ...re, messageType: "admin", message: v.message });
2872
+ if (He.isOutgoing(v, r.userId)) {
2873
+ const H = {
2874
+ ...re,
2875
+ message: v.message,
2876
+ sender: J(v),
2877
+ sendingStatus: v.sendingStatus
2718
2878
  };
2719
- if (y.isUserMessage())
2720
- return /* @__PURE__ */ n.createElement($, { messageType: "user", ...re });
2721
- if (y.isFileMessage()) {
2722
- const [ce, G] = ((le = y.metaArrays.find((oe) => oe.key === Pn)) == null ? void 0 : le.value) ?? [];
2879
+ if (v.isUserMessage())
2880
+ return /* @__PURE__ */ n.createElement(C, { messageType: "user", ...H });
2881
+ if (v.isFileMessage()) {
2882
+ const [se, G] = ((fe = v.metaArrays.find((Ee) => Ee.key === zn)) == null ? void 0 : fe.value) ?? [];
2723
2883
  return /* @__PURE__ */ n.createElement(
2724
- $,
2884
+ C,
2725
2885
  {
2726
2886
  messageType: "file",
2727
- file: y,
2887
+ file: v,
2728
2888
  metadata: {
2729
- aspectRatio: ce && G ? `${ce}/${G}` : "1/1",
2730
- localFile: (St = y.messageParams) == null ? void 0 : St.file
2889
+ aspectRatio: se && G ? `${se}/${G}` : "1/1",
2890
+ localFile: (be = v.messageParams) == null ? void 0 : be.file
2731
2891
  },
2732
- ...re
2892
+ ...H
2733
2893
  }
2734
2894
  );
2735
2895
  }
2736
2896
  }
2737
- if (Ue.isIncoming(y, r.userId)) {
2738
- const re = y.sender.userId === o.userId, ce = {
2739
- ...ne,
2740
- sender: D(y, re),
2741
- message: y.message,
2742
- suggestedRepliesVisible: L,
2897
+ if (He.isIncoming(v, r.userId)) {
2898
+ const H = v.sender.userId === o.userId, se = {
2899
+ ...re,
2900
+ sender: J(v, H),
2901
+ message: v.message,
2902
+ suggestedRepliesVisible: Qe,
2743
2903
  suggestedRepliesDirection: a == null ? void 0 : a.suggestedRepliesDirection,
2744
- isBotMessage: re,
2904
+ isBotMessage: H,
2745
2905
  onClickSuggestedReply: async ({ reply: G }) => {
2746
- const oe = await f({ message: G });
2747
- g.sendUserMessage(oe, h).then(h);
2906
+ h.sendUserMessage({ message: G });
2748
2907
  },
2749
2908
  onRequestMessageTemplate: async (G) => {
2750
- const { template: oe } = await s.aiAgent.getMessageTemplate(G);
2751
- return v.setTemplate(G, oe), oe;
2909
+ const { template: Ee } = await s.aiAgent.getMessageTemplate(G);
2910
+ return T.setTemplate(G, Ee), Ee;
2752
2911
  },
2753
- onGetCachedMessageTemplate: (G) => v.getTemplate(G)
2912
+ onGetCachedMessageTemplate: (G) => T.getTemplate(G)
2754
2913
  };
2755
- if (y.isUserMessage())
2756
- return /* @__PURE__ */ n.createElement(N, { messageType: "user", ...ce });
2757
- if (y.isFileMessage())
2758
- return /* @__PURE__ */ n.createElement(N, { messageType: "file", file: y, ...ce });
2914
+ if (v.isUserMessage())
2915
+ return /* @__PURE__ */ n.createElement(w, { messageType: "user", ...se });
2916
+ if (v.isFileMessage())
2917
+ return /* @__PURE__ */ n.createElement(w, { messageType: "file", file: v, ...se });
2759
2918
  }
2760
2919
  })();
2761
- return /* @__PURE__ */ n.createElement("div", { key: H, id: `${J}-message-item` }, z, Se);
2920
+ return /* @__PURE__ */ n.createElement("div", { key: L, id: `${Y}-message-item` }, he, W);
2762
2921
  }
2763
2922
  }
2764
2923
  );
2765
2924
  };
2766
- return /* @__PURE__ */ n.createElement(Cl, { id: `${J}-message-list` }, te(), e && /* @__PURE__ */ n.createElement(Yi, { onClose: () => t(null), message: e }));
2767
- }, Cl = c.div`overflow-y:hidden;display:flex;flex:1;position:relative;`, _l = c(al)`position:absolute;bottom:20px;inset-inline-end:20px;`;
2768
- function Tl(e) {
2925
+ return /* @__PURE__ */ n.createElement(Ol, { id: `${Y}-message-list` }, X(), e && /* @__PURE__ */ n.createElement(al, { onClose: () => t(null), message: e }));
2926
+ }, Ol = c.div`overflow-y:hidden;display:flex;flex:1;position:relative;`, Rl = c(hl)`position:absolute;bottom:20px;inset-inline-end:20px;`;
2927
+ function Ll(e) {
2769
2928
  var t;
2770
2929
  if (((t = e == null ? void 0 : e.resolution) == null ? void 0 : t.determinedBy) === "user")
2771
2930
  return e.resolution.isResolved;
2772
2931
  }
2773
- const Sl = () => {
2774
- const { stringSet: e } = M(), { connectionError: t } = U(), { channel: r, channelFetchError: o, fetchChannel: a } = K(), s = t || o;
2775
- if (s) {
2776
- const i = t ? void 0 : { label: e.RETRY, onClick: () => a() };
2777
- return /* @__PURE__ */ n.createElement(Ce, { type: "error", label: s.message, action: i });
2932
+ const Nl = () => {
2933
+ const { stringSet: e } = M(), { connectionError: t } = P(), { channelSource: r } = K(), o = t || r.error;
2934
+ if (o) {
2935
+ const a = t ? void 0 : { label: e.RETRY, onClick: () => r.refetch() };
2936
+ return /* @__PURE__ */ n.createElement(Ce, { type: "error", label: o.message, action: a });
2778
2937
  }
2779
- return r ? /* @__PURE__ */ n.createElement(yl, null) : /* @__PURE__ */ n.createElement(Ce, { type: "loading" });
2780
- }, jn = () => {
2781
- const { stringSet: e } = M(), { activeChannel: t } = U(), [r] = C(() => (t == null ? void 0 : t.status) === j.OPEN);
2938
+ return r.channel ? /* @__PURE__ */ n.createElement(Ml, null) : /* @__PURE__ */ n.createElement(Ce, { type: "loading" });
2939
+ }, Jn = () => {
2940
+ const { stringSet: e } = M(), { activeChannel: t } = P(), [r] = y(() => (t == null ? void 0 : t.status) === z.OPEN);
2782
2941
  return r ? e.RETURN_TO_CONVERSATION : e.START_NEW_CONVERSATION;
2783
- }, kl = () => {
2784
- const { stringSet: e } = M(), { goToActiveConversation: t } = K(), r = jn();
2785
- return /* @__PURE__ */ n.createElement(wl, null, /* @__PURE__ */ n.createElement(T, { variant: "body1", color: d.themedColor.textMidEmphasis }, e.CONVERSATION_CLOSED_FOOTER_LABEL), /* @__PURE__ */ n.createElement(Al, { onClick: t }, /* @__PURE__ */ n.createElement(T, { variant: "button", color: d.themedColor.textHighEmphasis }, r)));
2786
- }, wl = c.div`display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px 0;gap:14px;${V.light`
2942
+ }, Bl = () => {
2943
+ const { stringSet: e } = M(), { goToActiveConversation: t } = K(), r = Jn();
2944
+ return /* @__PURE__ */ n.createElement(Dl, null, /* @__PURE__ */ n.createElement(S, { variant: "body1", color: d.themedColor.textMidEmphasis }, e.CONVERSATION_CLOSED_FOOTER_LABEL), /* @__PURE__ */ n.createElement(Pl, { onClick: t }, /* @__PURE__ */ n.createElement(S, { variant: "button", color: d.themedColor.textHighEmphasis }, r)));
2945
+ }, Dl = c.div`display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px 0;gap:14px;${U.light`
2787
2946
  background-color: ${d.color.background100};
2788
2947
  `}
2789
- ${V.dark`
2948
+ ${U.dark`
2790
2949
  background-color: ${d.color.background500};
2791
2950
  `}
2792
- `, Al = c.button`all:unset;padding:10px 20px;border-radius:6px;border:1px solid ${d.themedColor.textDisabled};cursor:pointer;${V.light`
2951
+ `, Pl = c.button`all:unset;padding:10px 20px;border-radius:6px;border:1px solid ${d.themedColor.textDisabled};cursor:pointer;${U.light`
2793
2952
  background-color: ${d.color.background50};
2794
2953
  `}
2795
- ${V.dark`
2954
+ ${U.dark`
2796
2955
  background-color: ${d.color.background700};
2797
2956
  `}
2798
- `, Kn = _e(void 0), Il = ({ children: e }) => {
2799
- const { stringSet: t } = M(), { aiAgentInfo: r } = U(), [o, a] = C([]), [s, i] = C({
2957
+ `, Xn = _e(void 0), Fl = ({ children: e }) => {
2958
+ const { stringSet: t } = M(), { aiAgentInfo: r } = P(), [o, a] = y([]), [s, i] = y({
2800
2959
  visible: !1,
2801
2960
  title: "",
2802
2961
  buttonText: t.BUTTON__OK
2803
- }), l = r == null ? void 0 : r.replyToFile, u = (p) => {
2962
+ }), l = r == null ? void 0 : r.replyToFile, u = (h) => {
2804
2963
  if (!l) return;
2805
- const h = p.filter((f) => fn.includes(f.type));
2806
- if (h.length !== 0) {
2807
- if (h.some((f) => f.size > Yr)) {
2808
- i((f) => ({
2809
- ...f,
2964
+ const g = h.filter((b) => xn.includes(b.type));
2965
+ if (g.length !== 0) {
2966
+ if (g.some((b) => b.size > fo)) {
2967
+ i((b) => ({
2968
+ ...b,
2810
2969
  visible: !0,
2811
2970
  title: t.FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT.replace("%d", "25")
2812
2971
  }));
2813
2972
  return;
2814
2973
  }
2815
- if (h.length > 1 || h.length > 0 && o.length > 0) {
2816
- i((f) => ({
2817
- ...f,
2974
+ if (g.length > 1 || g.length > 0 && o.length > 0) {
2975
+ i((b) => ({
2976
+ ...b,
2818
2977
  visible: !0,
2819
2978
  title: t.FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT
2820
2979
  }));
2821
2980
  return;
2822
2981
  }
2823
- a((f) => [
2824
- ...f,
2825
- ...h.map((E) => ({
2982
+ a((b) => [
2983
+ ...b,
2984
+ ...g.map((E) => ({
2826
2985
  file: E,
2827
2986
  preview: { url: URL.createObjectURL(E), type: E.type, name: E.name }
2828
2987
  }))
2829
2988
  ]);
2830
2989
  }
2831
- }, m = (p) => {
2832
- a((h) => {
2990
+ }, p = (h) => {
2991
+ a((g) => {
2833
2992
  var E;
2834
- const f = (E = h[p]) == null ? void 0 : E.preview;
2835
- return f && URL.revokeObjectURL(f.url), h.filter((x, b) => b !== p);
2993
+ const b = (E = g[h]) == null ? void 0 : E.preview;
2994
+ return b && URL.revokeObjectURL(b.url), g.filter((x, f) => f !== h);
2836
2995
  });
2837
- }, g = () => {
2838
- a((p) => (p.forEach((h) => URL.revokeObjectURL(h.preview.url)), []));
2996
+ }, m = () => {
2997
+ a((h) => (h.forEach((g) => URL.revokeObjectURL(g.preview.url)), []));
2839
2998
  };
2840
2999
  return /* @__PURE__ */ n.createElement(
2841
- Kn.Provider,
3000
+ Xn.Provider,
2842
3001
  {
2843
3002
  value: {
2844
3003
  files: o,
2845
3004
  addFiles: u,
2846
- removeFile: m,
2847
- clearFiles: g,
3005
+ removeFile: p,
3006
+ clearFiles: m,
2848
3007
  isFileUploadEnabled: l
2849
3008
  }
2850
3009
  },
2851
3010
  e,
2852
- /* @__PURE__ */ n.createElement(Ml, { ...s, onClose: () => i((p) => ({ ...p, visible: !1, title: "" })) })
3011
+ /* @__PURE__ */ n.createElement(Ul, { ...s, onClose: () => i((h) => ({ ...h, visible: !1, title: "" })) })
2853
3012
  );
2854
- }, Tt = () => {
2855
- const e = X(Kn);
3013
+ }, wt = () => {
3014
+ const e = te(Xn);
2856
3015
  if (!e)
2857
3016
  throw new Error("useFileUpload must be used within FileUploadProvider");
2858
3017
  return e;
2859
- }, Ml = ({
3018
+ }, Ul = ({
2860
3019
  title: e,
2861
3020
  buttonText: t,
2862
3021
  visible: r,
2863
3022
  onClose: o
2864
- }) => /* @__PURE__ */ n.createElement(Hn, { rootElementId: Q.WINDOW, visible: r, onClose: o }, /* @__PURE__ */ n.createElement($l, null, /* @__PURE__ */ n.createElement(Rl, null, /* @__PURE__ */ n.createElement(T, { variant: "h1", color: d.themedColor.onbackground1 }, e)), /* @__PURE__ */ n.createElement(Ol, null, /* @__PURE__ */ n.createElement(Ll, { onClick: o }, /* @__PURE__ */ n.createElement(T, { variant: "button", color: d.themedColor.oncontent1 }, t))))), $l = c.div`width:100%;height:auto;padding-block:18px 24px;padding-inline:24px;margin:0 auto;border-radius:4px;box-sizing:border-box;background-color:${({ theme: e }) => e.colors.base.modalContentBackground};`, Ol = c.div`display:flex;flex-direction:row;justify-content:flex-end;`, Rl = c.div`margin-bottom:16px;`, Ll = c.button`display:flex;justify-content:center;align-items:center;border-radius:4px;cursor:pointer;background-color:${d.themedColor.error};border:1px solid ${d.themedColor.error};padding:10px 16px;&:hover{background-color:${d.color.error.dark};border-color:${d.color.error.dark};}&:active{background-color:${d.color.error.extraDark};}`;
2865
- function Nl({ blurred: e, elementRef: t, document: r = window.document }) {
2866
- const o = F(!1);
3023
+ }) => /* @__PURE__ */ n.createElement(Kn, { rootElementId: ne.WINDOW, visible: r, onClose: o }, /* @__PURE__ */ n.createElement(Vl, null, /* @__PURE__ */ n.createElement(zl, null, /* @__PURE__ */ n.createElement(S, { variant: "h1", color: d.themedColor.onbackground1 }, e)), /* @__PURE__ */ n.createElement(Hl, null, /* @__PURE__ */ n.createElement(Wl, { onClick: o }, /* @__PURE__ */ n.createElement(S, { variant: "button", color: d.themedColor.oncontent1 }, t))))), Vl = c.div`width:100%;height:auto;padding-block:18px 24px;padding-inline:24px;margin:0 auto;border-radius:4px;box-sizing:border-box;background-color:${({ theme: e }) => e.colors.base.modalContentBackground};`, Hl = c.div`display:flex;flex-direction:row;justify-content:flex-end;`, zl = c.div`margin-bottom:16px;`, Wl = c.button`display:flex;justify-content:center;align-items:center;border-radius:4px;cursor:pointer;background-color:${d.themedColor.error};border:1px solid ${d.themedColor.error};padding:10px 16px;&:hover{background-color:${d.color.error.dark};border-color:${d.color.error.dark};}&:active{background-color:${d.color.error.extraDark};}`;
3024
+ function Gl({ blurred: e, elementRef: t, document: r = window.document }) {
3025
+ const o = D(!1);
2867
3026
  e && t.current && r.activeElement === t.current && (o.current = !0), ye(() => {
2868
3027
  var a;
2869
3028
  !e && o.current && ((a = t.current) == null || a.focus(), o.current = !1);
2870
3029
  }, [e]);
2871
3030
  }
2872
- const Bl = c.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex;flex-direction:row;gap:10px;padding:8px 16px;background-color:transparent;`, Dl = c.div`display:flex;flex-shrink:0;position:relative;margin-block-start:8px;border-radius:12px;height:64px;img{border-radius:12px;object-fit:cover;width:64px;-webkit-user-drag:none;}`, Pl = c.div`display:flex;align-items:center;justify-content:center;position:absolute;inset-inline-end:-8px;inset-block-start:-8px;cursor:pointer;border-radius:50%;${V.light`
3031
+ const jl = c.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex;flex-direction:row;gap:10px;padding:8px 16px;background-color:transparent;`, Kl = c.div`display:flex;flex-shrink:0;position:relative;margin-block-start:8px;border-radius:12px;height:64px;img{border-radius:12px;object-fit:cover;width:64px;-webkit-user-drag:none;}`, Zl = c.div`display:flex;align-items:center;justify-content:center;position:absolute;inset-inline-end:-8px;inset-block-start:-8px;cursor:pointer;border-radius:50%;${U.light`
2873
3032
  background-color: ${d.color.background50};
2874
3033
  `}
2875
- ${V.dark`
3034
+ ${U.dark`
2876
3035
  background-color: ${d.color.background500};
2877
3036
  `}
2878
3037
  path {
@@ -2888,19 +3047,19 @@ const Bl = c.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex
2888
3047
  circle {
2889
3048
  stroke: ${d.themedColor.background1};
2890
3049
  }
2891
- `, Fl = () => {
2892
- const e = Re(), [t, r] = C(), { files: o, removeFile: a, isFileUploadEnabled: s } = Tt();
2893
- return !s || o.length === 0 ? null : /* @__PURE__ */ n.createElement(Bl, null, o.map(({ preview: { type: i, name: l, url: u } }, m) => /* @__PURE__ */ n.createElement(Dl, { key: u, onMouseOver: () => r(m), onMouseLeave: () => r(void 0) }, (e || t === m) && /* @__PURE__ */ n.createElement(Pl, { title: "Remove file", onClick: () => a(m) }, /* @__PURE__ */ n.createElement(A, { type: "close-filled", color: d.themedColor.onbackground2 })), i.startsWith("image/") ? /* @__PURE__ */ n.createElement("img", { alt: "file-image", src: u }) : /* @__PURE__ */ n.createElement(mt, { name: l, type: ut(l, i) }))));
2894
- }, Ul = ({ channel: e, messages: t }) => {
2895
- const { stringSet: r } = M(), { aiAgentInfo: o } = U(), a = Vl(), s = Hl({
3050
+ `, Yl = () => {
3051
+ const e = Ne(), [t, r] = y(), { files: o, removeFile: a, isFileUploadEnabled: s } = wt();
3052
+ return !s || o.length === 0 ? null : /* @__PURE__ */ n.createElement(jl, null, o.map(({ preview: { type: i, name: l, url: u } }, p) => /* @__PURE__ */ n.createElement(Kl, { key: u, onMouseOver: () => r(p), onMouseLeave: () => r(void 0) }, (e || t === p) && /* @__PURE__ */ n.createElement(Zl, { title: "Remove file", onClick: () => a(p) }, /* @__PURE__ */ n.createElement($, { type: "close-filled", color: d.themedColor.onbackground2 })), i.startsWith("image/") ? /* @__PURE__ */ n.createElement("img", { alt: "file-image", src: u }) : /* @__PURE__ */ n.createElement(bt, { name: l, type: ft(l, i) }))));
3053
+ }, ql = ({ channel: e, messages: t }) => {
3054
+ const { stringSet: r } = M(), { aiAgentInfo: o } = P(), a = Jl(), s = Xl({
2896
3055
  lastMessage: t[t.length - 1],
2897
3056
  aiAgentUserId: o.userId
2898
3057
  });
2899
- return !e || !a || Cn(e) ? [!0, r.MESSAGE_INPUT__PLACE_HOLDER__DISABLED] : s ? [!0, r.MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE] : [!1, r.MESSAGE_INPUT__PLACE_HOLDER];
2900
- }, Vl = () => {
2901
- const e = rr(), { chatSDK: t } = B(), [r, o] = C(!0);
2902
- return P(() => {
2903
- const a = new sn({
3058
+ return !e || !a || kn(e) ? [!0, r.MESSAGE_INPUT__PLACE_HOLDER__DISABLED] : s ? [!0, r.MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE] : [!1, r.MESSAGE_INPUT__PLACE_HOLDER];
3059
+ }, Jl = () => {
3060
+ const e = an(), { chatSDK: t } = B(), [r, o] = y(!0);
3061
+ return N(() => {
3062
+ const a = new ct({
2904
3063
  onDisconnected: () => o(!1),
2905
3064
  onConnected: () => o(!0),
2906
3065
  onReconnectSucceeded: () => o(!0)
@@ -2909,23 +3068,23 @@ const Bl = c.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex
2909
3068
  t.removeConnectionHandler(e);
2910
3069
  };
2911
3070
  }, [t]), r;
2912
- }, Hl = ({
3071
+ }, Xl = ({
2913
3072
  lastMessage: e,
2914
3073
  aiAgentUserId: t
2915
3074
  }) => {
2916
- const [r, o] = C(!1), a = Gn();
2917
- return P(() => {
3075
+ const [r, o] = y(!1), a = qn();
3076
+ return N(() => {
2918
3077
  if (!e) return;
2919
- const s = a.some((l) => l.userId === t), i = Fn(e, t) && _t.isStreaming(e);
3078
+ const s = a.some((l) => l.userId === t), i = Wn(e, t) && St.isStreaming(e);
2920
3079
  o(!!(i || s));
2921
3080
  }, [a, e, t]), r;
2922
- }, Zn = {
3081
+ }, Qn = {
2923
3082
  textArea: k`min-height:40px;height:40px;font-size:16px;line-height:24px;`,
2924
3083
  attachIcon: k`margin-bottom:4px;`
2925
- }, Yn = c.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:32px;height:32px;`, Wl = c(Yn)`flex-shrink:0;margin-inline-end:12px;margin-bottom:2px;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover{path{fill:${d.themedColor.onbackground1};}}&:active{border-radius:4px;background-color:${d.themedColor.background3};}}${xt && Zn.attachIcon};`, zl = c.input`display:none;`, Xt = c.div`width:100%;position:relative;background-color:${d.themedColor.background2};border-radius:20px;`, Qt = c.div`display:flex;flex-direction:row;align-items:flex-end;position:relative;`, en = c.textarea`all:unset;display:block;flex:1;min-width:0;padding-top:8px;padding-bottom:8px;padding-inline-start:16px;padding-inline-end:12px;box-sizing:border-box;font-size:14px;line-height:20px;color:${d.themedColor.onbackground1};resize:none;width:100%;height:${hn}px;overflow-wrap:break-word;white-space:pre-wrap;overflow-x:hidden;${xt && Zn.textArea};&::placeholder{color:${d.themedColor.onbackground3};}&:disabled{cursor:not-allowed;&::placeholder{color:${d.themedColor.onbackground4};}}`, tn = c.div`padding:12px 16px;position:relative;display:flex;align-items:center;`, nn = ({ disabled: e }) => {
2926
- const t = F(null), { addFiles: r, clearFiles: o, files: a, isFileUploadEnabled: s } = Tt();
3084
+ }, er = c.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:32px;height:32px;`, Ql = c(er)`flex-shrink:0;margin-inline-end:12px;margin-bottom:2px;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover{path{fill:${d.themedColor.onbackground1};}}&:active{border-radius:4px;background-color:${d.themedColor.background3};}}${Ct && Qn.attachIcon};`, ec = c.input`display:none;`, Qt = c.div`width:100%;position:relative;background-color:${d.themedColor.background2};border-radius:20px;`, en = c.div`display:flex;flex-direction:row;align-items:flex-end;position:relative;`, tn = c.textarea`all:unset;display:block;flex:1;min-width:0;padding-top:8px;padding-bottom:8px;padding-inline-start:16px;padding-inline-end:12px;box-sizing:border-box;font-size:14px;line-height:20px;color:${d.themedColor.onbackground1};resize:none;width:100%;height:${En}px;overflow-wrap:break-word;white-space:pre-wrap;overflow-x:hidden;${Ct && Qn.textArea};&::placeholder{color:${d.themedColor.onbackground3};}&:disabled{cursor:not-allowed;&::placeholder{color:${d.themedColor.onbackground4};}}`, nn = c.div`padding:12px 16px;position:relative;display:flex;align-items:center;`, rn = ({ disabled: e }) => {
3085
+ const t = D(null), { addFiles: r, clearFiles: o, files: a, isFileUploadEnabled: s } = wt();
2927
3086
  return !s || a.length > 0 ? null : /* @__PURE__ */ n.createElement(
2928
- Wl,
3087
+ Ql,
2929
3088
  {
2930
3089
  disabled: e,
2931
3090
  onClick: () => {
@@ -2934,7 +3093,7 @@ const Bl = c.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex
2934
3093
  }
2935
3094
  },
2936
3095
  /* @__PURE__ */ n.createElement(
2937
- A,
3096
+ $,
2938
3097
  {
2939
3098
  type: "attach",
2940
3099
  color: e ? d.themedColor.onbackground4 : d.themedColor.onbackground2,
@@ -2942,7 +3101,7 @@ const Bl = c.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex
2942
3101
  }
2943
3102
  ),
2944
3103
  /* @__PURE__ */ n.createElement(
2945
- zl,
3104
+ ec,
2946
3105
  {
2947
3106
  type: "file",
2948
3107
  ref: t,
@@ -2950,169 +3109,169 @@ const Bl = c.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex
2950
3109
  const l = i.currentTarget.files;
2951
3110
  l && r(Array.from(l)), i.target.value = "";
2952
3111
  },
2953
- accept: fn.join(",")
3112
+ accept: xn.join(",")
2954
3113
  }
2955
3114
  )
2956
3115
  );
2957
- }, Gl = () => {
2958
- const e = F(null), [t, r] = C(""), { rootElement: o } = B(), { channel: a, dataSource: s, onBeforeSendMessage: i, onAfterSendMessage: l } = K(), [u, m] = Ul({ channel: a, messages: s.messages }), { files: g, addFiles: p, clearFiles: h } = Tt();
2959
- _i({ onDropFiles: p }), Nl({ blurred: u, elementRef: e, document: pe(o) });
2960
- const f = t.trim().length > 0, E = g.length > 0, x = !u && (f || E), b = () => {
2961
- e.current && (e.current.value = "", e.current.style.height = ""), h(), r("");
2962
- }, S = async () => {
2963
- const w = t.trim(), D = { message: w };
2964
- if (!w && !g.length) return;
2965
- if (g.length > 0) {
2966
- const y = g[0].file, I = { ...D, file: y }, H = await i(I);
2967
- s.sendFileMessage(H, l).then(l), b();
2968
- return;
3116
+ }, tc = () => {
3117
+ const e = D(null), [t, r] = y(""), { rootElement: o } = B(), { channelSource: a, messageSource: s } = K(), [i, l] = ql({
3118
+ channel: a.channel,
3119
+ messages: s.messages
3120
+ }), { files: u, addFiles: p, clearFiles: m } = wt();
3121
+ Rs({ onDropFiles: p }), Gl({ blurred: i, elementRef: e, document: ue(o) });
3122
+ const h = t.trim().length > 0, g = u.length > 0, b = !i && (h || g), E = () => {
3123
+ e.current && (e.current.value = "", e.current.style.height = ""), m(), r("");
3124
+ }, x = async () => {
3125
+ const w = t.trim(), O = { message: w };
3126
+ if (!(!w && !u.length)) {
3127
+ if (u.length > 0) {
3128
+ const J = u[0].file, X = { ...O, file: J };
3129
+ s.sendFileMessage(X), E();
3130
+ return;
3131
+ }
3132
+ s.sendUserMessage(O), E();
2969
3133
  }
2970
- const te = await i(D);
2971
- s.sendUserMessage(te, l).then(l), b();
2972
- }, v = (w) => {
2973
- const D = Array.from(w.clipboardData.files);
2974
- D.length > 0 && (w.preventDefault(), p(D));
2975
- }, $ = (w) => {
2976
- w.key !== "Enter" || w.nativeEvent.isComposing || w.shiftKey || (w.preventDefault(), S());
2977
- }, N = (w) => {
3134
+ }, f = (w) => {
3135
+ const O = Array.from(w.clipboardData.files);
3136
+ O.length > 0 && (w.preventDefault(), p(O));
3137
+ }, T = (w) => {
3138
+ w.key !== "Enter" || w.nativeEvent.isComposing || w.shiftKey || (w.preventDefault(), x());
3139
+ }, C = (w) => {
2978
3140
  if (e.current) {
2979
3141
  e.current.style.height = "";
2980
- const D = Math.min(Zr, e.current.scrollHeight);
2981
- hn < D && (e.current.style.height = `${D}px`);
3142
+ const O = Math.min(ho, e.current.scrollHeight);
3143
+ En < O && (e.current.style.height = `${O}px`);
2982
3144
  }
2983
3145
  r(w.target.value);
2984
3146
  };
2985
- return u ? /* @__PURE__ */ n.createElement(tn, null, /* @__PURE__ */ n.createElement(Xt, null, /* @__PURE__ */ n.createElement(Qt, null, /* @__PURE__ */ n.createElement(en, { disabled: !0, placeholder: m }), /* @__PURE__ */ n.createElement(nn, { disabled: !0 })))) : /* @__PURE__ */ n.createElement(tn, null, /* @__PURE__ */ n.createElement(Xt, null, /* @__PURE__ */ n.createElement(Fl, null), /* @__PURE__ */ n.createElement(Qt, null, /* @__PURE__ */ n.createElement(
2986
- en,
3147
+ return i ? /* @__PURE__ */ n.createElement(nn, null, /* @__PURE__ */ n.createElement(Qt, null, /* @__PURE__ */ n.createElement(en, null, /* @__PURE__ */ n.createElement(tn, { disabled: !0, placeholder: l }), /* @__PURE__ */ n.createElement(rn, { disabled: !0 })))) : /* @__PURE__ */ n.createElement(nn, null, /* @__PURE__ */ n.createElement(Qt, null, /* @__PURE__ */ n.createElement(Yl, null), /* @__PURE__ */ n.createElement(en, null, /* @__PURE__ */ n.createElement(
3148
+ tn,
2987
3149
  {
2988
3150
  ref: e,
2989
3151
  role: "textbox",
2990
3152
  "aria-label": "Text Input",
2991
- placeholder: m,
3153
+ placeholder: l,
2992
3154
  maxLength: 5e3,
2993
- onKeyDown: $,
2994
- onChange: N,
2995
- onPaste: v
3155
+ onKeyDown: T,
3156
+ onChange: C,
3157
+ onPaste: f
2996
3158
  }
2997
- ), /* @__PURE__ */ n.createElement(nn, null))), x && /* @__PURE__ */ n.createElement(Yn, { onClick: () => S() }, /* @__PURE__ */ n.createElement(A, { type: "send", color: d.color.primary.main, size: 20 })));
2998
- }, jl = c.div`padding:8px 16px;text-align:center;word-break:break-word;white-space:pre-wrap;line-height:1.43;letter-spacing:-0.2px;font-size:14px;font-weight:400;color:${d.themedColor.textLowEmphasis};&& a{font-weight:700;text-decoration:none;${V.light`
3159
+ ), /* @__PURE__ */ n.createElement(rn, null))), b && /* @__PURE__ */ n.createElement(er, { onClick: () => x() }, /* @__PURE__ */ n.createElement($, { type: "send", color: d.color.primary.main, size: 20 })));
3160
+ }, nc = c.div`padding:8px 16px;text-align:center;word-break:break-word;white-space:pre-wrap;line-height:1.43;letter-spacing:-0.2px;font-size:14px;font-weight:400;color:${d.themedColor.textLowEmphasis};&& a{font-weight:700;text-decoration:none;${U.light`
2999
3161
  color: ${d.color.information.light};
3000
3162
  `};
3001
- ${V.dark`
3163
+ ${U.dark`
3002
3164
  color: ${d.color.information.main};
3003
3165
  `};
3004
3166
  }
3005
- `, Kl = _(() => import("./DiXu6nm5.js").then((e) => ({ default: e.MarkdownText }))), Zl = () => {
3006
- const { aiAgentInfo: e } = U(), { dataSource: t } = K(), { userSession: r } = U();
3007
- return !e.specialNoticeEnabled || !e.specialNotice || !(t.initialized && !t.messages.some((a) => Fn(a, r.userId))) ? null : /* @__PURE__ */ n.createElement(jl, null, /* @__PURE__ */ n.createElement(Kl, null, e.specialNotice));
3008
- }, Yl = () => /* @__PURE__ */ n.createElement(ql, null, /* @__PURE__ */ n.createElement(Zl, null), /* @__PURE__ */ n.createElement(Il, null, /* @__PURE__ */ n.createElement(Gl, null))), ql = c.div`z-index:0;border:none;width:100%;`, Jl = () => {
3009
- var s;
3010
- const { activeChannel: e } = U(), { channel: t } = K(), r = ((s = t == null ? void 0 : t.conversation) == null ? void 0 : s.status) === j.CLOSED;
3011
- return !((t == null ? void 0 : t.url) === (e == null ? void 0 : e.url)) && r ? /* @__PURE__ */ n.createElement(kl, null) : /* @__PURE__ */ n.createElement(Yl, null);
3012
- }, Xl = () => {
3013
- var S;
3014
- const { state: e, logger: t, enableCloseConversationButton: r, enableExpandButton: o, dispatcher: a } = B(), { stringSet: s } = M(), { aiAgentInfo: i, activeChannel: l } = U(), { channel: u, onNavigateToConversationList: m } = K(), p = Re() ? 24 : 16, h = () => {
3167
+ `, rc = _(() => import("./Cc9Mb_d1.js").then((e) => ({ default: e.MarkdownText }))), oc = () => {
3168
+ const { aiAgentInfo: e } = P(), { messageSource: t } = K(), { userSession: r } = P();
3169
+ return !e.specialNoticeEnabled || !e.specialNotice || !(t.initialized && !t.messages.some((a) => Wn(a, r.userId))) ? null : /* @__PURE__ */ n.createElement(nc, null, /* @__PURE__ */ n.createElement(rc, null, e.specialNotice));
3170
+ }, ac = () => /* @__PURE__ */ n.createElement(ic, null, /* @__PURE__ */ n.createElement(oc, null), /* @__PURE__ */ n.createElement(Fl, null, /* @__PURE__ */ n.createElement(tc, null))), ic = c.div`z-index:0;border:none;width:100%;`, sc = () => {
3171
+ var s, i, l;
3172
+ const { activeChannel: e } = P(), { channelSource: t } = K(), r = ((i = (s = t.channel) == null ? void 0 : s.conversation) == null ? void 0 : i.status) === z.CLOSED;
3173
+ return !(((l = t.channel) == null ? void 0 : l.url) === (e == null ? void 0 : e.url)) && r ? /* @__PURE__ */ n.createElement(Bl, null) : /* @__PURE__ */ n.createElement(ac, null);
3174
+ }, lc = () => {
3175
+ var C;
3176
+ const { state: e, logger: t, enableCloseConversationButton: r, enableExpandButton: o, dispatcher: a } = B(), { stringSet: s } = M(), { aiAgentInfo: i, activeChannel: l } = P(), { channelSource: u, onNavigateToConversationList: p } = K(), m = u.channel, g = Ne() ? 24 : 16, b = () => {
3015
3177
  e.setOpened(!1);
3016
- }, f = async () => {
3178
+ }, E = async () => {
3017
3179
  try {
3018
- const v = await (u == null ? void 0 : u.markConversationAsHandoff());
3019
- t.info("conversation.handleAgentHandoff: success", v);
3020
- } catch (v) {
3021
- t.error("conversation.handleAgentHandoff: error", v);
3180
+ const w = await (m == null ? void 0 : m.markConversationAsHandoff());
3181
+ t.info("conversation.handleAgentHandoff: success", w);
3182
+ } catch (w) {
3183
+ t.error("conversation.handleAgentHandoff: error", w);
3022
3184
  }
3023
- }, E = async () => {
3024
- u && await a.send(jr.CloseConversation());
3025
- }, x = l && (u == null ? void 0 : u.url) === l.url, b = i.showHandoffButton && !!((S = u == null ? void 0 : u.conversation) != null && S.handoff) && x;
3026
- return /* @__PURE__ */ n.createElement(rc, null, /* @__PURE__ */ n.createElement(oc, null, m && /* @__PURE__ */ n.createElement(Le, { onClick: () => m() }, /* @__PURE__ */ n.createElement(A, { type: "menu", size: 24, color: d.themedColor.textHighEmphasis })), x && /* @__PURE__ */ n.createElement(Wn, { size: 34 }), /* @__PURE__ */ n.createElement(sc, { variant: "h2", color: d.themedColor.onbackground1 }, i.nickname || (u == null ? void 0 : u.name))), /* @__PURE__ */ n.createElement(ac, null, b && /* @__PURE__ */ n.createElement(
3027
- nc,
3185
+ }, x = async () => {
3186
+ m && await a.send(Gr.CloseConversation());
3187
+ }, f = l && (m == null ? void 0 : m.url) === l.url, T = i.showHandoffButton && !!((C = m == null ? void 0 : m.conversation) != null && C.handoff) && f;
3188
+ return /* @__PURE__ */ n.createElement(pc, null, /* @__PURE__ */ n.createElement(gc, null, p && /* @__PURE__ */ n.createElement(Be, { onClick: () => p() }, /* @__PURE__ */ n.createElement($, { type: "menu", size: 24, color: d.themedColor.textHighEmphasis })), f && /* @__PURE__ */ n.createElement(Zn, { size: 34 }), /* @__PURE__ */ n.createElement(fc, { variant: "h2", color: d.themedColor.onbackground1 }, i.nickname || (m == null ? void 0 : m.name))), /* @__PURE__ */ n.createElement(hc, null, T && /* @__PURE__ */ n.createElement(
3189
+ mc,
3028
3190
  {
3029
3191
  tooltipLabel: s.HEADER_BUTTON__AGENT_HANDOFF,
3030
- disabled: !ra(u),
3031
- size: p,
3032
- onClick: f
3192
+ disabled: !ya(m),
3193
+ size: g,
3194
+ onClick: E
3033
3195
  }
3034
3196
  ), r && /* @__PURE__ */ n.createElement(
3035
- tc,
3197
+ uc,
3036
3198
  {
3037
- disabled: !ht(u),
3038
- size: p,
3039
- onClick: E
3199
+ disabled: !An(m),
3200
+ size: g,
3201
+ onClick: x
3040
3202
  }
3041
- ), o && /* @__PURE__ */ n.createElement(Ql, { size: p }), /* @__PURE__ */ n.createElement(ec, { size: p, onClick: h })));
3042
- }, Ql = ({ size: e, disabled: t }) => {
3203
+ ), o && /* @__PURE__ */ n.createElement(cc, { size: g }), /* @__PURE__ */ n.createElement(dc, { size: g, onClick: b })));
3204
+ }, cc = ({ size: e, disabled: t }) => {
3043
3205
  const { state: r } = B();
3044
- return /* @__PURE__ */ n.createElement(Le, { "aria-label": "expand", onClick: () => r.setExpanded(!r.expanded), disabled: t }, /* @__PURE__ */ n.createElement(A, { type: r.expanded ? "collapse" : "expand", size: e, color: d.themedColor.textHighEmphasis }));
3045
- }, ec = ({ size: e, disabled: t, onClick: r }) => /* @__PURE__ */ n.createElement(Le, { "aria-label": "close messenger", onClick: r, disabled: t }, /* @__PURE__ */ n.createElement(A, { type: "close", size: e, color: d.themedColor.textHighEmphasis })), tc = ({ size: e, disabled: t, onClick: r }) => /* @__PURE__ */ n.createElement(Le, { "aria-label": "close conversation", onClick: r, disabled: t }, /* @__PURE__ */ n.createElement(
3046
- A,
3206
+ return /* @__PURE__ */ n.createElement(Be, { "aria-label": "expand", onClick: () => r.setExpanded(!r.expanded), disabled: t }, /* @__PURE__ */ n.createElement($, { type: r.expanded ? "collapse" : "expand", size: e, color: d.themedColor.textHighEmphasis }));
3207
+ }, dc = ({ size: e, disabled: t, onClick: r }) => /* @__PURE__ */ n.createElement(Be, { "aria-label": "close messenger", onClick: r, disabled: t }, /* @__PURE__ */ n.createElement($, { type: "close", size: e, color: d.themedColor.textHighEmphasis })), uc = ({ size: e, disabled: t, onClick: r }) => /* @__PURE__ */ n.createElement(Be, { "aria-label": "close conversation", onClick: r, disabled: t }, /* @__PURE__ */ n.createElement(
3208
+ $,
3047
3209
  {
3048
3210
  type: "refresh",
3049
3211
  size: e,
3050
3212
  color: t ? d.themedColor.textDisabled : d.themedColor.textHighEmphasis
3051
3213
  }
3052
- )), nc = ({ size: e, onClick: t, disabled: r, tooltipLabel: o }) => /* @__PURE__ */ n.createElement(In, { label: o, position: "bottom", disabled: r }, /* @__PURE__ */ n.createElement(Le, { "aria-label": "agent", onClick: t, disabled: r }, /* @__PURE__ */ n.createElement(
3053
- A,
3214
+ )), mc = ({ size: e, onClick: t, disabled: r, tooltipLabel: o }) => /* @__PURE__ */ n.createElement(Ln, { label: o, position: "bottom", disabled: r }, /* @__PURE__ */ n.createElement(Be, { "aria-label": "agent", onClick: t, disabled: r }, /* @__PURE__ */ n.createElement(
3215
+ $,
3054
3216
  {
3055
3217
  type: "agent",
3056
3218
  size: e,
3057
3219
  color: r ? d.themedColor.textDisabled : d.themedColor.textHighEmphasis
3058
3220
  }
3059
- ))), rc = c.div`height:56px;box-sizing:border-box;display:flex;align-items:center;padding:11px 12px;border-bottom:1px solid ${d.themedColor.onbackground4};background-color:${({ theme: e }) => e.colors.base.headerBackground};`, oc = c.div`display:flex;flex:1;flex-direction:row;align-items:center;gap:6px;overflow:hidden;`, ac = c.div`display:flex;gap:10px;align-items:center;justify-content:center;`, sc = c(T)`text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:2px 0;`, Le = c.button`all:unset;padding:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;&:disabled{cursor:not-allowed;}`, ic = () => {
3221
+ ))), pc = c.div`height:56px;box-sizing:border-box;display:flex;align-items:center;padding:11px 12px;border-bottom:1px solid ${d.themedColor.onbackground4};background-color:${({ theme: e }) => e.colors.base.headerBackground};`, gc = c.div`display:flex;flex:1;flex-direction:row;align-items:center;gap:6px;overflow:hidden;`, hc = c.div`display:flex;gap:10px;align-items:center;justify-content:center;`, fc = c(S)`text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:2px 0;`, Be = c.button`all:unset;padding:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;&:disabled{cursor:not-allowed;}`, bc = () => {
3060
3222
  const { isDashboardActionbookTester: e } = Xe();
3061
- return e ? null : /* @__PURE__ */ n.createElement(Xl, null);
3062
- }, rn = ({
3223
+ return e ? null : /* @__PURE__ */ n.createElement(lc, null);
3224
+ }, on = ({
3063
3225
  children: e,
3064
3226
  onNavigateToConversationList: t,
3065
3227
  closedChannelUrl: r,
3066
3228
  onClearClosedChannelUrl: o
3067
3229
  }) => /* @__PURE__ */ n.createElement(
3068
- Ci,
3230
+ Os,
3069
3231
  {
3070
3232
  onNavigateToConversationList: t,
3071
3233
  closedChannelUrl: r,
3072
3234
  onClearClosedChannelUrl: o
3073
3235
  },
3074
- /* @__PURE__ */ n.createElement(ot, null, /* @__PURE__ */ n.createElement(ot.Consumer, null, (a) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(lc, { ...a }, /* @__PURE__ */ n.createElement(ic, null), /* @__PURE__ */ n.createElement(Sl, null), /* @__PURE__ */ n.createElement(Jl, null)), e)))
3075
- ), lc = c.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, [cc, qn] = ee("ConversationList");
3076
- function dc({
3077
- onOpenConversationView: e = ze,
3236
+ /* @__PURE__ */ n.createElement(st, null, /* @__PURE__ */ n.createElement(st.Consumer, null, (a) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(Ec, { ...a }, /* @__PURE__ */ n.createElement(bc, null), /* @__PURE__ */ n.createElement(Nl, null), /* @__PURE__ */ n.createElement(sc, null)), e)))
3237
+ ), Ec = c.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, {
3238
+ Provider: xc,
3239
+ useContext: tr
3240
+ } = j("ConversationList");
3241
+ function vc({
3242
+ onOpenConversationView: e = je,
3078
3243
  children: t
3079
3244
  }) {
3080
- const { chatSDK: r, aiAgentId: o } = B(), a = Wr(r, {
3081
- aiAgentId: o,
3082
- status: j.CLOSED,
3083
- order: br.UPDATED_AT,
3084
- reverse: !0
3085
- });
3086
- return /* @__PURE__ */ n.createElement(cc.Provider, { value: { dataSource: a, onOpenConversationView: e } }, t);
3245
+ return /* @__PURE__ */ n.createElement(Jr, null, (r) => /* @__PURE__ */ n.createElement(xc, { value: { ...r, onOpenConversationView: e } }, t));
3087
3246
  }
3088
- const uc = ({ onClick: e, conversation: t }) => {
3247
+ const yc = ({ onClick: e, conversation: t }) => {
3089
3248
  var a;
3090
3249
  const { stringSet: r, dateLocale: o } = M();
3091
- return /* @__PURE__ */ n.createElement(mc, { role: "button", onClick: () => e == null ? void 0 : e() }, /* @__PURE__ */ n.createElement(gc, null, /* @__PURE__ */ n.createElement(hc, null, /* @__PURE__ */ n.createElement(T, { variant: "subtitle1", color: d.themedColor.textHighEmphasis }, He(t.channelInfo.lastMessageTs, r.DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE, {
3250
+ return /* @__PURE__ */ n.createElement(Cc, { role: "button", onClick: () => e == null ? void 0 : e() }, /* @__PURE__ */ n.createElement(Tc, null, /* @__PURE__ */ n.createElement(Sc, null, /* @__PURE__ */ n.createElement(S, { variant: "subtitle1", color: d.themedColor.textHighEmphasis }, We(t.channelInfo.lastMessageTs, r.DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE, {
3092
3251
  locale: o
3093
- })), /* @__PURE__ */ n.createElement(T, { variant: "caption2", color: d.themedColor.textLowEmphasis }, He(
3252
+ })), /* @__PURE__ */ n.createElement(S, { variant: "caption2", color: d.themedColor.textLowEmphasis }, We(
3094
3253
  t.channelInfo.lastMessageTs,
3095
3254
  r.DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION,
3096
3255
  { locale: o }
3097
- ))), /* @__PURE__ */ n.createElement(T, { variant: "body3", color: d.themedColor.textMidEmphasis }, ((a = t.topics) == null ? void 0 : a.join(", ")) || r.CONVERSATION_LIST__TOPICS_FALLBACK)), /* @__PURE__ */ n.createElement(A, { type: "chevron-right", size: 16, color: d.themedColor.textHighEmphasis }), /* @__PURE__ */ n.createElement(pc, null));
3098
- }, mc = c.div`display:flex;flex-direction:row;align-items:center;position:relative;width:100%;padding:14px 16px;box-sizing:border-box;gap:4px;cursor:pointer;`, pc = c.div`position:absolute;bottom:0;height:1px;width:calc(100% - 32px);background-color:${d.themedColor.onbackground4};`, gc = c.div`gap:4px;display:flex;flex-direction:column;flex:1;`, hc = c.div`display:flex;justify-content:flex-start;align-items:center;gap:6px;`, fc = ({ items: e, renderItem: t, onEndReached: r }) => {
3256
+ ))), /* @__PURE__ */ n.createElement(S, { variant: "body3", color: d.themedColor.textMidEmphasis }, ((a = t.topics) == null ? void 0 : a.join(", ")) || r.CONVERSATION_LIST__TOPICS_FALLBACK)), /* @__PURE__ */ n.createElement($, { type: "chevron-right", size: 16, color: d.themedColor.textHighEmphasis }), /* @__PURE__ */ n.createElement(_c, null));
3257
+ }, Cc = c.div`display:flex;flex-direction:row;align-items:center;position:relative;width:100%;padding:14px 16px;box-sizing:border-box;gap:4px;cursor:pointer;`, _c = c.div`position:absolute;bottom:0;height:1px;width:calc(100% - 32px);background-color:${d.themedColor.onbackground4};`, Tc = c.div`gap:4px;display:flex;flex-direction:column;flex:1;`, Sc = c.div`display:flex;justify-content:flex-start;align-items:center;gap:6px;`, wc = ({ items: e, renderItem: t, onEndReached: r }) => {
3099
3258
  const o = (a) => {
3100
3259
  const s = a.target;
3101
3260
  s.scrollHeight - s.scrollTop === s.clientHeight && (r == null || r());
3102
3261
  };
3103
- return /* @__PURE__ */ n.createElement(bc, { onScroll: (a) => o(a) }, e.map((a, s) => t(a, s)));
3104
- }, bc = c.div`width:100%;height:100%;display:flex;flex-direction:column;flex:1;overflow:auto;`, Ec = () => {
3105
- const { stringSet: e } = M(), { dataSource: t, onOpenConversationView: r } = qn();
3262
+ return /* @__PURE__ */ n.createElement(kc, { onScroll: (a) => o(a) }, e.map((a, s) => t(a, s)));
3263
+ }, kc = c.div`width:100%;height:100%;display:flex;flex-direction:column;flex:1;overflow:auto;`, Ac = () => {
3264
+ const { stringSet: e } = M(), { listSource: t, onOpenConversationView: r } = tr();
3106
3265
  return t.initialized ? t.conversations.length === 0 ? /* @__PURE__ */ n.createElement(Ce, { type: "noChannels", label: e.CONVERSATION_LIST__NO_CONVERSATIONS }) : /* @__PURE__ */ n.createElement(
3107
- fc,
3266
+ wc,
3108
3267
  {
3109
3268
  items: t.conversations,
3110
3269
  renderItem: (o, a) => /* @__PURE__ */ n.createElement(
3111
- uc,
3270
+ yc,
3112
3271
  {
3113
3272
  key: a,
3114
3273
  conversation: o,
3115
- onClick: () => r(o.channelInfo.url, j.CLOSED)
3274
+ onClick: () => r(o.channelInfo.url, z.CLOSED)
3116
3275
  }
3117
3276
  ),
3118
3277
  onEndReached: () => {
@@ -3120,43 +3279,43 @@ const uc = ({ onClick: e, conversation: t }) => {
3120
3279
  }
3121
3280
  }
3122
3281
  ) : /* @__PURE__ */ n.createElement(Ce, { type: "loading" });
3123
- }, xc = () => {
3124
- const { refreshActiveChannel: e } = U(), { onOpenConversationView: t } = qn(), r = jn();
3282
+ }, Ic = () => {
3283
+ const { refreshActiveChannel: e } = P(), { onOpenConversationView: t } = tr(), r = Jn();
3125
3284
  return /* @__PURE__ */ n.createElement(
3126
- vc,
3285
+ $c,
3127
3286
  {
3128
3287
  role: "button",
3129
3288
  onClick: async () => {
3130
3289
  const o = await e();
3131
- t(o, j.OPEN);
3290
+ t(o, z.OPEN);
3132
3291
  }
3133
3292
  },
3134
- /* @__PURE__ */ n.createElement(yc, { variant: "h1" }, r)
3293
+ /* @__PURE__ */ n.createElement(Mc, { variant: "h1" }, r)
3135
3294
  );
3136
- }, vc = c.div`background-color:${({ theme: e }) => e.colors.base.primary};display:flex;align-items:center;justify-content:center;padding:16px;cursor:pointer;`, yc = c(T)`color:${({ theme: e }) => e.colors.base.primaryContrastContent};overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, Cc = () => {
3295
+ }, $c = c.div`background-color:${({ theme: e }) => e.colors.base.primary};display:flex;align-items:center;justify-content:center;padding:16px;cursor:pointer;`, Mc = c(S)`color:${({ theme: e }) => e.colors.base.primaryContrastContent};overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, Oc = () => {
3137
3296
  const { stringSet: e } = M();
3138
- return /* @__PURE__ */ n.createElement(_c, null, /* @__PURE__ */ n.createElement(Tc, { variant: "h2", color: d.themedColor.textHighEmphasis }, e.CONVERSATION_LIST__HEADER_TITLE), /* @__PURE__ */ n.createElement(Sc, null));
3139
- }, _c = c.div`display:flex;flex-direction:column;align-items:flex-start;justify-content:center;width:100%;flex-shrink:0;height:56px;position:relative;background-color:${({ theme: e }) => e.colors.base.headerBackground};`, Tc = c(T)`padding:0 12px;width:100%;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;`, Sc = c.div`position:absolute;bottom:0;width:100%;height:1px;background-color:${d.themedColor.onbackground4};`, kc = ({ children: e, onOpenConversationView: t }) => /* @__PURE__ */ n.createElement(dc, { onOpenConversationView: t }, /* @__PURE__ */ n.createElement(wc, null, /* @__PURE__ */ n.createElement(Cc, null), /* @__PURE__ */ n.createElement(Ec, null), /* @__PURE__ */ n.createElement(xc, null)), e), wc = c.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, Jn = _e(null);
3140
- function Ac() {
3141
- const e = X(Jn);
3297
+ return /* @__PURE__ */ n.createElement(Rc, null, /* @__PURE__ */ n.createElement(Lc, { variant: "h2", color: d.themedColor.textHighEmphasis }, e.CONVERSATION_LIST__HEADER_TITLE), /* @__PURE__ */ n.createElement(Nc, null));
3298
+ }, Rc = c.div`display:flex;flex-direction:column;align-items:flex-start;justify-content:center;width:100%;flex-shrink:0;height:56px;position:relative;background-color:${({ theme: e }) => e.colors.base.headerBackground};`, Lc = c(S)`padding:0 12px;width:100%;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;`, Nc = c.div`position:absolute;bottom:0;width:100%;height:1px;background-color:${d.themedColor.onbackground4};`, Bc = ({ children: e, onOpenConversationView: t }) => /* @__PURE__ */ n.createElement(vc, { onOpenConversationView: t }, /* @__PURE__ */ n.createElement(Dc, null, /* @__PURE__ */ n.createElement(Oc, null), /* @__PURE__ */ n.createElement(Ac, null), /* @__PURE__ */ n.createElement(Ic, null)), e), Dc = c.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, nr = _e(null);
3299
+ function Pc() {
3300
+ const e = te(nr);
3142
3301
  if (!e)
3143
3302
  throw new Error("useNavigator() must be used within <Navigator />");
3144
3303
  return e;
3145
3304
  }
3146
- function Xn({ children: e }) {
3147
- const t = Ac();
3305
+ function rr({ children: e }) {
3306
+ const t = Pc();
3148
3307
  return typeof e == "function" ? e(t) : /* @__PURE__ */ n.createElement(n.Fragment, null, e);
3149
3308
  }
3150
- const Ic = ln`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY(0px);opacity:1;}`, Mc = ln`0%{transform:translateY(0px);opacity:1;}100%{transform:translateY(40px);opacity:0;}`, $c = k`animation:${Ic} 0.3s forwards;`, Oc = k``, Rc = k`animation:${Mc} 0.3s forwards;`, Lc = k`visibility:hidden;`, Nc = c.div`position:absolute;top:0;left:0;width:100%;height:100%;${({ $transitionState: e }) => {
3309
+ const Fc = ln`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY(0px);opacity:1;}`, Uc = ln`0%{transform:translateY(0px);opacity:1;}100%{transform:translateY(40px);opacity:0;}`, Vc = k`animation-name:${Fc};animation-duration:0.3s;animation-fill-mode:forwards;`, Hc = k``, zc = k`animation-name:${Uc};animation-duration:0.3s;animation-fill-mode:forwards;`, Wc = k`visibility:hidden;`, Gc = c.div`position:absolute;top:0;left:0;width:100%;height:100%;${({ $transitionState: e }) => {
3151
3310
  switch (e) {
3152
3311
  case "entering":
3153
- return $c;
3312
+ return Vc;
3154
3313
  case "entered":
3155
- return Oc;
3314
+ return Hc;
3156
3315
  case "exiting":
3157
- return Rc;
3316
+ return zc;
3158
3317
  case "exited":
3159
- return Lc;
3318
+ return Wc;
3160
3319
  default:
3161
3320
  return "";
3162
3321
  }
@@ -3164,141 +3323,141 @@ const Ic = ln`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY
3164
3323
  z-index: 999;
3165
3324
  ` : k`z-index:1;pointer-events:none;`}
3166
3325
  `;
3167
- function we({ initialId: e, children: t }) {
3168
- const r = W((b, S) => {
3169
- u((v) => [...v, b]), g((v) => ({ ...v, [b]: !0 })), S != null && S.reset && E((v) => ({
3170
- ...v,
3171
- [b]: (v[b] || 0) + 1
3172
- })), h((v) => ({
3173
- ...v,
3174
- [b]: "entering"
3326
+ function Ae({ initialId: e, children: t }) {
3327
+ const r = F((f, T) => {
3328
+ u((C) => [...C, f]), m((C) => ({ ...C, [f]: !0 })), T != null && T.reset && E((C) => ({
3329
+ ...C,
3330
+ [f]: (C[f] || 0) + 1
3331
+ })), g((C) => ({
3332
+ ...C,
3333
+ [f]: "entering"
3175
3334
  })), setTimeout(() => {
3176
- h((v) => ({
3177
- ...v,
3178
- [b]: "entered"
3335
+ g((C) => ({
3336
+ ...C,
3337
+ [f]: "entered"
3179
3338
  }));
3180
3339
  }, 300);
3181
- }, []), o = W(() => {
3182
- u((b) => {
3183
- if (b.length <= 1) return b;
3184
- const S = b[b.length - 1];
3185
- return h((v) => ({
3186
- ...v,
3187
- [S]: "exiting"
3340
+ }, []), o = F(() => {
3341
+ u((f) => {
3342
+ if (f.length <= 1) return f;
3343
+ const T = f[f.length - 1];
3344
+ return g((C) => ({
3345
+ ...C,
3346
+ [T]: "exiting"
3188
3347
  })), setTimeout(() => {
3189
- h((v) => ({
3190
- ...v,
3191
- [S]: "exited"
3192
- })), u((v) => v.slice(0, -1));
3193
- }, 300), b;
3348
+ g((C) => ({
3349
+ ...C,
3350
+ [T]: "exited"
3351
+ })), u((C) => C.slice(0, -1));
3352
+ }, 300), f;
3194
3353
  });
3195
3354
  }, []), a = ve(() => ({
3196
3355
  navigation: {
3197
3356
  navigate: r,
3198
3357
  pop: o
3199
3358
  }
3200
- }), [r, o]), s = ve(() => or.toArray(t).filter(
3201
- (b) => b.type === Xn
3359
+ }), [r, o]), s = ve(() => lr.toArray(t).filter(
3360
+ (f) => f.type === rr
3202
3361
  ), [t]), i = ve(() => {
3203
- const b = {};
3204
- return s.forEach((S) => {
3205
- const { id: v, lazy: $, children: N } = S.props;
3206
- b[v] = { lazy: $, element: typeof N == "function" ? N(a) : N };
3207
- }), b;
3208
- }, [s]), [l, u] = C([e]), [m, g] = C(() => {
3209
- const b = {};
3210
- return Object.entries(i).forEach(([S, { lazy: v }]) => {
3211
- v === !1 && (b[S] = !0);
3212
- }), b[e] = !0, b;
3213
- }), [p, h] = C(() => {
3214
- const b = {};
3215
- return Object.keys(i).forEach((S) => {
3216
- S === e ? b[S] = "entered" : b[S] = "exited";
3217
- }), b;
3218
- }), [f, E] = C({}), x = l[l.length - 1];
3219
- return /* @__PURE__ */ n.createElement(Jn.Provider, { value: a }, /* @__PURE__ */ n.createElement(Bc, null, Object.keys(i).map((b) => {
3220
- var N;
3221
- if (!m[b]) return null;
3222
- const S = p[b] || "exited", v = b === x, $ = `${b}-${f[b] || 0}`;
3223
- return /* @__PURE__ */ n.createElement(Nc, { key: $, $transitionState: S, $active: v }, (N = i[b]) == null ? void 0 : N.element);
3362
+ const f = {};
3363
+ return s.forEach((T) => {
3364
+ const { id: C, lazy: w, children: O } = T.props;
3365
+ f[C] = { lazy: w, element: typeof O == "function" ? O(a) : O };
3366
+ }), f;
3367
+ }, [s]), [l, u] = y([e]), [p, m] = y(() => {
3368
+ const f = {};
3369
+ return Object.entries(i).forEach(([T, { lazy: C }]) => {
3370
+ C === !1 && (f[T] = !0);
3371
+ }), f[e] = !0, f;
3372
+ }), [h, g] = y(() => {
3373
+ const f = {};
3374
+ return Object.keys(i).forEach((T) => {
3375
+ T === e ? f[T] = "entered" : f[T] = "exited";
3376
+ }), f;
3377
+ }), [b, E] = y({}), x = l[l.length - 1];
3378
+ return /* @__PURE__ */ n.createElement(nr.Provider, { value: a }, /* @__PURE__ */ n.createElement(jc, null, Object.keys(i).map((f) => {
3379
+ var O;
3380
+ if (!p[f]) return null;
3381
+ const T = h[f] || "exited", C = f === x, w = `${f}-${b[f] || 0}`;
3382
+ return /* @__PURE__ */ n.createElement(Gc, { key: w, $transitionState: T, $active: C }, (O = i[f]) == null ? void 0 : O.element);
3224
3383
  })));
3225
3384
  }
3226
- const Bc = c.div`position:relative;width:100%;height:100%;`;
3227
- we.Screen = Xn;
3228
- const de = {
3385
+ const jc = c.div`position:relative;width:100%;height:100%;`;
3386
+ Ae.Screen = rr;
3387
+ const le = {
3229
3388
  activeConv: "active-conv",
3230
3389
  closedConv: "closed-conv",
3231
3390
  convList: "conv-list"
3232
- }, Qn = ({ setClosedChannelUrl: e, closedChannelUrl: t }) => /* @__PURE__ */ n.createElement(we, { initialId: de.activeConv }, /* @__PURE__ */ n.createElement(we.Screen, { id: de.activeConv }, ({ navigation: r }) => /* @__PURE__ */ n.createElement(rn, { onNavigateToConversationList: () => r.navigate(de.convList, { reset: !0 }) })), /* @__PURE__ */ n.createElement(we.Screen, { id: de.closedConv }, ({ navigation: r }) => /* @__PURE__ */ n.createElement(
3233
- rn,
3391
+ }, or = ({ setClosedChannelUrl: e, closedChannelUrl: t }) => /* @__PURE__ */ n.createElement(Ae, { initialId: le.activeConv }, /* @__PURE__ */ n.createElement(Ae.Screen, { id: le.activeConv }, ({ navigation: r }) => /* @__PURE__ */ n.createElement(on, { onNavigateToConversationList: () => r.navigate(le.convList, { reset: !0 }) })), /* @__PURE__ */ n.createElement(Ae.Screen, { id: le.closedConv }, ({ navigation: r }) => /* @__PURE__ */ n.createElement(
3392
+ on,
3234
3393
  {
3235
3394
  onNavigateToConversationList: () => r.pop(),
3236
3395
  closedChannelUrl: t,
3237
3396
  onClearClosedChannelUrl: () => e(void 0)
3238
3397
  }
3239
- )), /* @__PURE__ */ n.createElement(we.Screen, { id: de.convList, lazy: !0 }, ({ navigation: r }) => /* @__PURE__ */ n.createElement(
3240
- kc,
3398
+ )), /* @__PURE__ */ n.createElement(Ae.Screen, { id: le.convList, lazy: !0 }, ({ navigation: r }) => /* @__PURE__ */ n.createElement(
3399
+ Bc,
3241
3400
  {
3242
3401
  onOpenConversationView: (o, a) => {
3243
- a === "closed" ? (e(o), r.navigate(de.closedConv, { reset: !0 })) : r.navigate(de.activeConv);
3402
+ a === "closed" ? (e(o), r.navigate(le.closedConv, { reset: !0 })) : r.navigate(le.activeConv);
3244
3403
  }
3245
3404
  }
3246
3405
  )));
3247
- function Dc({ isExpanded: e, isOpened: t, children: r, launcher: o }) {
3406
+ function Kc({ isExpanded: e, isOpened: t, children: r, launcher: o }) {
3248
3407
  const { dir: a } = B();
3249
- return /* @__PURE__ */ n.createElement(Pc, null, /* @__PURE__ */ n.createElement(Fc, { dir: a, id: Q.WINDOW, $isExpanded: e, $isOpened: t }, r), o);
3408
+ return /* @__PURE__ */ n.createElement(Zc, null, /* @__PURE__ */ n.createElement(Yc, { dir: a, id: ne.WINDOW, $isExpanded: e, $isOpened: t }, r), o);
3250
3409
  }
3251
- const Pc = c.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end;`, Fc = c.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:right bottom;[dir='rtl'] &:not([dir='ltr']),&[dir='rtl']{transform-origin:left bottom;}${({ $isOpened: e }) => e && Vc};${({ $isExpanded: e }) => e && Uc};`, Uc = k`width:743px;height:723px;`, Vc = k`z-index:${fe.WINDOW};pointer-events:all;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;`, ud = ({ children: e, ...t }) => {
3252
- const r = Re(), [o, a] = C(), s = r ? Ln : Dc;
3253
- return /* @__PURE__ */ n.createElement(Rn, { enableExpandButton: !r, ...t }, /* @__PURE__ */ n.createElement($n, null, ({ state: i }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(s, { isExpanded: i.expanded, isOpened: i.opened, launcher: /* @__PURE__ */ n.createElement(Dn, null) }, /* @__PURE__ */ n.createElement(
3254
- Qn,
3410
+ const Zc = c.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end;`, Yc = c.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:right bottom;[dir='rtl'] &:not([dir='ltr']),&[dir='rtl']{transform-origin:left bottom;}${({ $isOpened: e }) => e && Jc};${({ $isExpanded: e }) => e && qc};`, qc = k`width:743px;height:723px;`, Jc = k`z-index:${ge.WINDOW};pointer-events:all;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;`, vd = ({ children: e, ...t }) => {
3411
+ const r = Ne(), [o, a] = y(), s = r ? Fn : Kc;
3412
+ return /* @__PURE__ */ n.createElement(Pn, { enableExpandButton: !r, ...t }, /* @__PURE__ */ n.createElement(Nn, null, ({ state: i }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(s, { isExpanded: i.expanded, isOpened: i.opened, launcher: /* @__PURE__ */ n.createElement(Hn, null) }, /* @__PURE__ */ n.createElement(
3413
+ or,
3255
3414
  {
3256
3415
  closedChannelUrl: o,
3257
3416
  setClosedChannelUrl: a
3258
3417
  }
3259
3418
  )), e)));
3260
3419
  };
3261
- function Hc(e) {
3262
- return /* @__PURE__ */ n.createElement(Wc, { ...e });
3420
+ function Xc(e) {
3421
+ return /* @__PURE__ */ n.createElement(Qc, { ...e });
3263
3422
  }
3264
- const Wc = c(Dn)`position:fixed;z-index:${fe.LAUNCHER};bottom:24px;inset-inline-end:24px;`;
3265
- function zc({ isExpanded: e, isOpened: t, children: r }) {
3423
+ const Qc = c(Hn)`position:fixed;z-index:${ge.LAUNCHER};bottom:24px;inset-inline-end:24px;`;
3424
+ function ed({ isExpanded: e, isOpened: t, children: r }) {
3266
3425
  const { dir: o } = B();
3267
- return /* @__PURE__ */ n.createElement(Gc, { dir: o, id: Q.WINDOW, $isExpanded: e, $isOpened: t }, r);
3426
+ return /* @__PURE__ */ n.createElement(td, { dir: o, id: ne.WINDOW, $isExpanded: e, $isOpened: t }, r);
3268
3427
  }
3269
- const Gc = c.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;position:fixed;bottom:84px;inset-inline-end:20px;height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:right bottom;[dir='rtl'] &:not([dir='ltr']),&[dir='rtl']{transform-origin:left bottom;}${({ $isOpened: e }) => e && Kc};${({ $isExpanded: e }) => e && jc};`, jc = k`width:743px;height:723px;`, Kc = k`z-index:${fe.WINDOW};pointer-events:all;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;`, md = ({ children: e, ...t }) => {
3270
- const r = Re(), [o, a] = C(), s = r ? Ln : zc;
3271
- return /* @__PURE__ */ n.createElement(Rn, { enableExpandButton: !r, ...t }, /* @__PURE__ */ n.createElement($n, null, ({ state: i }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(s, { isExpanded: i.expanded, isOpened: i.opened }, /* @__PURE__ */ n.createElement(
3272
- Qn,
3428
+ const td = c.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;position:fixed;bottom:84px;inset-inline-end:20px;height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:right bottom;[dir='rtl'] &:not([dir='ltr']),&[dir='rtl']{transform-origin:left bottom;}${({ $isOpened: e }) => e && rd};${({ $isExpanded: e }) => e && nd};`, nd = k`width:743px;height:723px;`, rd = k`z-index:${ge.WINDOW};pointer-events:all;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;`, yd = ({ children: e, ...t }) => {
3429
+ const r = Ne(), [o, a] = y(), s = r ? Fn : ed;
3430
+ return /* @__PURE__ */ n.createElement(Pn, { enableExpandButton: !r, ...t }, /* @__PURE__ */ n.createElement(Nn, null, ({ state: i }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(s, { isExpanded: i.expanded, isOpened: i.opened }, /* @__PURE__ */ n.createElement(
3431
+ or,
3273
3432
  {
3274
3433
  closedChannelUrl: o,
3275
3434
  setClosedChannelUrl: a
3276
3435
  }
3277
- )), /* @__PURE__ */ n.createElement(Hc, null), e)));
3436
+ )), /* @__PURE__ */ n.createElement(Xc, null), e)));
3278
3437
  };
3279
3438
  export {
3280
- lt as A,
3281
- jr as C,
3282
- ud as D,
3283
- md as F,
3284
- A as I,
3285
- wn as L,
3286
- qs as M,
3287
- bt as O,
3288
- dd as P,
3289
- Et as S,
3290
- T as a,
3291
- Rn as b,
3439
+ pt as A,
3440
+ Gr as C,
3441
+ vd as D,
3442
+ yd as F,
3443
+ $ as I,
3444
+ On as L,
3445
+ os as M,
3446
+ vt as O,
3447
+ xd as P,
3448
+ yt as S,
3449
+ S as a,
3450
+ Pn as b,
3292
3451
  d as c,
3293
- Fs as d,
3294
- U as e,
3452
+ Zi as d,
3453
+ P as e,
3295
3454
  M as f,
3296
- li as g,
3297
- he as h,
3298
- ue as i,
3299
- rn as j,
3300
- kc as k,
3455
+ bs as g,
3456
+ pe as h,
3457
+ ce as i,
3458
+ on as j,
3459
+ Bc as k,
3301
3460
  mn as l,
3302
- cd as m,
3461
+ gs as m,
3303
3462
  B as u
3304
3463
  };