react-sigma-chatbox 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import le, { useState as R, useRef as ee, useEffect as te } from "react";
2
- var F = { exports: {} }, $ = {};
1
+ import ce, { useState as R, useRef as ne, useEffect as q, useMemo as K } from "react";
2
+ var H = { exports: {} }, W = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -9,29 +9,29 @@ var F = { exports: {} }, $ = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var re;
13
- function ie() {
14
- if (re) return $;
15
- re = 1;
12
+ var se;
13
+ function de() {
14
+ if (se) return W;
15
+ se = 1;
16
16
  var r = Symbol.for("react.transitional.element"), u = Symbol.for("react.fragment");
17
- function o(s, l, c) {
18
- var h = null;
19
- if (c !== void 0 && (h = "" + c), l.key !== void 0 && (h = "" + l.key), "key" in l) {
17
+ function s(o, l, c) {
18
+ var x = null;
19
+ if (c !== void 0 && (x = "" + c), l.key !== void 0 && (x = "" + l.key), "key" in l) {
20
20
  c = {};
21
21
  for (var i in l)
22
22
  i !== "key" && (c[i] = l[i]);
23
23
  } else c = l;
24
24
  return l = c.ref, {
25
25
  $$typeof: r,
26
- type: s,
27
- key: h,
26
+ type: o,
27
+ key: x,
28
28
  ref: l !== void 0 ? l : null,
29
29
  props: c
30
30
  };
31
31
  }
32
- return $.Fragment = u, $.jsx = o, $.jsxs = o, $;
32
+ return W.Fragment = u, W.jsx = s, W.jsxs = s, W;
33
33
  }
34
- var D = {};
34
+ var Y = {};
35
35
  /**
36
36
  * @license React
37
37
  * react-jsx-runtime.development.js
@@ -41,26 +41,26 @@ var D = {};
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
43
  */
44
- var ne;
45
- function ce() {
46
- return ne || (ne = 1, process.env.NODE_ENV !== "production" && (function() {
44
+ var ae;
45
+ function ue() {
46
+ return ae || (ae = 1, process.env.NODE_ENV !== "production" && (function() {
47
47
  function r(t) {
48
48
  if (t == null) return null;
49
49
  if (typeof t == "function")
50
- return t.$$typeof === A ? null : t.displayName || t.name || null;
50
+ return t.$$typeof === N ? null : t.displayName || t.name || null;
51
51
  if (typeof t == "string") return t;
52
52
  switch (t) {
53
- case E:
53
+ case T:
54
54
  return "Fragment";
55
- case Y:
55
+ case X:
56
56
  return "Profiler";
57
57
  case C:
58
58
  return "StrictMode";
59
- case P:
59
+ case V:
60
60
  return "Suspense";
61
- case z:
61
+ case J:
62
62
  return "SuspenseList";
63
- case T:
63
+ case G:
64
64
  return "Activity";
65
65
  }
66
66
  if (typeof t == "object")
@@ -69,19 +69,19 @@ function ce() {
69
69
  ), t.$$typeof) {
70
70
  case _:
71
71
  return "Portal";
72
- case X:
72
+ case B:
73
73
  return t.displayName || "Context";
74
- case q:
74
+ case z:
75
75
  return (t._context.displayName || "Context") + ".Consumer";
76
- case N:
77
- var n = t.render;
78
- return t = t.displayName, t || (t = n.displayName || n.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
79
- case w:
80
- return n = t.displayName || null, n !== null ? n : r(t.type) || "Memo";
81
- case j:
82
- n = t._payload, t = t._init;
76
+ case U:
77
+ var a = t.render;
78
+ return t = t.displayName, t || (t = a.displayName || a.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
79
+ case v:
80
+ return a = t.displayName || null, a !== null ? a : r(t.type) || "Memo";
81
+ case A:
82
+ a = t._payload, t = t._init;
83
83
  try {
84
- return r(t(n));
84
+ return r(t(a));
85
85
  } catch {
86
86
  }
87
87
  }
@@ -90,77 +90,77 @@ function ce() {
90
90
  function u(t) {
91
91
  return "" + t;
92
92
  }
93
- function o(t) {
93
+ function s(t) {
94
94
  try {
95
95
  u(t);
96
- var n = !1;
96
+ var a = !1;
97
97
  } catch {
98
- n = !0;
98
+ a = !0;
99
99
  }
100
- if (n) {
101
- n = console;
102
- var m = n.error, f = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
103
- return m.call(
104
- n,
100
+ if (a) {
101
+ a = console;
102
+ var f = a.error, p = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
103
+ return f.call(
104
+ a,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- f
106
+ p
107
107
  ), u(t);
108
108
  }
109
109
  }
110
- function s(t) {
111
- if (t === E) return "<>";
112
- if (typeof t == "object" && t !== null && t.$$typeof === j)
110
+ function o(t) {
111
+ if (t === T) return "<>";
112
+ if (typeof t == "object" && t !== null && t.$$typeof === A)
113
113
  return "<...>";
114
114
  try {
115
- var n = r(t);
116
- return n ? "<" + n + ">" : "<...>";
115
+ var a = r(t);
116
+ return a ? "<" + a + ">" : "<...>";
117
117
  } catch {
118
118
  return "<...>";
119
119
  }
120
120
  }
121
121
  function l() {
122
- var t = M.A;
122
+ var t = y.A;
123
123
  return t === null ? null : t.getOwner();
124
124
  }
125
125
  function c() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
- function h(t) {
129
- if (I.call(t, "key")) {
130
- var n = Object.getOwnPropertyDescriptor(t, "key").get;
131
- if (n && n.isReactWarning) return !1;
128
+ function x(t) {
129
+ if (k.call(t, "key")) {
130
+ var a = Object.getOwnPropertyDescriptor(t, "key").get;
131
+ if (a && a.isReactWarning) return !1;
132
132
  }
133
133
  return t.key !== void 0;
134
134
  }
135
- function i(t, n) {
136
- function m() {
137
- J || (J = !0, console.error(
135
+ function i(t, a) {
136
+ function f() {
137
+ I || (I = !0, console.error(
138
138
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
- n
139
+ a
140
140
  ));
141
141
  }
142
- m.isReactWarning = !0, Object.defineProperty(t, "key", {
143
- get: m,
142
+ f.isReactWarning = !0, Object.defineProperty(t, "key", {
143
+ get: f,
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function a() {
147
+ function h() {
148
148
  var t = r(this.type);
149
- return G[t] || (G[t] = !0, console.error(
149
+ return M[t] || (M[t] = !0, console.error(
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
151
  )), t = this.props.ref, t !== void 0 ? t : null;
152
152
  }
153
- function d(t, n, m, f, U, V) {
154
- var p = m.ref;
153
+ function n(t, a, f, p, F, Q) {
154
+ var g = f.ref;
155
155
  return t = {
156
156
  $$typeof: S,
157
157
  type: t,
158
- key: n,
159
- props: m,
160
- _owner: f
161
- }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(t, "ref", {
158
+ key: a,
159
+ props: f,
160
+ _owner: p
161
+ }, (g !== void 0 ? g : null) !== null ? Object.defineProperty(t, "ref", {
162
162
  enumerable: !1,
163
- get: a
163
+ get: h
164
164
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
165
165
  configurable: !1,
166
166
  enumerable: !1,
@@ -175,119 +175,119 @@ function ce() {
175
175
  configurable: !1,
176
176
  enumerable: !1,
177
177
  writable: !0,
178
- value: U
178
+ value: F
179
179
  }), Object.defineProperty(t, "_debugTask", {
180
180
  configurable: !1,
181
181
  enumerable: !1,
182
182
  writable: !0,
183
- value: V
183
+ value: Q
184
184
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
185
185
  }
186
- function x(t, n, m, f, U, V) {
187
- var p = n.children;
188
- if (p !== void 0)
189
- if (f)
190
- if (L(p)) {
191
- for (f = 0; f < p.length; f++)
192
- g(p[f]);
193
- Object.freeze && Object.freeze(p);
186
+ function d(t, a, f, p, F, Q) {
187
+ var g = a.children;
188
+ if (g !== void 0)
189
+ if (p)
190
+ if (O(g)) {
191
+ for (p = 0; p < g.length; p++)
192
+ m(g[p]);
193
+ Object.freeze && Object.freeze(g);
194
194
  } else
195
195
  console.error(
196
196
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
197
  );
198
- else g(p);
199
- if (I.call(n, "key")) {
200
- p = r(t);
201
- var O = Object.keys(n).filter(function(oe) {
202
- return oe !== "key";
198
+ else m(g);
199
+ if (k.call(a, "key")) {
200
+ g = r(t);
201
+ var P = Object.keys(a).filter(function(ie) {
202
+ return ie !== "key";
203
203
  });
204
- f = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", K[p + f] || (O = 0 < O.length ? "{" + O.join(": ..., ") + ": ...}" : "{}", console.error(
204
+ p = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", re[g + p] || (P = 0 < P.length ? "{" + P.join(": ..., ") + ": ...}" : "{}", console.error(
205
205
  `A props object containing a "key" prop is being spread into JSX:
206
206
  let props = %s;
207
207
  <%s {...props} />
208
208
  React keys must be passed directly to JSX without using spread:
209
209
  let props = %s;
210
210
  <%s key={someKey} {...props} />`,
211
- f,
212
211
  p,
213
- O,
214
- p
215
- ), K[p + f] = !0);
212
+ g,
213
+ P,
214
+ g
215
+ ), re[g + p] = !0);
216
216
  }
217
- if (p = null, m !== void 0 && (o(m), p = "" + m), h(n) && (o(n.key), p = "" + n.key), "key" in n) {
218
- m = {};
219
- for (var H in n)
220
- H !== "key" && (m[H] = n[H]);
221
- } else m = n;
222
- return p && i(
223
- m,
217
+ if (g = null, f !== void 0 && (s(f), g = "" + f), x(a) && (s(a.key), g = "" + a.key), "key" in a) {
218
+ f = {};
219
+ for (var Z in a)
220
+ Z !== "key" && (f[Z] = a[Z]);
221
+ } else f = a;
222
+ return g && i(
223
+ f,
224
224
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
225
- ), d(
225
+ ), n(
226
226
  t,
227
- p,
228
- m,
227
+ g,
228
+ f,
229
229
  l(),
230
- U,
231
- V
230
+ F,
231
+ Q
232
232
  );
233
233
  }
234
- function g(t) {
235
- y(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === j && (t._payload.status === "fulfilled" ? y(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
234
+ function m(t) {
235
+ j(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === A && (t._payload.status === "fulfilled" ? j(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
236
236
  }
237
- function y(t) {
237
+ function j(t) {
238
238
  return typeof t == "object" && t !== null && t.$$typeof === S;
239
239
  }
240
- var v = le, S = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), Y = Symbol.for("react.profiler"), q = Symbol.for("react.consumer"), X = Symbol.for("react.context"), N = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), z = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), T = Symbol.for("react.activity"), A = Symbol.for("react.client.reference"), M = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, L = Array.isArray, B = console.createTask ? console.createTask : function() {
240
+ var b = ce, S = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), T = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), X = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), B = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), V = Symbol.for("react.suspense"), J = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), G = Symbol.for("react.activity"), N = Symbol.for("react.client.reference"), y = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, k = Object.prototype.hasOwnProperty, O = Array.isArray, D = console.createTask ? console.createTask : function() {
241
241
  return null;
242
242
  };
243
- v = {
243
+ b = {
244
244
  react_stack_bottom_frame: function(t) {
245
245
  return t();
246
246
  }
247
247
  };
248
- var J, G = {}, Q = v.react_stack_bottom_frame.bind(
249
- v,
248
+ var I, M = {}, ee = b.react_stack_bottom_frame.bind(
249
+ b,
250
250
  c
251
- )(), Z = B(s(c)), K = {};
252
- D.Fragment = E, D.jsx = function(t, n, m) {
253
- var f = 1e4 > M.recentlyCreatedOwnerStacks++;
254
- return x(
251
+ )(), te = D(o(c)), re = {};
252
+ Y.Fragment = T, Y.jsx = function(t, a, f) {
253
+ var p = 1e4 > y.recentlyCreatedOwnerStacks++;
254
+ return d(
255
255
  t,
256
- n,
257
- m,
256
+ a,
257
+ f,
258
258
  !1,
259
- f ? Error("react-stack-top-frame") : Q,
260
- f ? B(s(t)) : Z
259
+ p ? Error("react-stack-top-frame") : ee,
260
+ p ? D(o(t)) : te
261
261
  );
262
- }, D.jsxs = function(t, n, m) {
263
- var f = 1e4 > M.recentlyCreatedOwnerStacks++;
264
- return x(
262
+ }, Y.jsxs = function(t, a, f) {
263
+ var p = 1e4 > y.recentlyCreatedOwnerStacks++;
264
+ return d(
265
265
  t,
266
- n,
267
- m,
266
+ a,
267
+ f,
268
268
  !0,
269
- f ? Error("react-stack-top-frame") : Q,
270
- f ? B(s(t)) : Z
269
+ p ? Error("react-stack-top-frame") : ee,
270
+ p ? D(o(t)) : te
271
271
  );
272
272
  };
273
- })()), D;
273
+ })()), Y;
274
274
  }
275
- var se;
276
- function de() {
277
- return se || (se = 1, process.env.NODE_ENV === "production" ? F.exports = ie() : F.exports = ce()), F.exports;
275
+ var oe;
276
+ function he() {
277
+ return oe || (oe = 1, process.env.NODE_ENV === "production" ? H.exports = de() : H.exports = ue()), H.exports;
278
278
  }
279
- var e = de(), k = /* @__PURE__ */ ((r) => (r.TEXT = "text", r.PRODUCT_LIST = "product_list", r.LOADING = "loading", r))(k || {}), b = /* @__PURE__ */ ((r) => (r.USER = "user", r.AI = "ai", r))(b || {});
280
- const ue = ({
279
+ var e = he(), E = /* @__PURE__ */ ((r) => (r.TEXT = "text", r.PRODUCT_LIST = "product_list", r.LOADING = "loading", r))(E || {}), w = /* @__PURE__ */ ((r) => (r.USER = "user", r.AI = "ai", r))(w || {});
280
+ const me = ({
281
281
  title: r,
282
282
  primaryColor: u,
283
- onClose: o,
284
- onReset: s,
283
+ onClose: s,
284
+ onReset: o,
285
285
  onToggleExpand: l,
286
286
  isExpanded: c,
287
- language: h,
287
+ language: x,
288
288
  onLanguageChange: i
289
289
  }) => {
290
- const a = [
290
+ const h = [
291
291
  { value: "en", label: "EN" },
292
292
  { value: "vi", label: "VI" },
293
293
  { value: "ja", label: "JA" }
@@ -302,7 +302,7 @@ const ue = ({
302
302
  "img",
303
303
  {
304
304
  src: "https://fptshop.com.vn/img/bitu/bitu-avatar.png",
305
- onError: (d) => d.currentTarget.src = "https://cdn-icons-png.flaticon.com/512/4712/4712035.png",
305
+ onError: (n) => n.currentTarget.src = "https://cdn-icons-png.flaticon.com/512/4712/4712035.png",
306
306
  className: "w-full h-full object-contain",
307
307
  alt: "Bot Icon"
308
308
  }
@@ -324,11 +324,11 @@ const ue = ({
324
324
  /* @__PURE__ */ e.jsx(
325
325
  "select",
326
326
  {
327
- value: h,
328
- onChange: (d) => i(d.target.value),
327
+ value: x,
328
+ onChange: (n) => i(n.target.value),
329
329
  className: "appearance-none bg-white/50 border border-gray-200 rounded-lg px-2 pr-5 py-1 text-[10px] font-black text-indigo-600 cursor-pointer hover:bg-white transition-all focus:outline-none focus:ring-2 focus:ring-indigo-100 uppercase",
330
330
  title: "Select language",
331
- children: a.map((d) => /* @__PURE__ */ e.jsx("option", { value: d.value, className: "font-sans font-bold", children: d.label }, d.value))
331
+ children: h.map((n) => /* @__PURE__ */ e.jsx("option", { value: n.value, className: "font-sans font-bold", children: n.label }, n.value))
332
332
  }
333
333
  ),
334
334
  /* @__PURE__ */ e.jsx("div", { className: "absolute right-1.5 top-1/2 -translate-y-1/2 pointer-events-none text-indigo-400", children: /* @__PURE__ */ e.jsx("svg", { width: "8", height: "8", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e.jsx("path", { d: "m6 9 6 6 6-6" }) }) })
@@ -336,7 +336,7 @@ const ue = ({
336
336
  /* @__PURE__ */ e.jsx(
337
337
  "button",
338
338
  {
339
- onClick: s,
339
+ onClick: o,
340
340
  className: "w-8 h-8 flex items-center justify-center rounded-lg hover:bg-white/60 text-gray-500 hover:text-indigo-600 transition-all",
341
341
  title: "Reset chat",
342
342
  children: /* @__PURE__ */ e.jsxs("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
@@ -369,7 +369,7 @@ const ue = ({
369
369
  /* @__PURE__ */ e.jsx(
370
370
  "button",
371
371
  {
372
- onClick: o,
372
+ onClick: s,
373
373
  className: "w-8 h-8 flex items-center justify-center rounded-lg hover:bg-red-50 text-gray-500 hover:text-red-500 transition-all",
374
374
  title: "Close",
375
375
  children: /* @__PURE__ */ e.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
@@ -382,7 +382,7 @@ const ue = ({
382
382
  ]
383
383
  }
384
384
  );
385
- }, he = ({ product: r, primaryColor: u }) => /* @__PURE__ */ e.jsxs("div", { className: "min-w-[170px] max-w-[170px] bg-white rounded-xl border border-gray-50 shadow-sm overflow-hidden flex flex-col hover:shadow-lg transition-all duration-300 group", children: [
385
+ }, xe = ({ product: r, primaryColor: u }) => /* @__PURE__ */ e.jsxs("div", { className: "min-w-[170px] max-w-[170px] bg-white rounded-xl border border-gray-50 shadow-sm overflow-hidden flex flex-col hover:shadow-lg transition-all duration-300 group", children: [
386
386
  /* @__PURE__ */ e.jsxs("div", { className: "relative h-32 w-full bg-white flex items-center justify-center p-2", children: [
387
387
  /* @__PURE__ */ e.jsx(
388
388
  "img",
@@ -407,30 +407,30 @@ const ue = ({
407
407
  {
408
408
  className: "w-full py-1.5 rounded-lg text-[11px] font-bold border transition-all duration-300 active:scale-95 shadow-sm",
409
409
  style: { borderColor: u, color: u },
410
- onMouseEnter: (o) => {
411
- o.currentTarget.style.backgroundColor = u, o.currentTarget.style.color = "white";
410
+ onMouseEnter: (s) => {
411
+ s.currentTarget.style.backgroundColor = u, s.currentTarget.style.color = "white";
412
412
  },
413
- onMouseLeave: (o) => {
414
- o.currentTarget.style.backgroundColor = "transparent", o.currentTarget.style.color = u;
413
+ onMouseLeave: (s) => {
414
+ s.currentTarget.style.backgroundColor = "transparent", s.currentTarget.style.color = u;
415
415
  },
416
416
  children: "Chọn mua"
417
417
  }
418
418
  )
419
419
  ] })
420
- ] }), W = (r) => {
420
+ ] }), $ = (r) => {
421
421
  const u = /(\*\*.*?\*\*|\[.*?\]\(.*?\))/g;
422
- return r.split(u).map((s, l) => {
423
- if (s.startsWith("**") && s.endsWith("**")) {
424
- const h = s.slice(2, -2);
425
- return /* @__PURE__ */ e.jsx("strong", { className: "font-bold text-gray-900", children: h }, l);
422
+ return r.split(u).map((o, l) => {
423
+ if (o.startsWith("**") && o.endsWith("**")) {
424
+ const x = o.slice(2, -2);
425
+ return /* @__PURE__ */ e.jsx("strong", { className: "font-bold text-gray-900", children: x }, l);
426
426
  }
427
- const c = s.match(/\[(.*?)\]\((.*?)\)/);
427
+ const c = o.match(/\[(.*?)\]\((.*?)\)/);
428
428
  if (c) {
429
- const [h, i, a] = c;
429
+ const [x, i, h] = c;
430
430
  return /* @__PURE__ */ e.jsx(
431
431
  "a",
432
432
  {
433
- href: a,
433
+ href: h,
434
434
  target: "_blank",
435
435
  rel: "noopener noreferrer",
436
436
  className: "text-blue-600 hover:underline break-all font-semibold",
@@ -439,71 +439,72 @@ const ue = ({
439
439
  l
440
440
  );
441
441
  }
442
- return s;
442
+ return o;
443
443
  });
444
- }, me = ({ text: r }) => {
445
- const u = r.split(`
446
- `), o = [];
447
- let s = [], l = !1;
448
- const c = (h) => {
449
- if (s.length > 0) {
450
- const a = s.length > 1 && s[1].every((d) => d.trim().match(/^:?-+:?$/)) ? [s[0], ...s.slice(2)] : s;
451
- o.push(
452
- /* @__PURE__ */ e.jsx("div", { className: "my-4 overflow-x-auto border border-gray-200 rounded-lg shadow-sm bg-white", children: /* @__PURE__ */ e.jsxs("table", { className: "min-w-full divide-y divide-gray-200 text-[13px]", children: [
453
- /* @__PURE__ */ e.jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ e.jsx("tr", { children: a[0].map((d, x) => /* @__PURE__ */ e.jsx("th", { className: "px-3 py-2 text-left font-bold text-gray-700 border-r last:border-r-0 border-gray-200", children: W(d.trim()) }, x)) }) }),
454
- /* @__PURE__ */ e.jsx("tbody", { className: "divide-y divide-gray-100 bg-white", children: a.slice(1).map((d, x) => /* @__PURE__ */ e.jsx("tr", { className: "hover:bg-gray-50/50 transition-colors", children: d.map((g, y) => /* @__PURE__ */ e.jsx("td", { className: "px-3 py-2 text-gray-600 border-r last:border-r-0 border-gray-200 align-top", children: W(g.trim()) }, y)) }, x)) })
455
- ] }) }, `table-${h}`)
456
- ), s = [], l = !1;
444
+ }, fe = ({ text: r }) => {
445
+ const u = r.replace(/\r/g, "").split(`
446
+ `), s = [];
447
+ let o = [], l = !1;
448
+ const c = (x) => {
449
+ if (o.length > 0) {
450
+ const h = o.length > 1 && o[1].every((n) => n.trim().match(/^:?-+:?$/)) ? [o[0], ...o.slice(2)] : o;
451
+ h.length > 0 && s.push(
452
+ /* @__PURE__ */ e.jsx("div", { className: "my-4 overflow-x-auto border border-slate-200 rounded-xl shadow-sm bg-white", children: /* @__PURE__ */ e.jsxs("table", { className: "min-w-full border-collapse text-[13px] leading-normal", children: [
453
+ /* @__PURE__ */ e.jsx("thead", { className: "bg-slate-50 border-b border-slate-200", children: /* @__PURE__ */ e.jsx("tr", { children: h[0].map((n, d) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-3 text-left font-bold text-slate-700 border-r last:border-r-0 border-slate-200 whitespace-nowrap", children: $(n.trim()) }, d)) }) }),
454
+ /* @__PURE__ */ e.jsx("tbody", { className: "divide-y divide-slate-100", children: h.slice(1).map((n, d) => /* @__PURE__ */ e.jsx("tr", { className: "hover:bg-slate-50/50 transition-colors", children: n.map((m, j) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-3 text-slate-600 border-r last:border-r-0 border-slate-200 align-top", children: $(m.trim()) }, j)) }, d)) })
455
+ ] }) }, `table-wrapper-${x}`)
456
+ ), o = [], l = !1;
457
457
  }
458
458
  };
459
- return u.forEach((h, i) => {
460
- const a = h.trim();
461
- if (a.startsWith("|") && a.endsWith("|")) {
462
- const g = a.split("|").slice(1, -1);
463
- s.push(g), l = !0;
459
+ return u.forEach((x, i) => {
460
+ const h = x.trim();
461
+ if (h.includes("|") && (h.startsWith("|") || h.split("|").length > 1)) {
462
+ let m = h.split("|");
463
+ h.startsWith("|") && m.shift(), h.endsWith("|") && m.pop(), o.push(m), l = !0;
464
464
  return;
465
465
  } else l && c(i);
466
- const d = a.match(/^(#{1,4})\s+(.*)$/);
467
- if (d) {
468
- const g = d[1].length, y = d[2], v = g === 1 ? "text-lg font-bold mb-3 mt-4 first:mt-1" : g === 2 ? "text-md font-bold mb-2 mt-3" : "text-[13px] font-black mb-1.5 mt-4 text-indigo-600 uppercase tracking-widest";
469
- o.push(/* @__PURE__ */ e.jsx("div", { className: v, children: W(y) }, i));
466
+ const n = h.match(/^(#{1,4})\s+(.*)$/);
467
+ if (n) {
468
+ const m = n[1].length, j = n[2], b = m === 1 ? "text-xl font-bold mb-4 mt-6 first:mt-1" : m === 2 ? "text-lg font-bold mb-3 mt-5" : "text-[13px] font-black mb-2 mt-5 text-indigo-600 uppercase tracking-widest";
469
+ s.push(/* @__PURE__ */ e.jsx("div", { className: b, children: $(j) }, i));
470
470
  return;
471
471
  }
472
- const x = a.match(/^[*+-]\s+(.*)$/);
473
- if (x) {
474
- const g = x[1];
475
- o.push(
476
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2.5 pl-1 mb-1.5 items-start", children: [
477
- /* @__PURE__ */ e.jsx("span", { className: "text-indigo-400 flex-shrink-0 mt-2 w-1.5 h-1.5 bg-indigo-400 rounded-full" }),
478
- /* @__PURE__ */ e.jsx("div", { className: "flex-1 leading-relaxed text-gray-800", children: W(g) })
472
+ const d = h.match(/^[*+-]\s+(.*)$/);
473
+ if (d) {
474
+ const m = d[1];
475
+ s.push(
476
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-3 pl-1 mb-2 items-start group", children: [
477
+ /* @__PURE__ */ e.jsx("span", { className: "text-indigo-400 flex-shrink-0 mt-2 w-1.5 h-1.5 bg-indigo-400 rounded-full group-hover:scale-125 transition-transform" }),
478
+ /* @__PURE__ */ e.jsx("div", { className: "flex-1 leading-relaxed text-slate-700", children: $(m) })
479
479
  ] }, i)
480
480
  );
481
481
  return;
482
482
  }
483
- if (a === "") {
484
- o.push(/* @__PURE__ */ e.jsx("div", { className: "h-2" }, i));
483
+ if (h === "") {
484
+ s.push(/* @__PURE__ */ e.jsx("div", { className: "h-3" }, i));
485
485
  return;
486
486
  }
487
- o.push(
488
- /* @__PURE__ */ e.jsx("div", { className: "mb-1 leading-relaxed text-gray-800", children: W(h) }, i)
487
+ s.push(
488
+ /* @__PURE__ */ e.jsx("div", { className: "mb-1.5 leading-relaxed text-slate-700", children: $(x) }, i)
489
489
  );
490
- }), l && c(u.length), /* @__PURE__ */ e.jsx("div", { className: "markdown-body text-[14px]", children: o });
491
- }, xe = ({
490
+ }), l && c(u.length), /* @__PURE__ */ e.jsx("div", { className: "markdown-render w-full", children: s });
491
+ }, pe = ({
492
492
  messages: r,
493
493
  isLoading: u,
494
+ description: s,
494
495
  quickReplies: o,
495
- onQuickReply: s,
496
- primaryColor: l,
497
- renderMarkdown: c = !1
496
+ onQuickReply: l,
497
+ primaryColor: c,
498
+ renderMarkdown: x = !1
498
499
  }) => {
499
- const h = "https://fptshop.com.vn/img/bitu/bitu-avatar.png", i = "https://cdn-icons-png.flaticon.com/512/4712/4712035.png";
500
+ const i = "https://fptshop.com.vn/img/bitu/bitu-avatar.png", h = "https://cdn-icons-png.flaticon.com/512/4712/4712035.png";
500
501
  return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-8 pb-4", children: [
501
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-center animate-msg", children: [
502
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center pt-4 text-center animate-msg", children: [
502
503
  /* @__PURE__ */ e.jsx("div", { className: "relative mb-5", children: /* @__PURE__ */ e.jsx("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ e.jsx(
503
504
  "img",
504
505
  {
505
- src: h,
506
- onError: (a) => a.currentTarget.src = i,
506
+ src: i,
507
+ onError: (n) => n.currentTarget.src = h,
507
508
  className: "w-full h-full object-contain",
508
509
  alt: "Sigma AI Hero"
509
510
  }
@@ -512,58 +513,55 @@ const ue = ({
512
513
  "Sigma ",
513
514
  /* @__PURE__ */ e.jsx("span", { className: "bg-indigo-600 text-white text-[10px] px-1.5 py-0.5 rounded-md leading-none ml-1 uppercase font-bold tracking-tight", children: "AI" })
514
515
  ] }),
515
- /* @__PURE__ */ e.jsx("div", { className: "text-[14px] text-gray-600 mt-3 leading-relaxed px-4 max-w-[280px]", children: /* @__PURE__ */ e.jsxs("p", { children: [
516
- /* @__PURE__ */ e.jsx("span", { className: "font-bold text-gray-800", children: "Sigma Assistant" }),
517
- " hỗ trợ bạn mọi lúc mọi nơi"
518
- ] }) })
516
+ /* @__PURE__ */ e.jsx("div", { className: "text-[14px] text-gray-600 mt-3 leading-relaxed px-4 max-w-[280px]", children: s && /* @__PURE__ */ e.jsx("div", { className: "bot-description", children: $(s) }) })
519
517
  ] }),
520
- r.map((a, d) => /* @__PURE__ */ e.jsxs(
518
+ r.map((n, d) => /* @__PURE__ */ e.jsxs(
521
519
  "div",
522
520
  {
523
- className: `flex flex-col animate-msg ${a.sender === b.USER ? "items-end" : "items-start"}`,
521
+ className: `flex flex-col animate-msg ${n.sender === w.USER ? "items-end" : "items-start"}`,
524
522
  style: { animationDelay: `${d * 0.05}s` },
525
523
  children: [
526
- a.sender === b.AI && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1.5 mb-2 ml-1", children: [
524
+ n.sender === w.AI && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1.5 mb-2 ml-1", children: [
527
525
  /* @__PURE__ */ e.jsx(
528
526
  "img",
529
527
  {
530
- src: h,
531
- onError: (x) => x.currentTarget.src = i,
528
+ src: i,
529
+ onError: (m) => m.currentTarget.src = h,
532
530
  className: "w-4 h-4 object-contain",
533
531
  alt: "AI"
534
532
  }
535
533
  ),
536
534
  /* @__PURE__ */ e.jsx("span", { className: "text-[11px] font-bold text-gray-400 uppercase tracking-widest", children: "AI Agent" })
537
535
  ] }),
538
- /* @__PURE__ */ e.jsxs("div", { className: `flex flex-col ${a.sender === b.USER ? "items-end" : "items-start"} max-w-[96%]`, children: [
536
+ /* @__PURE__ */ e.jsxs("div", { className: `flex flex-col ${n.sender === w.USER ? "items-end" : "items-start"} w-full max-w-[96%]`, children: [
539
537
  /* @__PURE__ */ e.jsx(
540
538
  "div",
541
539
  {
542
- className: `px-4 py-3 rounded-[20px] shadow-sm border border-black/[0.02] ${a.sender === b.USER ? "bg-indigo-600 text-white rounded-tr-none whitespace-pre-line shadow-indigo-100" : "bg-white text-gray-800 border-none rounded-tl-none"} ${!c || a.sender === b.USER ? "whitespace-pre-line" : ""}`,
543
- children: c && a.sender === b.AI ? /* @__PURE__ */ e.jsx(me, { text: a.content }) : a.content
540
+ className: `px-4 py-3 rounded-[20px] shadow-sm border border-black/[0.02] overflow-hidden ${n.sender === w.USER ? "bg-indigo-600 text-white rounded-tr-none whitespace-pre-line shadow-indigo-100/50" : "bg-white text-slate-800 border-none rounded-tl-none"} ${!x || n.sender === w.USER ? "whitespace-pre-line" : ""}`,
541
+ children: x && n.sender === w.AI ? /* @__PURE__ */ e.jsx(fe, { text: n.content }) : n.content
544
542
  }
545
543
  ),
546
- a.type === k.PRODUCT_LIST && a.products && /* @__PURE__ */ e.jsx("div", { className: "w-full mt-4 flex gap-4 overflow-x-auto pb-4 pt-1 no-scrollbar snap-x", children: a.products.map((x) => /* @__PURE__ */ e.jsx("div", { className: "product-card-snap", children: /* @__PURE__ */ e.jsx(he, { product: x, primaryColor: l }) }, x.id)) }),
547
- d === 0 && r.length === 1 && a.sender === b.AI && /* @__PURE__ */ e.jsx("div", { className: "mt-5 flex flex-wrap gap-2.5 w-full", children: o.map((x, g) => /* @__PURE__ */ e.jsx(
544
+ n.type === E.PRODUCT_LIST && n.products && /* @__PURE__ */ e.jsx("div", { className: "w-full mt-4 flex gap-4 overflow-x-auto pb-4 pt-1 no-scrollbar snap-x", children: n.products.map((m) => /* @__PURE__ */ e.jsx("div", { className: "product-card-snap", children: /* @__PURE__ */ e.jsx(xe, { product: m, primaryColor: c }) }, m.id)) }),
545
+ d === 0 && r.length === 1 && n.sender === w.AI && /* @__PURE__ */ e.jsx("div", { className: "mt-5 flex flex-wrap gap-2.5 w-full", children: o.map((m, j) => /* @__PURE__ */ e.jsx(
548
546
  "button",
549
547
  {
550
- onClick: () => s(x),
548
+ onClick: () => l(m),
551
549
  className: "px-4 py-2 rounded-full text-[13px] font-semibold border border-transparent bg-white text-gray-600 hover:text-indigo-600 hover:border-indigo-100 transition-all duration-200 shadow-sm active:scale-95",
552
- children: x
550
+ children: m
553
551
  },
554
- g
552
+ j
555
553
  )) })
556
554
  ] })
557
555
  ]
558
556
  },
559
- a.id
557
+ n.id
560
558
  )),
561
559
  u && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1.5 items-start animate-msg", children: [
562
560
  /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1.5 ml-1", children: /* @__PURE__ */ e.jsx(
563
561
  "img",
564
562
  {
565
- src: h,
566
- onError: (a) => a.currentTarget.src = i,
563
+ src: i,
564
+ onError: (n) => n.currentTarget.src = h,
567
565
  className: "w-4 h-4 object-contain",
568
566
  alt: "AI Loading"
569
567
  }
@@ -575,19 +573,19 @@ const ue = ({
575
573
  ] })
576
574
  ] })
577
575
  ] });
578
- }, fe = ({ placeholder: r, onSendMessage: u, primaryColor: o }) => {
579
- const [s, l] = R(""), c = () => {
580
- s.trim() && (u(s), l(""));
581
- }, h = (i) => {
576
+ }, ge = ({ placeholder: r, onSendMessage: u, primaryColor: s }) => {
577
+ const [o, l] = R(""), c = () => {
578
+ o.trim() && (u(o), l(""));
579
+ }, x = (i) => {
582
580
  i.key === "Enter" && !i.shiftKey && (i.preventDefault(), c());
583
581
  };
584
582
  return /* @__PURE__ */ e.jsx("div", { className: "p-1", children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex items-center bg-gray-50/50 rounded-2xl border border-gray-100 focus-within:border-indigo-100 focus-within:bg-white transition-all duration-200 pr-2 pl-3 py-1", children: [
585
583
  /* @__PURE__ */ e.jsx(
586
584
  "textarea",
587
585
  {
588
- value: s,
586
+ value: o,
589
587
  onChange: (i) => l(i.target.value),
590
- onKeyDown: h,
588
+ onKeyDown: x,
591
589
  placeholder: r,
592
590
  rows: 1,
593
591
  className: "w-full bg-transparent border-none outline-none focus:ring-0 text-[14px] text-gray-700 font-normal py-3 px-1 resize-none chat-scrollbar min-h-[44px] max-h-[120px] leading-relaxed placeholder:text-gray-400",
@@ -598,8 +596,8 @@ const ue = ({
598
596
  "button",
599
597
  {
600
598
  onClick: c,
601
- disabled: !s.trim(),
602
- className: `w-9 h-9 rounded-xl flex-shrink-0 flex items-center justify-center transition-all duration-300 shadow-sm ${s.trim() ? "bg-indigo-600 text-white hover:bg-indigo-700 active:scale-95" : "bg-gray-200 text-gray-400 cursor-not-allowed"}`,
599
+ disabled: !o.trim(),
600
+ className: `w-9 h-9 rounded-xl flex-shrink-0 flex items-center justify-center transition-all duration-300 shadow-sm ${o.trim() ? "bg-indigo-600 text-white hover:bg-indigo-700 active:scale-95" : "bg-gray-200 text-gray-400 cursor-not-allowed"}`,
603
601
  children: /* @__PURE__ */ e.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: [
604
602
  /* @__PURE__ */ e.jsx("path", { d: "m5 12 7-7 7 7" }),
605
603
  /* @__PURE__ */ e.jsx("path", { d: "M12 19V5" })
@@ -607,7 +605,7 @@ const ue = ({
607
605
  }
608
606
  )
609
607
  ] }) });
610
- }, pe = ({ isOpen: r, onClick: u, primaryColor: o, className: s = "" }) => /* @__PURE__ */ e.jsx("div", { className: `fixed bottom-4 right-4 md:bottom-6 md:right-6 z-[100] ${s}`, children: /* @__PURE__ */ e.jsx(
608
+ }, be = ({ isOpen: r, onClick: u, primaryColor: s, className: o = "" }) => /* @__PURE__ */ e.jsx("div", { className: `fixed bottom-4 right-4 md:bottom-6 md:right-6 z-[100] ${o}`, children: /* @__PURE__ */ e.jsx(
611
609
  "button",
612
610
  {
613
611
  onClick: u,
@@ -622,129 +620,142 @@ const ue = ({
622
620
  }
623
621
  )
624
622
  }
625
- ) }), ae = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), be = ({ config: r, onGetAiResponse: u }) => {
626
- const [o, s] = R(!1), [l, c] = R(!1), [h, i] = R(!1), [a, d] = R(ae()), [x, g] = R("en"), [y, v] = R([
627
- {
623
+ ) }), le = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), L = (r, u, s) => typeof r == "object" && r !== null && !Array.isArray(r) ? r[u] || r.en || Object.values(r)[0] || s : r ?? s, je = ({ config: r, onGetAiResponse: u }) => {
624
+ const [s, o] = R(!1), [l, c] = R(!1), [x, i] = R(!1), [h, n] = R(le()), [d, m] = R("en"), [j, b] = R([]), [S, _] = R(!1), T = ne(null), C = ne(0);
625
+ q(() => {
626
+ const v = L(r.welcomeMessage, d, "Hello!");
627
+ b([{
628
628
  id: "welcome",
629
- type: k.TEXT,
630
- sender: b.AI,
631
- content: r.welcomeMessage,
629
+ type: E.TEXT,
630
+ sender: w.AI,
631
+ content: v,
632
632
  timestamp: /* @__PURE__ */ new Date()
633
+ }]);
634
+ }, []);
635
+ const X = K(() => L(r.placeholder, d, "Type a message..."), [r.placeholder, d]), z = K(() => L(r.quickReplies, d, []), [r.quickReplies, d]), B = K(() => L(r.description, d, ""), [r.description, d]);
636
+ q(() => {
637
+ if (j.length === 1 && j[0].id === "welcome") {
638
+ const v = L(r.welcomeMessage, d, "Hello!");
639
+ b([{ ...j[0], content: v }]);
633
640
  }
634
- ]), [S, _] = R(!1), E = ee(null), C = ee(0);
635
- te(() => {
636
- if (o) {
637
- const N = setTimeout(() => i(!0), 50);
638
- return () => clearTimeout(N);
641
+ }, [d]), q(() => {
642
+ if (s) {
643
+ const v = setTimeout(() => i(!0), 50);
644
+ return () => clearTimeout(v);
639
645
  } else
640
646
  i(!1);
641
- }, [o]), te(() => {
642
- E.current && o && (E.current.scrollTop = E.current.scrollHeight);
643
- }, [y, o, S]);
644
- const Y = async (N) => {
645
- if (!N.trim() || S) return;
646
- const P = ++C.current, z = {
647
+ }, [s]), q(() => {
648
+ T.current && s && (T.current.scrollTop = T.current.scrollHeight);
649
+ }, [j, s, S]);
650
+ const U = async (v) => {
651
+ if (!v.trim() || S) return;
652
+ const A = ++C.current, G = {
647
653
  id: `user-${Date.now()}`,
648
- type: k.TEXT,
649
- sender: b.USER,
650
- content: N,
654
+ type: E.TEXT,
655
+ sender: w.USER,
656
+ content: v,
651
657
  timestamp: /* @__PURE__ */ new Date()
652
658
  };
653
- v((w) => [...w, z]), _(!0);
659
+ b((N) => [...N, G]), _(!0);
654
660
  try {
655
- const w = u(N, a, x);
656
- if (w && typeof w == "object" && Symbol.asyncIterator in w) {
657
- let j = "", T = !1;
658
- const A = `ai-${Date.now()}`;
659
- for await (const M of w) {
660
- if (P !== C.current) return;
661
- T || (v((I) => [...I, {
662
- id: A,
663
- type: k.TEXT,
664
- sender: b.AI,
661
+ const N = u(v, h, d);
662
+ if (N && typeof N == "object" && Symbol.asyncIterator in N) {
663
+ let y = "", k = !1;
664
+ const O = `ai-${Date.now()}`;
665
+ for await (const D of N) {
666
+ if (A !== C.current) return;
667
+ k || (b((I) => [...I, {
668
+ id: O,
669
+ type: E.TEXT,
670
+ sender: w.AI,
665
671
  content: "",
666
672
  timestamp: /* @__PURE__ */ new Date()
667
- }]), _(!1), T = !0), j += M, v((I) => I.map(
668
- (L) => L.id === A ? { ...L, content: j } : L
673
+ }]), _(!1), k = !0), y += D, b((I) => I.map(
674
+ (M) => M.id === O ? { ...M, content: y } : M
669
675
  ));
670
676
  }
671
677
  } else {
672
- const j = await w;
673
- if (P !== C.current) return;
678
+ const y = await N;
679
+ if (A !== C.current) return;
674
680
  _(!1);
675
- const T = typeof j == "string" ? { text: j, products: void 0 } : j;
676
- v((A) => [...A, {
681
+ const k = typeof y == "string" ? { text: y, products: void 0 } : y;
682
+ b((O) => [...O, {
677
683
  id: `ai-${Date.now()}`,
678
- type: T.products ? k.PRODUCT_LIST : k.TEXT,
679
- sender: b.AI,
680
- content: T.text,
681
- products: T.products,
684
+ type: k.products ? E.PRODUCT_LIST : E.TEXT,
685
+ sender: w.AI,
686
+ content: k.text,
687
+ products: k.products,
682
688
  timestamp: /* @__PURE__ */ new Date()
683
689
  }]);
684
690
  }
685
- } catch (w) {
686
- if (P !== C.current) return;
687
- console.error("Chatbox Error:", w), _(!1), v((j) => [...j, {
691
+ } catch (N) {
692
+ if (A !== C.current) return;
693
+ console.error("Chatbox Error:", N), _(!1);
694
+ const y = d === "vi" ? "Hệ thống đang bận, vui lòng thử lại sau." : "System is busy, please try again later.";
695
+ b((k) => [...k, {
688
696
  id: `err-${Date.now()}`,
689
- type: k.TEXT,
690
- sender: b.AI,
691
- content: "Hệ thống đang bận, vui lòng thử lại sau.",
697
+ type: E.TEXT,
698
+ sender: w.AI,
699
+ content: y,
692
700
  timestamp: /* @__PURE__ */ new Date()
693
701
  }]);
694
702
  }
695
- }, q = () => {
696
- C.current++, d(ae()), v([{
703
+ }, V = () => {
704
+ C.current++, n(le());
705
+ const v = L(r.welcomeMessage, d, "Hello!");
706
+ b([{
697
707
  id: "welcome",
698
- type: k.TEXT,
699
- sender: b.AI,
700
- content: r.welcomeMessage,
708
+ type: E.TEXT,
709
+ sender: w.AI,
710
+ content: v,
701
711
  timestamp: /* @__PURE__ */ new Date()
702
712
  }]), _(!1), c(!1);
703
- }, X = `
713
+ }, J = `
704
714
  fixed z-[99] overflow-hidden flex flex-col border border-white/40 shadow-2xl bg-white animate-chat-pop
705
- ${h ? "transition-[width,height,border-radius,right,bottom] duration-300 ease-in-out" : ""}
706
- ${l ? "bottom-0 right-0 w-full h-full md:bottom-6 md:right-28 md:w-[850px] md:h-[85vh] rounded-none md:rounded-[32px]" : "bottom-0 right-0 w-full h-[80vh] md:bottom-6 md:right-28 md:w-[380px] md:h-[580px] rounded-t-[28px] md:rounded-[28px]"}
715
+ ${x ? "transition-[width,height,border-radius,right,bottom] duration-300 ease-in-out" : ""}
716
+ ${l ? "bottom-0 right-0 w-full h-full md:bottom-6 md:right-28 md:w-[850px] md:h-[85vh] rounded-none md:rounded-[32px]" : "bottom-0 right-0 w-full h-[80vh] md:bottom-6 md:right-28 md:w-[420px] md:h-[580px] rounded-t-[28px] md:rounded-[28px]"}
707
717
  `;
708
718
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
709
719
  /* @__PURE__ */ e.jsx(
710
- pe,
720
+ be,
711
721
  {
712
- isOpen: o,
713
- onClick: () => s(!o),
722
+ isOpen: s,
723
+ onClick: () => o(!s),
714
724
  primaryColor: r.primaryColor,
715
- className: o ? "hidden md:flex" : "flex"
725
+ className: s ? "hidden md:flex" : "flex"
716
726
  }
717
727
  ),
718
- o && /* @__PURE__ */ e.jsxs("div", { className: X, style: { left: "auto" }, children: [
728
+ s && /* @__PURE__ */ e.jsxs("div", { className: J, style: { left: "auto" }, children: [
719
729
  /* @__PURE__ */ e.jsx(
720
- ue,
730
+ me,
721
731
  {
722
732
  title: r.botName,
723
733
  primaryColor: r.primaryColor,
724
- onClose: () => s(!1),
725
- onReset: q,
734
+ onClose: () => o(!1),
735
+ onReset: V,
726
736
  onToggleExpand: () => c(!l),
727
737
  isExpanded: l,
728
- language: x,
729
- onLanguageChange: g
738
+ language: d,
739
+ onLanguageChange: m
730
740
  }
731
741
  ),
732
- /* @__PURE__ */ e.jsx("div", { className: "flex-1 overflow-y-auto chat-scrollbar px-5 py-5 bg-slate-50/30", ref: E, children: /* @__PURE__ */ e.jsx(
733
- xe,
742
+ /* @__PURE__ */ e.jsx("div", { className: "flex-1 overflow-y-auto chat-scrollbar px-5 py-5 bg-slate-50/30", ref: T, children: /* @__PURE__ */ e.jsx(
743
+ pe,
734
744
  {
735
- messages: y,
745
+ messages: j,
736
746
  isLoading: S,
737
- quickReplies: r.quickReplies,
738
- onQuickReply: (N) => Y(N),
747
+ description: B,
748
+ quickReplies: z,
749
+ onQuickReply: (v) => U(v),
739
750
  primaryColor: r.primaryColor,
740
751
  renderMarkdown: r.renderMarkdown
741
752
  }
742
753
  ) }),
743
754
  /* @__PURE__ */ e.jsx("div", { className: "bg-white p-3 border-t border-slate-100", children: /* @__PURE__ */ e.jsx(
744
- fe,
755
+ ge,
745
756
  {
746
- placeholder: r.placeholder,
747
- onSendMessage: Y,
757
+ placeholder: X,
758
+ onSendMessage: U,
748
759
  primaryColor: r.primaryColor
749
760
  }
750
761
  ) })
@@ -752,7 +763,7 @@ const ue = ({
752
763
  ] });
753
764
  };
754
765
  export {
755
- be as Chatbox,
756
- k as MessageType,
757
- b as SenderType
766
+ je as Chatbox,
767
+ E as MessageType,
768
+ w as SenderType
758
769
  };