@tarxemo/customer_support 1.0.6 → 1.0.9

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.es.js CHANGED
@@ -1,14 +1,14 @@
1
1
  var St = Object.defineProperty;
2
2
  var Rt = (e, t, n) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var De = (e, t, n) => Rt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import b, { useState as J, useRef as Ge, useEffect as ge, useCallback as ee } from "react";
3
+ var Pe = (e, t, n) => Rt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import E, { useState as J, useRef as Xe, useEffect as Ge, useCallback as ee } from "react";
5
5
  import { ExternalLink as Ot, Send as _t, X as Tt, Loader2 as At, MessageCircle as Ct } from "lucide-react";
6
6
  function Qe(e, t) {
7
7
  return function() {
8
8
  return e.apply(t, arguments);
9
9
  };
10
10
  }
11
- const { toString: Nt } = Object.prototype, { getPrototypeOf: Se } = Object, { iterator: ie, toStringTag: Ye } = Symbol, ae = /* @__PURE__ */ ((e) => (t) => {
11
+ const { toString: Nt } = Object.prototype, { getPrototypeOf: ge } = Object, { iterator: ie, toStringTag: Ye } = Symbol, ae = /* @__PURE__ */ ((e) => (t) => {
12
12
  const n = Nt.call(t);
13
13
  return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
14
14
  })(/* @__PURE__ */ Object.create(null)), P = (e) => (e = e.toLowerCase(), (t) => ae(t) === e), ce = (e) => (t) => typeof t === e, { isArray: q } = Array, H = ce("undefined");
@@ -23,7 +23,7 @@ function xt(e) {
23
23
  const Pt = ce("string"), C = ce("function"), et = ce("number"), K = (e) => e !== null && typeof e == "object", Dt = (e) => e === !0 || e === !1, ne = (e) => {
24
24
  if (ae(e) !== "object")
25
25
  return !1;
26
- const t = Se(e);
26
+ const t = ge(e);
27
27
  return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Ye in e) && !(ie in e);
28
28
  }, Ft = (e) => {
29
29
  if (!K(e) || V(e))
@@ -66,10 +66,10 @@ function tt(e, t) {
66
66
  return null;
67
67
  }
68
68
  const I = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, nt = (e) => !H(e) && e !== I;
69
- function ye() {
69
+ function we() {
70
70
  const { caseless: e, skipUndefined: t } = nt(this) && this || {}, n = {}, r = (s, o) => {
71
71
  const i = e && tt(n, o) || o;
72
- ne(n[i]) && ne(s) ? n[i] = ye(n[i], s) : ne(s) ? n[i] = ye({}, s) : q(s) ? n[i] = s.slice() : (!t || !H(s)) && (n[i] = s);
72
+ ne(n[i]) && ne(s) ? n[i] = we(n[i], s) : ne(s) ? n[i] = we({}, s) : q(s) ? n[i] = s.slice() : (!t || !H(s)) && (n[i] = s);
73
73
  };
74
74
  for (let s = 0, o = arguments.length; s < o; s++)
75
75
  arguments[s] && W(arguments[s], r);
@@ -103,7 +103,7 @@ const Jt = (e, t, n, { allOwnKeys: r } = {}) => (W(t, (s, o) => {
103
103
  do {
104
104
  for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
105
105
  i = s[o], (!r || r(i, e, t)) && !a[i] && (t[i] = e[i], a[i] = !0);
106
- e = n !== !1 && Se(e);
106
+ e = n !== !1 && ge(e);
107
107
  } while (e && (!n || n(e, t)) && e !== Object.prototype);
108
108
  return t;
109
109
  }, Xt = (e, t, n) => {
@@ -119,7 +119,7 @@ const Jt = (e, t, n, { allOwnKeys: r } = {}) => (W(t, (s, o) => {
119
119
  for (; t-- > 0; )
120
120
  n[t] = e[t];
121
121
  return n;
122
- }, Qt = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Se(Uint8Array)), Yt = (e, t) => {
122
+ }, Qt = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ge(Uint8Array)), Yt = (e, t) => {
123
123
  const r = (e && e[ie]).call(e);
124
124
  let s;
125
125
  for (; (s = r.next()) && !s.done; ) {
@@ -137,7 +137,7 @@ const Jt = (e, t, n, { allOwnKeys: r } = {}) => (W(t, (s, o) => {
137
137
  function(n, r, s) {
138
138
  return r.toUpperCase() + s;
139
139
  }
140
- ), Fe = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), nn = P("RegExp"), rt = (e, t) => {
140
+ ), De = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), nn = P("RegExp"), rt = (e, t) => {
141
141
  const n = Object.getOwnPropertyDescriptors(e), r = {};
142
142
  W(n, (s, o) => {
143
143
  let i;
@@ -223,7 +223,7 @@ const ln = (e) => {
223
223
  isTypedArray: Qt,
224
224
  isFileList: Bt,
225
225
  forEach: W,
226
- merge: ye,
226
+ merge: we,
227
227
  extend: Jt,
228
228
  trim: vt,
229
229
  stripBOM: Vt,
@@ -236,8 +236,8 @@ const ln = (e) => {
236
236
  forEachEntry: Yt,
237
237
  matchAll: Zt,
238
238
  isHTMLForm: en,
239
- hasOwnProperty: Fe,
240
- hasOwnProp: Fe,
239
+ hasOwnProperty: De,
240
+ hasOwnProp: De,
241
241
  // an alias to avoid ESLint no-prototype-builtins detection
242
242
  reduceDescriptors: rt,
243
243
  freezeMethods: rn,
@@ -308,21 +308,21 @@ w.ERR_CANCELED = "ERR_CANCELED";
308
308
  w.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
309
309
  w.ERR_INVALID_URL = "ERR_INVALID_URL";
310
310
  const mn = null;
311
- function we(e) {
311
+ function ye(e) {
312
312
  return c.isPlainObject(e) || c.isArray(e);
313
313
  }
314
314
  function it(e) {
315
315
  return c.endsWith(e, "[]") ? e.slice(0, -2) : e;
316
316
  }
317
- function Ue(e, t, n) {
317
+ function Fe(e, t, n) {
318
318
  return e ? e.concat(t).map(function(s, o) {
319
319
  return s = it(s), !n && o ? "[" + s + "]" : s;
320
320
  }).join(n ? "." : "") : t;
321
321
  }
322
322
  function hn(e) {
323
- return c.isArray(e) && !e.some(we);
323
+ return c.isArray(e) && !e.some(ye);
324
324
  }
325
- const yn = c.toFlatObject(c, {}, null, function(t) {
325
+ const wn = c.toFlatObject(c, {}, null, function(t) {
326
326
  return /^is[A-Z]/.test(t);
327
327
  });
328
328
  function le(e, t, n) {
@@ -349,38 +349,38 @@ function le(e, t, n) {
349
349
  return c.isArrayBuffer(f) || c.isTypedArray(f) ? d && typeof Blob == "function" ? new Blob([f]) : Buffer.from(f) : f;
350
350
  }
351
351
  function l(f, h, m) {
352
- let g = f;
352
+ let S = f;
353
353
  if (f && !m && typeof f == "object") {
354
354
  if (c.endsWith(h, "{}"))
355
355
  h = r ? h : h.slice(0, -2), f = JSON.stringify(f);
356
- else if (c.isArray(f) && hn(f) || (c.isFileList(f) || c.endsWith(h, "[]")) && (g = c.toArray(f)))
357
- return h = it(h), g.forEach(function(y, S) {
358
- !(c.isUndefined(y) || y === null) && t.append(
356
+ else if (c.isArray(f) && hn(f) || (c.isFileList(f) || c.endsWith(h, "[]")) && (S = c.toArray(f)))
357
+ return h = it(h), S.forEach(function(g, y) {
358
+ !(c.isUndefined(g) || g === null) && t.append(
359
359
  // eslint-disable-next-line no-nested-ternary
360
- i === !0 ? Ue([h], S, o) : i === null ? h : h + "[]",
361
- u(y)
360
+ i === !0 ? Fe([h], y, o) : i === null ? h : h + "[]",
361
+ u(g)
362
362
  );
363
363
  }), !1;
364
364
  }
365
- return we(f) ? !0 : (t.append(Ue(m, h, o), u(f)), !1);
365
+ return ye(f) ? !0 : (t.append(Fe(m, h, o), u(f)), !1);
366
366
  }
367
- const p = [], E = Object.assign(yn, {
367
+ const p = [], b = Object.assign(wn, {
368
368
  defaultVisitor: l,
369
369
  convertValue: u,
370
- isVisitable: we
370
+ isVisitable: ye
371
371
  });
372
372
  function _(f, h) {
373
373
  if (!c.isUndefined(f)) {
374
374
  if (p.indexOf(f) !== -1)
375
375
  throw Error("Circular reference detected in " + h.join("."));
376
- p.push(f), c.forEach(f, function(g, R) {
377
- (!(c.isUndefined(g) || g === null) && s.call(
376
+ p.push(f), c.forEach(f, function(S, R) {
377
+ (!(c.isUndefined(S) || S === null) && s.call(
378
378
  t,
379
- g,
379
+ S,
380
380
  c.isString(R) ? R.trim() : R,
381
381
  h,
382
- E
383
- )) === !0 && _(g, h ? h.concat(R) : [R]);
382
+ b
383
+ )) === !0 && _(S, h ? h.concat(R) : [R]);
384
384
  }), p.pop();
385
385
  }
386
386
  }
@@ -388,7 +388,7 @@ function le(e, t, n) {
388
388
  throw new TypeError("data must be an object");
389
389
  return _(e), t;
390
390
  }
391
- function Le(e) {
391
+ function Ue(e) {
392
392
  const t = {
393
393
  "!": "%21",
394
394
  "'": "%27",
@@ -402,38 +402,38 @@ function Le(e) {
402
402
  return t[r];
403
403
  });
404
404
  }
405
- function Re(e, t) {
405
+ function Se(e, t) {
406
406
  this._pairs = [], e && le(e, this, t);
407
407
  }
408
- const at = Re.prototype;
408
+ const at = Se.prototype;
409
409
  at.append = function(t, n) {
410
410
  this._pairs.push([t, n]);
411
411
  };
412
412
  at.toString = function(t) {
413
413
  const n = t ? function(r) {
414
- return t.call(this, r, Le);
415
- } : Le;
414
+ return t.call(this, r, Ue);
415
+ } : Ue;
416
416
  return this._pairs.map(function(s) {
417
417
  return n(s[0]) + "=" + n(s[1]);
418
418
  }, "").join("&");
419
419
  };
420
- function wn(e) {
420
+ function yn(e) {
421
421
  return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
422
422
  }
423
423
  function ct(e, t, n) {
424
424
  if (!t)
425
425
  return e;
426
- const r = n && n.encode || wn, s = c.isFunction(n) ? {
426
+ const r = n && n.encode || yn, s = c.isFunction(n) ? {
427
427
  serialize: n
428
428
  } : n, o = s && s.serialize;
429
429
  let i;
430
- if (o ? i = o(t, s) : i = c.isURLSearchParams(t) ? t.toString() : new Re(t, s).toString(r), i) {
430
+ if (o ? i = o(t, s) : i = c.isURLSearchParams(t) ? t.toString() : new Se(t, s).toString(r), i) {
431
431
  const a = e.indexOf("#");
432
432
  a !== -1 && (e = e.slice(0, a)), e += (e.indexOf("?") === -1 ? "?" : "&") + i;
433
433
  }
434
434
  return e;
435
435
  }
436
- class ke {
436
+ class Le {
437
437
  constructor() {
438
438
  this.handlers = [];
439
439
  }
@@ -492,7 +492,7 @@ const lt = {
492
492
  silentJSONParsing: !0,
493
493
  forcedJSONParsing: !0,
494
494
  clarifyTimeoutError: !1
495
- }, En = typeof URLSearchParams < "u" ? URLSearchParams : Re, bn = typeof FormData < "u" ? FormData : null, gn = typeof Blob < "u" ? Blob : null, Sn = {
495
+ }, En = typeof URLSearchParams < "u" ? URLSearchParams : Se, bn = typeof FormData < "u" ? FormData : null, gn = typeof Blob < "u" ? Blob : null, Sn = {
496
496
  isBrowser: !0,
497
497
  classes: {
498
498
  URLSearchParams: En,
@@ -500,22 +500,22 @@ const lt = {
500
500
  Blob: gn
501
501
  },
502
502
  protocols: ["http", "https", "file", "blob", "url", "data"]
503
- }, Oe = typeof window < "u" && typeof document < "u", Ee = typeof navigator == "object" && navigator || void 0, Rn = Oe && (!Ee || ["ReactNative", "NativeScript", "NS"].indexOf(Ee.product) < 0), On = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
504
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _n = Oe && window.location.href || "http://localhost", Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
503
+ }, Re = typeof window < "u" && typeof document < "u", Ee = typeof navigator == "object" && navigator || void 0, Rn = Re && (!Ee || ["ReactNative", "NativeScript", "NS"].indexOf(Ee.product) < 0), On = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
504
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _n = Re && window.location.href || "http://localhost", Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
505
505
  __proto__: null,
506
- hasBrowserEnv: Oe,
506
+ hasBrowserEnv: Re,
507
507
  hasStandardBrowserEnv: Rn,
508
508
  hasStandardBrowserWebWorkerEnv: On,
509
509
  navigator: Ee,
510
510
  origin: _n
511
- }, Symbol.toStringTag, { value: "Module" })), T = {
511
+ }, Symbol.toStringTag, { value: "Module" })), A = {
512
512
  ...Tn,
513
513
  ...Sn
514
514
  };
515
515
  function An(e, t) {
516
- return le(e, new T.classes.URLSearchParams(), {
516
+ return le(e, new A.classes.URLSearchParams(), {
517
517
  visitor: function(n, r, s, o) {
518
- return T.isNode && c.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
518
+ return A.isNode && c.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
519
519
  },
520
520
  ...t
521
521
  });
@@ -610,8 +610,8 @@ const X = {
610
610
  maxContentLength: -1,
611
611
  maxBodyLength: -1,
612
612
  env: {
613
- FormData: T.classes.FormData,
614
- Blob: T.classes.Blob
613
+ FormData: A.classes.FormData,
614
+ Blob: A.classes.Blob
615
615
  },
616
616
  validateStatus: function(t) {
617
617
  return t >= 200 && t < 300;
@@ -651,7 +651,7 @@ const Pn = c.toObjectSet([
651
651
  `).forEach(function(i) {
652
652
  s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Pn[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
653
653
  }), t;
654
- }, Be = Symbol("internals");
654
+ }, ke = Symbol("internals");
655
655
  function v(e) {
656
656
  return e && String(e).trim().toLowerCase();
657
657
  }
@@ -806,7 +806,7 @@ let N = class {
806
806
  return n.forEach((s) => r.set(s)), r;
807
807
  }
808
808
  static accessor(t) {
809
- const r = (this[Be] = this[Be] = {
809
+ const r = (this[ke] = this[ke] = {
810
810
  accessors: {}
811
811
  }).accessors, s = this.prototype;
812
812
  function o(i) {
@@ -872,13 +872,13 @@ function In(e, t) {
872
872
  return t = t !== void 0 ? t : 1e3, function(d) {
873
873
  const u = Date.now(), l = r[o];
874
874
  i || (i = u), n[s] = d, r[s] = u;
875
- let p = o, E = 0;
875
+ let p = o, b = 0;
876
876
  for (; p !== s; )
877
- E += n[p++], p = p % e;
877
+ b += n[p++], p = p % e;
878
878
  if (s = (s + 1) % e, s === o && (o = (o + 1) % e), u - i < t)
879
879
  return;
880
880
  const _ = l && u - l;
881
- return _ ? Math.round(E * 1e3 / _) : void 0;
881
+ return _ ? Math.round(b * 1e3 / _) : void 0;
882
882
  };
883
883
  }
884
884
  function jn(e, t) {
@@ -912,17 +912,17 @@ const oe = (e, t, n = 3) => {
912
912
  };
913
913
  e(p);
914
914
  }, n);
915
- }, Ie = (e, t) => {
915
+ }, Be = (e, t) => {
916
916
  const n = e != null;
917
917
  return [(r) => t[0]({
918
918
  lengthComputable: n,
919
919
  total: e,
920
920
  loaded: r
921
921
  }), t[1]];
922
- }, je = (e) => (...t) => c.asap(() => e(...t)), Mn = T.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, T.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
923
- new URL(T.origin),
924
- T.navigator && /(msie|trident)/i.test(T.navigator.userAgent)
925
- ) : () => !0, $n = T.hasStandardBrowserEnv ? (
922
+ }, Ie = (e) => (...t) => c.asap(() => e(...t)), Mn = A.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, A.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
923
+ new URL(A.origin),
924
+ A.navigator && /(msie|trident)/i.test(A.navigator.userAgent)
925
+ ) : () => !0, $n = A.hasStandardBrowserEnv ? (
926
926
  // Standard browser envs support document.cookie
927
927
  {
928
928
  write(e, t, n, r, s, o, i) {
@@ -961,18 +961,18 @@ function pt(e, t, n) {
961
961
  let r = !Hn(t);
962
962
  return e && (r || n == !1) ? qn(e, t) : t;
963
963
  }
964
- const Me = (e) => e instanceof N ? { ...e } : e;
964
+ const je = (e) => e instanceof N ? { ...e } : e;
965
965
  function M(e, t) {
966
966
  t = t || {};
967
967
  const n = {};
968
- function r(u, l, p, E) {
969
- return c.isPlainObject(u) && c.isPlainObject(l) ? c.merge.call({ caseless: E }, u, l) : c.isPlainObject(l) ? c.merge({}, l) : c.isArray(l) ? l.slice() : l;
968
+ function r(u, l, p, b) {
969
+ return c.isPlainObject(u) && c.isPlainObject(l) ? c.merge.call({ caseless: b }, u, l) : c.isPlainObject(l) ? c.merge({}, l) : c.isArray(l) ? l.slice() : l;
970
970
  }
971
- function s(u, l, p, E) {
971
+ function s(u, l, p, b) {
972
972
  if (c.isUndefined(l)) {
973
973
  if (!c.isUndefined(u))
974
- return r(void 0, u, p, E);
975
- } else return r(u, l, p, E);
974
+ return r(void 0, u, p, b);
975
+ } else return r(u, l, p, b);
976
976
  }
977
977
  function o(u, l) {
978
978
  if (!c.isUndefined(l))
@@ -1019,11 +1019,11 @@ function M(e, t) {
1019
1019
  socketPath: i,
1020
1020
  responseEncoding: i,
1021
1021
  validateStatus: a,
1022
- headers: (u, l, p) => s(Me(u), Me(l), p, !0)
1022
+ headers: (u, l, p) => s(je(u), je(l), p, !0)
1023
1023
  };
1024
1024
  return c.forEach(Object.keys({ ...e, ...t }), function(l) {
1025
- const p = d[l] || s, E = p(e[l], t[l], l);
1026
- c.isUndefined(E) && p !== a || (n[l] = E);
1025
+ const p = d[l] || s, b = p(e[l], t[l], l);
1026
+ c.isUndefined(b) && p !== a || (n[l] = b);
1027
1027
  }), n;
1028
1028
  }
1029
1029
  const mt = (e) => {
@@ -1033,7 +1033,7 @@ const mt = (e) => {
1033
1033
  "Authorization",
1034
1034
  "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
1035
1035
  ), c.isFormData(n)) {
1036
- if (T.hasStandardBrowserEnv || T.hasStandardBrowserWebWorkerEnv)
1036
+ if (A.hasStandardBrowserEnv || A.hasStandardBrowserWebWorkerEnv)
1037
1037
  i.setContentType(void 0);
1038
1038
  else if (c.isFunction(n.getHeaders)) {
1039
1039
  const d = n.getHeaders(), u = ["content-type", "content-length"];
@@ -1042,7 +1042,7 @@ const mt = (e) => {
1042
1042
  });
1043
1043
  }
1044
1044
  }
1045
- if (T.hasStandardBrowserEnv && (r && c.isFunction(r) && (r = r(t)), r || r !== !1 && Mn(t.url))) {
1045
+ if (A.hasStandardBrowserEnv && (r && c.isFunction(r) && (r = r(t)), r || r !== !1 && Mn(t.url))) {
1046
1046
  const d = s && o && $n.read(o);
1047
1047
  d && i.set(s, d);
1048
1048
  }
@@ -1052,22 +1052,22 @@ const mt = (e) => {
1052
1052
  const s = mt(e);
1053
1053
  let o = s.data;
1054
1054
  const i = N.from(s.headers).normalize();
1055
- let { responseType: a, onUploadProgress: d, onDownloadProgress: u } = s, l, p, E, _, f;
1055
+ let { responseType: a, onUploadProgress: d, onDownloadProgress: u } = s, l, p, b, _, f;
1056
1056
  function h() {
1057
1057
  _ && _(), f && f(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
1058
1058
  }
1059
1059
  let m = new XMLHttpRequest();
1060
1060
  m.open(s.method.toUpperCase(), s.url, !0), m.timeout = s.timeout;
1061
- function g() {
1061
+ function S() {
1062
1062
  if (!m)
1063
1063
  return;
1064
- const y = N.from(
1064
+ const g = N.from(
1065
1065
  "getAllResponseHeaders" in m && m.getAllResponseHeaders()
1066
- ), A = {
1066
+ ), T = {
1067
1067
  data: !a || a === "text" || a === "json" ? m.responseText : m.response,
1068
1068
  status: m.status,
1069
1069
  statusText: m.statusText,
1070
- headers: y,
1070
+ headers: g,
1071
1071
  config: e,
1072
1072
  request: m
1073
1073
  };
@@ -1075,31 +1075,31 @@ const mt = (e) => {
1075
1075
  n(x), h();
1076
1076
  }, function(x) {
1077
1077
  r(x), h();
1078
- }, A), m = null;
1078
+ }, T), m = null;
1079
1079
  }
1080
- "onloadend" in m ? m.onloadend = g : m.onreadystatechange = function() {
1081
- !m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(g);
1080
+ "onloadend" in m ? m.onloadend = S : m.onreadystatechange = function() {
1081
+ !m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(S);
1082
1082
  }, m.onabort = function() {
1083
1083
  m && (r(new w("Request aborted", w.ECONNABORTED, e, m)), m = null);
1084
- }, m.onerror = function(S) {
1085
- const A = S && S.message ? S.message : "Network Error", U = new w(A, w.ERR_NETWORK, e, m);
1086
- U.event = S || null, r(U), m = null;
1084
+ }, m.onerror = function(y) {
1085
+ const T = y && y.message ? y.message : "Network Error", U = new w(T, w.ERR_NETWORK, e, m);
1086
+ U.event = y || null, r(U), m = null;
1087
1087
  }, m.ontimeout = function() {
1088
- let S = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1089
- const A = s.transitional || lt;
1090
- s.timeoutErrorMessage && (S = s.timeoutErrorMessage), r(new w(
1091
- S,
1092
- A.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
1088
+ let y = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1089
+ const T = s.transitional || lt;
1090
+ s.timeoutErrorMessage && (y = s.timeoutErrorMessage), r(new w(
1091
+ y,
1092
+ T.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
1093
1093
  e,
1094
1094
  m
1095
1095
  )), m = null;
1096
- }, o === void 0 && i.setContentType(null), "setRequestHeader" in m && c.forEach(i.toJSON(), function(S, A) {
1097
- m.setRequestHeader(A, S);
1098
- }), c.isUndefined(s.withCredentials) || (m.withCredentials = !!s.withCredentials), a && a !== "json" && (m.responseType = s.responseType), u && ([E, f] = oe(u, !0), m.addEventListener("progress", E)), d && m.upload && ([p, _] = oe(d), m.upload.addEventListener("progress", p), m.upload.addEventListener("loadend", _)), (s.cancelToken || s.signal) && (l = (y) => {
1099
- m && (r(!y || y.type ? new G(null, e, m) : y), m.abort(), m = null);
1096
+ }, o === void 0 && i.setContentType(null), "setRequestHeader" in m && c.forEach(i.toJSON(), function(y, T) {
1097
+ m.setRequestHeader(T, y);
1098
+ }), c.isUndefined(s.withCredentials) || (m.withCredentials = !!s.withCredentials), a && a !== "json" && (m.responseType = s.responseType), u && ([b, f] = oe(u, !0), m.addEventListener("progress", b)), d && m.upload && ([p, _] = oe(d), m.upload.addEventListener("progress", p), m.upload.addEventListener("loadend", _)), (s.cancelToken || s.signal) && (l = (g) => {
1099
+ m && (r(!g || g.type ? new G(null, e, m) : g), m.abort(), m = null);
1100
1100
  }, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
1101
1101
  const R = Bn(s.url);
1102
- if (R && T.protocols.indexOf(R) === -1) {
1102
+ if (R && A.protocols.indexOf(R) === -1) {
1103
1103
  r(new w("Unsupported protocol " + R + ":", w.ERR_BAD_REQUEST, e));
1104
1104
  return;
1105
1105
  }
@@ -1156,7 +1156,7 @@ const mt = (e) => {
1156
1156
  } finally {
1157
1157
  await t.cancel();
1158
1158
  }
1159
- }, $e = (e, t, n, r) => {
1159
+ }, Me = (e, t, n, r) => {
1160
1160
  const s = Kn(e, t);
1161
1161
  let o = 0, i, a = (d) => {
1162
1162
  i || (i = !0, r && r(d));
@@ -1171,8 +1171,8 @@ const mt = (e) => {
1171
1171
  }
1172
1172
  let p = l.byteLength;
1173
1173
  if (n) {
1174
- let E = o += p;
1175
- n(E);
1174
+ let b = o += p;
1175
+ n(b);
1176
1176
  }
1177
1177
  d.enqueue(new Uint8Array(l));
1178
1178
  } catch (u) {
@@ -1185,13 +1185,13 @@ const mt = (e) => {
1185
1185
  }, {
1186
1186
  highWaterMark: 2
1187
1187
  });
1188
- }, He = 64 * 1024, { isFunction: te } = c, Xn = (({ Request: e, Response: t }) => ({
1188
+ }, $e = 64 * 1024, { isFunction: te } = c, Xn = (({ Request: e, Response: t }) => ({
1189
1189
  Request: e,
1190
1190
  Response: t
1191
1191
  }))(c.global), {
1192
- ReadableStream: qe,
1193
- TextEncoder: ze
1194
- } = c.global, ve = (e, ...t) => {
1192
+ ReadableStream: He,
1193
+ TextEncoder: qe
1194
+ } = c.global, ze = (e, ...t) => {
1195
1195
  try {
1196
1196
  return !!e(...t);
1197
1197
  } catch {
@@ -1204,34 +1204,34 @@ const mt = (e) => {
1204
1204
  const { fetch: t, Request: n, Response: r } = e, s = t ? te(t) : typeof fetch == "function", o = te(n), i = te(r);
1205
1205
  if (!s)
1206
1206
  return !1;
1207
- const a = s && te(qe), d = s && (typeof ze == "function" ? /* @__PURE__ */ ((f) => (h) => f.encode(h))(new ze()) : async (f) => new Uint8Array(await new n(f).arrayBuffer())), u = o && a && ve(() => {
1207
+ const a = s && te(He), d = s && (typeof qe == "function" ? /* @__PURE__ */ ((f) => (h) => f.encode(h))(new qe()) : async (f) => new Uint8Array(await new n(f).arrayBuffer())), u = o && a && ze(() => {
1208
1208
  let f = !1;
1209
- const h = new n(T.origin, {
1210
- body: new qe(),
1209
+ const h = new n(A.origin, {
1210
+ body: new He(),
1211
1211
  method: "POST",
1212
1212
  get duplex() {
1213
1213
  return f = !0, "half";
1214
1214
  }
1215
1215
  }).headers.has("Content-Type");
1216
1216
  return f && !h;
1217
- }), l = i && a && ve(() => c.isReadableStream(new r("").body)), p = {
1217
+ }), l = i && a && ze(() => c.isReadableStream(new r("").body)), p = {
1218
1218
  stream: l && ((f) => f.body)
1219
1219
  };
1220
1220
  s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((f) => {
1221
1221
  !p[f] && (p[f] = (h, m) => {
1222
- let g = h && h[f];
1223
- if (g)
1224
- return g.call(h);
1222
+ let S = h && h[f];
1223
+ if (S)
1224
+ return S.call(h);
1225
1225
  throw new w(`Response type '${f}' is not supported`, w.ERR_NOT_SUPPORT, m);
1226
1226
  });
1227
1227
  });
1228
- const E = async (f) => {
1228
+ const b = async (f) => {
1229
1229
  if (f == null)
1230
1230
  return 0;
1231
1231
  if (c.isBlob(f))
1232
1232
  return f.size;
1233
1233
  if (c.isSpecCompliantForm(f))
1234
- return (await new n(T.origin, {
1234
+ return (await new n(A.origin, {
1235
1235
  method: "POST",
1236
1236
  body: f
1237
1237
  }).arrayBuffer()).byteLength;
@@ -1241,68 +1241,68 @@ const mt = (e) => {
1241
1241
  return (await d(f)).byteLength;
1242
1242
  }, _ = async (f, h) => {
1243
1243
  const m = c.toFiniteNumber(f.getContentLength());
1244
- return m ?? E(h);
1244
+ return m ?? b(h);
1245
1245
  };
1246
1246
  return async (f) => {
1247
1247
  let {
1248
1248
  url: h,
1249
1249
  method: m,
1250
- data: g,
1250
+ data: S,
1251
1251
  signal: R,
1252
- cancelToken: y,
1253
- timeout: S,
1254
- onDownloadProgress: A,
1252
+ cancelToken: g,
1253
+ timeout: y,
1254
+ onDownloadProgress: T,
1255
1255
  onUploadProgress: U,
1256
1256
  responseType: x,
1257
1257
  headers: fe,
1258
1258
  withCredentials: Q = "same-origin",
1259
- fetchOptions: Te
1260
- } = mt(f), Ae = t || fetch;
1259
+ fetchOptions: _e
1260
+ } = mt(f), Te = t || fetch;
1261
1261
  x = x ? (x + "").toLowerCase() : "text";
1262
- let Y = Jn([R, y && y.toAbortSignal()], S), z = null;
1262
+ let Y = Jn([R, g && g.toAbortSignal()], y), z = null;
1263
1263
  const B = Y && Y.unsubscribe && (() => {
1264
1264
  Y.unsubscribe();
1265
1265
  });
1266
- let Ce;
1266
+ let Ae;
1267
1267
  try {
1268
- if (U && u && m !== "get" && m !== "head" && (Ce = await _(fe, g)) !== 0) {
1268
+ if (U && u && m !== "get" && m !== "head" && (Ae = await _(fe, S)) !== 0) {
1269
1269
  let k = new n(h, {
1270
1270
  method: "POST",
1271
- body: g,
1271
+ body: S,
1272
1272
  duplex: "half"
1273
1273
  }), $;
1274
- if (c.isFormData(g) && ($ = k.headers.get("content-type")) && fe.setContentType($), k.body) {
1275
- const [de, Z] = Ie(
1276
- Ce,
1277
- oe(je(U))
1274
+ if (c.isFormData(S) && ($ = k.headers.get("content-type")) && fe.setContentType($), k.body) {
1275
+ const [de, Z] = Be(
1276
+ Ae,
1277
+ oe(Ie(U))
1278
1278
  );
1279
- g = $e(k.body, He, de, Z);
1279
+ S = Me(k.body, $e, de, Z);
1280
1280
  }
1281
1281
  }
1282
1282
  c.isString(Q) || (Q = Q ? "include" : "omit");
1283
- const D = o && "credentials" in n.prototype, Ne = {
1284
- ...Te,
1283
+ const D = o && "credentials" in n.prototype, Ce = {
1284
+ ..._e,
1285
1285
  signal: Y,
1286
1286
  method: m.toUpperCase(),
1287
1287
  headers: fe.normalize().toJSON(),
1288
- body: g,
1288
+ body: S,
1289
1289
  duplex: "half",
1290
1290
  credentials: D ? Q : void 0
1291
1291
  };
1292
- z = o && new n(h, Ne);
1293
- let L = await (o ? Ae(z, Te) : Ae(h, Ne));
1294
- const xe = l && (x === "stream" || x === "response");
1295
- if (l && (A || xe && B)) {
1292
+ z = o && new n(h, Ce);
1293
+ let L = await (o ? Te(z, _e) : Te(h, Ce));
1294
+ const Ne = l && (x === "stream" || x === "response");
1295
+ if (l && (T || Ne && B)) {
1296
1296
  const k = {};
1297
- ["status", "statusText", "headers"].forEach((Pe) => {
1298
- k[Pe] = L[Pe];
1297
+ ["status", "statusText", "headers"].forEach((xe) => {
1298
+ k[xe] = L[xe];
1299
1299
  });
1300
- const $ = c.toFiniteNumber(L.headers.get("content-length")), [de, Z] = A && Ie(
1300
+ const $ = c.toFiniteNumber(L.headers.get("content-length")), [de, Z] = T && Be(
1301
1301
  $,
1302
- oe(je(A), !0)
1302
+ oe(Ie(T), !0)
1303
1303
  ) || [];
1304
1304
  L = new r(
1305
- $e(L.body, He, de, () => {
1305
+ Me(L.body, $e, de, () => {
1306
1306
  Z && Z(), B && B();
1307
1307
  }),
1308
1308
  k
@@ -1310,7 +1310,7 @@ const mt = (e) => {
1310
1310
  }
1311
1311
  x = x || "text";
1312
1312
  let gt = await p[c.findKey(p, x) || "text"](L, f);
1313
- return !xe && B && B(), await new Promise((k, $) => {
1313
+ return !Ne && B && B(), await new Promise((k, $) => {
1314
1314
  dt(k, $, {
1315
1315
  data: gt,
1316
1316
  headers: N.from(L.headers),
@@ -1342,14 +1342,14 @@ const mt = (e) => {
1342
1342
  return u;
1343
1343
  };
1344
1344
  ht();
1345
- const _e = {
1345
+ const Oe = {
1346
1346
  http: mn,
1347
1347
  xhr: vn,
1348
1348
  fetch: {
1349
1349
  get: ht
1350
1350
  }
1351
1351
  };
1352
- c.forEach(_e, (e, t) => {
1352
+ c.forEach(Oe, (e, t) => {
1353
1353
  if (e) {
1354
1354
  try {
1355
1355
  Object.defineProperty(e, "name", { value: t });
@@ -1358,7 +1358,7 @@ c.forEach(_e, (e, t) => {
1358
1358
  Object.defineProperty(e, "adapterName", { value: t });
1359
1359
  }
1360
1360
  });
1361
- const Je = (e) => `- ${e}`, Yn = (e) => c.isFunction(e) || e === null || e === !1;
1361
+ const ve = (e) => `- ${e}`, Yn = (e) => c.isFunction(e) || e === null || e === !1;
1362
1362
  function Zn(e, t) {
1363
1363
  e = c.isArray(e) ? e : [e];
1364
1364
  const { length: n } = e;
@@ -1367,7 +1367,7 @@ function Zn(e, t) {
1367
1367
  for (let i = 0; i < n; i++) {
1368
1368
  r = e[i];
1369
1369
  let a;
1370
- if (s = r, !Yn(r) && (s = _e[(a = String(r)).toLowerCase()], s === void 0))
1370
+ if (s = r, !Yn(r) && (s = Oe[(a = String(r)).toLowerCase()], s === void 0))
1371
1371
  throw new w(`Unknown adapter '${a}'`);
1372
1372
  if (s && (c.isFunction(s) || (s = s.get(t))))
1373
1373
  break;
@@ -1378,8 +1378,8 @@ function Zn(e, t) {
1378
1378
  ([d, u]) => `adapter ${d} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build")
1379
1379
  );
1380
1380
  let a = n ? i.length > 1 ? `since :
1381
- ` + i.map(Je).join(`
1382
- `) : " " + Je(i[0]) : "as no adapter specified";
1381
+ ` + i.map(ve).join(`
1382
+ `) : " " + ve(i[0]) : "as no adapter specified";
1383
1383
  throw new w(
1384
1384
  "There is no suitable adapter to dispatch the request " + a,
1385
1385
  "ERR_NOT_SUPPORT"
@@ -1387,7 +1387,7 @@ function Zn(e, t) {
1387
1387
  }
1388
1388
  return s;
1389
1389
  }
1390
- const yt = {
1390
+ const wt = {
1391
1391
  /**
1392
1392
  * Resolve an adapter from a list of adapter names or functions.
1393
1393
  * @type {Function}
@@ -1397,17 +1397,17 @@ const yt = {
1397
1397
  * Exposes all known adapters
1398
1398
  * @type {Object<string, Function|Object>}
1399
1399
  */
1400
- adapters: _e
1400
+ adapters: Oe
1401
1401
  };
1402
1402
  function he(e) {
1403
1403
  if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1404
1404
  throw new G(null, e);
1405
1405
  }
1406
- function Ve(e) {
1406
+ function Je(e) {
1407
1407
  return he(e), e.headers = N.from(e.headers), e.data = me.call(
1408
1408
  e,
1409
1409
  e.transformRequest
1410
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), yt.getAdapter(e.adapter || X.adapter, e)(e).then(function(r) {
1410
+ ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), wt.getAdapter(e.adapter || X.adapter, e)(e).then(function(r) {
1411
1411
  return he(e), r.data = me.call(
1412
1412
  e,
1413
1413
  e.transformResponse,
@@ -1421,16 +1421,16 @@ function Ve(e) {
1421
1421
  ), r.response.headers = N.from(r.response.headers))), Promise.reject(r);
1422
1422
  });
1423
1423
  }
1424
- const wt = "1.13.4", ue = {};
1424
+ const yt = "1.13.4", ue = {};
1425
1425
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1426
1426
  ue[e] = function(r) {
1427
1427
  return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1428
1428
  };
1429
1429
  });
1430
- const Ke = {};
1430
+ const Ve = {};
1431
1431
  ue.transitional = function(t, n, r) {
1432
1432
  function s(o, i) {
1433
- return "[Axios v" + wt + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
1433
+ return "[Axios v" + yt + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
1434
1434
  }
1435
1435
  return (o, i, a) => {
1436
1436
  if (t === !1)
@@ -1438,7 +1438,7 @@ ue.transitional = function(t, n, r) {
1438
1438
  s(i, " has been removed" + (n ? " in " + n : "")),
1439
1439
  w.ERR_DEPRECATED
1440
1440
  );
1441
- return n && !Ke[i] && (Ke[i] = !0, console.warn(
1441
+ return n && !Ve[i] && (Ve[i] = !0, console.warn(
1442
1442
  s(
1443
1443
  i,
1444
1444
  " has been deprecated since v" + n + " and will be removed in the near future"
@@ -1473,8 +1473,8 @@ const se = {
1473
1473
  let j = class {
1474
1474
  constructor(t) {
1475
1475
  this.defaults = t || {}, this.interceptors = {
1476
- request: new ke(),
1477
- response: new ke()
1476
+ request: new Le(),
1477
+ response: new Le()
1478
1478
  };
1479
1479
  }
1480
1480
  /**
@@ -1537,16 +1537,16 @@ let j = class {
1537
1537
  this.interceptors.response.forEach(function(h) {
1538
1538
  u.push(h.fulfilled, h.rejected);
1539
1539
  });
1540
- let l, p = 0, E;
1540
+ let l, p = 0, b;
1541
1541
  if (!d) {
1542
- const f = [Ve.bind(this), void 0];
1543
- for (f.unshift(...a), f.push(...u), E = f.length, l = Promise.resolve(n); p < E; )
1542
+ const f = [Je.bind(this), void 0];
1543
+ for (f.unshift(...a), f.push(...u), b = f.length, l = Promise.resolve(n); p < b; )
1544
1544
  l = l.then(f[p++], f[p++]);
1545
1545
  return l;
1546
1546
  }
1547
- E = a.length;
1547
+ b = a.length;
1548
1548
  let _ = n;
1549
- for (; p < E; ) {
1549
+ for (; p < b; ) {
1550
1550
  const f = a[p++], h = a[p++];
1551
1551
  try {
1552
1552
  _ = f(_);
@@ -1556,11 +1556,11 @@ let j = class {
1556
1556
  }
1557
1557
  }
1558
1558
  try {
1559
- l = Ve.call(this, _);
1559
+ l = Je.call(this, _);
1560
1560
  } catch (f) {
1561
1561
  return Promise.reject(f);
1562
1562
  }
1563
- for (p = 0, E = u.length; p < E; )
1563
+ for (p = 0, b = u.length; p < b; )
1564
1564
  l = l.then(u[p++], u[p++]);
1565
1565
  return l;
1566
1566
  }
@@ -1760,7 +1760,7 @@ O.Axios = j;
1760
1760
  O.CanceledError = G;
1761
1761
  O.CancelToken = tr;
1762
1762
  O.isCancel = ft;
1763
- O.VERSION = wt;
1763
+ O.VERSION = yt;
1764
1764
  O.toFormData = le;
1765
1765
  O.AxiosError = w;
1766
1766
  O.Cancel = O.CanceledError;
@@ -1772,7 +1772,7 @@ O.isAxiosError = rr;
1772
1772
  O.mergeConfig = M;
1773
1773
  O.AxiosHeaders = N;
1774
1774
  O.formToJSON = (e) => ut(c.isHTMLForm(e) ? new FormData(e) : e);
1775
- O.getAdapter = yt.getAdapter;
1775
+ O.getAdapter = wt.getAdapter;
1776
1776
  O.HttpStatusCode = be;
1777
1777
  O.default = O;
1778
1778
  const {
@@ -1792,10 +1792,10 @@ const {
1792
1792
  formToJSON: Dr,
1793
1793
  getAdapter: Fr,
1794
1794
  mergeConfig: Ur
1795
- } = O, sr = "http://localhost:8000/api";
1795
+ } = O, sr = "https://customers-services.tarxemo.com/api";
1796
1796
  class or {
1797
1797
  constructor(t, n = sr) {
1798
- De(this, "client");
1798
+ Pe(this, "client");
1799
1799
  this.client = O.create({
1800
1800
  baseURL: n,
1801
1801
  headers: {
@@ -1859,7 +1859,7 @@ class or {
1859
1859
  this.client.defaults.baseURL = t;
1860
1860
  }
1861
1861
  }
1862
- function We(e, t) {
1862
+ function Ke(e, t) {
1863
1863
  const [n, r] = J(() => {
1864
1864
  try {
1865
1865
  const o = window.localStorage.getItem(e);
@@ -1877,80 +1877,80 @@ function We(e, t) {
1877
1877
  }
1878
1878
  }];
1879
1879
  }
1880
- function Xe() {
1880
+ function We() {
1881
1881
  return `session_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
1882
1882
  }
1883
1883
  const ir = "customer_support_session_id", ar = "customer_support_messages";
1884
1884
  function cr(e) {
1885
- const { apiKey: t, baseUrl: n, onError: r } = e, [s, o] = We(ar, []), [i, a] = We(
1885
+ const { apiKey: t, baseUrl: n, onError: r } = e, [s, o] = Ke(ar, []), [i, a] = Ke(
1886
1886
  ir,
1887
- Xe()
1888
- ), [d, u] = J(!1), [l, p] = J(null), E = Ge(null);
1889
- ge(() => {
1890
- E.current = new or(t, n);
1887
+ We()
1888
+ ), [d, u] = J(!1), [l, p] = J(null), b = Xe(null);
1889
+ Ge(() => {
1890
+ b.current = new or(t, n);
1891
1891
  }, [t, n]);
1892
1892
  const _ = ee(() => {
1893
1893
  p(null);
1894
1894
  }, []), f = ee(
1895
- async (g) => {
1896
- if (!E.current) {
1897
- const y = new Error("API client not initialized");
1898
- p(y), r == null || r(y);
1895
+ async (S) => {
1896
+ if (!b.current) {
1897
+ const g = new Error("API client not initialized");
1898
+ p(g), r == null || r(g);
1899
1899
  return;
1900
1900
  }
1901
- if (!g.trim())
1901
+ if (!S.trim())
1902
1902
  return;
1903
1903
  const R = {
1904
1904
  id: `user_${Date.now()}`,
1905
1905
  role: "USER",
1906
- content: g,
1906
+ content: S,
1907
1907
  timestamp: /* @__PURE__ */ new Date()
1908
1908
  };
1909
- o((y) => [...y, R]), u(!0), p(null);
1909
+ o((g) => [...g, R]), u(!0), p(null);
1910
1910
  try {
1911
- const y = await E.current.sendMessage(g, i), S = {
1911
+ const g = await b.current.sendMessage(S, i), y = {
1912
1912
  id: `assistant_${Date.now()}`,
1913
1913
  role: "ASSISTANT",
1914
- content: y.answer,
1914
+ content: g.answer,
1915
1915
  timestamp: /* @__PURE__ */ new Date(),
1916
- sources: y.sources
1916
+ sources: g.sources
1917
1917
  };
1918
- o((A) => [...A, S]), y.session_id !== i && a(y.session_id);
1919
- } catch (y) {
1920
- const S = y instanceof Error ? y : new Error("Failed to send message");
1921
- p(S), r == null || r(S);
1922
- const A = {
1918
+ o((T) => [...T, y]), g.session_id !== i && a(g.session_id);
1919
+ } catch (g) {
1920
+ const y = g instanceof Error ? g : new Error("Failed to send message");
1921
+ p(y), r == null || r(y);
1922
+ const T = {
1923
1923
  id: `error_${Date.now()}`,
1924
1924
  role: "ASSISTANT",
1925
- content: `Sorry, I encountered an error: ${S.message}`,
1925
+ content: `Sorry, I encountered an error: ${y.message}`,
1926
1926
  timestamp: /* @__PURE__ */ new Date()
1927
1927
  };
1928
- o((U) => [...U, A]);
1928
+ o((U) => [...U, T]);
1929
1929
  } finally {
1930
1930
  u(!1);
1931
1931
  }
1932
1932
  },
1933
1933
  [i, r, o, a]
1934
1934
  ), h = ee(async () => {
1935
- if (!(!E.current || !i)) {
1935
+ if (!(!b.current || !i)) {
1936
1936
  u(!0), p(null);
1937
1937
  try {
1938
- const R = (await E.current.getConversationHistory(i)).messages.map((y, S) => ({
1939
- id: `${y.role.toLowerCase()}_${S}_${Date.now()}`,
1940
- role: y.role,
1941
- content: y.content,
1942
- timestamp: new Date(y.created_at)
1938
+ const R = (await b.current.getConversationHistory(i)).messages.map((g, y) => ({
1939
+ id: `${g.role.toLowerCase()}_${y}_${Date.now()}`,
1940
+ role: g.role,
1941
+ content: g.content,
1942
+ timestamp: new Date(g.created_at)
1943
1943
  }));
1944
1944
  o(R);
1945
- } catch (g) {
1946
- const R = g instanceof Error ? g : new Error("Failed to load history");
1945
+ } catch (S) {
1946
+ const R = S instanceof Error ? S : new Error("Failed to load history");
1947
1947
  p(R), r == null || r(R);
1948
1948
  } finally {
1949
1949
  u(!1);
1950
1950
  }
1951
1951
  }
1952
1952
  }, [i, r, o]), m = ee(() => {
1953
- o([]), a(Xe());
1953
+ o([]), a(We());
1954
1954
  }, [o, a]);
1955
1955
  return {
1956
1956
  messages: s,
@@ -1965,7 +1965,7 @@ function cr(e) {
1965
1965
  }
1966
1966
  const lr = ({ message: e }) => {
1967
1967
  const t = e.role === "USER", n = e.timestamp instanceof Date ? e.timestamp : new Date(e.timestamp);
1968
- return /* @__PURE__ */ b.createElement("div", { className: `cs-message ${t ? "cs-message--user" : "cs-message--assistant"}` }, /* @__PURE__ */ b.createElement("div", { className: "cs-message__content" }, /* @__PURE__ */ b.createElement("p", { className: "cs-message__text" }, e.content), e.sources && e.sources.length > 0 && /* @__PURE__ */ b.createElement("div", { className: "cs-message__sources" }, /* @__PURE__ */ b.createElement("p", { className: "cs-message__sources-title" }, "Sources:"), /* @__PURE__ */ b.createElement("ul", { className: "cs-message__sources-list" }, e.sources.map((r, s) => /* @__PURE__ */ b.createElement("li", { key: s, className: "cs-message__source-item" }, /* @__PURE__ */ b.createElement(
1968
+ return /* @__PURE__ */ E.createElement("div", { className: `cs-message ${t ? "cs-message--user" : "cs-message--assistant"}` }, /* @__PURE__ */ E.createElement("div", { className: "cs-message__content" }, /* @__PURE__ */ E.createElement("p", { className: "cs-message__text" }, e.content), e.sources && e.sources.length > 0 && /* @__PURE__ */ E.createElement("div", { className: "cs-message__sources" }, /* @__PURE__ */ E.createElement("p", { className: "cs-message__sources-title" }, "Sources:"), /* @__PURE__ */ E.createElement("ul", { className: "cs-message__sources-list" }, e.sources.map((r, s) => /* @__PURE__ */ E.createElement("li", { key: s, className: "cs-message__source-item" }, /* @__PURE__ */ E.createElement(
1969
1969
  "a",
1970
1970
  {
1971
1971
  href: r.url,
@@ -1973,9 +1973,9 @@ const lr = ({ message: e }) => {
1973
1973
  rel: "noopener noreferrer",
1974
1974
  className: "cs-message__source-link"
1975
1975
  },
1976
- /* @__PURE__ */ b.createElement(Ot, { size: 12 }),
1977
- /* @__PURE__ */ b.createElement("span", null, r.title)
1978
- ), /* @__PURE__ */ b.createElement("span", { className: "cs-message__source-similarity" }, Math.round(r.similarity * 100), "% match")))))), /* @__PURE__ */ b.createElement("time", { className: "cs-message__time", dateTime: n.toISOString() }, n.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })));
1976
+ /* @__PURE__ */ E.createElement(Ot, { size: 12 }),
1977
+ /* @__PURE__ */ E.createElement("span", null, r.title)
1978
+ ), /* @__PURE__ */ E.createElement("span", { className: "cs-message__source-similarity" }, Math.round(r.similarity * 100), "% match")))))), /* @__PURE__ */ E.createElement("time", { className: "cs-message__time", dateTime: n.toISOString() }, n.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })));
1979
1979
  }, ur = ({
1980
1980
  onSendMessage: e,
1981
1981
  isLoading: t,
@@ -1986,7 +1986,7 @@ const lr = ({ message: e }) => {
1986
1986
  }, i = (a) => {
1987
1987
  a.key === "Enter" && !a.shiftKey && (a.preventDefault(), o(a));
1988
1988
  };
1989
- return /* @__PURE__ */ b.createElement("form", { className: "cs-input", onSubmit: o }, /* @__PURE__ */ b.createElement(
1989
+ return /* @__PURE__ */ E.createElement("form", { className: "cs-input", onSubmit: o }, /* @__PURE__ */ E.createElement(
1990
1990
  "textarea",
1991
1991
  {
1992
1992
  className: "cs-input__textarea",
@@ -1998,7 +1998,7 @@ const lr = ({ message: e }) => {
1998
1998
  rows: 1,
1999
1999
  "aria-label": "Message input"
2000
2000
  }
2001
- ), /* @__PURE__ */ b.createElement(
2001
+ ), /* @__PURE__ */ E.createElement(
2002
2002
  "button",
2003
2003
  {
2004
2004
  type: "submit",
@@ -2006,7 +2006,7 @@ const lr = ({ message: e }) => {
2006
2006
  disabled: !r.trim() || t,
2007
2007
  "aria-label": "Send message"
2008
2008
  },
2009
- /* @__PURE__ */ b.createElement(_t, { size: 20 })
2009
+ /* @__PURE__ */ E.createElement(_t, { size: 20 })
2010
2010
  ));
2011
2011
  }, fr = ({
2012
2012
  messages: e,
@@ -2017,19 +2017,19 @@ const lr = ({ message: e }) => {
2017
2017
  placeholder: o,
2018
2018
  welcomeMessage: i = "Hi! How can I help you today?"
2019
2019
  }) => {
2020
- const a = Ge(null);
2021
- return ge(() => {
2020
+ const a = Xe(null);
2021
+ return Ge(() => {
2022
2022
  var d;
2023
2023
  (d = a.current) == null || d.scrollIntoView({ behavior: "smooth" });
2024
- }, [e]), /* @__PURE__ */ b.createElement("div", { className: "cs-window" }, /* @__PURE__ */ b.createElement("div", { className: "cs-window__header" }, /* @__PURE__ */ b.createElement("h3", { className: "cs-window__title" }, "Customer Support"), /* @__PURE__ */ b.createElement(
2024
+ }, [e]), /* @__PURE__ */ E.createElement("div", { className: "cs-window" }, /* @__PURE__ */ E.createElement("div", { className: "cs-window__header" }, /* @__PURE__ */ E.createElement("h3", { className: "cs-window__title" }, "Customer Support"), /* @__PURE__ */ E.createElement(
2025
2025
  "button",
2026
2026
  {
2027
2027
  className: "cs-window__close",
2028
2028
  onClick: n,
2029
2029
  "aria-label": "Close chat"
2030
2030
  },
2031
- /* @__PURE__ */ b.createElement(Tt, { size: 20 })
2032
- )), /* @__PURE__ */ b.createElement("div", { className: "cs-window__messages" }, e.length === 0 && !r && /* @__PURE__ */ b.createElement("div", { className: "cs-window__welcome" }, /* @__PURE__ */ b.createElement("p", null, i)), e.map((d) => /* @__PURE__ */ b.createElement(lr, { key: d.id, message: d })), r && /* @__PURE__ */ b.createElement("div", { className: "cs-window__typing" }, /* @__PURE__ */ b.createElement(At, { size: 20, className: "cs-window__typing-icon" }), /* @__PURE__ */ b.createElement("span", null, "Thinking...")), s && /* @__PURE__ */ b.createElement("div", { className: "cs-window__error" }, /* @__PURE__ */ b.createElement("p", null, s.message)), /* @__PURE__ */ b.createElement("div", { ref: a })), /* @__PURE__ */ b.createElement("div", { className: "cs-window__input-wrapper" }, /* @__PURE__ */ b.createElement(
2031
+ /* @__PURE__ */ E.createElement(Tt, { size: 20 })
2032
+ )), /* @__PURE__ */ E.createElement("div", { className: "cs-window__messages" }, e.length === 0 && !r && /* @__PURE__ */ E.createElement("div", { className: "cs-window__welcome" }, /* @__PURE__ */ E.createElement("p", null, i)), e.map((d) => /* @__PURE__ */ E.createElement(lr, { key: d.id, message: d })), r && /* @__PURE__ */ E.createElement("div", { className: "cs-window__typing" }, /* @__PURE__ */ E.createElement(At, { size: 20, className: "cs-window__typing-icon" }), /* @__PURE__ */ E.createElement("span", null, "Thinking...")), s && /* @__PURE__ */ E.createElement("div", { className: "cs-window__error" }, /* @__PURE__ */ E.createElement("p", null, s.message)), /* @__PURE__ */ E.createElement("div", { ref: a })), /* @__PURE__ */ E.createElement("div", { className: "cs-window__input-wrapper" }, /* @__PURE__ */ E.createElement(
2033
2033
  ur,
2034
2034
  {
2035
2035
  onSendMessage: t,
@@ -2050,7 +2050,7 @@ const lr = ({ message: e }) => {
2050
2050
  onMessageReceived: u
2051
2051
  }) => {
2052
2052
  const [l, p] = J(!1), {
2053
- messages: E,
2053
+ messages: b,
2054
2054
  sendMessage: _,
2055
2055
  isLoading: f,
2056
2056
  error: h,
@@ -2059,43 +2059,48 @@ const lr = ({ message: e }) => {
2059
2059
  apiKey: e,
2060
2060
  baseUrl: t,
2061
2061
  onError: a
2062
- });
2063
- ge(() => {
2064
- if (n) {
2065
- const y = document.documentElement;
2066
- n.primaryColor && y.style.setProperty("--cs-primary-color", n.primaryColor), n.secondaryColor && y.style.setProperty("--cs-secondary-color", n.secondaryColor), n.backgroundColor && y.style.setProperty("--cs-bg-color", n.backgroundColor), n.textColor && y.style.setProperty("--cs-text-color", n.textColor), n.fontFamily && y.style.setProperty("--cs-font-family", n.fontFamily), n.borderRadius && y.style.setProperty("--cs-border-radius", n.borderRadius), n.buttonColor && y.style.setProperty("--cs-button-color", n.buttonColor), n.userMessageColor && y.style.setProperty("--cs-user-message-color", n.userMessageColor), n.assistantMessageColor && y.style.setProperty("--cs-assistant-message-color", n.assistantMessageColor);
2067
- }
2068
- }, [n]);
2069
- const g = async (y) => {
2062
+ }), S = E.useMemo(() => {
2063
+ if (!n) return {};
2064
+ const y = {};
2065
+ return n.primaryColor && (y["--cs-primary-color"] = n.primaryColor, n.buttonColor || (y["--cs-button-color"] = n.primaryColor), n.userMessageColor || (y["--cs-user-message-color"] = n.primaryColor), y["--cs-focus-ring"] = `${n.primaryColor}33`), n.secondaryColor && (y["--cs-secondary-color"] = n.secondaryColor), n.backgroundColor && (y["--cs-bg-color"] = n.backgroundColor), n.textColor && (y["--cs-text-color"] = n.textColor), n.fontFamily && (y["--cs-font-family"] = n.fontFamily), n.borderRadius && (y["--cs-border-radius"] = n.borderRadius), n.buttonColor && (y["--cs-button-color"] = n.buttonColor), n.userMessageColor && (y["--cs-user-message-color"] = n.userMessageColor), n.assistantMessageColor && (y["--cs-assistant-message-color"] = n.assistantMessageColor), y;
2066
+ }, [n]), R = async (y) => {
2070
2067
  if (d == null || d(y), await _(y), !h) {
2071
- const S = E[E.length - 1];
2072
- (S == null ? void 0 : S.role) === "ASSISTANT" && (u == null || u(S.content));
2068
+ const T = b[b.length - 1];
2069
+ (T == null ? void 0 : T.role) === "ASSISTANT" && (u == null || u(T.content));
2073
2070
  }
2074
- }, R = () => {
2071
+ }, g = () => {
2075
2072
  p(!l), h && m();
2076
2073
  };
2077
- return /* @__PURE__ */ b.createElement("div", { className: `cs-widget cs-widget--${r} ${i}` }, l && /* @__PURE__ */ b.createElement(
2078
- fr,
2074
+ return /* @__PURE__ */ E.createElement(
2075
+ "div",
2079
2076
  {
2080
- messages: E,
2081
- onSendMessage: g,
2082
- onClose: () => p(!1),
2083
- isLoading: f,
2084
- error: h,
2085
- placeholder: o,
2086
- welcomeMessage: s
2087
- }
2088
- ), /* @__PURE__ */ b.createElement(
2089
- "button",
2090
- {
2091
- className: `cs-widget__toggle ${l ? "cs-widget__toggle--open" : ""}`,
2092
- onClick: R,
2093
- "aria-label": l ? "Close chat" : "Open chat",
2094
- "aria-expanded": l
2077
+ className: `cs-widget cs-widget--${r} ${l ? "cs-widget--open" : ""} ${i}`,
2078
+ style: S
2095
2079
  },
2096
- /* @__PURE__ */ b.createElement(Ct, { size: 24 }),
2097
- !l && E.length > 0 && /* @__PURE__ */ b.createElement("span", { className: "cs-widget__badge" }, E.filter((y) => y.role === "ASSISTANT").length)
2098
- ));
2080
+ l && /* @__PURE__ */ E.createElement(
2081
+ fr,
2082
+ {
2083
+ messages: b,
2084
+ onSendMessage: R,
2085
+ onClose: () => p(!1),
2086
+ isLoading: f,
2087
+ error: h,
2088
+ placeholder: o,
2089
+ welcomeMessage: s
2090
+ }
2091
+ ),
2092
+ /* @__PURE__ */ E.createElement(
2093
+ "button",
2094
+ {
2095
+ className: `cs-widget__toggle ${l ? "cs-widget__toggle--open" : ""}`,
2096
+ onClick: g,
2097
+ "aria-label": l ? "Close chat" : "Open chat",
2098
+ "aria-expanded": l
2099
+ },
2100
+ /* @__PURE__ */ E.createElement(Ct, { size: 24 }),
2101
+ !l && b.length > 0 && /* @__PURE__ */ E.createElement("span", { className: "cs-widget__badge" }, b.filter((y) => y.role === "ASSISTANT").length)
2102
+ )
2103
+ );
2099
2104
  };
2100
2105
  export {
2101
2106
  ur as ChatInput,
@@ -2104,6 +2109,6 @@ export {
2104
2109
  or as CustomerSupportAPIClient,
2105
2110
  Lr as CustomerSupportWidget,
2106
2111
  cr as useCustomerSupport,
2107
- We as useLocalStorage
2112
+ Ke as useLocalStorage
2108
2113
  };
2109
2114
  //# sourceMappingURL=index.es.js.map