@enegelai/bot-widget 1.2.4 → 1.2.5

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,9 +1,9 @@
1
- var dt = Object.defineProperty;
2
- var pt = (t, e, o) => e in t ? dt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var $ = (t, e, o) => (pt(t, typeof e != "symbol" ? e + "" : e, o), o);
4
- import { css as x, LitElement as le, html as c, svg as He } from "lit";
5
- import { property as l, customElement as k, queryAll as ht, query as ce, eventOptions as qe } from "lit/decorators.js";
6
- import { unsafeHTML as N } from "lit-html/directives/unsafe-html.js";
1
+ var pt = Object.defineProperty;
2
+ var ht = (t, e, o) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var j = (t, e, o) => (ht(t, typeof e != "symbol" ? e + "" : e, o), o);
4
+ import { css as x, LitElement as de, html as c, svg as ve } from "lit";
5
+ import { property as l, customElement as k, queryAll as ut, query as pe, eventOptions as qe } from "lit/decorators.js";
6
+ import { unsafeHTML as q } from "lit-html/directives/unsafe-html.js";
7
7
  import "@shoelace-style/shoelace/dist/themes/light.css";
8
8
  import "@shoelace-style/shoelace/dist/themes/dark.css";
9
9
  import "@shoelace-style/shoelace/dist/components/button/button.js";
@@ -21,38 +21,38 @@ import "@shoelace-style/shoelace/dist/components/switch/switch.js";
21
21
  import "@shoelace-style/shoelace/dist/components/tooltip/tooltip.js";
22
22
  import "@shoelace-style/shoelace/dist/components/spinner/spinner.js";
23
23
  import "@shoelace-style/shoelace/dist/components/alert/alert.js";
24
- import { repeat as ye } from "lit/directives/repeat.js";
25
- import { when as R } from "lit/directives/when.js";
24
+ import { repeat as we } from "lit/directives/repeat.js";
25
+ import { when as D } from "lit/directives/when.js";
26
26
  import { until as Ie } from "lit-html/directives/until.js";
27
- import ut from "markdown-it";
28
- import gt from "markdown-it-link-attributes";
27
+ import gt from "markdown-it";
28
+ import bt from "markdown-it-link-attributes";
29
29
  import "@shoelace-style/shoelace/dist/components/popup/popup.js";
30
30
  function De(t) {
31
31
  return typeof t == "function" ? t() : t;
32
32
  }
33
- const ie = class ie extends Event {
33
+ const ce = class ce extends Event {
34
34
  /**
35
35
  * @param {string} key of the state that has changed
36
36
  * @param {unknown} value for the changed key
37
37
  */
38
38
  constructor(o, a, r) {
39
- super(ie.eventName, {
39
+ super(ce.eventName, {
40
40
  cancelable: !1
41
41
  });
42
- $(this, "key");
43
- $(this, "state");
44
- $(this, "value");
42
+ j(this, "key");
43
+ j(this, "state");
44
+ j(this, "value");
45
45
  this.key = o, this.value = a, this.state = r;
46
46
  }
47
47
  };
48
- $(ie, "eventName", "lit-state-changed");
49
- let B = ie;
50
- const bt = (t, e) => e !== t && (e === e || t === t);
48
+ j(ce, "eventName", "lit-state-changed");
49
+ let B = ce;
50
+ const mt = (t, e) => e !== t && (e === e || t === t);
51
51
  class X extends EventTarget {
52
52
  constructor() {
53
53
  super();
54
54
  // hold a reference to hooks
55
- $(this, "hookMap", /* @__PURE__ */ new Map());
55
+ j(this, "hookMap", /* @__PURE__ */ new Map());
56
56
  this.constructor.finalize(), this.propertyMap && [...this.propertyMap].forEach(([o, a]) => {
57
57
  if (a.initialValue !== void 0) {
58
58
  const r = De(a.initialValue);
@@ -81,7 +81,7 @@ class X extends EventTarget {
81
81
  Object.defineProperty(this.prototype, o, s);
82
82
  }
83
83
  static getPropertyDescriptor(o, a, r) {
84
- const s = (r == null ? void 0 : r.hasChanged) || bt;
84
+ const s = (r == null ? void 0 : r.hasChanged) || mt;
85
85
  return {
86
86
  get() {
87
87
  return this[a];
@@ -123,12 +123,12 @@ class X extends EventTarget {
123
123
  }
124
124
  }
125
125
  // a map holding decorators definition.
126
- $(X, "propertyMap"), $(X, "properties"), $(X, "finalized", !1);
127
- class mt {
126
+ j(X, "propertyMap"), j(X, "properties"), j(X, "finalized", !1);
127
+ class Fe {
128
128
  constructor(e, o, a) {
129
- $(this, "host");
130
- $(this, "state");
131
- $(this, "callback");
129
+ j(this, "host");
130
+ j(this, "state");
131
+ j(this, "callback");
132
132
  this.host = e, this.state = o, this.host.addController(this), this.callback = a || (() => this.host.requestUpdate());
133
133
  }
134
134
  hostConnected() {
@@ -143,7 +143,7 @@ class mt {
143
143
  * Copyright 2017 Google LLC
144
144
  * SPDX-License-Identifier: BSD-3-Clause
145
145
  */
146
- const Fe = ({ finisher: t, descriptor: e }) => (o, a) => {
146
+ const Ue = ({ finisher: t, descriptor: e }) => (o, a) => {
147
147
  var r;
148
148
  if (a === void 0) {
149
149
  const s = (r = o.originalKey) !== null && r !== void 0 ? r : o.key, n = e != null ? { kind: "method", placement: "prototype", key: s, descriptor: e(o.key) } : { ...o, key: s };
@@ -156,8 +156,8 @@ const Fe = ({ finisher: t, descriptor: e }) => (o, a) => {
156
156
  e !== void 0 && Object.defineProperty(o, a, e(a)), t == null || t(s, a);
157
157
  }
158
158
  };
159
- function H(t) {
160
- return Fe({
159
+ function L(t) {
160
+ return Ue({
161
161
  // @ts-ignore ctor is typof State and not typeof ReactiveElement
162
162
  finisher: (e, o) => {
163
163
  if (Object.getOwnPropertyDescriptor(e.prototype, o))
@@ -179,8 +179,8 @@ new URL(window.location.href);
179
179
  const ft = {
180
180
  prefix: "_ls"
181
181
  };
182
- function D(t) {
183
- return t = { ...ft, ...t }, Fe({
182
+ function R(t) {
183
+ return t = { ...ft, ...t }, Ue({
184
184
  // @ts-ignore ctor is typof State and not typeof ReactiveElement
185
185
  finisher: (e, o) => {
186
186
  const a = Object.getOwnPropertyDescriptor(e.prototype, o);
@@ -205,7 +205,7 @@ var vt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
205
205
  function wt(t) {
206
206
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
207
207
  }
208
- var Ue = { exports: {} };
208
+ var Ze = { exports: {} };
209
209
  (function(t) {
210
210
  (function(e, o) {
211
211
  t.exports ? t.exports = o() : e.log = o();
@@ -251,52 +251,52 @@ var Ue = { exports: {} };
251
251
  function y(u, f, w) {
252
252
  return i(u) || m.apply(this, arguments);
253
253
  }
254
- function ue(u, f, w) {
255
- var h = this, Oe;
254
+ function be(u, f, w) {
255
+ var h = this, Le;
256
256
  f = f ?? "WARN";
257
- var S = "loglevel";
258
- typeof u == "string" ? S += ":" + u : typeof u == "symbol" && (S = void 0);
259
- function it(d) {
260
- var T = (r[d] || "silent").toUpperCase();
261
- if (!(typeof window === o || !S)) {
257
+ var A = "loglevel";
258
+ typeof u == "string" ? A += ":" + u : typeof u == "symbol" && (A = void 0);
259
+ function lt(p) {
260
+ var T = (r[p] || "silent").toUpperCase();
261
+ if (!(typeof window === o || !A)) {
262
262
  try {
263
- window.localStorage[S] = T;
263
+ window.localStorage[A] = T;
264
264
  return;
265
265
  } catch {
266
266
  }
267
267
  try {
268
- window.document.cookie = encodeURIComponent(S) + "=" + T + ";";
268
+ window.document.cookie = encodeURIComponent(A) + "=" + T + ";";
269
269
  } catch {
270
270
  }
271
271
  }
272
272
  }
273
- function Le() {
274
- var d;
275
- if (!(typeof window === o || !S)) {
273
+ function He() {
274
+ var p;
275
+ if (!(typeof window === o || !A)) {
276
276
  try {
277
- d = window.localStorage[S];
277
+ p = window.localStorage[A];
278
278
  } catch {
279
279
  }
280
- if (typeof d === o)
280
+ if (typeof p === o)
281
281
  try {
282
282
  var T = window.document.cookie, Y = T.indexOf(
283
- encodeURIComponent(S) + "="
283
+ encodeURIComponent(A) + "="
284
284
  );
285
- Y !== -1 && (d = /^([^;]+)/.exec(T.slice(Y))[1]);
285
+ Y !== -1 && (p = /^([^;]+)/.exec(T.slice(Y))[1]);
286
286
  } catch {
287
287
  }
288
- return h.levels[d] === void 0 && (d = void 0), d;
288
+ return h.levels[p] === void 0 && (p = void 0), p;
289
289
  }
290
290
  }
291
- function lt() {
292
- if (!(typeof window === o || !S)) {
291
+ function ct() {
292
+ if (!(typeof window === o || !A)) {
293
293
  try {
294
- window.localStorage.removeItem(S);
294
+ window.localStorage.removeItem(A);
295
295
  return;
296
296
  } catch {
297
297
  }
298
298
  try {
299
- window.document.cookie = encodeURIComponent(S) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
299
+ window.document.cookie = encodeURIComponent(A) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
300
300
  } catch {
301
301
  }
302
302
  }
@@ -309,46 +309,46 @@ var Ue = { exports: {} };
309
309
  ERROR: 4,
310
310
  SILENT: 5
311
311
  }, h.methodFactory = w || y, h.getLevel = function() {
312
- return Oe;
313
- }, h.setLevel = function(d, T) {
314
- if (typeof d == "string" && h.levels[d.toUpperCase()] !== void 0 && (d = h.levels[d.toUpperCase()]), typeof d == "number" && d >= 0 && d <= h.levels.SILENT) {
315
- if (Oe = d, T !== !1 && it(d), g.call(h, d, u), typeof console === o && d < h.levels.SILENT)
312
+ return Le;
313
+ }, h.setLevel = function(p, T) {
314
+ if (typeof p == "string" && h.levels[p.toUpperCase()] !== void 0 && (p = h.levels[p.toUpperCase()]), typeof p == "number" && p >= 0 && p <= h.levels.SILENT) {
315
+ if (Le = p, T !== !1 && lt(p), g.call(h, p, u), typeof console === o && p < h.levels.SILENT)
316
316
  return "No console available for logging";
317
317
  } else
318
- throw "log.setLevel() called with invalid level: " + d;
319
- }, h.setDefaultLevel = function(d) {
320
- f = d, Le() || h.setLevel(d, !1);
318
+ throw "log.setLevel() called with invalid level: " + p;
319
+ }, h.setDefaultLevel = function(p) {
320
+ f = p, He() || h.setLevel(p, !1);
321
321
  }, h.resetLevel = function() {
322
- h.setLevel(f, !1), lt();
323
- }, h.enableAll = function(d) {
324
- h.setLevel(h.levels.TRACE, d);
325
- }, h.disableAll = function(d) {
326
- h.setLevel(h.levels.SILENT, d);
322
+ h.setLevel(f, !1), ct();
323
+ }, h.enableAll = function(p) {
324
+ h.setLevel(h.levels.TRACE, p);
325
+ }, h.disableAll = function(p) {
326
+ h.setLevel(h.levels.SILENT, p);
327
327
  };
328
- var be = Le();
329
- be == null && (be = f), h.setLevel(be, !1);
328
+ var ye = He();
329
+ ye == null && (ye = f), h.setLevel(ye, !1);
330
330
  }
331
- var M = new ue(), ge = {};
332
- M.getLogger = function(f) {
331
+ var S = new be(), me = {};
332
+ S.getLogger = function(f) {
333
333
  if (typeof f != "symbol" && typeof f != "string" || f === "")
334
334
  throw new TypeError("You must supply a name when creating a logger.");
335
- var w = ge[f];
336
- return w || (w = ge[f] = new ue(
335
+ var w = me[f];
336
+ return w || (w = me[f] = new be(
337
337
  f,
338
- M.getLevel(),
339
- M.methodFactory
338
+ S.getLevel(),
339
+ S.methodFactory
340
340
  )), w;
341
341
  };
342
- var nt = typeof window !== o ? window.log : void 0;
343
- return M.noConflict = function() {
344
- return typeof window !== o && window.log === M && (window.log = nt), M;
345
- }, M.getLoggers = function() {
346
- return ge;
347
- }, M.default = M, M;
342
+ var it = typeof window !== o ? window.log : void 0;
343
+ return S.noConflict = function() {
344
+ return typeof window !== o && window.log === S && (window.log = it), S;
345
+ }, S.getLoggers = function() {
346
+ return me;
347
+ }, S.default = S, S;
348
348
  });
349
- })(Ue);
350
- var xt = Ue.exports;
351
- const de = /* @__PURE__ */ wt(xt), kt = x`
349
+ })(Ze);
350
+ var xt = Ze.exports;
351
+ const he = /* @__PURE__ */ wt(xt), kt = x`
352
352
  :host {
353
353
  }
354
354
  .cb-wrapper {
@@ -415,68 +415,75 @@ const de = /* @__PURE__ */ wt(xt), kt = x`
415
415
  border-radius: 0;
416
416
  }
417
417
  }
418
- `, O = x`
419
- :host {
420
- --primary-color: var(--sl-color-primary-600);
421
- }
418
+ `, I = x`
419
+ :host {
420
+ --primary-color: var(--sl-color-primary-600);
421
+ }
422
422
 
423
- .link__item,
424
- .link__item:visited,
425
- .link__item:active {
426
- color: var(--primary-color);
427
- }
423
+ .link__item,
424
+ .link__item:visited,
425
+ .link__item:active {
426
+ color: var(--primary-color);
427
+ }
428
428
 
429
- .link__item.inverse,
430
- .link__item.inverse:visited,
431
- .link__item.inverse:active {
432
- color: white;
433
- }
429
+ .link__item.inverse,
430
+ .link__item.inverse:visited,
431
+ .link__item.inverse:active {
432
+ color: white;
433
+ }
434
434
 
435
- sl-button.icon {
436
- display: flex;
437
- justify-content: center;
438
- align-items: center;
439
- }
435
+ /*
436
+ sl-button.cb-icon {
437
+ display: flex;
438
+ justify-content: center;
439
+ align-items: center;
440
+ }
441
+ */
442
+ sl-button {
443
+ display: flex;
444
+ justify-content: center;
445
+ align-items: center;
446
+ }
440
447
 
441
- .color-white {
442
- color: white;
443
- }
448
+ .color-white {
449
+ color: white;
450
+ }
444
451
 
445
- .color-default {
446
- color: var(--sl-color-neutral-600);
447
- }
452
+ .color-default {
453
+ color: var(--sl-color-neutral-600);
454
+ }
448
455
 
449
- .color-primary {
450
- color: var(--sl-color-primary-600);
451
- }
456
+ .color-primary {
457
+ color: var(--sl-color-primary-600);
458
+ }
452
459
 
453
- .color-success,
454
- .color-green {
455
- color: var(--sl-color-success-600);
456
- }
460
+ .color-success,
461
+ .color-green {
462
+ color: var(--sl-color-success-600);
463
+ }
457
464
 
458
- .color-warning {
459
- color: var(--sl-color-warning-600);
460
- }
465
+ .color-warning {
466
+ color: var(--sl-color-warning-600);
467
+ }
461
468
 
462
- .color-danger,
463
- .color-error {
464
- color: var(--sl-color-danger-600);
465
- }
469
+ .color-danger,
470
+ .color-error {
471
+ color: var(--sl-color-danger-600);
472
+ }
466
473
 
467
- .color-default {
468
- color: var(--sl-color-neutral-600);
469
- }
474
+ .color-default {
475
+ color: var(--sl-color-neutral-600);
476
+ }
470
477
 
471
- .text-button {
472
- cursor: pointer;
473
- }
478
+ .text-button {
479
+ cursor: pointer;
480
+ }
474
481
 
475
- .text-button:hover {
476
- text-decoration: underline;
477
- }
478
- `, Ze = x`
479
- ${O}
482
+ .text-button:hover {
483
+ text-decoration: underline;
484
+ }
485
+ `, Ne = x`
486
+ ${I}
480
487
 
481
488
  :host {
482
489
  display: inline-flex;
@@ -498,29 +505,29 @@ const de = /* @__PURE__ */ wt(xt), kt = x`
498
505
  color: white;
499
506
  }
500
507
  `;
501
- var _t = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, $e = (t, e, o, a) => {
508
+ var _t = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, Me = (t, e, o, a) => {
502
509
  for (var r = a > 1 ? void 0 : a ? Ct(e, o) : e, s = t.length - 1, n; s >= 0; s--)
503
510
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
504
511
  return a && r && _t(e, o, r), r;
505
512
  };
506
- let W = class extends le {
513
+ let W = class extends de {
507
514
  constructor() {
508
515
  super(...arguments), this.color = "primary", this.svg = "";
509
516
  }
510
517
  render() {
511
518
  return c`<span class="cb-icon color-${this.color}" part="base"
512
- >${N(this.svg)}</span
519
+ >${q(this.svg)}</span
513
520
  >`;
514
521
  }
515
522
  };
516
- W.styles = Ze;
517
- $e([
523
+ W.styles = Ne;
524
+ Me([
518
525
  l({ type: String })
519
526
  ], W.prototype, "color", 2);
520
- $e([
527
+ Me([
521
528
  l({ type: String })
522
529
  ], W.prototype, "svg", 2);
523
- W = $e([
530
+ W = Me([
524
531
  k("cb-icon")
525
532
  ], W);
526
533
  let $t = (t) => crypto.getRandomValues(new Uint8Array(t)), jt = (t, e, o) => {
@@ -536,7 +543,7 @@ let $t = (t) => crypto.getRandomValues(new Uint8Array(t)), jt = (t, e, o) => {
536
543
  };
537
544
  }, Mt = (t, e = 21) => jt(t, e, $t);
538
545
  const St = Mt("1234567890abcdefghijklmnopqrstuvwxyz", 10);
539
- function fe(t = 10) {
546
+ function xe(t = 10) {
540
547
  return St(t);
541
548
  }
542
549
  function At(t) {
@@ -559,7 +566,7 @@ function Ot(t = !0) {
559
566
  }), o.click();
560
567
  });
561
568
  }
562
- const _ = de.noConflict();
569
+ const _ = he.noConflict();
563
570
  _.setLevel("info");
564
571
  class Lt {
565
572
  constructor(e = {}) {
@@ -669,27 +676,27 @@ class Lt {
669
676
  });
670
677
  }*/
671
678
  }
672
- var Ht = Object.defineProperty, It = Object.getOwnPropertyDescriptor, I = (t, e, o, a) => {
679
+ var Ht = Object.defineProperty, It = Object.getOwnPropertyDescriptor, H = (t, e, o, a) => {
673
680
  for (var r = a > 1 ? void 0 : a ? It(e, o) : e, s = t.length - 1, n; s >= 0; s--)
674
681
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
675
682
  return a && r && Ht(e, o, r), r;
676
683
  };
677
- const j = de.noConflict();
678
- j.setLevel("info");
679
- const F = "cb_";
680
- class L extends X {
684
+ const $ = he.noConflict();
685
+ $.setLevel("info");
686
+ const V = "cb_";
687
+ class M extends X {
681
688
  constructor() {
682
689
  super(...arguments), this.actionIdCounter = 0, this.wsClient = null, this.replyMessage = null;
683
690
  }
684
691
  // this is called at startup
685
692
  setSetting(e) {
686
- j.info("appState: Startup: setSetting"), this.setting = e, this.initBot().catch((o) => {
687
- j.info(`Exception during bot initialization: ${o.message}`);
693
+ $.info("appState: Startup: setSetting", e), this.setting = e, this.initBot().catch((o) => {
694
+ $.info(`Exception during bot initialization: ${o.message}`);
688
695
  });
689
696
  }
690
697
  clearConversation() {
691
698
  this.wsClient && (this.wsClient.stop().then(() => {
692
- }), this.wsClient = null), this.conversationId = fe(), this.connectWs = "false", this.messages = [], this.actions = [], this.addMessage({
699
+ }), this.wsClient = null), this.conversationId = xe(), this.connectWs = "false", this.messages = [], this.actions = [], this.addMessage({
693
700
  author: "assistant",
694
701
  type: "text",
695
702
  data: {
@@ -708,7 +715,7 @@ class L extends X {
708
715
  async initBot() {
709
716
  if (!this.botSettingsInitialized) {
710
717
  const o = `${this.setting.url.startsWith("localhost") ? "http" : "https"}://${this.setting.url}/api/bot/settings/${this.setting.orgId}/${this.setting.botId}`;
711
- j.info(`Getting bot settings at ${o} ...`);
718
+ $.info(`Getting bot settings at ${o} ...`);
712
719
  let a = null, r = null;
713
720
  try {
714
721
  a = await fetch(o, {
@@ -716,15 +723,17 @@ class L extends X {
716
723
  "Access-Control-Allow-Origin": "null",
717
724
  "X-Enegel-Signature": this.setting.botId
718
725
  }
719
- }), !a.ok || a.status !== 200 ? j.error(`Failed to get bot ${this.setting.botId} settings: ${a.status} ${a.statusText}`) : r = await a.json();
726
+ }), !a.ok || a.status !== 200 ? $.error(`Failed to get bot ${this.setting.botId} settings: ${a.status} ${a.statusText}`) : r = await a.json();
720
727
  } catch (s) {
721
- j.error(`Failed to get bot ${this.setting.botId} settings: ${s.message}`), r = null;
728
+ $.error(`Failed to get bot ${this.setting.botId} settings: ${s.message}`), r = null;
722
729
  }
723
730
  if (this.botSettingsInitialized = !0, !r) {
724
- j.error("No bot settings available - bot disabled"), this.disabled = !0;
731
+ $.error("No bot settings available - bot disabled"), this.disabled = !0;
725
732
  return;
726
733
  }
727
- this.setting.welcomeMessage = (r == null ? void 0 : r.welcomeMessage) || "How can I help ?";
734
+ this.setting.welcomeMessage = (r == null ? void 0 : r.welcomeMessage) || "How can I help ?", this.setting.engageMessage = (r == null ? void 0 : r.engageMessage) || "How can I help ?", this.setting.engageTimeout = (r == null ? void 0 : r.engageTimeout) || 5, setTimeout(() => {
735
+ this.open || ($.info("Engaging User !"), this.engage = !0);
736
+ }, this.setting.engageTimeout * 1e3);
728
737
  }
729
738
  Array.isArray(this.messages) && this.messages.length <= 0 && this.addMessage({
730
739
  author: "assistant",
@@ -732,8 +741,8 @@ class L extends X {
732
741
  data: {
733
742
  text: this.setting.welcomeMessage
734
743
  }
735
- }), this.connectWs === "true" && (j.info("appState: connectWs is true"), this.getWsClient().catch((e) => {
736
- j.error(`Exception during ws client startup: ${e.message}`);
744
+ }), this.connectWs === "true" && ($.info("appState: connectWs is true"), this.getWsClient().catch((e) => {
745
+ $.error(`Exception during ws client startup: ${e.message}`);
737
746
  }));
738
747
  }
739
748
  // Lazy initialization: avoid connecting until we actually need to send something
@@ -743,7 +752,7 @@ class L extends X {
743
752
  if (this.wsClient)
744
753
  return this.wsClient;
745
754
  const o = `${this.setting.url.startsWith("localhost") ? "ws" : "wss"}://${this.setting.url}/api/bot/connect/${this.setting.orgId}/${this.setting.botId}/${this.conversationId}`;
746
- return j.info(`Initiating ws connection to ${o} ...`), this.wsClient = new Lt({
755
+ return $.info(`Initiating ws connection to ${o} ...`), this.wsClient = new Lt({
747
756
  url: o,
748
757
  orgId: this.setting.orgId,
749
758
  botId: this.setting.botId,
@@ -807,10 +816,10 @@ class L extends X {
807
816
  }
808
817
  }
809
818
  async sendMessage(e) {
810
- e = this.formatMessage(e), j.info("Send Message:", e), this.messages = this.messages.concat([e]);
819
+ e = this.formatMessage(e), $.info("Send Message:", e), this.messages = this.messages.concat([e]);
811
820
  const o = await this.getWsClient();
812
821
  if (!o) {
813
- j.error("Error - failed to obtain ws client"), this.replyMessage = null;
822
+ $.error("Error - failed to obtain ws client"), this.replyMessage = null;
814
823
  return;
815
824
  }
816
825
  o.sendMessage({
@@ -822,7 +831,7 @@ class L extends X {
822
831
  // TODO revisit below
823
832
  formatMessage(e) {
824
833
  var o;
825
- return e.id || (e.id = fe()), e.timestamp = Date.now(), e.author === "assistant" && (e.replyId = (o = this.messages[this.messages.length - 1]) == null ? void 0 : o.id), e;
834
+ return e.id || (e.id = xe()), e.timestamp = Date.now(), e.author === "assistant" && (e.replyId = (o = this.messages[this.messages.length - 1]) == null ? void 0 : o.id), e;
826
835
  }
827
836
  // add message
828
837
  addMessage(e) {
@@ -851,31 +860,36 @@ class L extends X {
851
860
  this.messages = [];
852
861
  }
853
862
  }
854
- I([
855
- D({ prefix: F }),
856
- H({ value: "en" })
857
- ], L.prototype, "language", 2);
858
- I([
859
- D({ prefix: F }),
860
- H({ value: "light" })
861
- ], L.prototype, "theme", 2);
862
- I([
863
- D({ prefix: F }),
864
- H({ value: "false" })
865
- ], L.prototype, "connectWs", 2);
866
- I([
867
- D({ prefix: F }),
868
- H({ value: fe() })
869
- ], L.prototype, "conversationId", 2);
870
- I([
871
- D({ prefix: F }),
872
- H({ type: Array, value: [] })
873
- ], L.prototype, "messages", 2);
874
- I([
875
- H({
863
+ H([
864
+ R({ prefix: V }),
865
+ L({ value: "en" })
866
+ ], M.prototype, "language", 2);
867
+ H([
868
+ R({ prefix: V }),
869
+ L({ value: "light" })
870
+ ], M.prototype, "theme", 2);
871
+ H([
872
+ R({ prefix: V }),
873
+ L({ type: Boolean, value: !1 })
874
+ ], M.prototype, "open", 2);
875
+ H([
876
+ R({ prefix: V }),
877
+ L({ value: "false" })
878
+ ], M.prototype, "connectWs", 2);
879
+ H([
880
+ R({ prefix: V }),
881
+ L({ value: xe() })
882
+ ], M.prototype, "conversationId", 2);
883
+ H([
884
+ R({ prefix: V }),
885
+ L({ type: Array, value: [] })
886
+ ], M.prototype, "messages", 2);
887
+ H([
888
+ L({
876
889
  type: Array,
877
890
  value: []
878
- /*value: [
891
+ /*
892
+ value: [
879
893
  {
880
894
  internalId: 1,
881
895
  type: 'calendlyMeeting',
@@ -890,18 +904,42 @@ I([
890
904
  url: 'https://signup.ticketspice.com/',
891
905
  // TODO Any other properties
892
906
  },
907
+ {
908
+ internalId: 3,
909
+ type: 'link',
910
+ title: 'Sign Up',
911
+ url: 'https://signup.ticketspice.com/',
912
+ // TODO Any other properties
913
+ },
914
+ {
915
+ internalId: 4,
916
+ type: 'calendlyMeeting',
917
+ title: 'Book 1:1 meeting',
918
+ url: 'https://calendly.com/slava-sayko/1-1-meeting-with-sales?hide_gdpr_banner=1',
919
+ // TODO Any other properties
920
+ },
921
+ {
922
+ internalId: 5,
923
+ type: 'calendlyMeeting',
924
+ title: 'Book 1:1 meeting',
925
+ url: 'https://calendly.com/slava-sayko/1-1-meeting-with-sales?hide_gdpr_banner=1',
926
+ // TODO Any other properties
927
+ },
893
928
  ],*/
894
929
  })
895
- ], L.prototype, "actions", 2);
896
- I([
897
- H({ type: Boolean, value: !1 })
898
- ], L.prototype, "botSettingsInitialized", 2);
899
- I([
900
- H({ type: Boolean, value: !1 })
901
- ], L.prototype, "disabled", 2);
902
- I([
903
- D({ prefix: F }),
904
- H({
930
+ ], M.prototype, "actions", 2);
931
+ H([
932
+ L({ type: Boolean, value: !1 })
933
+ ], M.prototype, "botSettingsInitialized", 2);
934
+ H([
935
+ L({ type: Boolean, value: !1 })
936
+ ], M.prototype, "disabled", 2);
937
+ H([
938
+ L({ type: Boolean, value: !1 })
939
+ ], M.prototype, "engage", 2);
940
+ H([
941
+ R({ prefix: V }),
942
+ L({
905
943
  type: Object,
906
944
  value: {
907
945
  orgId: null,
@@ -910,9 +948,9 @@ I([
910
948
  welcomeMessage: null
911
949
  }
912
950
  })
913
- ], L.prototype, "setting", 2);
914
- const p = new L(), Pt = x`
915
- ${O}
951
+ ], M.prototype, "setting", 2);
952
+ const d = new M(), Pt = x`
953
+ ${I}
916
954
  :host {
917
955
  position: relative;
918
956
  font-weight: bold;
@@ -952,13 +990,17 @@ const p = new L(), Pt = x`
952
990
  font-size: 1.5rem;
953
991
  color: white;
954
992
  }
993
+
994
+ .cb-setting-button cb-icon {
995
+ display: inline;
996
+ }
955
997
  `;
956
998
  var zt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, Tt = (t, e, o, a) => {
957
999
  for (var r = a > 1 ? void 0 : a ? Et(e, o) : e, s = t.length - 1, n; s >= 0; s--)
958
1000
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
959
1001
  return a && r && zt(e, o, r), r;
960
1002
  };
961
- class C extends le {
1003
+ class C extends de {
962
1004
  constructor() {
963
1005
  super(...arguments), this.lang = "en";
964
1006
  }
@@ -976,13 +1018,13 @@ class C extends le {
976
1018
  Tt([
977
1019
  l({ type: String })
978
1020
  ], C.prototype, "lang", 2);
979
- const je = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8L2.146 2.854Z"/></svg>';
980
- var Bt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Ne = (t, e, o, a) => {
1021
+ const oe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8L2.146 2.854Z"/></svg>';
1022
+ var Bt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, We = (t, e, o, a) => {
981
1023
  for (var r = a > 1 ? void 0 : a ? Rt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
982
1024
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
983
1025
  return a && r && Bt(e, o, r), r;
984
1026
  };
985
- let te = class extends C {
1027
+ let re = class extends C {
986
1028
  constructor() {
987
1029
  super(...arguments), this.title = "ChatBot";
988
1030
  }
@@ -990,13 +1032,13 @@ let te = class extends C {
990
1032
  return c` <header class="cb-header" part="header">
991
1033
  <span class="left">
992
1034
  <sl-button @click=${this._clickHandler} class="cb-setting-button" variant="text" circle>
993
- <cb-icon color="white" svg="${p.setting.logoSvg}"></cb-icon>
1035
+ <cb-icon color="white" svg="${d.setting.logoSvg}"></cb-icon>
994
1036
  </sl-button>
995
1037
  </span>
996
1038
  <span class="center title">${this.title}</span>
997
1039
  <span class="right">
998
1040
  <sl-button @click=${this._clickCloseHandler} class="cb-setting-button" variant="text" circle>
999
- <cb-icon color="white" svg="${je}"></cb-icon>
1041
+ <cb-icon color="white" svg="${oe}"></cb-icon>
1000
1042
  </sl-button>
1001
1043
  </span>
1002
1044
  </header>`;
@@ -1012,15 +1054,15 @@ let te = class extends C {
1012
1054
  });
1013
1055
  }
1014
1056
  };
1015
- te.styles = Pt;
1016
- Ne([
1057
+ re.styles = Pt;
1058
+ We([
1017
1059
  l({ type: String, attribute: "title" })
1018
- ], te.prototype, "title", 2);
1019
- te = Ne([
1060
+ ], re.prototype, "title", 2);
1061
+ re = We([
1020
1062
  k("cb-header")
1021
- ], te);
1063
+ ], re);
1022
1064
  const Vt = x`
1023
- ${O}
1065
+ ${I}
1024
1066
  .cb-footer {
1025
1067
  line-height: 60px;
1026
1068
  font-size: 16px;
@@ -1039,7 +1081,7 @@ var qt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, Ft = (t, e
1039
1081
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1040
1082
  return a && r && qt(e, o, r), r;
1041
1083
  };
1042
- let ve = class extends C {
1084
+ let ke = class extends C {
1043
1085
  constructor() {
1044
1086
  super(...arguments), this.year = (/* @__PURE__ */ new Date()).getFullYear();
1045
1087
  }
@@ -1074,12 +1116,12 @@ let ve = class extends C {
1074
1116
  `;
1075
1117
  }
1076
1118
  };
1077
- ve.styles = Vt;
1078
- ve = Ft([
1119
+ ke.styles = Vt;
1120
+ ke = Ft([
1079
1121
  k("cb-footer")
1080
- ], ve);
1122
+ ], ke);
1081
1123
  const Ut = x`
1082
- ${O}
1124
+ ${I}
1083
1125
 
1084
1126
  :host {
1085
1127
  width: 100%;
@@ -1124,15 +1166,16 @@ const Ut = x`
1124
1166
 
1125
1167
  .cb-actions-list {
1126
1168
  margin: 10px 0px 0px 0px;
1127
- padding: 10px 0px;
1169
+ padding: 0px 0px;
1128
1170
  //border-top: 1px solid rgba(0, 0, 0, 0.1);
1129
1171
  display: flex;
1130
1172
  justify-content: center;
1173
+ flex-wrap: wrap;
1131
1174
  }
1132
1175
 
1133
1176
  .cb-action {
1134
1177
  padding: 6px 6px;
1135
- margin: 1px 4px;
1178
+ margin: 1px 2px;
1136
1179
  border-radius: 6px;
1137
1180
  cursor: pointer;
1138
1181
  color: rgba(255, 255, 255, 1);
@@ -1179,12 +1222,12 @@ var Zt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, Wt = (t, e
1179
1222
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1180
1223
  return a && r && Zt(e, o, r), r;
1181
1224
  };
1182
- let we = class extends le {
1225
+ let _e = class extends de {
1183
1226
  render() {
1184
1227
  return c` <div class="cb-thinking" style="color: rgb(34, 34, 34);"><span></span><span></span><span></span></div>`;
1185
1228
  }
1186
1229
  };
1187
- we.styles = x`
1230
+ _e.styles = x`
1188
1231
  .cb-thinking {
1189
1232
  text-align: center;
1190
1233
  }
@@ -1222,15 +1265,15 @@ we.styles = x`
1222
1265
  }
1223
1266
  }
1224
1267
  `;
1225
- we = Wt([
1268
+ _e = Wt([
1226
1269
  k("cb-thinking")
1227
- ], we);
1228
- var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, We = (t, e, o, a) => {
1270
+ ], _e);
1271
+ var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, Ke = (t, e, o, a) => {
1229
1272
  for (var r = a > 1 ? void 0 : a ? Jt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1230
1273
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1231
1274
  return a && r && Kt(e, o, r), r;
1232
1275
  };
1233
- let oe = class extends C {
1276
+ let ae = class extends C {
1234
1277
  constructor() {
1235
1278
  super(...arguments), this.files = [];
1236
1279
  }
@@ -1246,7 +1289,7 @@ let oe = class extends C {
1246
1289
  </div>`;
1247
1290
  }
1248
1291
  };
1249
- oe.styles = x`
1292
+ ae.styles = x`
1250
1293
  .cb-uploading {
1251
1294
  text-align: left;
1252
1295
  }
@@ -1264,14 +1307,14 @@ oe.styles = x`
1264
1307
  margin-right: 5px;
1265
1308
  }
1266
1309
  `;
1267
- We([
1310
+ Ke([
1268
1311
  l({ type: Array })
1269
- ], oe.prototype, "files", 2);
1270
- oe = We([
1312
+ ], ae.prototype, "files", 2);
1313
+ ae = Ke([
1271
1314
  k("cb-uploading")
1272
- ], oe);
1315
+ ], ae);
1273
1316
  const Yt = x`
1274
- ${O}
1317
+ ${I}
1275
1318
  :host {
1276
1319
  }
1277
1320
 
@@ -1291,12 +1334,12 @@ const Yt = x`
1291
1334
  margin-right: 0.2em;
1292
1335
  }
1293
1336
  `;
1294
- var Gt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Me = (t, e, o, a) => {
1337
+ var Gt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Se = (t, e, o, a) => {
1295
1338
  for (var r = a > 1 ? void 0 : a ? Xt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1296
1339
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1297
1340
  return a && r && Gt(e, o, r), r;
1298
1341
  };
1299
- let K = class extends le {
1342
+ let K = class extends de {
1300
1343
  constructor() {
1301
1344
  super(...arguments), this.url = "", this.inverse = !1;
1302
1345
  }
@@ -1341,17 +1384,17 @@ K.styles = x`
1341
1384
  text-decoration: underline;
1342
1385
  }
1343
1386
  `;
1344
- Me([
1387
+ Se([
1345
1388
  l({ type: String })
1346
1389
  ], K.prototype, "url", 2);
1347
- Me([
1390
+ Se([
1348
1391
  l({ type: Boolean })
1349
1392
  ], K.prototype, "inverse", 2);
1350
- K = Me([
1393
+ K = Se([
1351
1394
  k("cb-external-link")
1352
1395
  ], K);
1353
1396
  const Qt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-2v-1h2a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.928 15.849v-3.337h1.136v-.662H0v.662h1.134v3.337h.794Zm4.689-3.999h-.894L4.9 13.289h-.035l-.832-1.439h-.932l1.228 1.983l-1.24 2.016h.862l.853-1.415h.035l.85 1.415h.907l-1.253-1.992l1.274-2.007Zm1.93.662v3.337h-.794v-3.337H6.619v-.662h3.064v.662H8.546Z"/></svg>', eo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm1.217-1.333v3.999h1.46c.401 0 .734-.08.998-.237a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.589-.68c-.264-.156-.599-.234-1.005-.234H3.362Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.14 1.14 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082h-.563v-2.707Zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638H7.896Z"/></svg>', to = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2H9v-1h3a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM.706 13.189v2.66H0V11.85h.806l1.14 2.596h.026l1.14-2.596h.8v3.999h-.716v-2.66h-.038l-.946 2.159h-.516l-.952-2.16H.706Zm3.919 2.66V11.85h1.459c.406 0 .741.078 1.005.234c.263.157.46.383.589.68c.13.297.196.655.196 1.075c0 .422-.066.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-1 .237H4.626Zm1.353-3.354h-.562v2.707h.562c.186 0 .347-.028.484-.082a.8.8 0 0 0 .334-.252a1.14 1.14 0 0 0 .196-.422c.045-.168.067-.365.067-.592a2.1 2.1 0 0 0-.117-.753a.89.89 0 0 0-.354-.454c-.159-.102-.362-.152-.61-.152Z"/></svg>', oo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM3.517 14.841a1.13 1.13 0 0 0 .401.823c.13.108.289.192.478.252c.19.061.411.091.665.091c.338 0 .624-.053.859-.158c.236-.105.416-.252.539-.44c.125-.189.187-.408.187-.656c0-.224-.045-.41-.134-.56a1.001 1.001 0 0 0-.375-.357a2.027 2.027 0 0 0-.566-.21l-.621-.144a.97.97 0 0 1-.404-.176a.37.37 0 0 1-.144-.299c0-.156.062-.284.185-.384c.125-.101.296-.152.512-.152c.143 0 .266.023.37.068a.624.624 0 0 1 .246.181a.56.56 0 0 1 .12.258h.75a1.092 1.092 0 0 0-.2-.566a1.21 1.21 0 0 0-.5-.41a1.813 1.813 0 0 0-.78-.152c-.293 0-.551.05-.776.15c-.225.099-.4.24-.527.421c-.127.182-.19.395-.19.639c0 .201.04.376.122.524c.082.149.2.27.352.367c.152.095.332.167.539.213l.618.144c.207.049.361.113.463.193a.387.387 0 0 1 .152.326a.505.505 0 0 1-.085.29a.559.559 0 0 1-.255.193c-.111.047-.249.07-.413.07c-.117 0-.223-.013-.32-.04a.838.838 0 0 1-.248-.115a.578.578 0 0 1-.255-.384h-.765ZM.806 13.693c0-.248.034-.46.102-.633a.868.868 0 0 1 .302-.399a.814.814 0 0 1 .475-.137c.15 0 .283.032.398.097a.7.7 0 0 1 .272.26a.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964a1.441 1.441 0 0 0-.489-.272a1.838 1.838 0 0 0-.606-.097c-.356 0-.66.074-.911.223c-.25.148-.44.359-.572.632c-.13.274-.196.6-.196.979v.498c0 .379.064.704.193.976c.131.271.322.48.572.626c.25.145.554.217.914.217c.293 0 .554-.055.785-.164c.23-.11.414-.26.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.799.799 0 0 1-.118.363a.7.7 0 0 1-.272.25a.874.874 0 0 1-.401.087a.845.845 0 0 1-.478-.132a.833.833 0 0 1-.299-.392a1.699 1.699 0 0 1-.102-.627v-.495Zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879l-1.327 4Z"/></svg>', ro = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.817-1.333h-1.6v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474c.108-.201.161-.427.161-.677c0-.25-.052-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.793.793 0 0 1-.375.082H4.15V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.767-.67v3.336H7.48v-3.337H6.346v-.662h3.065v.662H8.274Z"/></svg>', ao = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-7.839 9.166v.522c0 .256-.039.47-.117.641a.861.861 0 0 1-.322.387a.877.877 0 0 1-.469.126a.883.883 0 0 1-.471-.126a.868.868 0 0 1-.32-.386a1.55 1.55 0 0 1-.117-.642v-.522c0-.257.04-.471.117-.641a.868.868 0 0 1 .32-.387a.868.868 0 0 1 .471-.129c.176 0 .332.043.469.13a.861.861 0 0 1 .322.386c.078.17.117.384.117.641Zm.803.519v-.513c0-.377-.068-.7-.205-.972a1.46 1.46 0 0 0-.589-.63c-.254-.147-.56-.22-.917-.22c-.355 0-.662.073-.92.22a1.441 1.441 0 0 0-.589.627c-.136.271-.205.596-.205.975v.513c0 .375.069.7.205.973c.137.271.333.48.59.627c.257.144.564.216.92.216c.357 0 .662-.072.916-.216c.256-.147.452-.356.59-.627c.136-.274.204-.598.204-.973ZM0 11.926v4h1.459c.402 0 .735-.08.999-.238a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.59-.68c-.263-.156-.598-.234-1.004-.234H0Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.141 1.141 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082H.79V12.57Zm7.422.483a1.732 1.732 0 0 0-.103.633v.495c0 .246.034.455.103.627a.834.834 0 0 0 .298.393a.845.845 0 0 0 .478.131a.868.868 0 0 0 .401-.088a.699.699 0 0 0 .273-.248a.8.8 0 0 0 .117-.364h.765v.076a1.268 1.268 0 0 1-.226.674c-.137.194-.32.345-.55.454a1.81 1.81 0 0 1-.786.164c-.36 0-.664-.072-.914-.216a1.424 1.424 0 0 1-.571-.627c-.13-.272-.194-.597-.194-.976v-.498c0-.379.066-.705.197-.978c.13-.274.321-.485.571-.633c.252-.149.556-.223.911-.223c.219 0 .421.032.607.097c.187.062.35.153.489.272a1.326 1.326 0 0 1 .466.964v.073H9.78a.85.85 0 0 0-.12-.38a.7.7 0 0 0-.273-.261a.802.802 0 0 0-.398-.097a.814.814 0 0 0-.475.138a.868.868 0 0 0-.301.398Z"/></svg>', so = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-6.839 9.688v-.522a1.54 1.54 0 0 0-.117-.641a.861.861 0 0 0-.322-.387a.862.862 0 0 0-.469-.129a.868.868 0 0 0-.471.13a.868.868 0 0 0-.32.386a1.54 1.54 0 0 0-.117.641v.522c0 .256.04.47.117.641a.868.868 0 0 0 .32.387a.883.883 0 0 0 .471.126a.877.877 0 0 0 .469-.126a.861.861 0 0 0 .322-.386a1.55 1.55 0 0 0 .117-.642Zm.803-.516v.513c0 .375-.068.7-.205.973a1.47 1.47 0 0 1-.589.627c-.254.144-.56.216-.917.216a1.86 1.86 0 0 1-.92-.216a1.463 1.463 0 0 1-.589-.627a2.151 2.151 0 0 1-.205-.973v-.513c0-.379.069-.704.205-.975c.137-.274.333-.483.59-.627c.257-.147.564-.22.92-.22c.357 0 .662.073.916.22c.256.146.452.356.59.63c.136.271.204.595.204.972ZM1 15.925v-3.999h1.459c.406 0 .741.078 1.005.235c.264.156.46.382.589.68c.13.296.196.655.196 1.074c0 .422-.065.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-.999.237H1Zm1.354-3.354H1.79v2.707h.563c.185 0 .346-.028.483-.082a.8.8 0 0 0 .334-.252c.088-.114.153-.254.196-.422a2.3 2.3 0 0 0 .068-.592c0-.3-.04-.552-.118-.753a.89.89 0 0 0-.354-.454c-.158-.102-.361-.152-.61-.152Zm6.756 1.116c0-.248.034-.46.103-.633a.868.868 0 0 1 .301-.398a.814.814 0 0 1 .475-.138c.15 0 .283.032.398.097a.7.7 0 0 1 .273.26a.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964a1.44 1.44 0 0 0-.49-.272a1.836 1.836 0 0 0-.606-.097c-.355 0-.66.074-.911.223c-.25.148-.44.359-.571.633c-.131.273-.197.6-.197.978v.498c0 .379.065.704.194.976c.13.271.321.48.571.627c.25.144.555.216.914.216c.293 0 .555-.054.785-.164c.23-.11.414-.26.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364a.699.699 0 0 1-.273.248a.874.874 0 0 1-.401.088a.845.845 0 0 1-.478-.131a.834.834 0 0 1-.298-.393a1.7 1.7 0 0 1-.103-.627v-.495Zm5.092-1.76h.894l-1.275 2.006l1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015l-1.228-1.984h.932l.832 1.439h.035l.823-1.439Z"/></svg>';
1354
- var no = Object.defineProperty, io = Object.getOwnPropertyDescriptor, Se = (t, e, o, a) => {
1397
+ var no = Object.defineProperty, io = Object.getOwnPropertyDescriptor, Ae = (t, e, o, a) => {
1355
1398
  for (var r = a > 1 ? void 0 : a ? io(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1356
1399
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1357
1400
  return a && r && no(e, o, r), r;
@@ -1396,13 +1439,13 @@ let J = class extends C {
1396
1439
  }
1397
1440
  };
1398
1441
  J.styles = Yt;
1399
- Se([
1442
+ Ae([
1400
1443
  l({ type: String })
1401
1444
  ], J.prototype, "filename", 2);
1402
- Se([
1445
+ Ae([
1403
1446
  l({ type: String })
1404
1447
  ], J.prototype, "url", 2);
1405
- J = Se([
1448
+ J = Ae([
1406
1449
  k("cb-file")
1407
1450
  ], J);
1408
1451
  const lo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"/></g></svg>', co = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 8a3 3 0 1 0 0-6a3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0a2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1s1-4 6-4s6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664h10Z"/></svg>', po = x`
@@ -2571,7 +2614,7 @@ const lo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="curr
2571
2614
  background-color: #282c34;
2572
2615
  }
2573
2616
  `, ho = x`
2574
- ${O}
2617
+ ${I}
2575
2618
  ${po}
2576
2619
 
2577
2620
  .cb-message-row {
@@ -2727,21 +2770,21 @@ const lo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="curr
2727
2770
  }
2728
2771
  `;
2729
2772
  function uo() {
2730
- const t = new ut({
2773
+ const t = new gt({
2731
2774
  linkify: !0
2732
2775
  });
2733
- return t.use(gt, { attrs: { target: "_blank", rel: "noopener" } }), t;
2776
+ return t.use(bt, { attrs: { target: "_blank", rel: "noopener" } }), t;
2734
2777
  }
2735
2778
  async function ze(t) {
2736
2779
  const e = uo();
2737
- return c`${N(e.render(t))}`;
2780
+ return c`${q(e.render(t))}`;
2738
2781
  }
2739
- var go = Object.defineProperty, bo = Object.getOwnPropertyDescriptor, pe = (t, e, o, a) => {
2782
+ var go = Object.defineProperty, bo = Object.getOwnPropertyDescriptor, ue = (t, e, o, a) => {
2740
2783
  for (var r = a > 1 ? void 0 : a ? bo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2741
2784
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
2742
2785
  return a && r && go(e, o, r), r;
2743
2786
  };
2744
- let V = class extends C {
2787
+ let F = class extends C {
2745
2788
  constructor() {
2746
2789
  super(...arguments), this.type = "assistant";
2747
2790
  }
@@ -2785,12 +2828,12 @@ let V = class extends C {
2785
2828
  });
2786
2829
  }
2787
2830
  render() {
2788
- return R(
2831
+ return D(
2789
2832
  this.message.data || this.message.isThinking,
2790
2833
  () => c`
2791
2834
  <div class="cb-message-row" part="cb-message-row">
2792
2835
  <!-- message -->
2793
- ${R(
2836
+ ${D(
2794
2837
  this._isBot,
2795
2838
  () => this.renderBotMessage(this.message),
2796
2839
  () => this.renderUserMessage(this.message)
@@ -2827,7 +2870,7 @@ let V = class extends C {
2827
2870
  renderMessageContent(t) {
2828
2871
  var e;
2829
2872
  return t.isThinking ? c`<cb-thinking></cb-thinking>` : t.isUploading ? c`<cb-uploading .files="${t.data.files || []}"></cb-uploading>` : t.type === "text" ? c`<div class="cb-message-text">
2830
- ${R(
2873
+ ${D(
2831
2874
  t.data.userName,
2832
2875
  () => c`<div style="font-size: 12px; color:#9ca3af">${t.data.userName}</div>`,
2833
2876
  () => null
@@ -2835,7 +2878,7 @@ let V = class extends C {
2835
2878
  ${Ie(
2836
2879
  this._getMessageText(t).then((o) => c`${o}`)
2837
2880
  )}
2838
- </div>` : t.type === "file" ? c`${ye(
2881
+ </div>` : t.type === "file" ? c`${we(
2839
2882
  t.data.files || [],
2840
2883
  (o) => o.id,
2841
2884
  (o) => c`<cb-file filename="${o.name}" url="${o.url}"></cb-file>`
@@ -2850,7 +2893,7 @@ let V = class extends C {
2850
2893
  const e = t.data.userAvatar || "";
2851
2894
  return c` <img src="${e}" style="width: 24px;height: 24px;" /> `;
2852
2895
  }
2853
- return t.author === "system" ? He`${N(p.setting.systemIconSvg)}` : He`${N(p.setting.botIconSvg)}`;
2896
+ return t.author === "system" ? ve`${q(d.setting.systemIconSvg)}` : ve`${q(d.setting.botIconSvg)}`;
2854
2897
  }
2855
2898
  renderBotMessage(t) {
2856
2899
  return c`
@@ -2866,31 +2909,31 @@ let V = class extends C {
2866
2909
  <!--<sl-avatar class="avatar user-avatar small" label="User">
2867
2910
  <cb-icon slot="icon" svg="${co}" color="white"></cb-icon>
2868
2911
  </sl-avatar>-->
2869
- <div class="avatar user-avatar">${N(p.setting.userIconSvg)}</div>
2912
+ <div class="avatar user-avatar">${q(d.setting.userIconSvg)}</div>
2870
2913
  ${this.renderMessage(t)}
2871
2914
  </div>
2872
2915
  `;
2873
2916
  }
2874
2917
  };
2875
- V.styles = ho;
2876
- pe([
2918
+ F.styles = ho;
2919
+ ue([
2877
2920
  l({ type: Object })
2878
- ], V.prototype, "message", 2);
2879
- pe([
2921
+ ], F.prototype, "message", 2);
2922
+ ue([
2880
2923
  l({ type: String })
2881
- ], V.prototype, "type", 2);
2882
- pe([
2883
- ht(".code-block-header__copy")
2884
- ], V.prototype, "copyBtns", 2);
2885
- V = pe([
2924
+ ], F.prototype, "type", 2);
2925
+ ue([
2926
+ ut(".code-block-header__copy")
2927
+ ], F.prototype, "copyBtns", 2);
2928
+ F = ue([
2886
2929
  k("cb-message")
2887
- ], V);
2888
- var mo = Object.defineProperty, yo = Object.getOwnPropertyDescriptor, U = (t, e, o, a) => {
2930
+ ], F);
2931
+ var mo = Object.defineProperty, yo = Object.getOwnPropertyDescriptor, Z = (t, e, o, a) => {
2889
2932
  for (var r = a > 1 ? void 0 : a ? yo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2890
2933
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
2891
2934
  return a && r && mo(e, o, r), r;
2892
2935
  };
2893
- const Q = de.noConflict();
2936
+ const Q = he.noConflict();
2894
2937
  Q.setLevel("info");
2895
2938
  let z = class extends C {
2896
2939
  constructor() {
@@ -2899,7 +2942,7 @@ let z = class extends C {
2899
2942
  render() {
2900
2943
  return c`
2901
2944
  <div class="cb-message-list" part="cb-message-list">
2902
- ${ye(
2945
+ ${we(
2903
2946
  this.messages,
2904
2947
  (t) => t.id + JSON.stringify(t.data),
2905
2948
  (t) => c`<cb-message .message="${t}"></cb-message>`
@@ -2912,7 +2955,7 @@ let z = class extends C {
2912
2955
  renderActions() {
2913
2956
  return !Array.isArray(this.actions) || this.actions.length <= 0 ? null : c`
2914
2957
  <div class="cb-actions-list">
2915
- ${ye(
2958
+ ${we(
2916
2959
  this.actions,
2917
2960
  (t) => t,
2918
2961
  (t) => this.renderAction(t)
@@ -2936,7 +2979,7 @@ let z = class extends C {
2936
2979
  switch (Q.info("Got Calendly Event:", t.data), t.data.event) {
2937
2980
  case "calendly.event_scheduled": {
2938
2981
  const e = this.activeCalendlyAction;
2939
- e >= 0 && (p.removeAction(e), p.addSystemMessage("Your meeting has been scheduled!"), this.activeCalendlyAction = -1);
2982
+ e >= 0 && (d.removeAction(e), d.addSystemMessage("Your meeting has been scheduled!"), this.activeCalendlyAction = -1);
2940
2983
  }
2941
2984
  }
2942
2985
  }
@@ -2987,26 +3030,26 @@ let z = class extends C {
2987
3030
  }
2988
3031
  };
2989
3032
  z.styles = Ut;
2990
- U([
3033
+ Z([
2991
3034
  l({ type: Array })
2992
3035
  ], z.prototype, "messages", 2);
2993
- U([
3036
+ Z([
2994
3037
  l({ type: Array })
2995
3038
  ], z.prototype, "actions", 2);
2996
- U([
2997
- ce("#cb-message-list-bottom-anchor")
3039
+ Z([
3040
+ pe("#cb-message-list-bottom-anchor")
2998
3041
  ], z.prototype, "_messageListBottomAnchor", 2);
2999
- U([
3042
+ Z([
3000
3043
  qe({ capture: !1, passive: !0 })
3001
3044
  ], z.prototype, "invokeLinkAction", 1);
3002
- U([
3045
+ Z([
3003
3046
  qe({ capture: !1, passive: !0 })
3004
3047
  ], z.prototype, "invokeCalendlyAction", 1);
3005
- z = U([
3048
+ z = Z([
3006
3049
  k("cb-message-list")
3007
3050
  ], z);
3008
3051
  const fo = x`
3009
- ${O}
3052
+ ${I}
3010
3053
 
3011
3054
  :host {
3012
3055
  width: 100%;
@@ -3054,7 +3097,7 @@ var xo = Object.defineProperty, ko = Object.getOwnPropertyDescriptor, P = (t, e,
3054
3097
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3055
3098
  return a && r && xo(e, o, r), r;
3056
3099
  };
3057
- let A = class extends C {
3100
+ let O = class extends C {
3058
3101
  constructor() {
3059
3102
  super(...arguments), this.placeholder = "Type a message...", this.sendButtonLabel = "Send", this.enableFileUpload = !1, this.value = "", this.loading = !1, this.disabled = !1, this.currentKey = "";
3060
3103
  }
@@ -3072,7 +3115,9 @@ let A = class extends C {
3072
3115
  text: this.value
3073
3116
  }
3074
3117
  }
3075
- }), this.value = "", this.inputElement.blur();
3118
+ }), this.value = "", this.inputElement.blur(), requestIdleCallback(() => {
3119
+ this.inputElement.focus();
3120
+ });
3076
3121
  }
3077
3122
  async _sendFileHandler() {
3078
3123
  const t = await Ot();
@@ -3084,97 +3129,84 @@ let A = class extends C {
3084
3129
  }
3085
3130
  render() {
3086
3131
  return c`
3087
- <div class="cb-user-input-wrapper" part="user-input-wrapper">
3088
- <sl-textarea
3089
- @sl-input=${this._inputChangeHandler}
3090
- placeholder=${this.placeholder}
3091
- class="cb-user-input"
3092
- clearable="true"
3093
- value=${this.value}
3094
- rows="1"
3095
- resize="auto"
3096
- filled
3097
- ?disabled=${this.disabled}
3098
- enterkeyhint="send"
3099
- @keydown=${this._keyDownHandler}
3100
- ></sl-textarea>
3132
+ <div class="cb-user-input-wrapper" part="user-input-wrapper">
3133
+ <sl-textarea
3134
+ @sl-input=${this._inputChangeHandler}
3135
+ placeholder=${this.placeholder}
3136
+ class="cb-user-input"
3137
+ clearable="true"
3138
+ value=${this.value}
3139
+ rows="1"
3140
+ resize="auto"
3141
+ filled
3142
+ ?disabled=${this.disabled}
3143
+ enterkeyhint="send"
3144
+ @keydown=${this._keyDownHandler}
3145
+ ></sl-textarea>
3101
3146
 
3102
- <span class="cb-input-buttons">
3103
- ${R(
3147
+ <span class="cb-input-buttons">
3148
+ ${D(
3104
3149
  this.enableFileUpload,
3105
3150
  () => c`
3106
- <sl-button
3107
- @click=${this._sendFileHandler}
3108
- name="paperclip"
3109
- label="Attachment"
3110
- size="large"
3111
- class="paperclip-button"
3112
- variant="text"
3113
- circle
3114
- >
3115
- <cb-icon svg="${wo}"></cb-icon>
3116
- <!-- select file input -->
3117
- <input
3118
- type="file"
3119
- id="file"
3120
- name="file"
3121
- class="file-input"
3122
- />
3123
- </sl-button>
3124
- `,
3151
+ <sl-button @click=${this._sendFileHandler} name="paperclip" label="Attachment" size="large" class="paperclip-button" variant="text" circle>
3152
+ <cb-icon svg="${wo}"></cb-icon>
3153
+ <!-- select file input -->
3154
+ <input type="file" id="file" name="file" class="file-input" />
3155
+ </sl-button>
3156
+ `,
3125
3157
  () => c``
3126
3158
  )}
3127
- <sl-button
3128
- @click=${this._sendHandler}
3129
- name="send"
3130
- label="Send"
3131
- size="small"
3132
- class="send-button"
3133
- variant="text"
3134
- ?disabled=${this.value.length === 0}
3135
- ?loading=${this.loading}
3136
- circle
3137
- >
3138
- <cb-icon svg="${vo}"></cb-icon>
3139
- </sl-button>
3140
- </span>
3141
- </div>
3142
- `;
3159
+ <sl-button
3160
+ @click=${this._sendHandler}
3161
+ name="send"
3162
+ label="Send"
3163
+ size="small"
3164
+ class="send-button"
3165
+ variant="text"
3166
+ ?disabled=${this.value.length === 0}
3167
+ ?loading=${this.loading}
3168
+ circle
3169
+ >
3170
+ <cb-icon svg="${vo}"></cb-icon>
3171
+ </sl-button>
3172
+ </span>
3173
+ </div>
3174
+ `;
3143
3175
  }
3144
3176
  _keyDownHandler(t) {
3145
3177
  t.key === "Enter" && !t.shiftKey && this._sendHandler();
3146
3178
  }
3147
3179
  };
3148
- A.styles = fo;
3180
+ O.styles = fo;
3149
3181
  P([
3150
3182
  l({ type: String, attribute: "placeholder" })
3151
- ], A.prototype, "placeholder", 2);
3183
+ ], O.prototype, "placeholder", 2);
3152
3184
  P([
3153
3185
  l({ type: String, attribute: "send-button-label" })
3154
- ], A.prototype, "sendButtonLabel", 2);
3186
+ ], O.prototype, "sendButtonLabel", 2);
3155
3187
  P([
3156
3188
  l({ type: Boolean, attribute: "enable-file-upload" })
3157
- ], A.prototype, "enableFileUpload", 2);
3189
+ ], O.prototype, "enableFileUpload", 2);
3158
3190
  P([
3159
3191
  l({ type: String })
3160
- ], A.prototype, "value", 2);
3192
+ ], O.prototype, "value", 2);
3161
3193
  P([
3162
3194
  l({ type: Boolean })
3163
- ], A.prototype, "loading", 2);
3195
+ ], O.prototype, "loading", 2);
3164
3196
  P([
3165
3197
  l({ type: Boolean })
3166
- ], A.prototype, "disabled", 2);
3198
+ ], O.prototype, "disabled", 2);
3167
3199
  P([
3168
3200
  l({ type: String })
3169
- ], A.prototype, "currentKey", 2);
3201
+ ], O.prototype, "currentKey", 2);
3170
3202
  P([
3171
- ce("sl-textarea")
3172
- ], A.prototype, "inputElement", 2);
3173
- A = P([
3203
+ pe("sl-textarea")
3204
+ ], O.prototype, "inputElement", 2);
3205
+ O = P([
3174
3206
  k("cb-user-input")
3175
- ], A);
3207
+ ], O);
3176
3208
  const _o = x`
3177
- ${O}
3209
+ ${I}
3178
3210
 
3179
3211
  sl-dialog::part(base) {
3180
3212
  z-index: 1000;
@@ -3208,12 +3240,12 @@ const _o = x`
3208
3240
  gap: 8px;
3209
3241
  }
3210
3242
  `;
3211
- var Co = Object.defineProperty, $o = Object.getOwnPropertyDescriptor, he = (t, e, o, a) => {
3243
+ var Co = Object.defineProperty, $o = Object.getOwnPropertyDescriptor, ge = (t, e, o, a) => {
3212
3244
  for (var r = a > 1 ? void 0 : a ? $o(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3213
3245
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3214
3246
  return a && r && Co(e, o, r), r;
3215
3247
  };
3216
- let q = class extends C {
3248
+ let U = class extends C {
3217
3249
  constructor() {
3218
3250
  super(...arguments), this.open = !1, this.label = "Dialog", this.zindex = 100;
3219
3251
  }
@@ -3244,7 +3276,7 @@ let q = class extends C {
3244
3276
  <cb-icon
3245
3277
  color="default"
3246
3278
  style="font-size: 1em;"
3247
- svg="${je}"
3279
+ svg="${oe}"
3248
3280
  ></cb-icon>
3249
3281
  </sl-button>
3250
3282
  </header>
@@ -3257,25 +3289,25 @@ let q = class extends C {
3257
3289
  </sl-dialog>`;
3258
3290
  }
3259
3291
  };
3260
- q.styles = _o;
3261
- he([
3292
+ U.styles = _o;
3293
+ ge([
3262
3294
  l({ type: Boolean })
3263
- ], q.prototype, "open", 2);
3264
- he([
3295
+ ], U.prototype, "open", 2);
3296
+ ge([
3265
3297
  l({ type: String, attribute: "label" })
3266
- ], q.prototype, "label", 2);
3267
- he([
3298
+ ], U.prototype, "label", 2);
3299
+ ge([
3268
3300
  l({ type: Number })
3269
- ], q.prototype, "zindex", 2);
3270
- q = he([
3301
+ ], U.prototype, "zindex", 2);
3302
+ U = ge([
3271
3303
  k("cb-dialog")
3272
- ], q);
3273
- var jo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor, Ke = (t, e, o, a) => {
3304
+ ], U);
3305
+ var jo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor, Je = (t, e, o, a) => {
3274
3306
  for (var r = a > 1 ? void 0 : a ? Mo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3275
3307
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3276
3308
  return a && r && jo(e, o, r), r;
3277
3309
  };
3278
- let re = class extends C {
3310
+ let se = class extends C {
3279
3311
  constructor() {
3280
3312
  super(...arguments), this.open = !1;
3281
3313
  }
@@ -3309,7 +3341,7 @@ let re = class extends C {
3309
3341
  this.emit("cancel");
3310
3342
  }
3311
3343
  };
3312
- re.styles = x`
3344
+ se.styles = x`
3313
3345
  .cb-clear-message-dialog {
3314
3346
  }
3315
3347
 
@@ -3317,12 +3349,12 @@ re.styles = x`
3317
3349
  z-index: 1000;
3318
3350
  }
3319
3351
  `;
3320
- Ke([
3352
+ Je([
3321
3353
  l({ type: Boolean })
3322
- ], re.prototype, "open", 2);
3323
- re = Ke([
3354
+ ], se.prototype, "open", 2);
3355
+ se = Je([
3324
3356
  k("cb-clear-message-dialog")
3325
- ], re);
3357
+ ], se);
3326
3358
  const So = x`
3327
3359
  :host {
3328
3360
  // width: 380px;
@@ -3383,7 +3415,7 @@ const So = x`
3383
3415
  grid-column-start: 2;
3384
3416
  }
3385
3417
  `;
3386
- var Ao = Object.defineProperty, Oo = Object.getOwnPropertyDescriptor, Z = (t, e, o, a) => {
3418
+ var Ao = Object.defineProperty, Oo = Object.getOwnPropertyDescriptor, N = (t, e, o, a) => {
3387
3419
  for (var r = a > 1 ? void 0 : a ? Oo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3388
3420
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3389
3421
  return a && r && Ao(e, o, r), r;
@@ -3427,7 +3459,7 @@ let E = class extends C {
3427
3459
  Enable it for your own backend.
3428
3460
  </sl-switch>
3429
3461
  </div> -->
3430
- ${R(
3462
+ ${D(
3431
3463
  this.customRequest,
3432
3464
  () => null,
3433
3465
  () => this.renderInternalServices()
@@ -3552,26 +3584,26 @@ let E = class extends C {
3552
3584
  }
3553
3585
  };
3554
3586
  E.styles = So;
3555
- Z([
3587
+ N([
3556
3588
  l({ type: Boolean })
3557
3589
  ], E.prototype, "open", 2);
3558
- Z([
3590
+ N([
3559
3591
  l({ type: Object })
3560
3592
  ], E.prototype, "setting", 2);
3561
- Z([
3593
+ N([
3562
3594
  l({ type: Boolean })
3563
3595
  ], E.prototype, "clearMessageDialogOpen", 2);
3564
- Z([
3565
- ce("sl-dialog")
3596
+ N([
3597
+ pe("sl-dialog")
3566
3598
  ], E.prototype, "dialog", 2);
3567
- Z([
3599
+ N([
3568
3600
  l({ type: Boolean })
3569
3601
  ], E.prototype, "customRequest", 2);
3570
- E = Z([
3602
+ E = N([
3571
3603
  k("cb-setting")
3572
3604
  ], E);
3573
3605
  const Lo = x`
3574
- ${O}
3606
+ ${I}
3575
3607
  :host {
3576
3608
  --primary-color: var(--sl-color-primary-600);
3577
3609
 
@@ -3615,11 +3647,11 @@ const Lo = x`
3615
3647
  }
3616
3648
 
3617
3649
  .cb-engage-popup {
3618
- min-width: 200px;
3650
+ min-width: 250px;
3619
3651
  min-height: 100px;
3620
- color: rgb(34, 34, 34);
3652
+ color: var(--enegelai-bot-popup-color, rgb(0, 0, 0));
3621
3653
  padding: 10px;
3622
- background-color: var(--sl-color-gray-50);
3654
+ background: var(--enegelai-bot-popup-background, var(--sl-color-gray-50));
3623
3655
  //border: 1px solid;
3624
3656
  //border-color: var(--sl-color-gray-100);
3625
3657
  border-radius: 6px;
@@ -3632,22 +3664,40 @@ const Lo = x`
3632
3664
  font-stretch: normal;
3633
3665
  font-variant: normal;
3634
3666
  cursor: pointer;
3635
- box-shadow: rgba(148, 149, 150, 0.2) 20px 20px 40px 20px;
3636
- //box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
3667
+ //box-shadow: rgba(148, 149, 150, 0.4) 20px 20px 20px 20px;
3668
+ box-shadow:
3669
+ 0 4px 8px 0 rgba(0, 0, 0, 0.2),
3670
+ 0 6px 20px 0 rgba(0, 0, 0, 0.19);
3637
3671
  }
3638
3672
 
3639
3673
  .cb-anchor sl-popup {
3640
- --arrow-color: var(--sl-color-gray-300);
3674
+ --arrow-color: var(--sl-color-gray-500);
3675
+ }
3676
+
3677
+ .cb-engage-popup-close {
3678
+ position: absolute;
3679
+ top: 0;
3680
+ right: 0;
3681
+ margin: 6px;
3682
+ color: var(--enegelai-bot-popup-close-color, var(--sl-color-gray-400));
3683
+ }
3684
+
3685
+ .cb-engage-popup-content {
3686
+ padding: 2px;
3687
+ margin-top: 10px;
3688
+ display: flex;
3689
+ align-items: start;
3690
+ gap: 10px;
3641
3691
  }
3642
3692
  `, Ho = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M16 8c0 3.866-3.582 7-8 7a9.06 9.06 0 0 1-2.347-.306c-.584.296-1.925.864-4.181 1.234c-.2.032-.352-.176-.273-.362c.354-.836.674-1.95.77-2.966C.744 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7zM5 8a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm4 0a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm3 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2z"/></svg>';
3643
- var Io = Object.defineProperty, Po = Object.getOwnPropertyDescriptor, Je = (t, e, o, a) => {
3693
+ var Io = Object.defineProperty, Po = Object.getOwnPropertyDescriptor, Ye = (t, e, o, a) => {
3644
3694
  for (var r = a > 1 ? void 0 : a ? Po(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3645
3695
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3646
3696
  return a && r && Io(e, o, r), r;
3647
3697
  };
3648
- let ae = class extends C {
3698
+ let ne = class extends C {
3649
3699
  constructor() {
3650
- super(...arguments), this.open = !1;
3700
+ super(...arguments), this.store = new Fe(this, d), this.open = !1;
3651
3701
  }
3652
3702
  // handler click
3653
3703
  _clickHandler() {
@@ -3658,37 +3708,43 @@ let ae = class extends C {
3658
3708
  }
3659
3709
  }), this.open = t;
3660
3710
  }
3661
- _popupClickHandler() {
3662
- console.log("Popup clicked!");
3711
+ _engageClickHandler(t) {
3712
+ console.log("engage close clicked!"), d.engage = !1, t.stopPropagation();
3663
3713
  }
3664
3714
  render() {
3665
3715
  return c`
3666
3716
  <div class="cb-anchor ${this.open ? "open" : ""}" part="cb-anchor" @click=${this._clickHandler.bind(this)}>
3667
- <sl-popup placement="top-end" distance="16">
3717
+ <sl-popup placement="top-end" distance="16" ?active="${d.engage && !d.open}">
3668
3718
  <sl-button slot="anchor" label="Start" size="large" variant="primary" class="icon anchor-button" circle>
3669
- ${R(
3719
+ ${D(
3670
3720
  this.open,
3671
- () => c`<cb-icon color="white" svg="${je}"></cb-icon>`,
3721
+ () => c`<cb-icon color="white" svg="${oe}"></cb-icon>`,
3672
3722
  () => c`<cb-icon color="white" svg="${Ho}"></cb-icon>`
3673
3723
  )}
3674
3724
  </sl-button>
3675
- <div class="cb-engage-popup">Popup</div>
3725
+ <div class="cb-engage-popup">
3726
+ <div class="cb-engage-popup-close" @click=${this._engageClickHandler.bind(this)}>${ve`${q(oe)}`}</div>
3727
+ <div class="cb-engage-popup-content">
3728
+ <cb-icon svg="${d.setting.logoSvg}"></cb-icon>
3729
+ <div>${d.setting.engageMessage}</div>
3730
+ </div>
3731
+ </div>
3676
3732
  </sl-popup>
3677
3733
  </div>
3678
3734
  `;
3679
3735
  }
3680
3736
  };
3681
- ae.styles = Lo;
3682
- Je([
3737
+ ne.styles = Lo;
3738
+ Ye([
3683
3739
  l({ type: Boolean })
3684
- ], ae.prototype, "open", 2);
3685
- ae = Je([
3740
+ ], ne.prototype, "open", 2);
3741
+ ne = Ye([
3686
3742
  k("cb-anchor")
3687
- ], ae);
3743
+ ], ne);
3688
3744
  const zo = x`
3689
- ${O}
3690
- `, xe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M4.54.146A.5.5 0 0 1 4.893 0h6.214a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146zM5.1 1L1 5.1v5.8L5.1 15h5.8l4.1-4.1V5.1L10.9 1H5.1z"/><path d="M7.002 11a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/></g></svg>', Ye = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016a.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06a.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017a.163.163 0 0 1-.054-.06a.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/><path d="M7.002 12a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/></g></svg>', Ge = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764a.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0a5.5 5.5 0 1 1-11 0z"/><path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293L5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l7-7z"/></g></svg>', Xe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="m8.93 6.588l-2.29.287l-.082.38l.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319c.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246c-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0z"/></g></svg>';
3691
- var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, Qe = (t, e, o, a) => {
3745
+ ${I}
3746
+ `, Ce = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M4.54.146A.5.5 0 0 1 4.893 0h6.214a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146zM5.1 1L1 5.1v5.8L5.1 15h5.8l4.1-4.1V5.1L10.9 1H5.1z"/><path d="M7.002 11a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/></g></svg>', Ge = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016a.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06a.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017a.163.163 0 0 1-.054-.06a.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/><path d="M7.002 12a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/></g></svg>', Xe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764a.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0a5.5 5.5 0 1 1-11 0z"/><path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293L5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l7-7z"/></g></svg>', Qe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="m8.93 6.588l-2.29.287l-.082.38l.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319c.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246c-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0z"/></g></svg>';
3747
+ var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, et = (t, e, o, a) => {
3692
3748
  for (var r = a > 1 ? void 0 : a ? To(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3693
3749
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3694
3750
  return a && r && Eo(e, o, r), r;
@@ -3696,26 +3752,26 @@ var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, Qe = (t, e
3696
3752
  const Ee = {
3697
3753
  error: {
3698
3754
  variant: "danger",
3699
- icon: xe
3755
+ icon: Ce
3700
3756
  },
3701
3757
  danger: {
3702
3758
  variant: "danger",
3703
- icon: xe
3759
+ icon: Ce
3704
3760
  },
3705
3761
  warning: {
3706
3762
  variant: "warning",
3707
- icon: Ye
3763
+ icon: Ge
3708
3764
  },
3709
3765
  success: {
3710
3766
  variant: "success",
3711
- icon: Ge
3767
+ icon: Xe
3712
3768
  },
3713
3769
  info: {
3714
3770
  variant: "primary",
3715
- icon: Xe
3771
+ icon: Qe
3716
3772
  }
3717
3773
  };
3718
- let se = class extends C {
3774
+ let ie = class extends C {
3719
3775
  constructor() {
3720
3776
  super(...arguments), this.status = "info";
3721
3777
  }
@@ -3724,19 +3780,19 @@ let se = class extends C {
3724
3780
  return c`<cb-icon svg=${e} color="${t}"></cb-icon>`;
3725
3781
  }
3726
3782
  };
3727
- se.styles = Ze;
3728
- Qe([
3783
+ ie.styles = Ne;
3784
+ et([
3729
3785
  l({ type: String })
3730
- ], se.prototype, "status", 2);
3731
- se = Qe([
3786
+ ], ie.prototype, "status", 2);
3787
+ ie = et([
3732
3788
  k("cb-status-icon")
3733
- ], se);
3789
+ ], ie);
3734
3790
  var Bo = Object.defineProperty, Ro = Object.getOwnPropertyDescriptor, Vo = (t, e, o, a) => {
3735
3791
  for (var r = a > 1 ? void 0 : a ? Ro(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3736
3792
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3737
3793
  return a && r && Bo(e, o, r), r;
3738
3794
  };
3739
- let ke = class extends C {
3795
+ let $e = class extends C {
3740
3796
  render() {
3741
3797
  return c` <sl-alert variant="danger" open>
3742
3798
  <cb-status-icon status="error" slot="icon"></cb-status-icon>
@@ -3752,10 +3808,10 @@ let ke = class extends C {
3752
3808
  this.emit("setting:show");
3753
3809
  }
3754
3810
  };
3755
- ke.styles = zo;
3756
- ke = Vo([
3811
+ $e.styles = zo;
3812
+ $e = Vo([
3757
3813
  k("cb-auth-alert")
3758
- ], ke);
3814
+ ], $e);
3759
3815
  class Te extends Error {
3760
3816
  constructor(e, o, a) {
3761
3817
  const r = e.status || e.status === 0 ? e.status : "", s = e.statusText || "", n = `${r} ${s}`.trim(), i = n ? `status code ${n}` : "an unknown error";
@@ -3777,7 +3833,7 @@ class Te extends Error {
3777
3833
  }), this.name = "HTTPError", this.response = e, this.request = o, this.options = a;
3778
3834
  }
3779
3835
  }
3780
- class et extends Error {
3836
+ class tt extends Error {
3781
3837
  constructor(e) {
3782
3838
  super("Request timed out"), Object.defineProperty(this, "request", {
3783
3839
  enumerable: !0,
@@ -3791,21 +3847,21 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
3791
3847
  for (const e of t)
3792
3848
  if ((!ee(e) || Array.isArray(e)) && typeof e < "u")
3793
3849
  throw new TypeError("The `options` argument must be an object");
3794
- return Ae({}, ...t);
3795
- }, tt = (t = {}, e = {}) => {
3850
+ return Oe({}, ...t);
3851
+ }, ot = (t = {}, e = {}) => {
3796
3852
  const o = new globalThis.Headers(t), a = e instanceof globalThis.Headers, r = new globalThis.Headers(e);
3797
3853
  for (const [s, n] of r.entries())
3798
3854
  a && n === "undefined" || n === void 0 ? o.delete(s) : o.set(s, n);
3799
3855
  return o;
3800
- }, Ae = (...t) => {
3856
+ }, Oe = (...t) => {
3801
3857
  let e = {}, o = {};
3802
3858
  for (const a of t)
3803
3859
  if (Array.isArray(a))
3804
3860
  Array.isArray(e) || (e = []), e = [...e, ...a];
3805
3861
  else if (ee(a)) {
3806
3862
  for (let [r, s] of Object.entries(a))
3807
- ee(s) && r in e && (s = Ae(e[r], s)), e = { ...e, [r]: s };
3808
- ee(a.headers) && (o = tt(o, a.headers), e.headers = o);
3863
+ ee(s) && r in e && (s = Oe(e[r], s)), e = { ...e, [r]: s };
3864
+ ee(a.headers) && (o = ot(o, a.headers), e.headers = o);
3809
3865
  }
3810
3866
  return e;
3811
3867
  }, qo = (() => {
@@ -3819,17 +3875,17 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
3819
3875
  return t = !0, "half";
3820
3876
  }
3821
3877
  }).headers.has("Content-Type")), t && !e;
3822
- })(), Do = typeof globalThis.AbortController == "function", Fo = typeof globalThis.ReadableStream == "function", Uo = typeof globalThis.FormData == "function", ot = ["get", "post", "put", "patch", "head", "delete"], Zo = {
3878
+ })(), Do = typeof globalThis.AbortController == "function", Fo = typeof globalThis.ReadableStream == "function", Uo = typeof globalThis.FormData == "function", rt = ["get", "post", "put", "patch", "head", "delete"], Zo = {
3823
3879
  json: "application/json",
3824
3880
  text: "text/*",
3825
3881
  formData: "multipart/form-data",
3826
3882
  arrayBuffer: "*/*",
3827
3883
  blob: "*/*"
3828
- }, me = 2147483647, rt = Symbol("stop"), No = (t) => ot.includes(t) ? t.toUpperCase() : t, Wo = ["get", "put", "head", "delete", "options", "trace"], Ko = [408, 413, 429, 500, 502, 503, 504], at = [413, 429, 503], Be = {
3884
+ }, fe = 2147483647, at = Symbol("stop"), No = (t) => rt.includes(t) ? t.toUpperCase() : t, Wo = ["get", "put", "head", "delete", "options", "trace"], Ko = [408, 413, 429, 500, 502, 503, 504], st = [413, 429, 503], Be = {
3829
3885
  limit: 2,
3830
3886
  methods: Wo,
3831
3887
  statusCodes: Ko,
3832
- afterStatusCodes: at,
3888
+ afterStatusCodes: st,
3833
3889
  maxRetryAfter: Number.POSITIVE_INFINITY,
3834
3890
  backoffLimit: Number.POSITIVE_INFINITY
3835
3891
  }, Jo = (t = {}) => {
@@ -3845,13 +3901,13 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
3845
3901
  return {
3846
3902
  ...Be,
3847
3903
  ...t,
3848
- afterStatusCodes: at
3904
+ afterStatusCodes: st
3849
3905
  };
3850
3906
  };
3851
3907
  async function Yo(t, e, o) {
3852
3908
  return new Promise((a, r) => {
3853
3909
  const s = setTimeout(() => {
3854
- e && e.abort(), r(new et(t));
3910
+ e && e.abort(), r(new tt(t));
3855
3911
  }, o.timeout);
3856
3912
  o.fetch(t).then(a).catch(r).then(() => {
3857
3913
  clearTimeout(s);
@@ -3882,12 +3938,12 @@ async function Xo(t, { signal: e }) {
3882
3938
  }, t);
3883
3939
  });
3884
3940
  }
3885
- class ne {
3941
+ class le {
3886
3942
  // eslint-disable-next-line @typescript-eslint/promise-function-async
3887
3943
  static create(e, o) {
3888
- const a = new ne(e, o), r = async () => {
3889
- if (a._options.timeout > me)
3890
- throw new RangeError(`The \`timeout\` option cannot be greater than ${me}`);
3944
+ const a = new le(e, o), r = async () => {
3945
+ if (a._options.timeout > fe)
3946
+ throw new RangeError(`The \`timeout\` option cannot be greater than ${fe}`);
3891
3947
  await Promise.resolve();
3892
3948
  let i = await a._fetch();
3893
3949
  for (const g of a._options.hooks.afterResponse) {
@@ -3954,8 +4010,8 @@ class ne {
3954
4010
  // TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
3955
4011
  credentials: this._input.credentials || "same-origin",
3956
4012
  ...o,
3957
- headers: tt(this._input.headers, o.headers),
3958
- hooks: Ae({
4013
+ headers: ot(this._input.headers, o.headers),
4014
+ hooks: Oe({
3959
4015
  beforeRequest: [],
3960
4016
  beforeRetry: [],
3961
4017
  beforeError: [],
@@ -3991,7 +4047,7 @@ class ne {
3991
4047
  this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
3992
4048
  }
3993
4049
  _calculateRetryDelay(e) {
3994
- if (this._retryCount++, this._retryCount < this._options.retry.limit && !(e instanceof et)) {
4050
+ if (this._retryCount++, this._retryCount < this._options.retry.limit && !(e instanceof tt)) {
3995
4051
  if (e instanceof Te) {
3996
4052
  if (!this._options.retry.statusCodes.includes(e.response.status))
3997
4053
  return 0;
@@ -4015,7 +4071,7 @@ class ne {
4015
4071
  try {
4016
4072
  return await e();
4017
4073
  } catch (o) {
4018
- const a = Math.min(this._calculateRetryDelay(o), me);
4074
+ const a = Math.min(this._calculateRetryDelay(o), fe);
4019
4075
  if (a !== 0 && this._retryCount > 0) {
4020
4076
  await Xo(a, { signal: this._options.signal });
4021
4077
  for (const r of this._options.hooks.beforeRetry)
@@ -4024,7 +4080,7 @@ class ne {
4024
4080
  options: this._options,
4025
4081
  error: o,
4026
4082
  retryCount: this._retryCount
4027
- }) === rt)
4083
+ }) === at)
4028
4084
  return;
4029
4085
  return this._retry(e);
4030
4086
  }
@@ -4078,12 +4134,12 @@ class ne {
4078
4134
  }
4079
4135
  }
4080
4136
  /*! MIT License © Sindre Sorhus */
4081
- const _e = (t) => {
4082
- const e = (o, a) => ne.create(o, G(t, a));
4083
- for (const o of ot)
4084
- e[o] = (a, r) => ne.create(a, G(t, r, { method: o }));
4085
- return e.create = (o) => _e(G(o)), e.extend = (o) => _e(G(t, o)), e.stop = rt, e;
4086
- }, Qo = _e(), er = Qo, st = er.extend({
4137
+ const je = (t) => {
4138
+ const e = (o, a) => le.create(o, G(t, a));
4139
+ for (const o of rt)
4140
+ e[o] = (a, r) => le.create(a, G(t, r, { method: o }));
4141
+ return e.create = (o) => je(G(o)), e.extend = (o) => je(G(t, o)), e.stop = at, e;
4142
+ }, Qo = je(), er = Qo, nt = er.extend({
4087
4143
  hooks: {
4088
4144
  beforeRequest: [
4089
4145
  () => {
@@ -4116,7 +4172,7 @@ async function or(t, e) {
4116
4172
  const o = new FormData();
4117
4173
  for (let r = 0; r < e.length; r++)
4118
4174
  o.append("files", e[r]);
4119
- const a = await st.post(t, {
4175
+ const a = await nt.post(t, {
4120
4176
  body: o
4121
4177
  });
4122
4178
  try {
@@ -4132,19 +4188,19 @@ async function or(t, e) {
4132
4188
  const Ve = {
4133
4189
  error: {
4134
4190
  variant: "danger",
4135
- icon: xe
4191
+ icon: Ce
4136
4192
  },
4137
4193
  warning: {
4138
4194
  variant: "warning",
4139
- icon: Ye
4195
+ icon: Ge
4140
4196
  },
4141
4197
  success: {
4142
4198
  variant: "success",
4143
- icon: Ge
4199
+ icon: Xe
4144
4200
  },
4145
4201
  info: {
4146
4202
  variant: "primary",
4147
- icon: Xe
4203
+ icon: Qe
4148
4204
  }
4149
4205
  };
4150
4206
  function rr(t) {
@@ -4195,7 +4251,7 @@ async function nr(t) {
4195
4251
  throw new Error("apiKey is required");
4196
4252
  const e = t.options ?? {};
4197
4253
  e.model || (e.model = "gpt-3.5-turbo");
4198
- const o = await st.post(t.url, {
4254
+ const o = await nt.post(t.url, {
4199
4255
  json: {
4200
4256
  messages: t.messages,
4201
4257
  ...t.options ?? {}
@@ -4220,11 +4276,11 @@ var ir = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, v = (t, e,
4220
4276
  (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
4221
4277
  return a && r && ir(e, o, r), r;
4222
4278
  };
4223
- const Ce = de.noConflict();
4224
- Ce.setLevel("info");
4279
+ const te = he.noConflict();
4280
+ te.setLevel("info");
4225
4281
  let b = class extends C {
4226
4282
  constructor() {
4227
- super(...arguments), this.store = new mt(this, p), this.displayLicense = !1, this.name = "ChatBot", this.orgId = "", this.botId = "", this.url = "ws://localhost:3070", this.welcomeMessage = "Hello! How can I help you today ?", this.logoSvg = ` <svg width="24" height="24" viewBox="0 0 40 40">
4283
+ super(...arguments), this.store = new Fe(this, d), this.displayLicense = !1, this.name = "ChatBot", this.orgId = "", this.botId = "", this.url = "ws://localhost:3070", this.logoSvg = ` <svg width="24" height="24" viewBox="0 0 40 40">
4228
4284
  <path
4229
4285
  d="M34.728 0.275L2.245 15.267c-3.748 1.749 -2.498 7.246 1.499 7.246h13.743v13.743c0 3.998 5.497 5.248 7.246 1.499l14.992 -32.483c1.249 -2.999 -1.999 -6.248 -4.998 -4.998z"
4230
4286
  fill="#E24D42"
@@ -4246,7 +4302,7 @@ let b = class extends C {
4246
4302
  isThinking: !0,
4247
4303
  data: {}
4248
4304
  };
4249
- return p.addMessage(t), t;
4305
+ return d.addMessage(t), t;
4250
4306
  }
4251
4307
  addTestMessage() {
4252
4308
  const t = {
@@ -4257,28 +4313,28 @@ let b = class extends C {
4257
4313
  text: "Long text.The element may not be scrolled completely to the top or bottom depending on the layout of other elements.The element may not be scrolled completely to the top or bottom depending on the layout of other elements."
4258
4314
  }
4259
4315
  };
4260
- return p.addMessage(t), t;
4316
+ return d.addMessage(t), t;
4261
4317
  }
4262
4318
  render() {
4263
4319
  return c`
4264
- <div class="cb-wrapper" style="${this.open ? "display:flex" : "display:none"}">
4320
+ <div class="cb-wrapper" style="${d.open ? "display:flex" : "display:none"}">
4265
4321
  <cb-header title="${this.name}"></cb-header>
4266
- <cb-message-list .messages=${p.messages} .actions=${p.actions}></cb-message-list>
4322
+ <cb-message-list .messages=${d.messages} .actions=${d.actions}></cb-message-list>
4267
4323
  <cb-user-input ?loading=${this.loading} ?disabled=${this.loading || this.showAuthAlert} ?enable-file-upload=${this.enableFileUpload}></cb-user-input>
4268
4324
  </div>
4269
- <cb-anchor ?open=${this.open}></cb-anchor>
4325
+ <cb-anchor ?open=${d.open}></cb-anchor>
4270
4326
  `;
4271
4327
  }
4272
4328
  connectedCallback() {
4273
- super.connectedCallback(), Ce.info("connectedCallback"), addEventListener("setting:show", () => {
4329
+ super.connectedCallback(), te.info("connectedCallback"), addEventListener("setting:show", () => {
4274
4330
  this.showSetting = !0;
4275
4331
  }), addEventListener("message:send", this._addMessageHandler.bind(this)), addEventListener("message:remove", this._deleteMessageHandler.bind(this)), addEventListener("setting:confirm", this._settingConfirmHandler.bind(this)), addEventListener("setting:hide", () => {
4276
4332
  this.showSetting = !1;
4277
4333
  }), addEventListener("chatbot:toggle", (t) => {
4278
4334
  const e = t.detail;
4279
- this.open = e.open;
4335
+ d.open = e.open, d.engage = !1;
4280
4336
  }), addEventListener("message:clear", () => {
4281
- p.clearMessages();
4337
+ d.clearMessages();
4282
4338
  }), addEventListener("message:send:file", this._sendFileHandler.bind(this)), addEventListener("setting:show", () => {
4283
4339
  this.showSetting = !0;
4284
4340
  });
@@ -4287,20 +4343,20 @@ let b = class extends C {
4287
4343
  // Use to initialize
4288
4344
  // This is also called when state changes - ??? - i.e. when message added to the array
4289
4345
  updated(t) {
4290
- super.updated(t), t.size > 0 && (Ce.info("updated,_changedProperties:", t), this._initSetting()), setTimeout(() => {
4346
+ super.updated(t), te.info("updated,_changedProperties:", t), t.size > 0 && (te.info("updated,_changedProperties:", t), this._initSetting()), setTimeout(() => {
4291
4347
  this._scrollToBottom();
4292
4348
  }, 0);
4293
4349
  }
4294
4350
  // initialize setting
4295
4351
  _initSetting() {
4296
- const t = p.setting;
4297
- t.orgId = this.orgId, t.botId = this.botId, t.url = this.url, t.welcomeMessage = this.welcomeMessage, t.logoSvg = this.logoSvg, t.botIconSvg = this.botIconSvg, t.userIconSvg = this.userIconSvg, t.systemIconSvg = this.systemIconSvg, p.setSetting(t);
4352
+ const t = d.setting;
4353
+ t.orgId = this.orgId, t.botId = this.botId, t.url = this.url, t.logoSvg = this.logoSvg, t.botIconSvg = this.botIconSvg, t.userIconSvg = this.userIconSvg, t.systemIconSvg = this.systemIconSvg, d.setSetting(t);
4298
4354
  }
4299
4355
  setLoading(t) {
4300
4356
  this.loading = t;
4301
4357
  }
4302
4358
  clearConversation() {
4303
- p.clearConversation();
4359
+ d.clearConversation();
4304
4360
  }
4305
4361
  // check auth
4306
4362
  _checkAuth() {
@@ -4308,13 +4364,13 @@ let b = class extends C {
4308
4364
  // TODO Remove
4309
4365
  async _sendToOpenai(t, e) {
4310
4366
  let o = "";
4311
- const a = p.setting.openai.apiBase || "https://api.openai.com/v1", r = await nr({
4367
+ const a = d.setting.openai.apiBase || "https://api.openai.com/v1", r = await nr({
4312
4368
  url: `${a}/chat/completions`,
4313
- apiKey: p.setting.openai.apiKey,
4369
+ apiKey: d.setting.openai.apiKey,
4314
4370
  messages: e,
4315
4371
  options: {
4316
- stream: p.setting.stream,
4317
- model: p.setting.openai.model
4372
+ stream: d.setting.stream,
4373
+ model: d.setting.openai.model
4318
4374
  // temperature: 0.9,
4319
4375
  },
4320
4376
  onMessage: (s, n) => {
@@ -4324,11 +4380,11 @@ let b = class extends C {
4324
4380
  return;
4325
4381
  }
4326
4382
  n && ((i = n.choices[0].delta) != null && i.content) && requestIdleCallback(() => {
4327
- o += n.choices[0].delta.content, p.updateMessage(t, o);
4383
+ o += n.choices[0].delta.content, d.updateMessage(t, o);
4328
4384
  });
4329
4385
  }
4330
4386
  });
4331
- !p.setting.stream && r && p.updateMessage(t, r.choices[0].message.content);
4387
+ !d.setting.stream && r && d.updateMessage(t, r.choices[0].message.content);
4332
4388
  }
4333
4389
  // TODO Remove
4334
4390
  async _sendHandler(t) {
@@ -4339,7 +4395,7 @@ let b = class extends C {
4339
4395
  isThinking: !0,
4340
4396
  data: {}
4341
4397
  };
4342
- if (p.addMessage(e), this.customRequest)
4398
+ if (d.addMessage(e), this.customRequest)
4343
4399
  await this.emit("chatbot:send", {
4344
4400
  detail: {
4345
4401
  newMessage: e,
@@ -4358,11 +4414,11 @@ let b = class extends C {
4358
4414
  }
4359
4415
  _addMessageHandler(t) {
4360
4416
  const e = t.detail;
4361
- p.sendMessage(e);
4417
+ d.sendMessage(e);
4362
4418
  }
4363
4419
  _deleteMessageHandler(t) {
4364
4420
  const e = t.detail;
4365
- p.removeMessage(e.id);
4421
+ d.removeMessage(e.id);
4366
4422
  }
4367
4423
  async _sendFileHandler(t) {
4368
4424
  const e = t.detail, a = {
@@ -4379,11 +4435,11 @@ let b = class extends C {
4379
4435
  }))
4380
4436
  }
4381
4437
  };
4382
- if (p.addMessage(a), this.uploadFileUrl) {
4438
+ if (d.addMessage(a), this.uploadFileUrl) {
4383
4439
  const r = await or(this.uploadFileUrl, e.files);
4384
4440
  r.code === 0 && r.data && (a.isUploading = !1, a.data = {
4385
4441
  files: r.data
4386
- }, p.updateMessage(a));
4442
+ }, d.updateMessage(a));
4387
4443
  }
4388
4444
  this.emit("chatbot:file:send", {
4389
4445
  detail: {
@@ -4395,12 +4451,12 @@ let b = class extends C {
4395
4451
  // setting confirm handler
4396
4452
  _settingConfirmHandler(t) {
4397
4453
  const e = t.detail;
4398
- p.setSetting(e.setting), this.showSetting = !1, this._checkAuth();
4454
+ d.setSetting(e.setting), this.showSetting = !1, this._checkAuth();
4399
4455
  }
4400
4456
  // scroll to bottom
4401
4457
  _scrollToBottom(t = !1) {
4402
4458
  var e;
4403
- (e = this._messageList) == null || e.scrollToBottom();
4459
+ console.log("Scrolling to bottom ..."), (e = this._messageList) == null || e.scrollToBottom();
4404
4460
  }
4405
4461
  };
4406
4462
  b.styles = kt;
@@ -4419,9 +4475,6 @@ v([
4419
4475
  v([
4420
4476
  l({ type: String, attribute: "url" })
4421
4477
  ], b.prototype, "url", 2);
4422
- v([
4423
- l({ type: String, attribute: "welcome-message" })
4424
- ], b.prototype, "welcomeMessage", 2);
4425
4478
  v([
4426
4479
  l({ type: String, attribute: "logo-svg" })
4427
4480
  ], b.prototype, "logoSvg", 2);
@@ -4459,7 +4512,7 @@ v([
4459
4512
  l({ type: Boolean })
4460
4513
  ], b.prototype, "showAuthAlert", 2);
4461
4514
  v([
4462
- ce("cb-message-list")
4515
+ pe("cb-message-list")
4463
4516
  ], b.prototype, "_messageList", 2);
4464
4517
  b = v([
4465
4518
  k("enegelai-bot")