@iai-lib/any-chat-widget 0.1.0-alpha.15 → 0.1.0-alpha.17

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.
@@ -2,7 +2,7 @@ var ai = (s, e, t) => {
2
2
  if (!e.has(s))
3
3
  throw TypeError("Cannot " + t);
4
4
  };
5
- var zt = (s, e, t) => (ai(s, e, "read from private field"), t ? t.call(s) : e.get(s)), Cs = (s, e, t) => {
5
+ var zt = (s, e, t) => (ai(s, e, "read from private field"), t ? t.call(s) : e.get(s)), $s = (s, e, t) => {
6
6
  if (e.has(s))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
8
  e instanceof WeakSet ? e.add(s) : e.set(s, t);
@@ -12,10 +12,10 @@ var zt = (s, e, t) => (ai(s, e, "read from private field"), t ? t.call(s) : e.ge
12
12
  * Copyright 2019 Google LLC
13
13
  * SPDX-License-Identifier: BSD-3-Clause
14
14
  */
15
- const Ut = globalThis, Zs = Ut.ShadowRoot && (Ut.ShadyCSS === void 0 || Ut.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ls = Symbol(), oi = /* @__PURE__ */ new WeakMap();
15
+ const Ut = globalThis, Zs = Ut.ShadowRoot && (Ut.ShadyCSS === void 0 || Ut.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ds = Symbol(), oi = /* @__PURE__ */ new WeakMap();
16
16
  let Ii = class {
17
17
  constructor(s, e, t) {
18
- if (this._$cssResult$ = !0, t !== Ls)
18
+ if (this._$cssResult$ = !0, t !== Ds)
19
19
  throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
20
20
  this.cssText = s, this.t = e;
21
21
  }
@@ -32,7 +32,7 @@ let Ii = class {
32
32
  return this.cssText;
33
33
  }
34
34
  };
35
- const gn = (s) => new Ii(typeof s == "string" ? s : s + "", void 0, Ls), ot = (s, ...e) => {
35
+ const gn = (s) => new Ii(typeof s == "string" ? s : s + "", void 0, Ds), ot = (s, ...e) => {
36
36
  const t = s.length === 1 ? s[0] : e.reduce((i, n, r) => i + ((a) => {
37
37
  if (a._$cssResult$ === !0)
38
38
  return a.cssText;
@@ -40,7 +40,7 @@ const gn = (s) => new Ii(typeof s == "string" ? s : s + "", void 0, Ls), ot = (s
40
40
  return a;
41
41
  throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
42
42
  })(n) + s[r + 1], s[0]);
43
- return new Ii(t, s, Ls);
43
+ return new Ii(t, s, Ds);
44
44
  }, yn = (s, e) => {
45
45
  if (Zs)
46
46
  s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
@@ -60,10 +60,10 @@ const gn = (s) => new Ii(typeof s == "string" ? s : s + "", void 0, Ls), ot = (s
60
60
  * Copyright 2017 Google LLC
61
61
  * SPDX-License-Identifier: BSD-3-Clause
62
62
  */
63
- const { is: vn, defineProperty: bn, getOwnPropertyDescriptor: wn, getOwnPropertyNames: _n, getOwnPropertySymbols: xn, getPrototypeOf: kn } = Object, it = globalThis, di = it.trustedTypes, Sn = di ? di.emptyScript : "", li = it.reactiveElementPolyfillSupport, pt = (s, e) => s, Ft = { toAttribute(s, e) {
63
+ const { is: vn, defineProperty: bn, getOwnPropertyDescriptor: wn, getOwnPropertyNames: _n, getOwnPropertySymbols: xn, getPrototypeOf: kn } = Object, it = globalThis, di = it.trustedTypes, En = di ? di.emptyScript : "", li = it.reactiveElementPolyfillSupport, pt = (s, e) => s, Wt = { toAttribute(s, e) {
64
64
  switch (e) {
65
65
  case Boolean:
66
- s = s ? Sn : null;
66
+ s = s ? En : null;
67
67
  break;
68
68
  case Object:
69
69
  case Array:
@@ -88,7 +88,7 @@ const { is: vn, defineProperty: bn, getOwnPropertyDescriptor: wn, getOwnProperty
88
88
  }
89
89
  }
90
90
  return t;
91
- } }, Ds = (s, e) => !vn(s, e), ui = { attribute: !0, type: String, converter: Ft, reflect: !1, hasChanged: Ds };
91
+ } }, Ls = (s, e) => !vn(s, e), ui = { attribute: !0, type: String, converter: Wt, reflect: !1, hasChanged: Ls };
92
92
  Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), it.litPropertyMetadata ?? (it.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
93
93
  class Qe extends HTMLElement {
94
94
  static addInitializer(e) {
@@ -209,7 +209,7 @@ class Qe extends HTMLElement {
209
209
  var i;
210
210
  const n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
211
211
  if (r !== void 0 && n.reflect === !0) {
212
- const a = (((i = n.converter) == null ? void 0 : i.toAttribute) !== void 0 ? n.converter : Ft).toAttribute(t, n.type);
212
+ const a = (((i = n.converter) == null ? void 0 : i.toAttribute) !== void 0 ? n.converter : Wt).toAttribute(t, n.type);
213
213
  this._$Em = e, a == null ? this.removeAttribute(r) : this.setAttribute(r, a), this._$Em = null;
214
214
  }
215
215
  }
@@ -217,13 +217,13 @@ class Qe extends HTMLElement {
217
217
  var i;
218
218
  const n = this.constructor, r = n._$Eh.get(e);
219
219
  if (r !== void 0 && this._$Em !== r) {
220
- const a = n.getPropertyOptions(r), o = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((i = a.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? a.converter : Ft;
220
+ const a = n.getPropertyOptions(r), o = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((i = a.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? a.converter : Wt;
221
221
  this._$Em = r, this[r] = o.fromAttribute(t, a.type), this._$Em = null;
222
222
  }
223
223
  }
224
224
  requestUpdate(e, t, i) {
225
225
  if (e !== void 0) {
226
- if (i ?? (i = this.constructor.getPropertyOptions(e)), !(i.hasChanged ?? Ds)(this[e], t))
226
+ if (i ?? (i = this.constructor.getPropertyOptions(e)), !(i.hasChanged ?? Ls)(this[e], t))
227
227
  return;
228
228
  this.P(e, t, i);
229
229
  }
@@ -307,9 +307,9 @@ Qe.elementStyles = [], Qe.shadowRootOptions = { mode: "open" }, Qe[pt("elementPr
307
307
  * Copyright 2017 Google LLC
308
308
  * SPDX-License-Identifier: BSD-3-Clause
309
309
  */
310
- const Vt = globalThis, Wt = Vt.trustedTypes, hi = Wt ? Wt.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, zs = "$lit$", we = `lit$${(Math.random() + "").slice(9)}$`, Us = "?" + we, Tn = `<${Us}>`, Fe = document, vt = () => Fe.createComment(""), bt = (s) => s === null || typeof s != "object" && typeof s != "function", Mi = Array.isArray, Ni = (s) => Mi(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", As = `[
310
+ const Ft = globalThis, Vt = Ft.trustedTypes, hi = Vt ? Vt.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, zs = "$lit$", we = `lit$${(Math.random() + "").slice(9)}$`, Us = "?" + we, Tn = `<${Us}>`, We = document, vt = () => We.createComment(""), bt = (s) => s === null || typeof s != "object" && typeof s != "function", Mi = Array.isArray, Ni = (s) => Mi(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", As = `[
311
311
  \f\r]`, ut = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, pi = /-->/g, mi = />/g, Ze = RegExp(`>|${As}(?:([^\\s"'>=/]+)(${As}*=${As}*(?:[^
312
- \f\r"'\`<>=]|("|')|))|$)`, "g"), fi = /'/g, gi = /"/g, Pi = /^(?:script|style|textarea|title)$/i, $n = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), L = $n(1), le = Symbol.for("lit-noChange"), B = Symbol.for("lit-nothing"), yi = /* @__PURE__ */ new WeakMap(), ze = Fe.createTreeWalker(Fe, 129);
312
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), fi = /'/g, gi = /"/g, Pi = /^(?:script|style|textarea|title)$/i, Sn = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), D = Sn(1), le = Symbol.for("lit-noChange"), B = Symbol.for("lit-nothing"), yi = /* @__PURE__ */ new WeakMap(), ze = We.createTreeWalker(We, 129);
313
313
  function ji(s, e) {
314
314
  if (!Array.isArray(s) || !s.hasOwnProperty("raw"))
315
315
  throw Error("invalid template strings array");
@@ -323,8 +323,8 @@ const Ri = (s, e) => {
323
323
  let l, h, p = -1, d = 0;
324
324
  for (; d < c.length && (a.lastIndex = d, h = a.exec(c), h !== null); )
325
325
  d = a.lastIndex, a === ut ? h[1] === "!--" ? a = pi : h[1] !== void 0 ? a = mi : h[2] !== void 0 ? (Pi.test(h[2]) && (n = RegExp("</" + h[2], "g")), a = Ze) : h[3] !== void 0 && (a = Ze) : a === Ze ? h[0] === ">" ? (a = n ?? ut, p = -1) : h[1] === void 0 ? p = -2 : (p = a.lastIndex - h[2].length, l = h[1], a = h[3] === void 0 ? Ze : h[3] === '"' ? gi : fi) : a === gi || a === fi ? a = Ze : a === pi || a === mi ? a = ut : (a = Ze, n = void 0);
326
- const b = a === Ze && s[o + 1].startsWith("/>") ? " " : "";
327
- r += a === ut ? c + Tn : p >= 0 ? (i.push(l), c.slice(0, p) + zs + c.slice(p) + we + b) : c + we + (p === -2 ? o : b);
326
+ const w = a === Ze && s[o + 1].startsWith("/>") ? " " : "";
327
+ r += a === ut ? c + Tn : p >= 0 ? (i.push(l), c.slice(0, p) + zs + c.slice(p) + we + w) : c + we + (p === -2 ? o : w);
328
328
  }
329
329
  return [ji(s, r + (s[t] || "<?>") + (e === 2 ? "</svg>" : "")), i];
330
330
  };
@@ -343,16 +343,16 @@ class wt {
343
343
  if (n.hasAttributes())
344
344
  for (const p of n.getAttributeNames())
345
345
  if (p.endsWith(zs)) {
346
- const d = h[a++], b = n.getAttribute(p).split(we), N = /([.?@])?(.*)/.exec(d);
347
- c.push({ type: 1, index: r, name: N[2], strings: b, ctor: N[1] === "." ? Li : N[1] === "?" ? Di : N[1] === "@" ? zi : jt }), n.removeAttribute(p);
346
+ const d = h[a++], w = n.getAttribute(p).split(we), N = /([.?@])?(.*)/.exec(d);
347
+ c.push({ type: 1, index: r, name: N[2], strings: w, ctor: N[1] === "." ? Di : N[1] === "?" ? Li : N[1] === "@" ? zi : jt }), n.removeAttribute(p);
348
348
  } else
349
349
  p.startsWith(we) && (c.push({ type: 6, index: r }), n.removeAttribute(p));
350
350
  if (Pi.test(n.tagName)) {
351
351
  const p = n.textContent.split(we), d = p.length - 1;
352
352
  if (d > 0) {
353
- n.textContent = Wt ? Wt.emptyScript : "";
354
- for (let b = 0; b < d; b++)
355
- n.append(p[b], vt()), ze.nextNode(), c.push({ type: 2, index: ++r });
353
+ n.textContent = Vt ? Vt.emptyScript : "";
354
+ for (let w = 0; w < d; w++)
355
+ n.append(p[w], vt()), ze.nextNode(), c.push({ type: 2, index: ++r });
356
356
  n.append(p[d], vt());
357
357
  }
358
358
  }
@@ -368,17 +368,17 @@ class wt {
368
368
  }
369
369
  }
370
370
  static createElement(e, t) {
371
- const i = Fe.createElement("template");
371
+ const i = We.createElement("template");
372
372
  return i.innerHTML = e, i;
373
373
  }
374
374
  }
375
- function Ve(s, e, t = s, i) {
375
+ function Fe(s, e, t = s, i) {
376
376
  var n, r;
377
377
  if (e === le)
378
378
  return e;
379
379
  let a = i !== void 0 ? (n = t._$Co) == null ? void 0 : n[i] : t._$Cl;
380
380
  const o = bt(e) ? void 0 : e._$litDirective$;
381
- return (a == null ? void 0 : a.constructor) !== o && ((r = a == null ? void 0 : a._$AO) == null || r.call(a, !1), o === void 0 ? a = void 0 : (a = new o(s), a._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = a : t._$Cl = a), a !== void 0 && (e = Ve(s, a._$AS(s, e.values), a, i)), e;
381
+ return (a == null ? void 0 : a.constructor) !== o && ((r = a == null ? void 0 : a._$AO) == null || r.call(a, !1), o === void 0 ? a = void 0 : (a = new o(s), a._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = a : t._$Cl = a), a !== void 0 && (e = Fe(s, a._$AS(s, e.values), a, i)), e;
382
382
  }
383
383
  class Zi {
384
384
  constructor(e, t) {
@@ -391,7 +391,7 @@ class Zi {
391
391
  return this._$AM._$AU;
392
392
  }
393
393
  u(e) {
394
- const { el: { content: t }, parts: i } = this._$AD, n = ((e == null ? void 0 : e.creationScope) ?? Fe).importNode(t, !0);
394
+ const { el: { content: t }, parts: i } = this._$AD, n = ((e == null ? void 0 : e.creationScope) ?? We).importNode(t, !0);
395
395
  ze.currentNode = n;
396
396
  let r = ze.nextNode(), a = 0, o = 0, c = i[0];
397
397
  for (; c !== void 0; ) {
@@ -401,7 +401,7 @@ class Zi {
401
401
  }
402
402
  a !== (c == null ? void 0 : c.index) && (r = ze.nextNode(), a++);
403
403
  }
404
- return ze.currentNode = Fe, n;
404
+ return ze.currentNode = We, n;
405
405
  }
406
406
  p(e) {
407
407
  let t = 0;
@@ -429,7 +429,7 @@ class ct {
429
429
  return this._$AB;
430
430
  }
431
431
  _$AI(e, t = this) {
432
- e = Ve(this, e, t), bt(e) ? e === B || e == null || e === "" ? (this._$AH !== B && this._$AR(), this._$AH = B) : e !== this._$AH && e !== le && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ni(e) ? this.k(e) : this._(e);
432
+ e = Fe(this, e, t), bt(e) ? e === B || e == null || e === "" ? (this._$AH !== B && this._$AR(), this._$AH = B) : e !== this._$AH && e !== le && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ni(e) ? this.k(e) : this._(e);
433
433
  }
434
434
  S(e) {
435
435
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -438,7 +438,7 @@ class ct {
438
438
  this._$AH !== e && (this._$AR(), this._$AH = this.S(e));
439
439
  }
440
440
  _(e) {
441
- this._$AH !== B && bt(this._$AH) ? this._$AA.nextSibling.data = e : this.T(Fe.createTextNode(e)), this._$AH = e;
441
+ this._$AH !== B && bt(this._$AH) ? this._$AA.nextSibling.data = e : this.T(We.createTextNode(e)), this._$AH = e;
442
442
  }
443
443
  $(e) {
444
444
  var t;
@@ -488,12 +488,12 @@ class jt {
488
488
  const r = this.strings;
489
489
  let a = !1;
490
490
  if (r === void 0)
491
- e = Ve(this, e, t, 0), a = !bt(e) || e !== this._$AH && e !== le, a && (this._$AH = e);
491
+ e = Fe(this, e, t, 0), a = !bt(e) || e !== this._$AH && e !== le, a && (this._$AH = e);
492
492
  else {
493
493
  const o = e;
494
494
  let c, l;
495
495
  for (e = r[0], c = 0; c < r.length - 1; c++)
496
- l = Ve(this, o[i + c], t, c), l === le && (l = this._$AH[c]), a || (a = !bt(l) || l !== this._$AH[c]), l === B ? e = B : e !== B && (e += (l ?? "") + r[c + 1]), this._$AH[c] = l;
496
+ l = Fe(this, o[i + c], t, c), l === le && (l = this._$AH[c]), a || (a = !bt(l) || l !== this._$AH[c]), l === B ? e = B : e !== B && (e += (l ?? "") + r[c + 1]), this._$AH[c] = l;
497
497
  }
498
498
  a && !n && this.j(e);
499
499
  }
@@ -501,7 +501,7 @@ class jt {
501
501
  e === B ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
502
502
  }
503
503
  }
504
- class Li extends jt {
504
+ class Di extends jt {
505
505
  constructor() {
506
506
  super(...arguments), this.type = 3;
507
507
  }
@@ -509,7 +509,7 @@ class Li extends jt {
509
509
  this.element[this.name] = e === B ? void 0 : e;
510
510
  }
511
511
  }
512
- class Di extends jt {
512
+ class Li extends jt {
513
513
  constructor() {
514
514
  super(...arguments), this.type = 4;
515
515
  }
@@ -522,7 +522,7 @@ class zi extends jt {
522
522
  super(e, t, i, n, r), this.type = 5;
523
523
  }
524
524
  _$AI(e, t = this) {
525
- if ((e = Ve(this, e, t, 0) ?? B) === le)
525
+ if ((e = Fe(this, e, t, 0) ?? B) === le)
526
526
  return;
527
527
  const i = this._$AH, n = e === B && i !== B || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, r = e !== B && (i === B || n);
528
528
  n && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, e), this._$AH = e;
@@ -540,12 +540,12 @@ class Ui {
540
540
  return this._$AM._$AU;
541
541
  }
542
542
  _$AI(e) {
543
- Ve(this, e);
543
+ Fe(this, e);
544
544
  }
545
545
  }
546
- const En = { P: zs, A: we, C: Us, M: 1, L: Ri, R: Zi, D: Ni, V: Ve, I: ct, H: jt, N: Di, U: zi, B: Li, F: Ui }, vi = Vt.litHtmlPolyfillSupport;
547
- vi == null || vi(wt, ct), (Vt.litHtmlVersions ?? (Vt.litHtmlVersions = [])).push("3.1.2");
548
- const Cn = (s, e, t) => {
546
+ const Cn = { P: zs, A: we, C: Us, M: 1, L: Ri, R: Zi, D: Ni, V: Fe, I: ct, H: jt, N: Li, U: zi, B: Di, F: Ui }, vi = Ft.litHtmlPolyfillSupport;
547
+ vi == null || vi(wt, ct), (Ft.litHtmlVersions ?? (Ft.litHtmlVersions = [])).push("3.1.2");
548
+ const $n = (s, e, t) => {
549
549
  const i = (t == null ? void 0 : t.renderBefore) ?? e;
550
550
  let n = i._$litPart$;
551
551
  if (n === void 0) {
@@ -570,7 +570,7 @@ let Q = class extends Qe {
570
570
  }
571
571
  update(s) {
572
572
  const e = this.render();
573
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(s), this._$Do = Cn(e, this.renderRoot, this.renderOptions);
573
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(s), this._$Do = $n(e, this.renderRoot, this.renderOptions);
574
574
  }
575
575
  connectedCallback() {
576
576
  var s;
@@ -605,7 +605,7 @@ const Pe = (s) => (e, t) => {
605
605
  * Copyright 2017 Google LLC
606
606
  * SPDX-License-Identifier: BSD-3-Clause
607
607
  */
608
- const An = { attribute: !0, type: String, converter: Ft, reflect: !1, hasChanged: Ds }, On = (s = An, e, t) => {
608
+ const An = { attribute: !0, type: String, converter: Wt, reflect: !1, hasChanged: Ls }, On = (s = An, e, t) => {
609
609
  const { kind: i, metadata: n } = t;
610
610
  let r = globalThis.litPropertyMetadata.get(n);
611
611
  if (r === void 0 && globalThis.litPropertyMetadata.set(n, r = /* @__PURE__ */ new Map()), r.set(t.name, s), i === "accessor") {
@@ -626,7 +626,7 @@ const An = { attribute: !0, type: String, converter: Ft, reflect: !1, hasChanged
626
626
  }
627
627
  throw Error("Unsupported decorator location: " + i);
628
628
  };
629
- function F(s) {
629
+ function W(s) {
630
630
  return (e, t) => typeof t == "object" ? On(s, e, t) : ((i, n, r) => {
631
631
  const a = n.hasOwnProperty(r);
632
632
  return n.constructor.createProperty(r, a ? { ...i, wrapped: !0 } : i), a ? Object.getOwnPropertyDescriptor(n, r) : void 0;
@@ -638,7 +638,7 @@ function F(s) {
638
638
  * SPDX-License-Identifier: BSD-3-Clause
639
639
  */
640
640
  function dt(s) {
641
- return F({ ...s, state: !0, attribute: !1 });
641
+ return W({ ...s, state: !0, attribute: !1 });
642
642
  }
643
643
  /**
644
644
  * @license
@@ -829,7 +829,7 @@ const f = j.arrayToEnum([
829
829
  "never",
830
830
  "map",
831
831
  "set"
832
- ]), Ee = (s) => {
832
+ ]), Ce = (s) => {
833
833
  switch (typeof s) {
834
834
  case "undefined":
835
835
  return f.undefined;
@@ -1031,7 +1031,7 @@ class J {
1031
1031
  const i = [];
1032
1032
  for (const n of t) {
1033
1033
  if (n.status === "aborted")
1034
- return E;
1034
+ return C;
1035
1035
  n.status === "dirty" && e.dirty(), i.push(n.value);
1036
1036
  }
1037
1037
  return { status: e.value, value: i };
@@ -1050,15 +1050,15 @@ class J {
1050
1050
  for (const n of t) {
1051
1051
  const { key: r, value: a } = n;
1052
1052
  if (r.status === "aborted" || a.status === "aborted")
1053
- return E;
1053
+ return C;
1054
1054
  r.status === "dirty" && e.dirty(), a.status === "dirty" && e.dirty(), r.value !== "__proto__" && (typeof a.value < "u" || n.alwaysSet) && (i[r.value] = a.value);
1055
1055
  }
1056
1056
  return { status: e.value, value: i };
1057
1057
  }
1058
1058
  }
1059
- const E = Object.freeze({
1059
+ const C = Object.freeze({
1060
1060
  status: "aborted"
1061
- }), Fi = (s) => ({ status: "dirty", value: s }), Y = (s) => ({ status: "valid", value: s }), Ns = (s) => s.status === "aborted", Ps = (s) => s.status === "dirty", xt = (s) => s.status === "valid", qt = (s) => typeof Promise < "u" && s instanceof Promise;
1061
+ }), Wi = (s) => ({ status: "dirty", value: s }), G = (s) => ({ status: "valid", value: s }), Ns = (s) => s.status === "aborted", Ps = (s) => s.status === "dirty", xt = (s) => s.status === "valid", qt = (s) => typeof Promise < "u" && s instanceof Promise;
1062
1062
  var _;
1063
1063
  (function(s) {
1064
1064
  s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
@@ -1102,13 +1102,13 @@ class I {
1102
1102
  return this._def.description;
1103
1103
  }
1104
1104
  _getType(e) {
1105
- return Ee(e.data);
1105
+ return Ce(e.data);
1106
1106
  }
1107
1107
  _getOrReturnCtx(e, t) {
1108
1108
  return t || {
1109
1109
  common: e.parent.common,
1110
1110
  data: e.data,
1111
- parsedType: Ee(e.data),
1111
+ parsedType: Ce(e.data),
1112
1112
  schemaErrorMap: this._def.errorMap,
1113
1113
  path: e.path,
1114
1114
  parent: e.parent
@@ -1120,7 +1120,7 @@ class I {
1120
1120
  ctx: {
1121
1121
  common: e.parent.common,
1122
1122
  data: e.data,
1123
- parsedType: Ee(e.data),
1123
+ parsedType: Ce(e.data),
1124
1124
  schemaErrorMap: this._def.errorMap,
1125
1125
  path: e.path,
1126
1126
  parent: e.parent
@@ -1155,7 +1155,7 @@ class I {
1155
1155
  schemaErrorMap: this._def.errorMap,
1156
1156
  parent: null,
1157
1157
  data: e,
1158
- parsedType: Ee(e)
1158
+ parsedType: Ce(e)
1159
1159
  }, r = this._parseSync({ data: e, path: n.path, parent: n });
1160
1160
  return ki(n, r);
1161
1161
  }
@@ -1176,7 +1176,7 @@ class I {
1176
1176
  schemaErrorMap: this._def.errorMap,
1177
1177
  parent: null,
1178
1178
  data: e,
1179
- parsedType: Ee(e)
1179
+ parsedType: Ce(e)
1180
1180
  }, n = this._parse({ data: e, path: i.path, parent: i }), r = await (qt(n) ? n : Promise.resolve(n));
1181
1181
  return ki(i, r);
1182
1182
  }
@@ -1219,10 +1219,10 @@ class I {
1219
1219
  return rt.create(this, this._def);
1220
1220
  }
1221
1221
  or(e) {
1222
- return $t.create([this, e], this._def);
1222
+ return St.create([this, e], this._def);
1223
1223
  }
1224
1224
  and(e) {
1225
- return Et.create(this, e, this._def);
1225
+ return Ct.create(this, e, this._def);
1226
1226
  }
1227
1227
  transform(e) {
1228
1228
  return new ae({
@@ -1242,7 +1242,7 @@ class I {
1242
1242
  });
1243
1243
  }
1244
1244
  brand() {
1245
- return new Wi({
1245
+ return new Vi({
1246
1246
  typeName: T.ZodBranded,
1247
1247
  type: this,
1248
1248
  ...A(this._def)
@@ -1277,10 +1277,10 @@ class I {
1277
1277
  return this.safeParse(null).success;
1278
1278
  }
1279
1279
  }
1280
- const Rn = /^c[^\s-]{8,}$/i, Zn = /^[a-z][a-z0-9]*$/, Ln = /^[0-9A-HJKMNP-TV-Z]{26}$/, Dn = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, zn = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Un = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1280
+ const Rn = /^c[^\s-]{8,}$/i, Zn = /^[a-z][a-z0-9]*$/, Dn = /^[0-9A-HJKMNP-TV-Z]{26}$/, Ln = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, zn = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Un = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1281
1281
  let Os;
1282
- const Hn = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/, Bn = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, Fn = (s) => s.precision ? s.offset ? new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`) : new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}Z$`) : s.precision === 0 ? s.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$") : s.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");
1283
- function Vn(s, e) {
1282
+ const Hn = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/, Bn = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, Wn = (s) => s.precision ? s.offset ? new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`) : new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}Z$`) : s.precision === 0 ? s.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$") : s.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");
1283
+ function Fn(s, e) {
1284
1284
  return !!((e === "v4" || !e) && Hn.test(s) || (e === "v6" || !e) && Bn.test(s));
1285
1285
  }
1286
1286
  class ie extends I {
@@ -1295,7 +1295,7 @@ class ie extends I {
1295
1295
  received: n.parsedType
1296
1296
  }
1297
1297
  //
1298
- ), E;
1298
+ ), C;
1299
1299
  }
1300
1300
  const t = new J();
1301
1301
  let i;
@@ -1348,7 +1348,7 @@ class ie extends I {
1348
1348
  message: n.message
1349
1349
  }), t.dirty());
1350
1350
  else if (n.kind === "uuid")
1351
- Dn.test(e.data) || (i = this._getOrReturnCtx(e, i), g(i, {
1351
+ Ln.test(e.data) || (i = this._getOrReturnCtx(e, i), g(i, {
1352
1352
  validation: "uuid",
1353
1353
  code: m.invalid_string,
1354
1354
  message: n.message
@@ -1366,7 +1366,7 @@ class ie extends I {
1366
1366
  message: n.message
1367
1367
  }), t.dirty());
1368
1368
  else if (n.kind === "ulid")
1369
- Ln.test(e.data) || (i = this._getOrReturnCtx(e, i), g(i, {
1369
+ Dn.test(e.data) || (i = this._getOrReturnCtx(e, i), g(i, {
1370
1370
  validation: "ulid",
1371
1371
  code: m.invalid_string,
1372
1372
  message: n.message
@@ -1398,11 +1398,11 @@ class ie extends I {
1398
1398
  code: m.invalid_string,
1399
1399
  validation: { endsWith: n.value },
1400
1400
  message: n.message
1401
- }), t.dirty()) : n.kind === "datetime" ? Fn(n).test(e.data) || (i = this._getOrReturnCtx(e, i), g(i, {
1401
+ }), t.dirty()) : n.kind === "datetime" ? Wn(n).test(e.data) || (i = this._getOrReturnCtx(e, i), g(i, {
1402
1402
  code: m.invalid_string,
1403
1403
  validation: "datetime",
1404
1404
  message: n.message
1405
- }), t.dirty()) : n.kind === "ip" ? Vn(e.data, n.version) || (i = this._getOrReturnCtx(e, i), g(i, {
1405
+ }), t.dirty()) : n.kind === "ip" ? Fn(e.data, n.version) || (i = this._getOrReturnCtx(e, i), g(i, {
1406
1406
  validation: "ip",
1407
1407
  code: m.invalid_string,
1408
1408
  message: n.message
@@ -1584,7 +1584,7 @@ ie.create = (s) => {
1584
1584
  ...A(s)
1585
1585
  });
1586
1586
  };
1587
- function Wn(s, e) {
1587
+ function Vn(s, e) {
1588
1588
  const t = (s.toString().split(".")[1] || "").length, i = (e.toString().split(".")[1] || "").length, n = t > i ? t : i, r = parseInt(s.toFixed(n).replace(".", "")), a = parseInt(e.toFixed(n).replace(".", ""));
1589
1589
  return r % a / Math.pow(10, n);
1590
1590
  }
@@ -1599,7 +1599,7 @@ class Ae extends I {
1599
1599
  code: m.invalid_type,
1600
1600
  expected: f.number,
1601
1601
  received: n.parsedType
1602
- }), E;
1602
+ }), C;
1603
1603
  }
1604
1604
  let t;
1605
1605
  const i = new J();
@@ -1623,7 +1623,7 @@ class Ae extends I {
1623
1623
  inclusive: n.inclusive,
1624
1624
  exact: !1,
1625
1625
  message: n.message
1626
- }), i.dirty()) : n.kind === "multipleOf" ? Wn(e.data, n.value) !== 0 && (t = this._getOrReturnCtx(e, t), g(t, {
1626
+ }), i.dirty()) : n.kind === "multipleOf" ? Vn(e.data, n.value) !== 0 && (t = this._getOrReturnCtx(e, t), g(t, {
1627
1627
  code: m.not_multiple_of,
1628
1628
  multipleOf: n.value,
1629
1629
  message: n.message
@@ -1771,7 +1771,7 @@ class Oe extends I {
1771
1771
  code: m.invalid_type,
1772
1772
  expected: f.bigint,
1773
1773
  received: n.parsedType
1774
- }), E;
1774
+ }), C;
1775
1775
  }
1776
1776
  let t;
1777
1777
  const i = new J();
@@ -1896,9 +1896,9 @@ class kt extends I {
1896
1896
  code: m.invalid_type,
1897
1897
  expected: f.boolean,
1898
1898
  received: t.parsedType
1899
- }), E;
1899
+ }), C;
1900
1900
  }
1901
- return Y(e.data);
1901
+ return G(e.data);
1902
1902
  }
1903
1903
  }
1904
1904
  kt.create = (s) => new kt({
@@ -1906,7 +1906,7 @@ kt.create = (s) => new kt({
1906
1906
  coerce: (s == null ? void 0 : s.coerce) || !1,
1907
1907
  ...A(s)
1908
1908
  });
1909
- class We extends I {
1909
+ class Ve extends I {
1910
1910
  _parse(e) {
1911
1911
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1912
1912
  const n = this._getOrReturnCtx(e);
@@ -1914,13 +1914,13 @@ class We extends I {
1914
1914
  code: m.invalid_type,
1915
1915
  expected: f.date,
1916
1916
  received: n.parsedType
1917
- }), E;
1917
+ }), C;
1918
1918
  }
1919
1919
  if (isNaN(e.data.getTime())) {
1920
1920
  const n = this._getOrReturnCtx(e);
1921
1921
  return g(n, {
1922
1922
  code: m.invalid_date
1923
- }), E;
1923
+ }), C;
1924
1924
  }
1925
1925
  const t = new J();
1926
1926
  let i;
@@ -1946,7 +1946,7 @@ class We extends I {
1946
1946
  };
1947
1947
  }
1948
1948
  _addCheck(e) {
1949
- return new We({
1949
+ return new Ve({
1950
1950
  ...this._def,
1951
1951
  checks: [...this._def.checks, e]
1952
1952
  });
@@ -1978,13 +1978,13 @@ class We extends I {
1978
1978
  return e != null ? new Date(e) : null;
1979
1979
  }
1980
1980
  }
1981
- We.create = (s) => new We({
1981
+ Ve.create = (s) => new Ve({
1982
1982
  checks: [],
1983
1983
  coerce: (s == null ? void 0 : s.coerce) || !1,
1984
1984
  typeName: T.ZodDate,
1985
1985
  ...A(s)
1986
1986
  });
1987
- class Yt extends I {
1987
+ class Gt extends I {
1988
1988
  _parse(e) {
1989
1989
  if (this._getType(e) !== f.symbol) {
1990
1990
  const t = this._getOrReturnCtx(e);
@@ -1992,16 +1992,16 @@ class Yt extends I {
1992
1992
  code: m.invalid_type,
1993
1993
  expected: f.symbol,
1994
1994
  received: t.parsedType
1995
- }), E;
1995
+ }), C;
1996
1996
  }
1997
- return Y(e.data);
1997
+ return G(e.data);
1998
1998
  }
1999
1999
  }
2000
- Yt.create = (s) => new Yt({
2000
+ Gt.create = (s) => new Gt({
2001
2001
  typeName: T.ZodSymbol,
2002
2002
  ...A(s)
2003
2003
  });
2004
- class St extends I {
2004
+ class Et extends I {
2005
2005
  _parse(e) {
2006
2006
  if (this._getType(e) !== f.undefined) {
2007
2007
  const t = this._getOrReturnCtx(e);
@@ -2009,12 +2009,12 @@ class St extends I {
2009
2009
  code: m.invalid_type,
2010
2010
  expected: f.undefined,
2011
2011
  received: t.parsedType
2012
- }), E;
2012
+ }), C;
2013
2013
  }
2014
- return Y(e.data);
2014
+ return G(e.data);
2015
2015
  }
2016
2016
  }
2017
- St.create = (s) => new St({
2017
+ Et.create = (s) => new Et({
2018
2018
  typeName: T.ZodUndefined,
2019
2019
  ...A(s)
2020
2020
  });
@@ -2026,9 +2026,9 @@ class Tt extends I {
2026
2026
  code: m.invalid_type,
2027
2027
  expected: f.null,
2028
2028
  received: t.parsedType
2029
- }), E;
2029
+ }), C;
2030
2030
  }
2031
- return Y(e.data);
2031
+ return G(e.data);
2032
2032
  }
2033
2033
  }
2034
2034
  Tt.create = (s) => new Tt({
@@ -2040,7 +2040,7 @@ class nt extends I {
2040
2040
  super(...arguments), this._any = !0;
2041
2041
  }
2042
2042
  _parse(e) {
2043
- return Y(e.data);
2043
+ return G(e.data);
2044
2044
  }
2045
2045
  }
2046
2046
  nt.create = (s) => new nt({
@@ -2052,7 +2052,7 @@ class He extends I {
2052
2052
  super(...arguments), this._unknown = !0;
2053
2053
  }
2054
2054
  _parse(e) {
2055
- return Y(e.data);
2055
+ return G(e.data);
2056
2056
  }
2057
2057
  }
2058
2058
  He.create = (s) => new He({
@@ -2066,14 +2066,14 @@ class xe extends I {
2066
2066
  code: m.invalid_type,
2067
2067
  expected: f.never,
2068
2068
  received: t.parsedType
2069
- }), E;
2069
+ }), C;
2070
2070
  }
2071
2071
  }
2072
2072
  xe.create = (s) => new xe({
2073
2073
  typeName: T.ZodNever,
2074
2074
  ...A(s)
2075
2075
  });
2076
- class Gt extends I {
2076
+ class Yt extends I {
2077
2077
  _parse(e) {
2078
2078
  if (this._getType(e) !== f.undefined) {
2079
2079
  const t = this._getOrReturnCtx(e);
@@ -2081,12 +2081,12 @@ class Gt extends I {
2081
2081
  code: m.invalid_type,
2082
2082
  expected: f.void,
2083
2083
  received: t.parsedType
2084
- }), E;
2084
+ }), C;
2085
2085
  }
2086
- return Y(e.data);
2086
+ return G(e.data);
2087
2087
  }
2088
2088
  }
2089
- Gt.create = (s) => new Gt({
2089
+ Yt.create = (s) => new Yt({
2090
2090
  typeName: T.ZodVoid,
2091
2091
  ...A(s)
2092
2092
  });
@@ -2098,7 +2098,7 @@ class re extends I {
2098
2098
  code: m.invalid_type,
2099
2099
  expected: f.array,
2100
2100
  received: t.parsedType
2101
- }), E;
2101
+ }), C;
2102
2102
  if (n.exactLength !== null) {
2103
2103
  const a = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
2104
2104
  (a || o) && (g(t, {
@@ -2197,7 +2197,7 @@ class H extends I {
2197
2197
  code: m.invalid_type,
2198
2198
  expected: f.object,
2199
2199
  received: c.parsedType
2200
- }), E;
2200
+ }), C;
2201
2201
  }
2202
2202
  const { status: t, ctx: i } = this._processInputParams(e), { shape: n, keys: r } = this._getCached(), a = [];
2203
2203
  if (!(this._def.catchall instanceof xe && this._def.unknownKeys === "strip"))
@@ -2444,7 +2444,7 @@ class H extends I {
2444
2444
  });
2445
2445
  }
2446
2446
  keyof() {
2447
- return Vi(j.objectKeys(this.shape));
2447
+ return Fi(j.objectKeys(this.shape));
2448
2448
  }
2449
2449
  }
2450
2450
  H.create = (s, e) => new H({
@@ -2468,7 +2468,7 @@ H.lazycreate = (s, e) => new H({
2468
2468
  typeName: T.ZodObject,
2469
2469
  ...A(e)
2470
2470
  });
2471
- class $t extends I {
2471
+ class St extends I {
2472
2472
  _parse(e) {
2473
2473
  const { ctx: t } = this._processInputParams(e), i = this._def.options;
2474
2474
  function n(r) {
@@ -2482,7 +2482,7 @@ class $t extends I {
2482
2482
  return g(t, {
2483
2483
  code: m.invalid_union,
2484
2484
  unionErrors: a
2485
- }), E;
2485
+ }), C;
2486
2486
  }
2487
2487
  if (t.common.async)
2488
2488
  return Promise.all(i.map(async (r) => {
@@ -2529,19 +2529,19 @@ class $t extends I {
2529
2529
  return g(t, {
2530
2530
  code: m.invalid_union,
2531
2531
  unionErrors: o
2532
- }), E;
2532
+ }), C;
2533
2533
  }
2534
2534
  }
2535
2535
  get options() {
2536
2536
  return this._def.options;
2537
2537
  }
2538
2538
  }
2539
- $t.create = (s, e) => new $t({
2539
+ St.create = (s, e) => new St({
2540
2540
  options: s,
2541
2541
  typeName: T.ZodUnion,
2542
2542
  ...A(e)
2543
2543
  });
2544
- const Ht = (s) => s instanceof At ? Ht(s.schema) : s instanceof ae ? Ht(s.innerType()) : s instanceof Ot ? [s.value] : s instanceof Ie ? s.options : s instanceof It ? Object.keys(s.enum) : s instanceof Mt ? Ht(s._def.innerType) : s instanceof St ? [void 0] : s instanceof Tt ? [null] : null;
2544
+ const Ht = (s) => s instanceof At ? Ht(s.schema) : s instanceof ae ? Ht(s.innerType()) : s instanceof Ot ? [s.value] : s instanceof Ie ? s.options : s instanceof It ? Object.keys(s.enum) : s instanceof Mt ? Ht(s._def.innerType) : s instanceof Et ? [void 0] : s instanceof Tt ? [null] : null;
2545
2545
  class us extends I {
2546
2546
  _parse(e) {
2547
2547
  const { ctx: t } = this._processInputParams(e);
@@ -2550,7 +2550,7 @@ class us extends I {
2550
2550
  code: m.invalid_type,
2551
2551
  expected: f.object,
2552
2552
  received: t.parsedType
2553
- }), E;
2553
+ }), C;
2554
2554
  const i = this.discriminator, n = t.data[i], r = this.optionsMap.get(n);
2555
2555
  return r ? t.common.async ? r._parseAsync({
2556
2556
  data: t.data,
@@ -2564,7 +2564,7 @@ class us extends I {
2564
2564
  code: m.invalid_union_discriminator,
2565
2565
  options: Array.from(this.optionsMap.keys()),
2566
2566
  path: [i]
2567
- }), E);
2567
+ }), C);
2568
2568
  }
2569
2569
  get discriminator() {
2570
2570
  return this._def.discriminator;
@@ -2605,7 +2605,7 @@ class us extends I {
2605
2605
  }
2606
2606
  }
2607
2607
  function js(s, e) {
2608
- const t = Ee(s), i = Ee(e);
2608
+ const t = Ce(s), i = Ce(e);
2609
2609
  if (s === e)
2610
2610
  return { valid: !0, data: s };
2611
2611
  if (t === f.object && i === f.object) {
@@ -2631,15 +2631,15 @@ function js(s, e) {
2631
2631
  } else
2632
2632
  return t === f.date && i === f.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
2633
2633
  }
2634
- class Et extends I {
2634
+ class Ct extends I {
2635
2635
  _parse(e) {
2636
2636
  const { status: t, ctx: i } = this._processInputParams(e), n = (r, a) => {
2637
2637
  if (Ns(r) || Ns(a))
2638
- return E;
2638
+ return C;
2639
2639
  const o = js(r.value, a.value);
2640
2640
  return o.valid ? ((Ps(r) || Ps(a)) && t.dirty(), { status: t.value, value: o.data }) : (g(i, {
2641
2641
  code: m.invalid_intersection_types
2642
- }), E);
2642
+ }), C);
2643
2643
  };
2644
2644
  return i.common.async ? Promise.all([
2645
2645
  this._def.left._parseAsync({
@@ -2663,7 +2663,7 @@ class Et extends I {
2663
2663
  }));
2664
2664
  }
2665
2665
  }
2666
- Et.create = (s, e, t) => new Et({
2666
+ Ct.create = (s, e, t) => new Ct({
2667
2667
  left: s,
2668
2668
  right: e,
2669
2669
  typeName: T.ZodIntersection,
@@ -2677,7 +2677,7 @@ class he extends I {
2677
2677
  code: m.invalid_type,
2678
2678
  expected: f.array,
2679
2679
  received: i.parsedType
2680
- }), E;
2680
+ }), C;
2681
2681
  if (i.data.length < this._def.items.length)
2682
2682
  return g(i, {
2683
2683
  code: m.too_small,
@@ -2685,7 +2685,7 @@ class he extends I {
2685
2685
  inclusive: !0,
2686
2686
  exact: !1,
2687
2687
  type: "array"
2688
- }), E;
2688
+ }), C;
2689
2689
  !this._def.rest && i.data.length > this._def.items.length && (g(i, {
2690
2690
  code: m.too_big,
2691
2691
  maximum: this._def.items.length,
@@ -2719,7 +2719,7 @@ he.create = (s, e) => {
2719
2719
  ...A(e)
2720
2720
  });
2721
2721
  };
2722
- class Ct extends I {
2722
+ class $t extends I {
2723
2723
  get keySchema() {
2724
2724
  return this._def.keyType;
2725
2725
  }
@@ -2733,7 +2733,7 @@ class Ct extends I {
2733
2733
  code: m.invalid_type,
2734
2734
  expected: f.object,
2735
2735
  received: i.parsedType
2736
- }), E;
2736
+ }), C;
2737
2737
  const n = [], r = this._def.keyType, a = this._def.valueType;
2738
2738
  for (const o in i.data)
2739
2739
  n.push({
@@ -2746,12 +2746,12 @@ class Ct extends I {
2746
2746
  return this._def.valueType;
2747
2747
  }
2748
2748
  static create(e, t, i) {
2749
- return t instanceof I ? new Ct({
2749
+ return t instanceof I ? new $t({
2750
2750
  keyType: e,
2751
2751
  valueType: t,
2752
2752
  typeName: T.ZodRecord,
2753
2753
  ...A(i)
2754
- }) : new Ct({
2754
+ }) : new $t({
2755
2755
  keyType: ie.create(),
2756
2756
  valueType: e,
2757
2757
  typeName: T.ZodRecord,
@@ -2773,7 +2773,7 @@ class Xt extends I {
2773
2773
  code: m.invalid_type,
2774
2774
  expected: f.map,
2775
2775
  received: i.parsedType
2776
- }), E;
2776
+ }), C;
2777
2777
  const n = this._def.keyType, r = this._def.valueType, a = [...i.data.entries()].map(([o, c], l) => ({
2778
2778
  key: n._parse(new ue(i, o, i.path, [l, "key"])),
2779
2779
  value: r._parse(new ue(i, c, i.path, [l, "value"]))
@@ -2784,7 +2784,7 @@ class Xt extends I {
2784
2784
  for (const c of a) {
2785
2785
  const l = await c.key, h = await c.value;
2786
2786
  if (l.status === "aborted" || h.status === "aborted")
2787
- return E;
2787
+ return C;
2788
2788
  (l.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(l.value, h.value);
2789
2789
  }
2790
2790
  return { status: t.value, value: o };
@@ -2794,7 +2794,7 @@ class Xt extends I {
2794
2794
  for (const c of a) {
2795
2795
  const l = c.key, h = c.value;
2796
2796
  if (l.status === "aborted" || h.status === "aborted")
2797
- return E;
2797
+ return C;
2798
2798
  (l.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(l.value, h.value);
2799
2799
  }
2800
2800
  return { status: t.value, value: o };
@@ -2815,7 +2815,7 @@ class Ke extends I {
2815
2815
  code: m.invalid_type,
2816
2816
  expected: f.set,
2817
2817
  received: i.parsedType
2818
- }), E;
2818
+ }), C;
2819
2819
  const n = this._def;
2820
2820
  n.minSize !== null && i.data.size < n.minSize.value && (g(i, {
2821
2821
  code: m.too_small,
@@ -2837,7 +2837,7 @@ class Ke extends I {
2837
2837
  const l = /* @__PURE__ */ new Set();
2838
2838
  for (const h of c) {
2839
2839
  if (h.status === "aborted")
2840
- return E;
2840
+ return C;
2841
2841
  h.status === "dirty" && t.dirty(), l.add(h.value);
2842
2842
  }
2843
2843
  return { status: t.value, value: l };
@@ -2882,7 +2882,7 @@ class st extends I {
2882
2882
  code: m.invalid_type,
2883
2883
  expected: f.function,
2884
2884
  received: t.parsedType
2885
- }), E;
2885
+ }), C;
2886
2886
  function i(o, c) {
2887
2887
  return Jt({
2888
2888
  data: o,
@@ -2918,7 +2918,7 @@ class st extends I {
2918
2918
  const r = { errorMap: t.common.contextualErrorMap }, a = t.data;
2919
2919
  if (this._def.returns instanceof rt) {
2920
2920
  const o = this;
2921
- return Y(async function(...c) {
2921
+ return G(async function(...c) {
2922
2922
  const l = new ne([]), h = await o._def.args.parseAsync(c, r).catch((d) => {
2923
2923
  throw l.addIssue(i(c, d)), l;
2924
2924
  }), p = await Reflect.apply(a, this, h);
@@ -2928,7 +2928,7 @@ class st extends I {
2928
2928
  });
2929
2929
  } else {
2930
2930
  const o = this;
2931
- return Y(function(...c) {
2931
+ return G(function(...c) {
2932
2932
  const l = o._def.args.safeParse(c, r);
2933
2933
  if (!l.success)
2934
2934
  throw new ne([i(c, l.error)]);
@@ -2994,7 +2994,7 @@ class Ot extends I {
2994
2994
  received: t.data,
2995
2995
  code: m.invalid_literal,
2996
2996
  expected: this._def.value
2997
- }), E;
2997
+ }), C;
2998
2998
  }
2999
2999
  return { status: "valid", value: e.data };
3000
3000
  }
@@ -3007,7 +3007,7 @@ Ot.create = (s, e) => new Ot({
3007
3007
  typeName: T.ZodLiteral,
3008
3008
  ...A(e)
3009
3009
  });
3010
- function Vi(s, e) {
3010
+ function Fi(s, e) {
3011
3011
  return new Ie({
3012
3012
  values: s,
3013
3013
  typeName: T.ZodEnum,
@@ -3022,7 +3022,7 @@ class Ie extends I {
3022
3022
  expected: j.joinValues(i),
3023
3023
  received: t.parsedType,
3024
3024
  code: m.invalid_type
3025
- }), E;
3025
+ }), C;
3026
3026
  }
3027
3027
  if (this._def.values.indexOf(e.data) === -1) {
3028
3028
  const t = this._getOrReturnCtx(e), i = this._def.values;
@@ -3030,9 +3030,9 @@ class Ie extends I {
3030
3030
  received: t.data,
3031
3031
  code: m.invalid_enum_value,
3032
3032
  options: i
3033
- }), E;
3033
+ }), C;
3034
3034
  }
3035
- return Y(e.data);
3035
+ return G(e.data);
3036
3036
  }
3037
3037
  get options() {
3038
3038
  return this._def.values;
@@ -3062,7 +3062,7 @@ class Ie extends I {
3062
3062
  return Ie.create(this.options.filter((t) => !e.includes(t)));
3063
3063
  }
3064
3064
  }
3065
- Ie.create = Vi;
3065
+ Ie.create = Fi;
3066
3066
  class It extends I {
3067
3067
  _parse(e) {
3068
3068
  const t = j.getValidEnumValues(this._def.values), i = this._getOrReturnCtx(e);
@@ -3072,7 +3072,7 @@ class It extends I {
3072
3072
  expected: j.joinValues(n),
3073
3073
  received: i.parsedType,
3074
3074
  code: m.invalid_type
3075
- }), E;
3075
+ }), C;
3076
3076
  }
3077
3077
  if (t.indexOf(e.data) === -1) {
3078
3078
  const n = j.objectValues(t);
@@ -3080,9 +3080,9 @@ class It extends I {
3080
3080
  received: i.data,
3081
3081
  code: m.invalid_enum_value,
3082
3082
  options: n
3083
- }), E;
3083
+ }), C;
3084
3084
  }
3085
- return Y(e.data);
3085
+ return G(e.data);
3086
3086
  }
3087
3087
  get enum() {
3088
3088
  return this._def.values;
@@ -3104,9 +3104,9 @@ class rt extends I {
3104
3104
  code: m.invalid_type,
3105
3105
  expected: f.promise,
3106
3106
  received: t.parsedType
3107
- }), E;
3107
+ }), C;
3108
3108
  const i = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
3109
- return Y(i.then((n) => this._def.type.parseAsync(n, {
3109
+ return G(i.then((n) => this._def.type.parseAsync(n, {
3110
3110
  path: t.path,
3111
3111
  errorMap: t.common.contextualErrorMap
3112
3112
  })));
@@ -3163,9 +3163,9 @@ class ae extends I {
3163
3163
  path: i.path,
3164
3164
  parent: i
3165
3165
  });
3166
- return o.status === "aborted" ? E : (o.status === "dirty" && t.dirty(), a(o.value), { status: t.value, value: o.value });
3166
+ return o.status === "aborted" ? C : (o.status === "dirty" && t.dirty(), a(o.value), { status: t.value, value: o.value });
3167
3167
  } else
3168
- return this._def.schema._parseAsync({ data: i.data, path: i.path, parent: i }).then((o) => o.status === "aborted" ? E : (o.status === "dirty" && t.dirty(), a(o.value).then(() => ({ status: t.value, value: o.value }))));
3168
+ return this._def.schema._parseAsync({ data: i.data, path: i.path, parent: i }).then((o) => o.status === "aborted" ? C : (o.status === "dirty" && t.dirty(), a(o.value).then(() => ({ status: t.value, value: o.value }))));
3169
3169
  }
3170
3170
  if (n.type === "transform")
3171
3171
  if (i.common.async === !1) {
@@ -3199,7 +3199,7 @@ ae.createWithPreprocess = (s, e, t) => new ae({
3199
3199
  });
3200
3200
  class _e extends I {
3201
3201
  _parse(e) {
3202
- return this._getType(e) === f.undefined ? Y(void 0) : this._def.innerType._parse(e);
3202
+ return this._getType(e) === f.undefined ? G(void 0) : this._def.innerType._parse(e);
3203
3203
  }
3204
3204
  unwrap() {
3205
3205
  return this._def.innerType;
@@ -3212,7 +3212,7 @@ _e.create = (s, e) => new _e({
3212
3212
  });
3213
3213
  class Je extends I {
3214
3214
  _parse(e) {
3215
- return this._getType(e) === f.null ? Y(null) : this._def.innerType._parse(e);
3215
+ return this._getType(e) === f.null ? G(null) : this._def.innerType._parse(e);
3216
3216
  }
3217
3217
  unwrap() {
3218
3218
  return this._def.innerType;
@@ -3294,7 +3294,7 @@ class es extends I {
3294
3294
  code: m.invalid_type,
3295
3295
  expected: f.nan,
3296
3296
  received: t.parsedType
3297
- }), E;
3297
+ }), C;
3298
3298
  }
3299
3299
  return { status: "valid", value: e.data };
3300
3300
  }
@@ -3304,7 +3304,7 @@ es.create = (s) => new es({
3304
3304
  ...A(s)
3305
3305
  });
3306
3306
  const Kn = Symbol("zod_brand");
3307
- class Wi extends I {
3307
+ class Vi extends I {
3308
3308
  _parse(e) {
3309
3309
  const { ctx: t } = this._processInputParams(e), i = t.data;
3310
3310
  return this._def.type._parse({
@@ -3327,7 +3327,7 @@ class Rt extends I {
3327
3327
  path: i.path,
3328
3328
  parent: i
3329
3329
  });
3330
- return n.status === "aborted" ? E : n.status === "dirty" ? (t.dirty(), Fi(n.value)) : this._def.out._parseAsync({
3330
+ return n.status === "aborted" ? C : n.status === "dirty" ? (t.dirty(), Wi(n.value)) : this._def.out._parseAsync({
3331
3331
  data: n.value,
3332
3332
  path: i.path,
3333
3333
  parent: i
@@ -3339,7 +3339,7 @@ class Rt extends I {
3339
3339
  path: i.path,
3340
3340
  parent: i
3341
3341
  });
3342
- return n.status === "aborted" ? E : n.status === "dirty" ? (t.dirty(), {
3342
+ return n.status === "aborted" ? C : n.status === "dirty" ? (t.dirty(), {
3343
3343
  status: "dirty",
3344
3344
  value: n.value
3345
3345
  }) : this._def.out._parseSync({
@@ -3383,7 +3383,7 @@ var T;
3383
3383
  })(T || (T = {}));
3384
3384
  const qn = (s, e = {
3385
3385
  message: `Input not instance of ${s.name}`
3386
- }) => Ki((t) => t instanceof s, e), Ji = ie.create, qi = Ae.create, Yn = es.create, Gn = Oe.create, Yi = kt.create, Xn = We.create, Qn = Yt.create, er = St.create, tr = Tt.create, sr = nt.create, ir = He.create, nr = xe.create, rr = Gt.create, ar = re.create, or = H.create, cr = H.strictCreate, dr = $t.create, lr = us.create, ur = Et.create, hr = he.create, pr = Ct.create, mr = Xt.create, fr = Ke.create, gr = st.create, yr = At.create, vr = Ot.create, br = Ie.create, wr = It.create, _r = rt.create, Si = ae.create, xr = _e.create, kr = Je.create, Sr = ae.createWithPreprocess, Tr = Rt.create, $r = () => Ji().optional(), Er = () => qi().optional(), Cr = () => Yi().optional(), Ar = {
3386
+ }) => Ki((t) => t instanceof s, e), Ji = ie.create, qi = Ae.create, Gn = es.create, Yn = Oe.create, Gi = kt.create, Xn = Ve.create, Qn = Gt.create, er = Et.create, tr = Tt.create, sr = nt.create, ir = He.create, nr = xe.create, rr = Yt.create, ar = re.create, or = H.create, cr = H.strictCreate, dr = St.create, lr = us.create, ur = Ct.create, hr = he.create, pr = $t.create, mr = Xt.create, fr = Ke.create, gr = st.create, yr = At.create, vr = Ot.create, br = Ie.create, wr = It.create, _r = rt.create, Ei = ae.create, xr = _e.create, kr = Je.create, Er = ae.createWithPreprocess, Tr = Rt.create, Sr = () => Ji().optional(), Cr = () => qi().optional(), $r = () => Gi().optional(), Ar = {
3387
3387
  string: (s) => ie.create({ ...s, coerce: !0 }),
3388
3388
  number: (s) => Ae.create({ ...s, coerce: !0 }),
3389
3389
  boolean: (s) => kt.create({
@@ -3391,9 +3391,9 @@ const qn = (s, e = {
3391
3391
  coerce: !0
3392
3392
  }),
3393
3393
  bigint: (s) => Oe.create({ ...s, coerce: !0 }),
3394
- date: (s) => We.create({ ...s, coerce: !0 })
3395
- }, Or = E;
3396
- var w = /* @__PURE__ */ Object.freeze({
3394
+ date: (s) => Ve.create({ ...s, coerce: !0 })
3395
+ }, Or = C;
3396
+ var b = /* @__PURE__ */ Object.freeze({
3397
3397
  __proto__: null,
3398
3398
  defaultErrorMap: _t,
3399
3399
  setErrorMap: Pn,
@@ -3402,9 +3402,9 @@ var w = /* @__PURE__ */ Object.freeze({
3402
3402
  EMPTY_PATH: jn,
3403
3403
  addIssueToContext: g,
3404
3404
  ParseStatus: J,
3405
- INVALID: E,
3406
- DIRTY: Fi,
3407
- OK: Y,
3405
+ INVALID: C,
3406
+ DIRTY: Wi,
3407
+ OK: G,
3408
3408
  isAborted: Ns,
3409
3409
  isDirty: Ps,
3410
3410
  isValid: xt,
@@ -3416,27 +3416,27 @@ var w = /* @__PURE__ */ Object.freeze({
3416
3416
  return Ms;
3417
3417
  },
3418
3418
  ZodParsedType: f,
3419
- getParsedType: Ee,
3419
+ getParsedType: Ce,
3420
3420
  ZodType: I,
3421
3421
  ZodString: ie,
3422
3422
  ZodNumber: Ae,
3423
3423
  ZodBigInt: Oe,
3424
3424
  ZodBoolean: kt,
3425
- ZodDate: We,
3426
- ZodSymbol: Yt,
3427
- ZodUndefined: St,
3425
+ ZodDate: Ve,
3426
+ ZodSymbol: Gt,
3427
+ ZodUndefined: Et,
3428
3428
  ZodNull: Tt,
3429
3429
  ZodAny: nt,
3430
3430
  ZodUnknown: He,
3431
3431
  ZodNever: xe,
3432
- ZodVoid: Gt,
3432
+ ZodVoid: Yt,
3433
3433
  ZodArray: re,
3434
3434
  ZodObject: H,
3435
- ZodUnion: $t,
3435
+ ZodUnion: St,
3436
3436
  ZodDiscriminatedUnion: us,
3437
- ZodIntersection: Et,
3437
+ ZodIntersection: Ct,
3438
3438
  ZodTuple: he,
3439
- ZodRecord: Ct,
3439
+ ZodRecord: $t,
3440
3440
  ZodMap: Xt,
3441
3441
  ZodSet: Ke,
3442
3442
  ZodFunction: st,
@@ -3453,7 +3453,7 @@ var w = /* @__PURE__ */ Object.freeze({
3453
3453
  ZodCatch: Qt,
3454
3454
  ZodNaN: es,
3455
3455
  BRAND: Kn,
3456
- ZodBranded: Wi,
3456
+ ZodBranded: Vi,
3457
3457
  ZodPipeline: Rt,
3458
3458
  ZodReadonly: ts,
3459
3459
  custom: Ki,
@@ -3466,11 +3466,11 @@ var w = /* @__PURE__ */ Object.freeze({
3466
3466
  coerce: Ar,
3467
3467
  any: sr,
3468
3468
  array: ar,
3469
- bigint: Gn,
3470
- boolean: Yi,
3469
+ bigint: Yn,
3470
+ boolean: Gi,
3471
3471
  date: Xn,
3472
3472
  discriminatedUnion: lr,
3473
- effect: Si,
3473
+ effect: Ei,
3474
3474
  enum: br,
3475
3475
  function: gr,
3476
3476
  instanceof: qn,
@@ -3478,26 +3478,26 @@ var w = /* @__PURE__ */ Object.freeze({
3478
3478
  lazy: yr,
3479
3479
  literal: vr,
3480
3480
  map: mr,
3481
- nan: Yn,
3481
+ nan: Gn,
3482
3482
  nativeEnum: wr,
3483
3483
  never: nr,
3484
3484
  null: tr,
3485
3485
  nullable: kr,
3486
3486
  number: qi,
3487
3487
  object: or,
3488
- oboolean: Cr,
3489
- onumber: Er,
3488
+ oboolean: $r,
3489
+ onumber: Cr,
3490
3490
  optional: xr,
3491
- ostring: $r,
3491
+ ostring: Sr,
3492
3492
  pipeline: Tr,
3493
- preprocess: Sr,
3493
+ preprocess: Er,
3494
3494
  promise: _r,
3495
3495
  record: pr,
3496
3496
  set: fr,
3497
3497
  strictObject: cr,
3498
3498
  string: Ji,
3499
3499
  symbol: Qn,
3500
- transformer: Si,
3500
+ transformer: Ei,
3501
3501
  tuple: hr,
3502
3502
  undefined: er,
3503
3503
  union: dr,
@@ -3508,60 +3508,62 @@ var w = /* @__PURE__ */ Object.freeze({
3508
3508
  quotelessJson: Nn,
3509
3509
  ZodError: ne
3510
3510
  });
3511
- const hs = w.object({
3512
- assistantId: w.string(),
3513
- params: w.record(w.any()).default({}),
3514
- config: w.object({
3515
- historyKey: w.string().refine((s) => s.replace(/-/g, "_")).nullable().default("main"),
3516
- welcomeMessage: w.string().default("Hello! How can I help you today?"),
3517
- initialReplyMessage: w.string().nullable().default(null),
3518
- placement: w.enum(["left", "right"]).default("right"),
3519
- openChatButton: w.object({
3520
- imageSrc: w.string().optional(),
3521
- width: w.union([w.string(), w.number()]).default("48px"),
3522
- height: w.union([w.string(), w.number()]).default("48px"),
3523
- cta: w.string().optional()
3511
+ const hs = b.object({
3512
+ assistantId: b.string(),
3513
+ params: b.record(b.any()).default({}),
3514
+ config: b.object({
3515
+ historyKey: b.string().refine((s) => s.replace(/-/g, "_")).nullable().default("main"),
3516
+ welcomeMessage: b.string().default("Hello! How can I help you today?"),
3517
+ inactivityWarningMessage: b.string().default("Are you still there? The chat will end soon if we don't hear from you."),
3518
+ chatEndedMessage: b.string().default("The chat has ended. Please restart the chat to continue."),
3519
+ initialReplyMessage: b.string().nullable().default(null),
3520
+ placement: b.enum(["left", "right"]).default("right"),
3521
+ openChatButton: b.object({
3522
+ imageSrc: b.string().optional(),
3523
+ width: b.union([b.string(), b.number()]).default("48px"),
3524
+ height: b.union([b.string(), b.number()]).default("48px"),
3525
+ cta: b.string().optional()
3524
3526
  }).default({}),
3525
- chatWindow: w.object({
3526
- header: w.object({
3527
- text: w.string().nullable().default("AI Chat"),
3528
- imageSrc: w.string().optional()
3527
+ chatWindow: b.object({
3528
+ header: b.object({
3529
+ text: b.string().nullable().default("AI Chat"),
3530
+ imageSrc: b.string().optional()
3529
3531
  }).default({}),
3530
- showCloseButton: w.boolean().default(!0)
3532
+ showCloseButton: b.boolean().default(!0)
3531
3533
  }).default({}),
3532
- styles: w.object({
3533
- primaryColor: w.string().optional(),
3534
- textColor: w.string().optional(),
3535
- openChatButton: w.object({
3536
- backgroundColor: w.string().optional(),
3537
- iconColor: w.string().optional()
3534
+ styles: b.object({
3535
+ primaryColor: b.string().optional(),
3536
+ textColor: b.string().optional(),
3537
+ openChatButton: b.object({
3538
+ backgroundColor: b.string().optional(),
3539
+ iconColor: b.string().optional()
3538
3540
  }).optional(),
3539
- header: w.object({
3540
- backgroundColor: w.string().optional(),
3541
- textColor: w.string().optional()
3541
+ header: b.object({
3542
+ backgroundColor: b.string().optional(),
3543
+ textColor: b.string().optional()
3542
3544
  }).optional(),
3543
- button: w.object({
3544
- backgroundColor: w.string().optional(),
3545
- textColor: w.string().optional()
3545
+ button: b.object({
3546
+ backgroundColor: b.string().optional(),
3547
+ textColor: b.string().optional()
3546
3548
  }).optional(),
3547
- messages: w.object({
3548
- user: w.object({
3549
- backgroundColor: w.string().optional(),
3550
- textColor: w.string().optional()
3549
+ messages: b.object({
3550
+ user: b.object({
3551
+ backgroundColor: b.string().optional(),
3552
+ textColor: b.string().optional()
3551
3553
  }).optional(),
3552
- assistant: w.object({
3553
- backgroundColor: w.string().optional(),
3554
- textColor: w.string().optional()
3554
+ assistant: b.object({
3555
+ backgroundColor: b.string().optional(),
3556
+ textColor: b.string().optional()
3555
3557
  }).optional()
3556
3558
  }).optional()
3557
3559
  }).default({})
3558
3560
  }).default({}),
3559
- handlers: w.object({
3560
- functionCalls: w.record(
3561
- w.function().returns(w.union([w.any(), w.promise(w.any())]))
3561
+ handlers: b.object({
3562
+ functionCalls: b.record(
3563
+ b.function().returns(b.union([b.any(), b.promise(b.any())]))
3562
3564
  ).default({}),
3563
- enhancedContent: w.record(
3564
- w.function().returns(w.union([w.any(), w.promise(w.any())]))
3565
+ enhancedContent: b.record(
3566
+ b.function().returns(b.union([b.any(), b.promise(b.any())]))
3565
3567
  ).default({})
3566
3568
  }).default({})
3567
3569
  });
@@ -3582,7 +3584,7 @@ if (typeof window < "u") {
3582
3584
  };
3583
3585
  window.addEventListener("testPassive", null, Ti), window.removeEventListener("testPassive", null, Ti);
3584
3586
  }
3585
- var ss = typeof window < "u" && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1), Be = [], is = !1, Gi = -1, mt = void 0, De = void 0, ft = void 0, Xi = function(s) {
3587
+ var ss = typeof window < "u" && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1), Be = [], is = !1, Yi = -1, mt = void 0, Le = void 0, ft = void 0, Xi = function(s) {
3586
3588
  return Be.some(function(e) {
3587
3589
  return !!(e.options.allowTouchMove && e.options.allowTouchMove(s));
3588
3590
  });
@@ -3602,8 +3604,8 @@ var ss = typeof window < "u" && window.navigator && window.navigator.platform &&
3602
3604
  ft !== void 0 && (document.body.style.paddingRight = ft, ft = void 0), mt !== void 0 && (document.body.style.overflow = mt, mt = void 0);
3603
3605
  }, Pr = function() {
3604
3606
  return window.requestAnimationFrame(function() {
3605
- if (De === void 0) {
3606
- De = {
3607
+ if (Le === void 0) {
3608
+ Le = {
3607
3609
  position: document.body.style.position,
3608
3610
  top: document.body.style.top,
3609
3611
  left: document.body.style.left
@@ -3618,16 +3620,16 @@ var ss = typeof window < "u" && window.navigator && window.navigator.platform &&
3618
3620
  }
3619
3621
  });
3620
3622
  }, jr = function() {
3621
- if (De !== void 0) {
3623
+ if (Le !== void 0) {
3622
3624
  var s = -parseInt(document.body.style.top, 10), e = -parseInt(document.body.style.left, 10);
3623
- document.body.style.position = De.position, document.body.style.top = De.top, document.body.style.left = De.left, window.scrollTo(e, s), De = void 0;
3625
+ document.body.style.position = Le.position, document.body.style.top = Le.top, document.body.style.left = Le.left, window.scrollTo(e, s), Le = void 0;
3624
3626
  }
3625
3627
  }, Rr = function(s) {
3626
3628
  return s ? s.scrollHeight - s.scrollTop <= s.clientHeight : !1;
3627
3629
  }, Zr = function(s, e) {
3628
- var t = s.targetTouches[0].clientY - Gi;
3630
+ var t = s.targetTouches[0].clientY - Yi;
3629
3631
  return Xi(s.target) ? !1 : e && e.scrollTop === 0 && t > 0 || Rr(e) && t < 0 ? Bs(s) : (s.stopPropagation(), !0);
3630
- }, Lr = function(s, e) {
3632
+ }, Dr = function(s, e) {
3631
3633
  if (!s) {
3632
3634
  console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");
3633
3635
  return;
@@ -3640,12 +3642,12 @@ var ss = typeof window < "u" && window.navigator && window.navigator.platform &&
3640
3642
  options: e || {}
3641
3643
  };
3642
3644
  Be = [].concat(Ir(Be), [t]), ss ? Pr() : Mr(e), ss && (s.ontouchstart = function(i) {
3643
- i.targetTouches.length === 1 && (Gi = i.targetTouches[0].clientY);
3645
+ i.targetTouches.length === 1 && (Yi = i.targetTouches[0].clientY);
3644
3646
  }, s.ontouchmove = function(i) {
3645
3647
  i.targetTouches.length === 1 && Zr(i, s);
3646
3648
  }, is || (document.addEventListener("touchmove", Bs, Hs ? { passive: !1 } : void 0), is = !0));
3647
3649
  }
3648
- }, $i = function(s) {
3650
+ }, Si = function(s) {
3649
3651
  if (!s) {
3650
3652
  console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");
3651
3653
  return;
@@ -3653,21 +3655,21 @@ var ss = typeof window < "u" && window.navigator && window.navigator.platform &&
3653
3655
  Be = Be.filter(function(e) {
3654
3656
  return e.targetElement !== s;
3655
3657
  }), ss && (s.ontouchstart = null, s.ontouchmove = null, is && Be.length === 0 && (document.removeEventListener("touchmove", Bs, Hs ? { passive: !1 } : void 0), is = !1)), ss ? jr() : Nr();
3656
- }, Dr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3658
+ }, Lr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3657
3659
  function Qi(s) {
3658
3660
  return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
3659
3661
  }
3660
- var Fs = {};
3662
+ var Ws = {};
3661
3663
  (function(s) {
3662
3664
  function e(o) {
3663
3665
  o && o.options && clearTimeout(o.options.timer);
3664
3666
  }
3665
3667
  function t(o, c, l, h) {
3666
3668
  var p = { timer: void 0, lastArgs: [] }, d = function() {
3667
- for (var b = this, N = [], U = 0; U < arguments.length; U++)
3669
+ for (var w = this, N = [], U = 0; U < arguments.length; U++)
3668
3670
  N[U] = arguments[U];
3669
3671
  p.lastArgs = N, p.timer ? clearTimeout(p.timer) : c && l.apply(this, p.lastArgs), p.timer = setTimeout(function() {
3670
- c || l.apply(b, p.lastArgs), p.timer = void 0;
3672
+ c || l.apply(w, p.lastArgs), p.timer = void 0;
3671
3673
  }, o);
3672
3674
  };
3673
3675
  return h && (d = d.bind(h)), d.options = p, d;
@@ -3691,9 +3693,9 @@ var Fs = {};
3691
3693
  throw new Error("function applied debounce decorator should be a method");
3692
3694
  if (l.length === 1)
3693
3695
  throw new Error("method applied debounce decorator should have valid name");
3694
- var p = l[0], d = l[1], b = l.length === 3 && l[2] ? l[2] : Object.getOwnPropertyDescriptor(p, d);
3695
- if (b)
3696
- return n(o, c, b);
3696
+ var p = l[0], d = l[1], w = l.length === 3 && l[2] ? l[2] : Object.getOwnPropertyDescriptor(p, d);
3697
+ if (w)
3698
+ return n(o, c, w);
3697
3699
  i(o, c, p, d);
3698
3700
  }
3699
3701
  function a() {
@@ -3704,15 +3706,15 @@ var Fs = {};
3704
3706
  typeof o[0] == "number" && (l = o[0]);
3705
3707
  var p = void 0;
3706
3708
  return typeof o[0] == "object" && o[0].leading !== void 0 && (p = o[0]), 1 < o.length && typeof o[1] == "object" && o[1].leading !== void 0 && (p = o[1]), p && (h = p.leading), function() {
3707
- for (var d = [], b = 0; b < arguments.length; b++)
3708
- d[b] = arguments[b];
3709
+ for (var d = [], w = 0; w < arguments.length; w++)
3710
+ d[w] = arguments[w];
3709
3711
  return r.apply(void 0, [l, h].concat(d));
3710
3712
  };
3711
3713
  }
3712
3714
  return r.apply(void 0, [l, h].concat(o));
3713
3715
  }
3714
3716
  Object.defineProperty(s, "__esModule", { value: !0 }), s.cancel = e, s.debounce = a;
3715
- })(Fs);
3717
+ })(Ws);
3716
3718
  var zr = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, Zt = (s, e, t, i) => {
3717
3719
  for (var n = i > 1 ? void 0 : i ? Ur(e, t) : e, r = s.length - 1, a; r >= 0; r--)
3718
3720
  (a = s[r]) && (n = (i ? a(e, t, n) : a(n)) || n);
@@ -3721,14 +3723,14 @@ var zr = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, Zt = (s, e
3721
3723
  let qe = class extends Q {
3722
3724
  constructor() {
3723
3725
  super(...arguments), this.isOpen = !0, this.onResizeHandler = () => {
3724
- this.isOpen && window.innerWidth < 768 ? Lr(this) : $i(this);
3726
+ this.isOpen && window.innerWidth < 768 ? Dr(this) : Si(this);
3725
3727
  };
3726
3728
  }
3727
3729
  connectedCallback() {
3728
3730
  super.connectedCallback(), this.cleanOptions = hs.parse(this.options), this.onResizeHandler(), window.addEventListener("resize", this.onResizeHandler, { passive: !0 });
3729
3731
  }
3730
3732
  disconnectedCallback() {
3731
- super.disconnectedCallback(), $i(this), window.removeEventListener("resize", this.onResizeHandler);
3733
+ super.disconnectedCallback(), Si(this), window.removeEventListener("resize", this.onResizeHandler);
3732
3734
  }
3733
3735
  render() {
3734
3736
  const s = this.cleanOptions.config.placement !== "left", e = xi({
@@ -3756,7 +3758,7 @@ let qe = class extends Q {
3756
3758
  "md:flex": !0
3757
3759
  // override 'hidden' to ALWAYS show button on larger screens, whether chat is open or not
3758
3760
  });
3759
- return L`
3761
+ return D`
3760
3762
  <div
3761
3763
  class=${e}
3762
3764
  >
@@ -3789,7 +3791,7 @@ let qe = class extends Q {
3789
3791
  };
3790
3792
  qe.styles = [Ne];
3791
3793
  Zt([
3792
- F({ type: Object })
3794
+ W({ type: Object })
3793
3795
  ], qe.prototype, "options", 2);
3794
3796
  Zt([
3795
3797
  dt()
@@ -3798,14 +3800,14 @@ Zt([
3798
3800
  In("iai-chat")
3799
3801
  ], qe.prototype, "chatWindow", 2);
3800
3802
  Zt([
3801
- Fs.debounce(250)
3803
+ Ws.debounce(250)
3802
3804
  ], qe.prototype, "onResizeHandler", 2);
3803
3805
  qe = Zt([
3804
3806
  Pe("iai-chat-popup")
3805
3807
  ], qe);
3806
- const Vs = "https://ai-dev.anyonehome.xyz";
3808
+ const Fs = "https://ai-dev.anyonehome.xyz";
3807
3809
  async function Hr(s, e = {}) {
3808
- return await (await fetch(`${Vs}/threads`, {
3810
+ return await (await fetch(`${Fs}/threads`, {
3809
3811
  method: "POST",
3810
3812
  headers: {
3811
3813
  "Content-Type": "application/json"
@@ -3814,7 +3816,7 @@ async function Hr(s, e = {}) {
3814
3816
  })).json();
3815
3817
  }
3816
3818
  async function Br(s, e) {
3817
- return await (await fetch(`${Vs}/threads/${s}/messages`, {
3819
+ return await (await fetch(`${Fs}/threads/${s}/messages`, {
3818
3820
  method: "POST",
3819
3821
  headers: {
3820
3822
  "Content-Type": "application/json"
@@ -3822,8 +3824,8 @@ async function Br(s, e) {
3822
3824
  body: JSON.stringify({ content: e })
3823
3825
  })).json();
3824
3826
  }
3825
- async function Fr(s, e, t, i = !1) {
3826
- return await (await fetch(`${Vs}/threads/${s}/functions/${e}`, {
3827
+ async function Wr(s, e, t, i = !1) {
3828
+ return await (await fetch(`${Fs}/threads/${s}/functions/${e}`, {
3827
3829
  method: "POST",
3828
3830
  headers: {
3829
3831
  "Content-Type": "application/json"
@@ -3831,7 +3833,7 @@ async function Fr(s, e, t, i = !1) {
3831
3833
  body: JSON.stringify({ params: t, rerunLLM: i })
3832
3834
  })).json();
3833
3835
  }
3834
- function Vr(s) {
3836
+ function Fr(s) {
3835
3837
  return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, t) {
3836
3838
  var i = s.get(e);
3837
3839
  i ? i.push(t) : s.set(e, [t]);
@@ -3847,137 +3849,184 @@ function Vr(s) {
3847
3849
  });
3848
3850
  } };
3849
3851
  }
3850
- let Wr = class {
3851
- constructor(s, e = {}) {
3852
- if (this._assistantId = "", this._threadId = "", this._messages = [], this.isTyping = !1, this.inputDisabled = !1, this.onStorageEvent = (t) => {
3853
- var i;
3854
- const [n, r, a] = ((i = t.key) == null ? void 0 : i.split("-")) || [];
3855
- if (!(n !== "iaiChat" || r !== this.options.historyKey))
3856
- switch (a) {
3852
+ class Vr {
3853
+ constructor(e, t = {}) {
3854
+ if (this._assistantId = "", this._conversationDetails = null, this._messages = [], this.isTyping = !1, this.inputDisabled = !1, this.chatEndingWarningSent = !1, this.chatEnded = !1, this.onStorageEvent = (i) => {
3855
+ var n;
3856
+ const [r, a, o] = ((n = i.key) == null ? void 0 : n.split("-")) || [];
3857
+ if (!(r !== "iaiChat" || a !== this.options.historyKey))
3858
+ switch (o) {
3857
3859
  case "messageHistory":
3858
- this.onMessageHistoryStorageEvent(t);
3860
+ this.onMessageHistoryStorageEvent(i);
3861
+ break;
3862
+ case "conversation":
3863
+ this.setConversationDetails(JSON.parse(i.newValue || "null"), !0);
3859
3864
  break;
3860
- case "threadId":
3861
- this.setThreadId(JSON.parse(t.newValue || ""), !0);
3865
+ case "lastActivity":
3866
+ this.keepAlive(JSON.parse(i.newValue || "null"), !0);
3867
+ break;
3868
+ case "chatEndingWarningSent":
3869
+ this.setChatEndingWarningSent(JSON.parse(i.newValue || "false"), !0);
3870
+ break;
3871
+ case "chatEnded":
3872
+ this.setChatEnded(JSON.parse(i.newValue || "false"), !0);
3862
3873
  break;
3863
3874
  case "typing":
3864
- this.setTyping(JSON.parse(t.newValue || "false"), !0);
3875
+ this.setTyping(JSON.parse(i.newValue || "false"), !0);
3865
3876
  break;
3866
3877
  case "inputDisabled":
3867
- this.setInputDisabled(JSON.parse(t.newValue || "false"), !0);
3878
+ this.setInputDisabled(JSON.parse(i.newValue || "false"), !0);
3868
3879
  break;
3869
3880
  }
3870
- }, this._assistantId = s, this.options = {
3881
+ }, this._assistantId = e, this.options = {
3871
3882
  params: {},
3872
- simulateDelays: !0,
3873
- historyKey: null,
3874
- initialReplyMessage: null,
3875
- ...e
3876
- }, this._emitter = Vr(), this.on = this._emitter.on.bind(this._emitter), this.off = this._emitter.off.bind(this._emitter), e.historyKey) {
3877
- const t = this.storageGet("messageHistory");
3878
- t && (this._messages = t);
3879
- const i = this.storageGet("threadId");
3880
- i && this.setThreadId(i, !0);
3881
- const n = this.storageGet("typing");
3882
- n && this.setTyping(n, !0);
3883
- const r = this.storageGet("inputDisabled");
3884
- r && this.setInputDisabled(r, !0), window.addEventListener("storage", this.onStorageEvent);
3885
- }
3886
- e.events && Object.entries(e.events).forEach(([t, i]) => {
3887
- this._emitter.on(t, i);
3888
- });
3889
- }
3890
- onMessageHistoryStorageEvent(s) {
3891
- if (!s.newValue) {
3883
+ simulateDelays: !1,
3884
+ historyKey: "main",
3885
+ ...t
3886
+ }, this._emitter = Fr(), this.on = this._emitter.on.bind(this._emitter), this.off = this._emitter.off.bind(this._emitter), t.events && Object.entries(t.events).forEach(([i, n]) => {
3887
+ this._emitter.on(i, n);
3888
+ }), t.historyKey) {
3889
+ this._messages = this.storageGet("messageHistory", []);
3890
+ const i = this.storageGet("conversation");
3891
+ i && this.setConversationDetails(i, !0);
3892
+ const n = this.storageGet("chatEndingWarningSent");
3893
+ n && this.setChatEndingWarningSent(n, !0);
3894
+ const r = this.storageGet("chatEnded");
3895
+ r && this.setChatEnded(r, !0);
3896
+ const a = this.storageGet("typing");
3897
+ a && this.setTyping(a, !0);
3898
+ const o = this.storageGet("inputDisabled");
3899
+ o && this.setInputDisabled(o, !0);
3900
+ const c = this.storageGet("lastActivity");
3901
+ c && setTimeout(() => this.keepAlive(c, !0), 0), window.addEventListener("storage", this.onStorageEvent);
3902
+ }
3903
+ }
3904
+ onMessageHistoryStorageEvent(e) {
3905
+ if (!e.newValue) {
3892
3906
  this.reset();
3893
3907
  return;
3894
3908
  }
3895
- const e = JSON.parse(s.newValue), t = this._messages.map((n) => n.id), i = e.map((n) => n.id);
3896
- this._messages.forEach((n) => {
3897
- i.includes(n.id) || this._emitter.emit("messageRemoved", n.id);
3898
- }), e.forEach((n) => {
3899
- t.includes(n.id) || this._emitter.emit("message", n);
3900
- }), this._messages = e;
3909
+ const t = JSON.parse(e.newValue), i = this._messages.map((r) => r.id), n = t.map((r) => r.id);
3910
+ this._messages.forEach((r) => {
3911
+ n.includes(r.id) || this._emitter.emit("messageRemoved", r.id);
3912
+ }), t.forEach((r) => {
3913
+ i.includes(r.id) || this._emitter.emit("message", r);
3914
+ }), this._messages = t;
3901
3915
  }
3902
3916
  reset() {
3903
- this._threadId = "", this._messages = [], this.setTyping(!1), this.setInputDisabled(!1), this.storageRemoveAll(), this._emitter.emit("reset");
3917
+ this._messages = [], this.setConversationDetails(null), this.setTyping(!1), this.setInputDisabled(!1), this.setChatEnded(!1), this.stopInactivityTimers(), this.storageRemoveAll(), this._emitter.emit("reset");
3904
3918
  }
3905
3919
  destroy() {
3906
- this._emitter.all.clear(), window.removeEventListener("storage", this.onStorageEvent), this._emitter.emit("destroy");
3920
+ this._emitter.all.clear(), window.removeEventListener("storage", this.onStorageEvent), this.stopInactivityTimers(), this._emitter.emit("destroy");
3921
+ }
3922
+ stopInactivityTimers() {
3923
+ this._inactivityTimeout && (clearTimeout(this._inactivityTimeout), this._inactivityTimeout = null), this._inactivityWarningTimeout && (clearTimeout(this._inactivityWarningTimeout), this._inactivityWarningTimeout = null);
3924
+ }
3925
+ keepAlive(e = Date.now(), t = !1) {
3926
+ if (this.stopInactivityTimers(), this.chatEnded || !e)
3927
+ return;
3928
+ const { timeUntilChatEnds: i, timeUntilWarnAboutChatEnding: n } = this;
3929
+ if (!i)
3930
+ return;
3931
+ t || this.storageSet("lastActivity", e);
3932
+ const r = Date.now() - e;
3933
+ r > i ? (this.chatEnded || this._emitter.emit("chatEnded"), this.setChatEnded(!0)) : r > n ? (this.sendChatEndingWarning(), this._inactivityTimeout = setTimeout(() => {
3934
+ this.chatEnded || this._emitter.emit("chatEnded"), this.setChatEnded(!0);
3935
+ }, i - r)) : (this.setChatEndingWarningSent(!1), this._inactivityWarningTimeout = setTimeout(
3936
+ () => this.sendChatEndingWarning(),
3937
+ n - r
3938
+ ), this._inactivityTimeout = setTimeout(() => {
3939
+ this.chatEnded || this._emitter.emit("chatEnded"), this.setChatEnded(!0);
3940
+ }, i - r));
3907
3941
  }
3908
3942
  async startChat() {
3909
3943
  if (this.chatStarted)
3910
3944
  return;
3911
- const { id: s } = await Hr(this.assistantId, this.params);
3912
- if (!s)
3945
+ const { id: e, inactivityWaitTime: t, inactivityWarningTime: i } = await Hr(this.assistantId, this.params);
3946
+ if (!e)
3913
3947
  throw new Error("Could not start chat");
3914
- this.setThreadId(s);
3948
+ this.setConversationDetails({ threadId: e, inactivityWaitTime: t, inactivityWarningTime: i });
3915
3949
  }
3916
- addMessage(s) {
3917
- const e = {
3918
- ...s,
3919
- id: s.id || Math.random().toString(36).substring(7)
3950
+ addMessage(e) {
3951
+ const t = {
3952
+ ...e,
3953
+ id: e.id || Math.random().toString(36).substring(7)
3920
3954
  };
3921
- return this._messages.push(e), this.storageSet("messageHistory", this._messages), this._emitter.emit("message", e), e;
3955
+ return this._messages.push(t), this.storageSet("messageHistory", this._messages), this._emitter.emit("message", t), t;
3922
3956
  }
3923
- removeMessage(s) {
3924
- this._messages = this._messages.filter((e) => e.id !== s), this.storageSet("messageHistory", this._messages), this._emitter.emit("messageRemoved", s);
3957
+ removeMessage(e) {
3958
+ this._messages = this._messages.filter(
3959
+ (t) => t.id !== e
3960
+ ), this.storageSet("messageHistory", this._messages), this._emitter.emit("messageRemoved", e);
3925
3961
  }
3926
- async respondToFunctionCall(s, e, t) {
3962
+ async respondToFunctionCall(e, t, i) {
3927
3963
  this.simulateDelay(1800).then(() => this.setTyping(!0));
3928
- const i = this.simulateDelay(2e3);
3964
+ const n = this.simulateDelay(2e3);
3929
3965
  await this.insertMessagesWithSimulatedDelays(
3930
3966
  Promise.all([
3931
- Fr(this.threadId, s, e, t),
3932
- i
3933
- ]).then(([n]) => n)
3967
+ Wr(this.threadId, e, t, i),
3968
+ n
3969
+ ]).then(([r]) => r)
3934
3970
  );
3935
3971
  }
3936
- async sendUserMessage(s) {
3972
+ async sendUserMessage(e) {
3937
3973
  try {
3938
3974
  this.addMessage({
3939
3975
  role: "user",
3940
- content: s
3941
- }), this.simulateDelay(1800).then(() => this.setTyping(!0));
3942
- let e = this.simulateDelay(4800);
3976
+ content: e
3977
+ }), this.simulateDelay(1800).then(() => this._emitter.emit("typing", !0)), this.simulateDelay(1800).then(() => this.setTyping(!0));
3978
+ let t = this.simulateDelay(4800);
3943
3979
  if (!this.chatStarted) {
3944
- const { initialReplyMessage: n } = this.options;
3945
- n && (this.simulateDelay(3800).then(() => {
3980
+ const { initialReplyMessage: r } = this.options;
3981
+ r && (this.simulateDelay(3800).then(() => {
3946
3982
  this.addMessage({
3947
3983
  role: "assistant",
3948
- content: n
3984
+ content: r
3949
3985
  }), this.setTyping(!1);
3950
- }), this.simulateDelay(6200).then(() => this.setTyping(!0)), e = this.simulateDelay(8200)), await this.startChat();
3986
+ }), this.simulateDelay(6200).then(() => this.setTyping(!0)), t = this.simulateDelay(8200)), await this.startChat();
3951
3987
  }
3952
- const { messages: t, functions: i } = await this.insertMessagesWithSimulatedDelays(
3988
+ this.keepAlive();
3989
+ const { messages: i, functions: n } = await this.insertMessagesWithSimulatedDelays(
3953
3990
  Promise.all([
3954
- Br(this.threadId, s),
3955
- e
3956
- ]).then(([n]) => n)
3991
+ Br(this.threadId, e),
3992
+ t
3993
+ ]).then(([r]) => r)
3957
3994
  );
3958
- return { messages: t, functions: i };
3959
- } catch (e) {
3960
- throw console.error(e), new Error("There was an error sending the message");
3995
+ return { messages: i, functions: n };
3996
+ } catch (t) {
3997
+ throw console.error(t), new Error("There was an error sending the message");
3961
3998
  }
3962
3999
  }
3963
- setThreadId(s, e = !1) {
3964
- this._threadId = s, e || this.storageSet("threadId", s);
4000
+ setTyping(e, t = !1) {
4001
+ this.isTyping = e, this._emitter.emit("typing", e), t || this.storageSet("typing", e);
4002
+ }
4003
+ setConversationDetails(e, t = !1) {
4004
+ this._conversationDetails = e, t || this.storageSet("conversation", e);
3965
4005
  }
3966
- setTyping(s, e = !1) {
3967
- this.isTyping = s, this._emitter.emit("typing", s), e || this.storageSet("typing", s);
4006
+ setInputDisabled(e, t = !1) {
4007
+ this.inputDisabled = e, this._emitter.emit("inputDisabled", e), t || this.storageSet("inputDisabled", e);
3968
4008
  }
3969
- setInputDisabled(s, e = !1) {
3970
- this.inputDisabled = s, this._emitter.emit("inputDisabled", s), e || this.storageSet("inputDisabled", s);
4009
+ setChatEnded(e, t = !1) {
4010
+ this.chatEnded = e, t || this.storageSet("chatEnded", e);
3971
4011
  }
3972
- async insertMessagesWithSimulatedDelays(s) {
3973
- const e = await s;
3974
- if (e.error)
3975
- throw new Error(e.message);
3976
- const { messages: t, functions: i } = e;
3977
- return await Promise.all(t.map(async (n, r) => (await this.simulateDelay(1e3 * r), this.addMessage(n)))), this.setTyping(!1), i.forEach((n) => this._emitter.emit("functionCall", n)), { messages: t, functions: i };
4012
+ setChatEndingWarningSent(e, t = !1) {
4013
+ this.chatEndingWarningSent = e, t || this.storageSet("chatEndingWarningSent", e);
3978
4014
  }
3979
- simulateDelay(s) {
3980
- return this.options.simulateDelays ? new Promise((e) => setTimeout(e, s)) : Promise.resolve();
4015
+ sendChatEndingWarning() {
4016
+ this.chatEndingWarningSent || (this._emitter.emit("inactivityWarning"), this.setChatEndingWarningSent(!0));
4017
+ }
4018
+ async insertMessagesWithSimulatedDelays(e) {
4019
+ this._emitter.emit("typing", !0);
4020
+ const t = await e;
4021
+ if (t.error)
4022
+ throw new Error(t.message);
4023
+ const { messages: i, functions: n } = t;
4024
+ return await Promise.all(
4025
+ i.map(async (r, a) => (await this.simulateDelay(1e3 * a), this.addMessage(r)))
4026
+ ), this.setTyping(!1), n.forEach((r) => this._emitter.emit("functionCall", r)), { messages: i, functions: n };
4027
+ }
4028
+ simulateDelay(e) {
4029
+ return this.options.simulateDelays ? new Promise((t) => setTimeout(t, e)) : Promise.resolve();
3981
4030
  }
3982
4031
  get assistantId() {
3983
4032
  return this._assistantId;
@@ -3986,32 +4035,41 @@ let Wr = class {
3986
4035
  return this.options.params;
3987
4036
  }
3988
4037
  get threadId() {
3989
- return this._threadId;
4038
+ var e;
4039
+ return (e = this._conversationDetails) == null ? void 0 : e.threadId;
4040
+ }
4041
+ get timeUntilChatEnds() {
4042
+ const { inactivityWaitTime: e } = this._conversationDetails || {};
4043
+ return e ? e * 60 * 1e3 : null;
4044
+ }
4045
+ get timeUntilWarnAboutChatEnding() {
4046
+ const { inactivityWaitTime: e = 0, inactivityWarningTime: t = 0 } = this._conversationDetails || {};
4047
+ return (e - t) * 60 * 1e3;
3990
4048
  }
3991
4049
  get messages() {
3992
4050
  return this._messages;
3993
4051
  }
3994
4052
  get chatStarted() {
3995
- return !!this._threadId;
4053
+ return !!this.threadId;
3996
4054
  }
3997
- storageSet(s, e) {
3998
- this.options.historyKey && localStorage.setItem(`iaiChat-${this.options.historyKey}-${s}`, JSON.stringify(e));
4055
+ storageSet(e, t) {
4056
+ this.options.historyKey && localStorage.setItem(`iaiChat-${this.options.historyKey}-${e}`, JSON.stringify(t));
3999
4057
  }
4000
- storageGet(s) {
4058
+ storageGet(e, t = null) {
4001
4059
  if (!this.options.historyKey)
4002
4060
  return null;
4003
- const e = localStorage.getItem(`iaiChat-${this.options.historyKey}-${s}`);
4004
- return e ? JSON.parse(e) : null;
4061
+ const i = localStorage.getItem(`iaiChat-${this.options.historyKey}-${e}`);
4062
+ return i ? JSON.parse(i) : t;
4005
4063
  }
4006
- storageRemove(s) {
4007
- localStorage.removeItem(`iaiChat-${this.options.historyKey}-${s}`);
4064
+ storageRemove(e) {
4065
+ localStorage.removeItem(`iaiChat-${this.options.historyKey}-${e}`);
4008
4066
  }
4009
4067
  storageRemoveAll() {
4010
- this.options.historyKey && Object.keys(localStorage).forEach((s) => {
4011
- s.startsWith(`iaiChat-${this.options.historyKey}-`) && localStorage.removeItem(s);
4068
+ this.options.historyKey && Object.keys(localStorage).forEach((e) => {
4069
+ e.startsWith(`iaiChat-${this.options.historyKey}-`) && localStorage.removeItem(e);
4012
4070
  });
4013
4071
  }
4014
- };
4072
+ }
4015
4073
  function Kr(s) {
4016
4074
  return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, t) {
4017
4075
  var i = s.get(e);
@@ -4033,7 +4091,7 @@ function Kr(s) {
4033
4091
  * Copyright 2021 Google LLC
4034
4092
  * SPDX-License-Identifier: BSD-3-Clause
4035
4093
  */
4036
- function Ce(s, e, t) {
4094
+ function $e(s, e, t) {
4037
4095
  return s ? e(s) : t == null ? void 0 : t(s);
4038
4096
  }
4039
4097
  /**
@@ -4041,11 +4099,11 @@ function Ce(s, e, t) {
4041
4099
  * Copyright 2020 Google LLC
4042
4100
  * SPDX-License-Identifier: BSD-3-Clause
4043
4101
  */
4044
- const { I: Jr } = En, Ei = () => document.createComment(""), ht = (s, e, t) => {
4102
+ const { I: Jr } = Cn, Ci = () => document.createComment(""), ht = (s, e, t) => {
4045
4103
  var i;
4046
4104
  const n = s._$AA.parentNode, r = e === void 0 ? s._$AB : e._$AA;
4047
4105
  if (t === void 0) {
4048
- const a = n.insertBefore(Ei(), r), o = n.insertBefore(Ei(), r);
4106
+ const a = n.insertBefore(Ci(), r), o = n.insertBefore(Ci(), r);
4049
4107
  t = new Jr(a, o, s, s.options);
4050
4108
  } else {
4051
4109
  const a = t._$AB.nextSibling, o = t._$AM, c = o !== s;
@@ -4062,7 +4120,7 @@ const { I: Jr } = En, Ei = () => document.createComment(""), ht = (s, e, t) => {
4062
4120
  }
4063
4121
  }
4064
4122
  return t;
4065
- }, Le = (s, e, t = s) => (s._$AI(e, t), s), qr = {}, Yr = (s, e = qr) => s._$AH = e, Gr = (s) => s._$AH, Is = (s) => {
4123
+ }, De = (s, e, t = s) => (s._$AI(e, t), s), qr = {}, Gr = (s, e = qr) => s._$AH = e, Yr = (s) => s._$AH, Is = (s) => {
4066
4124
  var e;
4067
4125
  (e = s._$AP) == null || e.call(s, !1, !0);
4068
4126
  let t = s._$AA;
@@ -4077,7 +4135,7 @@ const { I: Jr } = En, Ei = () => document.createComment(""), ht = (s, e, t) => {
4077
4135
  * Copyright 2017 Google LLC
4078
4136
  * SPDX-License-Identifier: BSD-3-Clause
4079
4137
  */
4080
- const Ci = (s, e, t) => {
4138
+ const $i = (s, e, t) => {
4081
4139
  const i = /* @__PURE__ */ new Map();
4082
4140
  for (let n = e; n <= t; n++)
4083
4141
  i.set(s[n], n);
@@ -4100,48 +4158,48 @@ const Ci = (s, e, t) => {
4100
4158
  return this.dt(s, e, t).values;
4101
4159
  }
4102
4160
  update(s, [e, t, i]) {
4103
- const n = Gr(s), { values: r, keys: a } = this.dt(e, t, i);
4161
+ const n = Yr(s), { values: r, keys: a } = this.dt(e, t, i);
4104
4162
  if (!Array.isArray(n))
4105
4163
  return this.ut = a, r;
4106
4164
  const o = this.ut ?? (this.ut = []), c = [];
4107
- let l, h, p = 0, d = n.length - 1, b = 0, N = r.length - 1;
4108
- for (; p <= d && b <= N; )
4165
+ let l, h, p = 0, d = n.length - 1, w = 0, N = r.length - 1;
4166
+ for (; p <= d && w <= N; )
4109
4167
  if (n[p] === null)
4110
4168
  p++;
4111
4169
  else if (n[d] === null)
4112
4170
  d--;
4113
- else if (o[p] === a[b])
4114
- c[b] = Le(n[p], r[b]), p++, b++;
4171
+ else if (o[p] === a[w])
4172
+ c[w] = De(n[p], r[w]), p++, w++;
4115
4173
  else if (o[d] === a[N])
4116
- c[N] = Le(n[d], r[N]), d--, N--;
4174
+ c[N] = De(n[d], r[N]), d--, N--;
4117
4175
  else if (o[p] === a[N])
4118
- c[N] = Le(n[p], r[N]), ht(s, c[N + 1], n[p]), p++, N--;
4119
- else if (o[d] === a[b])
4120
- c[b] = Le(n[d], r[b]), ht(s, n[p], n[d]), d--, b++;
4121
- else if (l === void 0 && (l = Ci(a, b, N), h = Ci(o, p, d)), l.has(o[p]))
4176
+ c[N] = De(n[p], r[N]), ht(s, c[N + 1], n[p]), p++, N--;
4177
+ else if (o[d] === a[w])
4178
+ c[w] = De(n[d], r[w]), ht(s, n[p], n[d]), d--, w++;
4179
+ else if (l === void 0 && (l = $i(a, w, N), h = $i(o, p, d)), l.has(o[p]))
4122
4180
  if (l.has(o[d])) {
4123
- const U = h.get(a[b]), G = U !== void 0 ? n[U] : null;
4124
- if (G === null) {
4181
+ const U = h.get(a[w]), Y = U !== void 0 ? n[U] : null;
4182
+ if (Y === null) {
4125
4183
  const pe = ht(s, n[p]);
4126
- Le(pe, r[b]), c[b] = pe;
4184
+ De(pe, r[w]), c[w] = pe;
4127
4185
  } else
4128
- c[b] = Le(G, r[b]), ht(s, n[p], G), n[U] = null;
4129
- b++;
4186
+ c[w] = De(Y, r[w]), ht(s, n[p], Y), n[U] = null;
4187
+ w++;
4130
4188
  } else
4131
4189
  Is(n[d]), d--;
4132
4190
  else
4133
4191
  Is(n[p]), p++;
4134
- for (; b <= N; ) {
4192
+ for (; w <= N; ) {
4135
4193
  const U = ht(s, c[N + 1]);
4136
- Le(U, r[b]), c[b++] = U;
4194
+ De(U, r[w]), c[w++] = U;
4137
4195
  }
4138
4196
  for (; p <= d; ) {
4139
4197
  const U = n[p++];
4140
4198
  U !== null && Is(U);
4141
4199
  }
4142
- return this.ut = a, Yr(s, c), le;
4200
+ return this.ut = a, Gr(s, c), le;
4143
4201
  }
4144
- }), Nt = L`
4202
+ }), Nt = D`
4145
4203
  <svg
4146
4204
  xmlns="http://www.w3.org/2000/svg"
4147
4205
  viewBox="0 0 24 24"
@@ -4153,7 +4211,7 @@ const Ci = (s, e, t) => {
4153
4211
  <path
4154
4212
  d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
4155
4213
  </svg>
4156
- `, Qr = L`
4214
+ `, Qr = D`
4157
4215
  <svg
4158
4216
  xmlns="http://www.w3.org/2000/svg"
4159
4217
  viewBox="0 0 24 24"
@@ -4165,7 +4223,7 @@ const Ci = (s, e, t) => {
4165
4223
  <path
4166
4224
  d="M12,3C17.5,3 22,6.58 22,11C22,15.42 17.5,19 12,19C10.76,19 9.57,18.82 8.47,18.5C5.55,21 2,21 2,21C4.33,18.67 4.7,17.1 4.75,16.5C3.05,15.07 2,13.13 2,11C2,6.58 6.5,3 12,3Z"/>
4167
4225
  </svg>
4168
- `, ea = L`
4226
+ `, ea = D`
4169
4227
  <svg
4170
4228
  xmlns="http://www.w3.org/2000/svg"
4171
4229
  viewBox="0 0 24 24"
@@ -4176,7 +4234,7 @@ const Ci = (s, e, t) => {
4176
4234
  <title>send</title>
4177
4235
  <path d="M2,21L23,12L2,3V10L17,12L2,14V21Z"/>
4178
4236
  </svg>
4179
- `, ta = L`
4237
+ `, ta = D`
4180
4238
  <svg
4181
4239
  xmlns="http://www.w3.org/2000/svg"
4182
4240
  viewBox="0 0 24 24"
@@ -4199,10 +4257,10 @@ var sa = Object.defineProperty, ia = Object.getOwnPropertyDescriptor, ke = (s, e
4199
4257
  if (e.has(s))
4200
4258
  throw TypeError("Cannot add the same private member more than once");
4201
4259
  e instanceof WeakSet ? e.add(s) : e.set(s, t);
4202
- }, Oi = (s, e, t, i) => (en(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t), $e, Bt;
4260
+ }, Oi = (s, e, t, i) => (en(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t), Se, Bt;
4203
4261
  let oe = class extends Q {
4204
4262
  constructor() {
4205
- super(), Ai(this, $e, void 0), Ai(this, Bt, Promise.resolve()), this.disableInput = !1, this.showTyping = !1, this.messages = [], this.inputValue = "", this.internalDisableInput = !1, this.internalShowTyping = !1, this._emitter = Kr(), this._emitter.on("*", (s, e) => this.dispatchEvent(
4263
+ super(), Ai(this, Se, void 0), Ai(this, Bt, Promise.resolve()), this.disableInput = !1, this.showTyping = !1, this.messages = [], this.inputValue = "", this.internalDisableInput = !1, this.internalShowTyping = !1, this._emitter = Kr(), this._emitter.on("*", (s, e) => this.dispatchEvent(
4206
4264
  new CustomEvent(`iai-chat-${s.toString()}`, {
4207
4265
  bubbles: !0,
4208
4266
  // Allow events to be reached through other elements
@@ -4217,22 +4275,32 @@ let oe = class extends Q {
4217
4275
  connectedCallback() {
4218
4276
  super.connectedCallback(), this.cleanOptions = hs.parse(this.options || {});
4219
4277
  const { assistantId: s, params: e, config: t } = this.cleanOptions;
4220
- Oi(this, $e, new Wr(s, {
4278
+ Oi(this, Se, new Vr(s, {
4221
4279
  params: e,
4222
4280
  simulateDelays: !0,
4223
4281
  historyKey: t.historyKey,
4224
4282
  initialReplyMessage: t.initialReplyMessage
4225
- })), this.updateMessages(Xe(this, $e).messages), this.showTyping = Xe(this, $e).isTyping, this.disableInput = Xe(this, $e).inputDisabled, this.chatManager.on("functionCall", ({ id: i, name: n, params: r }) => {
4283
+ })), this.updateMessages(Xe(this, Se).messages), this.showTyping = Xe(this, Se).isTyping, this.disableInput = Xe(this, Se).inputDisabled, this.chatManager.on("functionCall", ({ id: i, name: n, params: r }) => {
4226
4284
  const a = this.cleanOptions.handlers.functionCalls[n];
4227
4285
  if (!a) {
4228
4286
  console.warn(`No function call handler found for ${n}`);
4229
4287
  return;
4230
4288
  }
4231
- a.call(this, { id: i, params: r, html: L, chatWindow: this });
4289
+ a.call(this, { id: i, params: r, html: D, chatWindow: this });
4232
4290
  }), this.chatManager.on("typing", (i) => {
4233
4291
  this.showTyping = i;
4234
4292
  }), this.chatManager.on("inputDisabled", (i) => {
4235
4293
  this.disableInput = i;
4294
+ }), this.chatManager.on("inactivityWarning", () => {
4295
+ this.addMessage({
4296
+ role: "assistant",
4297
+ content: t.inactivityWarningMessage
4298
+ });
4299
+ }), this.chatManager.on("chatEnded", () => {
4300
+ this.addMessage({
4301
+ role: "system",
4302
+ content: t.chatEndedMessage
4303
+ }), this.setInputDisabled(!0);
4236
4304
  }), this.chatManager.on("message", (i) => {
4237
4305
  this.updateMessages([...this.messages, i]);
4238
4306
  }), this.chatManager.on("messageRemoved", (i) => {
@@ -4242,7 +4310,7 @@ let oe = class extends Q {
4242
4310
  }), this.chatManager.on("*", this._emitter.emit);
4243
4311
  }
4244
4312
  disconnectedCallback() {
4245
- super.disconnectedCallback(), this._emitter.all.clear(), Xe(this, $e).destroy();
4313
+ super.disconnectedCallback(), this._emitter.all.clear(), Xe(this, Se).destroy();
4246
4314
  }
4247
4315
  firstUpdated() {
4248
4316
  this.focusOnInput();
@@ -4252,14 +4320,14 @@ let oe = class extends Q {
4252
4320
  }
4253
4321
  render() {
4254
4322
  const { header: s, showCloseButton: e } = this.cleanOptions.config.chatWindow;
4255
- return L`
4323
+ return D`
4256
4324
  <div class="flex flex-col h-full rounded-lg shadow-lg bg-white">
4257
4325
  <div class="header rounded-t-lg text-lg p-2 flex justify-between items-center">
4258
4326
  <div class="flex flex-row h-full items-center">
4259
- ${Ce(s.imageSrc, () => L`
4327
+ ${$e(s.imageSrc, () => D`
4260
4328
  <img src="${s.imageSrc}" alt="Logo" style="max-height: 100%" />
4261
4329
  `)}
4262
- ${Ce(s.text, () => L`
4330
+ ${$e(s.text, () => D`
4263
4331
  <span class="text-lg font-semibold ml-2">${s.text}</span>
4264
4332
  `)}
4265
4333
  </div>
@@ -4273,7 +4341,7 @@ let oe = class extends Q {
4273
4341
  ${ta}
4274
4342
  </button>
4275
4343
 
4276
- ${Ce(e, () => L`
4344
+ ${$e(e, () => D`
4277
4345
  <button class="mr-2 h-6 focus:outline-none" @click="${this.closeChat}">
4278
4346
  ${Nt}
4279
4347
  </button>
@@ -4283,7 +4351,7 @@ let oe = class extends Q {
4283
4351
  <div id="chat-container" class="flex-1 overflow-y-auto p-4 flex flex-col gap-2">
4284
4352
  ${this.chatMessage({ id: "intro-message", role: "assistant", content: this.cleanOptions.config.welcomeMessage })}
4285
4353
 
4286
- ${Xr(this.messages, (t) => t.id, (t, i) => L`
4354
+ ${Xr(this.messages, (t) => t.id, (t, i) => D`
4287
4355
  <div>
4288
4356
  ${this.nameLabel(i)}
4289
4357
  ${this.chatMessage(t)}
@@ -4323,7 +4391,7 @@ let oe = class extends Q {
4323
4391
  }
4324
4392
  // Getters
4325
4393
  get chatManager() {
4326
- return Xe(this, $e);
4394
+ return Xe(this, Se);
4327
4395
  }
4328
4396
  resetChat() {
4329
4397
  this.chatManager.reset();
@@ -4381,28 +4449,28 @@ let oe = class extends Q {
4381
4449
  if (e.role !== "assistant")
4382
4450
  return null;
4383
4451
  const t = e.name || "Assistant", i = this.messages[s - 1];
4384
- return ((i == null ? void 0 : i.name) || "Assistant") === t ? null : L`
4452
+ return ((i == null ? void 0 : i.name) || "Assistant") === t ? null : D`
4385
4453
  <div class="name text-sm">${e.name || "Assistant"}</div>
4386
4454
  `;
4387
4455
  }
4388
4456
  chatMessage(s) {
4389
4457
  switch (s.role) {
4390
4458
  case "assistant":
4391
- return L`
4459
+ return D`
4392
4460
  <iai-chat-message-assistant
4393
4461
  id="message-${s.id}"
4394
4462
  .content="${s.content}"
4395
4463
  ></iai-chat-message-assistant>
4396
4464
  `;
4397
4465
  case "user":
4398
- return L`
4466
+ return D`
4399
4467
  <iai-chat-message-user
4400
4468
  id="message-${s.id}"
4401
4469
  .content="${s.content}"
4402
4470
  ></iai-chat-message-user>
4403
4471
  `;
4404
4472
  case "system":
4405
- return L`
4473
+ return D`
4406
4474
  <iai-chat-message-system
4407
4475
  id="message-${s.id}"
4408
4476
  .content="${s.content}"
@@ -4419,7 +4487,7 @@ let oe = class extends Q {
4419
4487
  this._emitter.emit("close");
4420
4488
  }
4421
4489
  };
4422
- $e = /* @__PURE__ */ new WeakMap();
4490
+ Se = /* @__PURE__ */ new WeakMap();
4423
4491
  Bt = /* @__PURE__ */ new WeakMap();
4424
4492
  oe.styles = [Ne, ot`
4425
4493
  .header {
@@ -4439,13 +4507,13 @@ oe.styles = [Ne, ot`
4439
4507
  }
4440
4508
  `];
4441
4509
  ke([
4442
- F({ type: Object })
4510
+ W({ type: Object })
4443
4511
  ], oe.prototype, "options", 2);
4444
4512
  ke([
4445
- F()
4513
+ W()
4446
4514
  ], oe.prototype, "disableInput", 2);
4447
4515
  ke([
4448
- F()
4516
+ W()
4449
4517
  ], oe.prototype, "showTyping", 2);
4450
4518
  ke([
4451
4519
  dt()
@@ -4460,7 +4528,7 @@ ke([
4460
4528
  dt()
4461
4529
  ], oe.prototype, "internalShowTyping", 2);
4462
4530
  ke([
4463
- Fs.debounce(1)
4531
+ Ws.debounce(1)
4464
4532
  ], oe.prototype, "scrollChatToBottom", 1);
4465
4533
  oe = ke([
4466
4534
  Pe("iai-chat")
@@ -4475,7 +4543,7 @@ var tn = { exports: {} };
4475
4543
  scroll: 1,
4476
4544
  bodyScroll: 1,
4477
4545
  documentElementScroll: 1
4478
- }), d = {}, b = null, N = Object.freeze({
4546
+ }), d = {}, w = null, N = Object.freeze({
4479
4547
  autoResize: !0,
4480
4548
  bodyBackground: null,
4481
4549
  bodyMargin: null,
@@ -4523,7 +4591,7 @@ var tn = { exports: {} };
4523
4591
  function U() {
4524
4592
  return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
4525
4593
  }
4526
- function G(u, y, M) {
4594
+ function Y(u, y, M) {
4527
4595
  u.addEventListener(y, M, !1);
4528
4596
  }
4529
4597
  function pe(u, y, M) {
@@ -4539,7 +4607,7 @@ var tn = { exports: {} };
4539
4607
  var y = "Host page: " + u;
4540
4608
  return window.top !== window.self && (y = window.parentIFrame && window.parentIFrame.getId ? window.parentIFrame.getId() + ": " + u : "Nested host page: " + u), y;
4541
4609
  }
4542
- function Ge(u) {
4610
+ function Ye(u) {
4543
4611
  return o + "[" + X(u) + "]";
4544
4612
  }
4545
4613
  function fe(u) {
@@ -4555,21 +4623,21 @@ var tn = { exports: {} };
4555
4623
  ms("warn", u, y, !0);
4556
4624
  }
4557
4625
  function ms(u, y, M, x) {
4558
- x === !0 && typeof window.console == "object" && console[u](Ge(y), M);
4626
+ x === !0 && typeof window.console == "object" && console[u](Ye(y), M);
4559
4627
  }
4560
4628
  function dn(u) {
4561
4629
  function y() {
4562
4630
  function v() {
4563
- Qs(R), Ys($), Re("onResized", R);
4631
+ Qs(R), Gs(S), Re("onResized", R);
4564
4632
  }
4565
4633
  Z("Height"), Z("Width"), ei(v, R, "init");
4566
4634
  }
4567
4635
  function M() {
4568
- var v = se.slice(c).split(":"), C = v[1] ? parseInt(v[1], 10) : 0, D = d[v[0]] && d[v[0]].iframe, z = getComputedStyle(D);
4636
+ var v = se.slice(c).split(":"), $ = v[1] ? parseInt(v[1], 10) : 0, L = d[v[0]] && d[v[0]].iframe, z = getComputedStyle(L);
4569
4637
  return {
4570
- iframe: D,
4638
+ iframe: L,
4571
4639
  id: v[0],
4572
- height: C + x(z) + P(z),
4640
+ height: $ + x(z) + P(z),
4573
4641
  width: v[2],
4574
4642
  type: v[3]
4575
4643
  };
@@ -4577,43 +4645,43 @@ var tn = { exports: {} };
4577
4645
  function x(v) {
4578
4646
  if (v.boxSizing !== "border-box")
4579
4647
  return 0;
4580
- var C = v.paddingTop ? parseInt(v.paddingTop, 10) : 0, D = v.paddingBottom ? parseInt(v.paddingBottom, 10) : 0;
4581
- return C + D;
4648
+ var $ = v.paddingTop ? parseInt(v.paddingTop, 10) : 0, L = v.paddingBottom ? parseInt(v.paddingBottom, 10) : 0;
4649
+ return $ + L;
4582
4650
  }
4583
4651
  function P(v) {
4584
4652
  if (v.boxSizing !== "border-box")
4585
4653
  return 0;
4586
- var C = v.borderTopWidth ? parseInt(v.borderTopWidth, 10) : 0, D = v.borderBottomWidth ? parseInt(v.borderBottomWidth, 10) : 0;
4587
- return C + D;
4654
+ var $ = v.borderTopWidth ? parseInt(v.borderTopWidth, 10) : 0, L = v.borderBottomWidth ? parseInt(v.borderBottomWidth, 10) : 0;
4655
+ return $ + L;
4588
4656
  }
4589
4657
  function Z(v) {
4590
- var C = Number(d[$]["max" + v]), D = Number(d[$]["min" + v]), z = v.toLowerCase(), W = Number(R[z]);
4591
- O($, "Checking " + z + " is in range " + D + "-" + C), W < D && (W = D, O($, "Set " + z + " to min value")), W > C && (W = C, O($, "Set " + z + " to max value")), R[z] = "" + W;
4658
+ var $ = Number(d[S]["max" + v]), L = Number(d[S]["min" + v]), z = v.toLowerCase(), V = Number(R[z]);
4659
+ O(S, "Checking " + z + " is in range " + L + "-" + $), V < L && (V = L, O(S, "Set " + z + " to min value")), V > $ && (V = $, O(S, "Set " + z + " to max value")), R[z] = "" + V;
4592
4660
  }
4593
4661
  function de() {
4594
4662
  function v() {
4595
4663
  function z() {
4596
4664
  var q = 0, ve = !1;
4597
4665
  for (O(
4598
- $,
4599
- "Checking connection is from allowed list of origins: " + D
4600
- ); q < D.length; q++)
4601
- if (D[q] === C) {
4666
+ S,
4667
+ "Checking connection is from allowed list of origins: " + L
4668
+ ); q < L.length; q++)
4669
+ if (L[q] === $) {
4602
4670
  ve = !0;
4603
4671
  break;
4604
4672
  }
4605
4673
  return ve;
4606
4674
  }
4607
- function W() {
4608
- var q = d[$] && d[$].remoteHost;
4609
- return O($, "Checking connection is from: " + q), C === q;
4675
+ function V() {
4676
+ var q = d[S] && d[S].remoteHost;
4677
+ return O(S, "Checking connection is from: " + q), $ === q;
4610
4678
  }
4611
- return D.constructor === Array ? z() : W();
4679
+ return L.constructor === Array ? z() : V();
4612
4680
  }
4613
- var C = u.origin, D = d[$] && d[$].checkOrigin;
4614
- if (D && "" + C != "null" && !v())
4681
+ var $ = u.origin, L = d[S] && d[S].checkOrigin;
4682
+ if (L && "" + $ != "null" && !v())
4615
4683
  throw new Error(
4616
- "Unexpected message received from: " + C + " for " + R.iframe.id + ". Message was: " + u.data + ". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains."
4684
+ "Unexpected message received from: " + $ + " for " + R.iframe.id + ". Message was: " + u.data + ". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains."
4617
4685
  );
4618
4686
  return !0;
4619
4687
  }
@@ -4622,25 +4690,25 @@ var tn = { exports: {} };
4622
4690
  }
4623
4691
  function ge() {
4624
4692
  var v = R.type in { true: 1, false: 1, undefined: 1 };
4625
- return v && O($, "Ignoring init message from meta parent page"), v;
4693
+ return v && O(S, "Ignoring init message from meta parent page"), v;
4626
4694
  }
4627
4695
  function ye(v) {
4628
4696
  return se.slice(se.indexOf(":") + a + v);
4629
4697
  }
4630
- function Se(v) {
4698
+ function Ee(v) {
4631
4699
  O(
4632
- $,
4700
+ S,
4633
4701
  "onMessage passed: {iframe: " + R.iframe.id + ", message: " + v + "}"
4634
4702
  ), Re("onMessage", {
4635
4703
  iframe: R.iframe,
4636
4704
  message: JSON.parse(v)
4637
- }), O($, "--");
4705
+ }), O(S, "--");
4638
4706
  }
4639
4707
  function ws() {
4640
- var v = document.body.getBoundingClientRect(), C = R.iframe.getBoundingClientRect();
4708
+ var v = document.body.getBoundingClientRect(), $ = R.iframe.getBoundingClientRect();
4641
4709
  return JSON.stringify({
4642
- iframeHeight: C.height,
4643
- iframeWidth: C.width,
4710
+ iframeHeight: $.height,
4711
+ iframeWidth: $.width,
4644
4712
  clientHeight: Math.max(
4645
4713
  document.documentElement.clientHeight,
4646
4714
  window.innerHeight || 0
@@ -4649,8 +4717,8 @@ var tn = { exports: {} };
4649
4717
  document.documentElement.clientWidth,
4650
4718
  window.innerWidth || 0
4651
4719
  ),
4652
- offsetTop: parseInt(C.top - v.top, 10),
4653
- offsetLeft: parseInt(C.left - v.left, 10),
4720
+ offsetTop: parseInt($.top - v.top, 10),
4721
+ offsetLeft: parseInt($.left - v.left, 10),
4654
4722
  scrollTop: window.pageYOffset,
4655
4723
  scrollLeft: window.pageXOffset,
4656
4724
  documentHeight: document.documentElement.clientHeight,
@@ -4659,52 +4727,52 @@ var tn = { exports: {} };
4659
4727
  windowWidth: window.innerWidth
4660
4728
  });
4661
4729
  }
4662
- function Dt(v, C) {
4663
- function D() {
4664
- ce("Send Page Info", "pageInfo:" + ws(), v, C);
4730
+ function Lt(v, $) {
4731
+ function L() {
4732
+ ce("Send Page Info", "pageInfo:" + ws(), v, $);
4665
4733
  }
4666
- un(D, 32, C);
4734
+ un(L, 32, $);
4667
4735
  }
4668
4736
  function _s() {
4669
- function v(W, q) {
4737
+ function v(V, q) {
4670
4738
  function ve() {
4671
- d[z] ? Dt(d[z].iframe, z) : C();
4739
+ d[z] ? Lt(d[z].iframe, z) : $();
4672
4740
  }
4673
4741
  ["scroll", "resize"].forEach(function(ri) {
4674
- O(z, W + ri + " listener for sendPageInfo"), q(window, ri, ve);
4742
+ O(z, V + ri + " listener for sendPageInfo"), q(window, ri, ve);
4675
4743
  });
4676
4744
  }
4677
- function C() {
4745
+ function $() {
4678
4746
  v("Remove ", pe);
4679
4747
  }
4680
- function D() {
4681
- v("Add ", G);
4748
+ function L() {
4749
+ v("Add ", Y);
4682
4750
  }
4683
- var z = $;
4684
- D(), d[z] && (d[z].stopPageInfo = C);
4751
+ var z = S;
4752
+ L(), d[z] && (d[z].stopPageInfo = $);
4685
4753
  }
4686
4754
  function xs() {
4687
- d[$] && d[$].stopPageInfo && (d[$].stopPageInfo(), delete d[$].stopPageInfo);
4755
+ d[S] && d[S].stopPageInfo && (d[S].stopPageInfo(), delete d[S].stopPageInfo);
4688
4756
  }
4689
4757
  function ks() {
4690
4758
  var v = !0;
4691
- return R.iframe === null && (ee($, "IFrame (" + R.id + ") not found"), v = !1), v;
4759
+ return R.iframe === null && (ee(S, "IFrame (" + R.id + ") not found"), v = !1), v;
4692
4760
  }
4693
4761
  function k(v) {
4694
- var C = v.getBoundingClientRect();
4695
- return qs($), {
4696
- x: Math.floor(Number(C.left) + Number(l.x)),
4697
- y: Math.floor(Number(C.top) + Number(l.y))
4762
+ var $ = v.getBoundingClientRect();
4763
+ return qs(S), {
4764
+ x: Math.floor(Number($.left) + Number(l.x)),
4765
+ y: Math.floor(Number($.top) + Number(l.y))
4698
4766
  };
4699
4767
  }
4700
- function S(v) {
4701
- function C() {
4702
- l = q, V(), O($, "--");
4768
+ function E(v) {
4769
+ function $() {
4770
+ l = q, F(), O(S, "--");
4703
4771
  }
4704
- function D() {
4772
+ function L() {
4705
4773
  return {
4706
- x: Number(R.width) + W.x,
4707
- y: Number(R.height) + W.y
4774
+ x: Number(R.width) + V.x,
4775
+ y: Number(R.height) + V.y
4708
4776
  };
4709
4777
  }
4710
4778
  function z() {
@@ -4712,70 +4780,70 @@ var tn = { exports: {} };
4712
4780
  q.x,
4713
4781
  q.y
4714
4782
  ) : ee(
4715
- $,
4783
+ S,
4716
4784
  "Unable to scroll to requested position, window.parentIFrame not found"
4717
4785
  );
4718
4786
  }
4719
- var W = v ? k(R.iframe) : { x: 0, y: 0 }, q = D();
4787
+ var V = v ? k(R.iframe) : { x: 0, y: 0 }, q = L();
4720
4788
  O(
4721
- $,
4722
- "Reposition requested from iFrame (offset x:" + W.x + " y:" + W.y + ")"
4723
- ), window.top === window.self ? C() : z();
4789
+ S,
4790
+ "Reposition requested from iFrame (offset x:" + V.x + " y:" + V.y + ")"
4791
+ ), window.top === window.self ? $() : z();
4724
4792
  }
4725
- function V() {
4726
- Re("onScroll", l) === !1 ? Gs() : Ys($);
4793
+ function F() {
4794
+ Re("onScroll", l) === !1 ? Ys() : Gs(S);
4727
4795
  }
4728
4796
  function K(v) {
4729
- function C() {
4797
+ function $() {
4730
4798
  var ve = k(q);
4731
4799
  O(
4732
- $,
4800
+ S,
4733
4801
  "Moving to in page link (#" + z + ") at x: " + ve.x + " y: " + ve.y
4734
4802
  ), l = {
4735
4803
  x: ve.x,
4736
4804
  y: ve.y
4737
- }, V(), O($, "--");
4805
+ }, F(), O(S, "--");
4738
4806
  }
4739
- function D() {
4807
+ function L() {
4740
4808
  window.parentIFrame ? window.parentIFrame.moveToAnchor(z) : O(
4741
- $,
4809
+ S,
4742
4810
  "In page link #" + z + " not found and window.parentIFrame not found"
4743
4811
  );
4744
4812
  }
4745
- var z = v.split("#")[1] || "", W = decodeURIComponent(z), q = document.getElementById(W) || document.getElementsByName(W)[0];
4746
- q ? C() : window.top === window.self ? O($, "In page link #" + z + " not found") : D();
4813
+ var z = v.split("#")[1] || "", V = decodeURIComponent(z), q = document.getElementById(V) || document.getElementsByName(V)[0];
4814
+ q ? $() : window.top === window.self ? O(S, "In page link #" + z + " not found") : L();
4747
4815
  }
4748
4816
  function te(v) {
4749
- var C = {};
4817
+ var $ = {};
4750
4818
  if (Number(R.width) === 0 && Number(R.height) === 0) {
4751
- var D = ye(9).split(":");
4752
- C = {
4753
- x: D[1],
4754
- y: D[0]
4819
+ var L = ye(9).split(":");
4820
+ $ = {
4821
+ x: L[1],
4822
+ y: L[0]
4755
4823
  };
4756
4824
  } else
4757
- C = {
4825
+ $ = {
4758
4826
  x: R.width,
4759
4827
  y: R.height
4760
4828
  };
4761
4829
  Re(v, {
4762
4830
  iframe: R.iframe,
4763
- screenX: Number(C.x),
4764
- screenY: Number(C.y),
4831
+ screenX: Number($.x),
4832
+ screenY: Number($.y),
4765
4833
  type: R.type
4766
4834
  });
4767
4835
  }
4768
- function Re(v, C) {
4769
- return fs($, v, C);
4836
+ function Re(v, $) {
4837
+ return fs(S, v, $);
4770
4838
  }
4771
- function Ss() {
4772
- switch (d[$] && d[$].firstRun && Es(), R.type) {
4839
+ function Es() {
4840
+ switch (d[S] && d[S].firstRun && Cs(), R.type) {
4773
4841
  case "close": {
4774
4842
  gs(R.iframe);
4775
4843
  break;
4776
4844
  }
4777
4845
  case "message": {
4778
- Se(ye(6));
4846
+ Ee(ye(6));
4779
4847
  break;
4780
4848
  }
4781
4849
  case "mouseenter": {
@@ -4787,21 +4855,21 @@ var tn = { exports: {} };
4787
4855
  break;
4788
4856
  }
4789
4857
  case "autoResize": {
4790
- d[$].autoResize = JSON.parse(ye(9));
4858
+ d[S].autoResize = JSON.parse(ye(9));
4791
4859
  break;
4792
4860
  }
4793
4861
  case "scrollTo": {
4794
- S(!1);
4862
+ E(!1);
4795
4863
  break;
4796
4864
  }
4797
4865
  case "scrollToOffset": {
4798
- S(!0);
4866
+ E(!0);
4799
4867
  break;
4800
4868
  }
4801
4869
  case "pageInfo": {
4802
- Dt(
4803
- d[$] && d[$].iframe,
4804
- $
4870
+ Lt(
4871
+ d[S] && d[S].iframe,
4872
+ S
4805
4873
  ), _s();
4806
4874
  break;
4807
4875
  }
@@ -4828,12 +4896,12 @@ var tn = { exports: {} };
4828
4896
  }
4829
4897
  }
4830
4898
  function Ts(v) {
4831
- var C = !0;
4832
- return d[v] || (C = !1, ee(
4899
+ var $ = !0;
4900
+ return d[v] || ($ = !1, ee(
4833
4901
  R.type + " No settings for " + v + ". Message was: " + se
4834
- )), C;
4902
+ )), $;
4835
4903
  }
4836
- function $s() {
4904
+ function Ss() {
4837
4905
  for (var v in d)
4838
4906
  ce(
4839
4907
  "iFrame requested init",
@@ -4842,11 +4910,11 @@ var tn = { exports: {} };
4842
4910
  v
4843
4911
  );
4844
4912
  }
4845
- function Es() {
4846
- d[$] && (d[$].firstRun = !1);
4913
+ function Cs() {
4914
+ d[S] && (d[S].firstRun = !1);
4847
4915
  }
4848
- var se = u.data, R = {}, $ = null;
4849
- se === "[iFrameResizerChild]Ready" ? $s() : je() ? (R = M(), $ = R.id, d[$] && (d[$].loaded = !0), !ge() && Ts($) && (O($, "Received: " + se), ks() && de() && Ss())) : Ks($, "Ignored: " + se);
4916
+ var se = u.data, R = {}, S = null;
4917
+ se === "[iFrameResizerChild]Ready" ? Ss() : je() ? (R = M(), S = R.id, d[S] && (d[S].loaded = !0), !ge() && Ts(S) && (O(S, "Received: " + se), ks() && de() && Es())) : Ks(S, "Ignored: " + se);
4850
4918
  }
4851
4919
  function fs(u, y, M) {
4852
4920
  var x = null, P = null;
@@ -4886,13 +4954,13 @@ var tn = { exports: {} };
4886
4954
  "Get page position: " + l.x + "," + l.y
4887
4955
  ));
4888
4956
  }
4889
- function Ys(u) {
4957
+ function Gs(u) {
4890
4958
  l !== null && (window.scrollTo(l.x, l.y), O(
4891
4959
  u,
4892
4960
  "Set page position: " + l.x + "," + l.y
4893
- ), Gs());
4961
+ ), Ys());
4894
4962
  }
4895
- function Gs() {
4963
+ function Ys() {
4896
4964
  l = null;
4897
4965
  }
4898
4966
  function Xs(u) {
@@ -4930,11 +4998,11 @@ var tn = { exports: {} };
4930
4998
  }
4931
4999
  function ce(u, y, M, x, P) {
4932
5000
  function Z() {
4933
- var Se = d[x] && d[x].targetOrigin;
5001
+ var Ee = d[x] && d[x].targetOrigin;
4934
5002
  O(
4935
5003
  x,
4936
- "[" + u + "] Sending msg to iframe[" + x + "] (" + y + ") targetOrigin: " + Se
4937
- ), M.contentWindow.postMessage(o + y, Se);
5004
+ "[" + u + "] Sending msg to iframe[" + x + "] (" + y + ") targetOrigin: " + Ee
5005
+ ), M.contentWindow.postMessage(o + y, Ee);
4938
5006
  }
4939
5007
  function de() {
4940
5008
  ee(x, "[" + u + "] IFrame(" + x + ") not found");
@@ -4943,14 +5011,14 @@ var tn = { exports: {} };
4943
5011
  M && "contentWindow" in M && M.contentWindow !== null ? Z() : de();
4944
5012
  }
4945
5013
  function ge() {
4946
- function Se() {
5014
+ function Ee() {
4947
5015
  d[x] && !d[x].loaded && !ye && (ye = !0, ee(
4948
5016
  x,
4949
5017
  "IFrame has not responded within " + d[x].warningTimeout / 1e3 + " seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."
4950
5018
  ));
4951
5019
  }
4952
5020
  P && d[x] && d[x].warningTimeout && (d[x].msgTimeout = setTimeout(
4953
- Se,
5021
+ Ee,
4954
5022
  d[x].warningTimeout
4955
5023
  ));
4956
5024
  }
@@ -4965,29 +5033,29 @@ var tn = { exports: {} };
4965
5033
  }
4966
5034
  function si(u, y) {
4967
5035
  function M() {
4968
- function S(K) {
5036
+ function E(K) {
4969
5037
  var te = d[k][K];
4970
5038
  te !== 1 / 0 && te !== 0 && (u.style[K] = ln(te) ? te + "px" : te, O(k, "Set " + K + " = " + u.style[K]));
4971
5039
  }
4972
- function V(K) {
5040
+ function F(K) {
4973
5041
  if (d[k]["min" + K] > d[k]["max" + K])
4974
5042
  throw new Error(
4975
5043
  "Value for min" + K + " can not be greater than max" + K
4976
5044
  );
4977
5045
  }
4978
- V("Height"), V("Width"), S("maxHeight"), S("minHeight"), S("maxWidth"), S("minWidth");
5046
+ F("Height"), F("Width"), E("maxHeight"), E("minHeight"), E("maxWidth"), E("minWidth");
4979
5047
  }
4980
5048
  function x() {
4981
- var S = y && y.id || N.id + t++;
4982
- return document.getElementById(S) !== null && (S += t++), S;
5049
+ var E = y && y.id || N.id + t++;
5050
+ return document.getElementById(E) !== null && (E += t++), E;
4983
5051
  }
4984
- function P(S) {
4985
- if (typeof S != "string")
5052
+ function P(E) {
5053
+ if (typeof E != "string")
4986
5054
  throw new TypeError("Invaild id for iFrame. Expected String");
4987
- return S === "" && (u.id = S = x(), i = (y || {}).log, O(
4988
- S,
4989
- "Added missing iframe ID: " + S + " (" + u.src + ")"
4990
- )), S;
5055
+ return E === "" && (u.id = E = x(), i = (y || {}).log, O(
5056
+ E,
5057
+ "Added missing iframe ID: " + E + " (" + u.src + ")"
5058
+ )), E;
4991
5059
  }
4992
5060
  function Z() {
4993
5061
  switch (O(
@@ -5012,8 +5080,8 @@ var tn = { exports: {} };
5012
5080
  (typeof (d[k] && d[k].bodyMargin) == "number" || (d[k] && d[k].bodyMargin) === "0") && (d[k].bodyMarginV1 = d[k].bodyMargin, d[k].bodyMargin = "" + d[k].bodyMargin + "px");
5013
5081
  }
5014
5082
  function je() {
5015
- var S = d[k] && d[k].firstRun, V = d[k] && d[k].heightCalculationMethod in p;
5016
- !S && V && Xs({ iframe: u, height: 0, width: 0, type: "init" });
5083
+ var E = d[k] && d[k].firstRun, F = d[k] && d[k].heightCalculationMethod in p;
5084
+ !E && F && Xs({ iframe: u, height: 0, width: 0, type: "init" });
5017
5085
  }
5018
5086
  function ge() {
5019
5087
  d[k] && (d[k].iframe.iFrameResizer = {
@@ -5028,72 +5096,72 @@ var tn = { exports: {} };
5028
5096
  "resize",
5029
5097
  d[k].iframe
5030
5098
  ),
5031
- moveToAnchor: function(S) {
5099
+ moveToAnchor: function(E) {
5032
5100
  ce(
5033
5101
  "Move to anchor",
5034
- "moveToAnchor:" + S,
5102
+ "moveToAnchor:" + E,
5035
5103
  d[k].iframe,
5036
5104
  k
5037
5105
  );
5038
5106
  },
5039
- sendMessage: function(S) {
5040
- S = JSON.stringify(S), ce(
5107
+ sendMessage: function(E) {
5108
+ E = JSON.stringify(E), ce(
5041
5109
  "Send Message",
5042
- "message:" + S,
5110
+ "message:" + E,
5043
5111
  d[k].iframe,
5044
5112
  k
5045
5113
  );
5046
5114
  }
5047
5115
  });
5048
5116
  }
5049
- function ye(S) {
5050
- function V() {
5051
- ce("iFrame.onload", S, u, e, !0), je();
5117
+ function ye(E) {
5118
+ function F() {
5119
+ ce("iFrame.onload", E, u, e, !0), je();
5052
5120
  }
5053
5121
  function K(Re) {
5054
5122
  if (u.parentNode) {
5055
- var Ss = new Re(function(Ts) {
5056
- Ts.forEach(function($s) {
5057
- var Es = Array.prototype.slice.call($s.removedNodes);
5058
- Es.forEach(function(se) {
5123
+ var Es = new Re(function(Ts) {
5124
+ Ts.forEach(function(Ss) {
5125
+ var Cs = Array.prototype.slice.call(Ss.removedNodes);
5126
+ Cs.forEach(function(se) {
5059
5127
  se === u && gs(u);
5060
5128
  });
5061
5129
  });
5062
5130
  });
5063
- Ss.observe(u.parentNode, {
5131
+ Es.observe(u.parentNode, {
5064
5132
  childList: !0
5065
5133
  });
5066
5134
  }
5067
5135
  }
5068
5136
  var te = U();
5069
- te && K(te), G(u, "load", V), ce("init", S, u, e, !0);
5137
+ te && K(te), Y(u, "load", F), ce("init", E, u, e, !0);
5070
5138
  }
5071
- function Se(S) {
5072
- if (typeof S != "object")
5139
+ function Ee(E) {
5140
+ if (typeof E != "object")
5073
5141
  throw new TypeError("Options is not an object");
5074
5142
  }
5075
- function ws(S) {
5076
- for (var V in N)
5077
- Object.prototype.hasOwnProperty.call(N, V) && (d[k][V] = Object.prototype.hasOwnProperty.call(
5078
- S,
5079
- V
5080
- ) ? S[V] : N[V]);
5143
+ function ws(E) {
5144
+ for (var F in N)
5145
+ Object.prototype.hasOwnProperty.call(N, F) && (d[k][F] = Object.prototype.hasOwnProperty.call(
5146
+ E,
5147
+ F
5148
+ ) ? E[F] : N[F]);
5081
5149
  }
5082
- function Dt(S) {
5083
- return S === "" || S.match(/^(about:blank|javascript:|file:\/\/)/) !== null ? "*" : S;
5150
+ function Lt(E) {
5151
+ return E === "" || E.match(/^(about:blank|javascript:|file:\/\/)/) !== null ? "*" : E;
5084
5152
  }
5085
- function _s(S) {
5086
- var V = S.split("Callback");
5087
- if (V.length === 2) {
5088
- var K = "on" + V[0].charAt(0).toUpperCase() + V[0].slice(1);
5089
- this[K] = this[S], delete this[S], ee(
5153
+ function _s(E) {
5154
+ var F = E.split("Callback");
5155
+ if (F.length === 2) {
5156
+ var K = "on" + F[0].charAt(0).toUpperCase() + F[0].slice(1);
5157
+ this[K] = this[E], delete this[E], ee(
5090
5158
  k,
5091
- "Deprecated: '" + S + "' has been renamed '" + K + "'. The old method will be removed in the next major version."
5159
+ "Deprecated: '" + E + "' has been renamed '" + K + "'. The old method will be removed in the next major version."
5092
5160
  );
5093
5161
  }
5094
5162
  }
5095
- function xs(S) {
5096
- S = S || {}, d[k] = /* @__PURE__ */ Object.create(null), d[k].iframe = u, d[k].firstRun = !0, d[k].remoteHost = u.src && u.src.split("/").slice(0, 3).join("/"), Se(S), Object.keys(S).forEach(_s, S), ws(S), d[k] && (d[k].targetOrigin = d[k].checkOrigin === !0 ? Dt(d[k].remoteHost) : "*");
5163
+ function xs(E) {
5164
+ E = E || {}, d[k] = /* @__PURE__ */ Object.create(null), d[k].iframe = u, d[k].firstRun = !0, d[k].remoteHost = u.src && u.src.split("/").slice(0, 3).join("/"), Ee(E), Object.keys(E).forEach(_s, E), ws(E), d[k] && (d[k].targetOrigin = d[k].checkOrigin === !0 ? Lt(d[k].remoteHost) : "*");
5097
5165
  }
5098
5166
  function ks() {
5099
5167
  return k in d && "iFrameResizer" in u;
@@ -5102,8 +5170,8 @@ var tn = { exports: {} };
5102
5170
  ks() ? ee(k, "Ignored iFrame, already setup.") : (xs(y), Z(), M(), de(), ye(ti(k)), ge());
5103
5171
  }
5104
5172
  function ys(u, y) {
5105
- b === null && (b = setTimeout(function() {
5106
- b = null, u();
5173
+ w === null && (w = setTimeout(function() {
5174
+ w = null, u();
5107
5175
  }, y));
5108
5176
  }
5109
5177
  var vs = {};
@@ -5173,9 +5241,9 @@ var tn = { exports: {} };
5173
5241
  });
5174
5242
  }
5175
5243
  function mn() {
5176
- G(window, "message", dn), G(window, "resize", function() {
5244
+ Y(window, "message", dn), Y(window, "resize", function() {
5177
5245
  pn("resize");
5178
- }), G(document, "visibilitychange", ii), G(document, "-webkit-visibilitychange", ii);
5246
+ }), Y(document, "visibilitychange", ii), Y(document, "-webkit-visibilitychange", ii);
5179
5247
  }
5180
5248
  function bs() {
5181
5249
  function u(x, P) {
@@ -5229,7 +5297,7 @@ var tn = { exports: {} };
5229
5297
  })(tn);
5230
5298
  var na = tn.exports;
5231
5299
  const ra = /* @__PURE__ */ Qi(na);
5232
- var aa = Object.defineProperty, oa = Object.getOwnPropertyDescriptor, Ws = (s, e, t, i) => {
5300
+ var aa = Object.defineProperty, oa = Object.getOwnPropertyDescriptor, Vs = (s, e, t, i) => {
5233
5301
  for (var n = i > 1 ? void 0 : i ? oa(e, t) : e, r = s.length - 1, a; r >= 0; r--)
5234
5302
  (a = s[r]) && (n = (i ? a(e, t, n) : a(n)) || n);
5235
5303
  return i && n && aa(e, t, n), n;
@@ -5255,9 +5323,9 @@ let Pt = class extends Q {
5255
5323
  this.dispatchEvent(new CustomEvent("close"));
5256
5324
  }
5257
5325
  render() {
5258
- return L`
5326
+ return D`
5259
5327
  <div class="relative">
5260
- ${Ce(this.showCloseButton, () => L`
5328
+ ${$e(this.showCloseButton, () => D`
5261
5329
  <button class="absolute top-0 right-0 m-2 h-6 text-white focus:outline-none" @click="${this.close}">
5262
5330
  ${Nt}
5263
5331
  </button>
@@ -5273,13 +5341,13 @@ let Pt = class extends Q {
5273
5341
  }
5274
5342
  };
5275
5343
  Pt.styles = [Ne];
5276
- Ws([
5277
- F({ type: String })
5344
+ Vs([
5345
+ W({ type: String })
5278
5346
  ], Pt.prototype, "src", 2);
5279
- Ws([
5280
- F({ type: Boolean })
5347
+ Vs([
5348
+ W({ type: Boolean })
5281
5349
  ], Pt.prototype, "showCloseButton", 2);
5282
- Pt = Ws([
5350
+ Pt = Vs([
5283
5351
  Pe("iai-chat-iframe")
5284
5352
  ], Pt);
5285
5353
  var ca = Object.defineProperty, da = Object.getOwnPropertyDescriptor, lt = (s, e, t, i) => {
@@ -5302,14 +5370,14 @@ let Me = class extends Q {
5302
5370
  width: this.width,
5303
5371
  height: this.height
5304
5372
  });
5305
- return L`
5373
+ return D`
5306
5374
  <div class="fixed inset-0 z-50 bg-black bg-opacity-50 flex justify-center items-center">
5307
5375
  <div
5308
5376
  class="flex flex-col rounded-lg shadow-lg bg-white mx-auto my-auto max-h-[90vh] max-w-[90vw] overflow-hidden"
5309
5377
  style=${s}
5310
5378
  part="modal"
5311
5379
  >
5312
- ${Ce(this.showHeader, () => L`
5380
+ ${$e(this.showHeader, () => D`
5313
5381
  <div class="header text-lg p-2 flex justify-between items-center">
5314
5382
  <div class="flex flex-row h-full items-center">
5315
5383
  <span class="text-lg font-semibold ml-2">${this.title}</span>
@@ -5341,19 +5409,19 @@ Me.styles = [Ne, ot`
5341
5409
  }
5342
5410
  `];
5343
5411
  lt([
5344
- F({ type: String })
5412
+ W({ type: String })
5345
5413
  ], Me.prototype, "title", 2);
5346
5414
  lt([
5347
- F({ type: String })
5415
+ W({ type: String })
5348
5416
  ], Me.prototype, "src", 2);
5349
5417
  lt([
5350
- F({ type: String })
5418
+ W({ type: String })
5351
5419
  ], Me.prototype, "width", 2);
5352
5420
  lt([
5353
- F({ type: String })
5421
+ W({ type: String })
5354
5422
  ], Me.prototype, "height", 2);
5355
5423
  lt([
5356
- F({ type: Boolean })
5424
+ W({ type: Boolean })
5357
5425
  ], Me.prototype, "showHeader", 2);
5358
5426
  Me = lt([
5359
5427
  Pe("iai-chat-iframe-modal")
@@ -5388,7 +5456,7 @@ var sn = { exports: {} };
5388
5456
  (function(s, e) {
5389
5457
  (function(t, i) {
5390
5458
  s.exports = i();
5391
- })(Dr, function() {
5459
+ })(Lr, function() {
5392
5460
  function t(o) {
5393
5461
  return o.replace(/\\([(){}[\]#*+\-.!_\\])/g, function(c, l) {
5394
5462
  return String.fromCharCode(1, n.indexOf(l) + r);
@@ -5396,8 +5464,8 @@ var sn = { exports: {} };
5396
5464
  return l === "~~" ? "<del>" + h + "</del>" : "<b>" + h + "</b>";
5397
5465
  }).replace(/(\n|^|\W)([_\*])(\S(?:[\s\S]*?\S)?)\2(\W|$|\n)/g, function(c, l, h, p, d) {
5398
5466
  return l + "<i>" + p + "</i>" + d;
5399
- }).replace(/(!?)\[([^\]<>]+)\]\((\+?)([^ \)<>]+)(?: "([^\(\)\"]+)")?\)/g, function(c, l, h, p, d, b) {
5400
- var N = b ? ' title="' + b + '"' : "";
5467
+ }).replace(/(!?)\[([^\]<>]+)\]\((\+?)([^ \)<>]+)(?: "([^\(\)\"]+)")?\)/g, function(c, l, h, p, d, w) {
5468
+ var N = w ? ' title="' + w + '"' : "";
5401
5469
  return l ? '<img src="' + a.href(d) + '" alt="' + h + '"' + N + "/>" : (p && (N += ' target="_blank"'), '<a href="' + a.href(d) + '"' + N + ">" + h + "</a>");
5402
5470
  });
5403
5471
  }
@@ -5413,10 +5481,10 @@ var sn = { exports: {} };
5413
5481
  return "<pre><code>" + l[1].replace(/\n /g, `
5414
5482
  `) + "</code></pre>";
5415
5483
  for (var h, p = [], d = t(c).split(`
5416
- `), b = 0, N = d.length; N > b; ++b) {
5417
- var U = d[b], G = /^\s{0,3}(\#{1,6})\s+(.*?)\s*#*\s*$/.exec(U);
5418
- if (G)
5419
- p.push(h = [G[2], "h", G[1].length]);
5484
+ `), w = 0, N = d.length; N > w; ++w) {
5485
+ var U = d[w], Y = /^\s{0,3}(\#{1,6})\s+(.*?)\s*#*\s*$/.exec(U);
5486
+ if (Y)
5487
+ p.push(h = [Y[2], "h", Y[1].length]);
5420
5488
  else {
5421
5489
  var pe = /^(\s*)(?:[-*]|(\d[.)])) (.+)$/.exec(U);
5422
5490
  pe ? p.push(h = [pe[3], pe[2] ? "ol" : "ul", pe[1].length]) : /^\s{0,3}([-])(\s*\1){2,}\s*$/.test(U) ? p.push(h = ["", "hr"]) : h && h[1] !== "hr" && h[1] !== "h" ? h[0] += `
@@ -5424,15 +5492,15 @@ var sn = { exports: {} };
5424
5492
  }
5425
5493
  }
5426
5494
  var me = "", X = [];
5427
- for (b = 0, N = p.length; N > b; ++b) {
5428
- h = p[b];
5429
- var Ge = h[0], fe = h[1], O = h[2];
5495
+ for (w = 0, N = p.length; N > w; ++w) {
5496
+ h = p[w];
5497
+ var Ye = h[0], fe = h[1], O = h[2];
5430
5498
  if (fe === "ul" || fe === "ol")
5431
- !X.length || O > X[0][1] ? (X.unshift([fe, O]), me += "<" + X[0][0] + "><li>" + Ge) : X.length > 1 && O <= X[1][1] ? (me += "</li></" + X.shift()[0] + ">", --b) : me += "</li><li>" + Ge;
5499
+ !X.length || O > X[0][1] ? (X.unshift([fe, O]), me += "<" + X[0][0] + "><li>" + Ye) : X.length > 1 && O <= X[1][1] ? (me += "</li></" + X.shift()[0] + ">", --w) : me += "</li><li>" + Ye;
5432
5500
  else {
5433
5501
  for (; X.length; )
5434
5502
  me += "</li></" + X.shift()[0] + ">";
5435
- me += fe === "hr" ? "<hr/>" : "<" + fe + O + a.headAttrs(O, Ge) + ">" + Ge + "</" + fe + O + ">";
5503
+ me += fe === "hr" ? "<hr/>" : "<" + fe + O + a.headAttrs(O, Ye) + ">" + Ye + "</" + fe + O + ">";
5436
5504
  }
5437
5505
  }
5438
5506
  for (; X.length; )
@@ -5462,7 +5530,7 @@ let ns = class extends Q {
5462
5530
  return ha(this.content);
5463
5531
  }
5464
5532
  render() {
5465
- return L`
5533
+ return D`
5466
5534
  <div class="flex items-end mr-20">
5467
5535
  <div class="message rounded-lg px-4 py-2 flex flex-col gap-3">
5468
5536
  ${la(this.htmlContent)}
@@ -5502,7 +5570,7 @@ ns.styles = [Ne, ot`
5502
5570
  }
5503
5571
  `];
5504
5572
  nn([
5505
- F({ type: String })
5573
+ W({ type: String })
5506
5574
  ], ns.prototype, "content", 2);
5507
5575
  ns = nn([
5508
5576
  Pe("iai-chat-message-assistant")
@@ -5511,14 +5579,14 @@ async function fa(s, e) {
5511
5579
  const { type: t, params: i } = s, n = e[t];
5512
5580
  if (!n)
5513
5581
  throw new Error(`No handler for enhanced content type ${t}`);
5514
- return n({ params: i, html: L });
5582
+ return n({ params: i, html: D });
5515
5583
  }
5516
- var ga = Object.defineProperty, ya = Object.getOwnPropertyDescriptor, Lt = (s, e, t, i) => {
5584
+ var ga = Object.defineProperty, ya = Object.getOwnPropertyDescriptor, Dt = (s, e, t, i) => {
5517
5585
  for (var n = i > 1 ? void 0 : i ? ya(e, t) : e, r = s.length - 1, a; r >= 0; r--)
5518
5586
  (a = s[r]) && (n = (i ? a(e, t, n) : a(n)) || n);
5519
5587
  return i && n && ga(e, t, n), n;
5520
5588
  };
5521
- let Ye = class extends Q {
5589
+ let Ge = class extends Q {
5522
5590
  constructor() {
5523
5591
  super(...arguments), this.content = "";
5524
5592
  }
@@ -5531,32 +5599,32 @@ let Ye = class extends Q {
5531
5599
  console.warn("Error processing enhanced content", s);
5532
5600
  }
5533
5601
  else
5534
- this.contentHtmlTemplate || (this.contentHtmlTemplate = L`<p class="text-center text-gray-400 text-sm">${this.content}</p>`);
5602
+ this.contentHtmlTemplate || (this.contentHtmlTemplate = D`<p class="text-center text-gray-400 text-sm">${this.content}</p>`);
5535
5603
  }
5536
5604
  render() {
5537
- return L`
5605
+ return D`
5538
5606
  <div>
5539
5607
  ${this.contentHtmlTemplate}
5540
5608
  </div>
5541
5609
  `;
5542
5610
  }
5543
5611
  };
5544
- Ye.styles = [Ne];
5545
- Lt([
5546
- F({ type: Object })
5547
- ], Ye.prototype, "options", 2);
5548
- Lt([
5549
- F({ type: String })
5550
- ], Ye.prototype, "content", 2);
5551
- Lt([
5552
- F({ type: Object })
5553
- ], Ye.prototype, "enhancedContent", 2);
5554
- Lt([
5555
- F()
5556
- ], Ye.prototype, "contentHtmlTemplate", 2);
5557
- Ye = Lt([
5612
+ Ge.styles = [Ne];
5613
+ Dt([
5614
+ W({ type: Object })
5615
+ ], Ge.prototype, "options", 2);
5616
+ Dt([
5617
+ W({ type: String })
5618
+ ], Ge.prototype, "content", 2);
5619
+ Dt([
5620
+ W({ type: Object })
5621
+ ], Ge.prototype, "enhancedContent", 2);
5622
+ Dt([
5623
+ W()
5624
+ ], Ge.prototype, "contentHtmlTemplate", 2);
5625
+ Ge = Dt([
5558
5626
  Pe("iai-chat-message-system")
5559
- ], Ye);
5627
+ ], Ge);
5560
5628
  var va = Object.defineProperty, ba = Object.getOwnPropertyDescriptor, rn = (s, e, t, i) => {
5561
5629
  for (var n = i > 1 ? void 0 : i ? ba(e, t) : e, r = s.length - 1, a; r >= 0; r--)
5562
5630
  (a = s[r]) && (n = (i ? a(e, t, n) : a(n)) || n);
@@ -5567,7 +5635,7 @@ let rs = class extends Q {
5567
5635
  super(...arguments), this.content = "";
5568
5636
  }
5569
5637
  render() {
5570
- return L`
5638
+ return D`
5571
5639
  <div class="flex items-end justify-end ml-20">
5572
5640
  <div class="message rounded-lg px-4 py-2 flex gap-2">
5573
5641
  <p>${this.content}</p>
@@ -5583,7 +5651,7 @@ rs.styles = [Ne, ot`
5583
5651
  }
5584
5652
  `];
5585
5653
  rn([
5586
- F({ type: String })
5654
+ W({ type: String })
5587
5655
  ], rs.prototype, "content", 2);
5588
5656
  rs = rn([
5589
5657
  Pe("iai-chat-message-user")
@@ -5602,9 +5670,9 @@ let at = class extends Q {
5602
5670
  openChatButton: { width: s, height: e, imageSrc: t, cta: i },
5603
5671
  placement: n
5604
5672
  } = this.options.config, r = tt({ alignItems: n !== "left" ? "end" : "start" }), a = tt({ width: s, height: e });
5605
- return L`
5673
+ return D`
5606
5674
  <div class="flex flex-col gap-4" style=${r}>
5607
- ${Ce(i && this.isCtaOpen && !this.isChatWindowOpen, () => L`
5675
+ ${$e(i && this.isCtaOpen && !this.isChatWindowOpen, () => D`
5608
5676
  <div class="relative rounded-lg p-5 shadow-md bg-white" style="max-width: 350px;">
5609
5677
  <button
5610
5678
  class="absolute top-0 right-0 w-5 h-5 m-0.5"
@@ -5621,13 +5689,13 @@ let at = class extends Q {
5621
5689
  `)}
5622
5690
 
5623
5691
  <button @click="${this.toggleChat}">
5624
- ${Ce(
5692
+ ${$e(
5625
5693
  t,
5626
- () => L`<img src="${t}" alt="Chat Icon" style=${a}/>`,
5627
- () => L`
5694
+ () => D`<img src="${t}" alt="Chat Icon" style=${a}/>`,
5695
+ () => D`
5628
5696
  <div class="button rounded-full flex items-center justify-center" style=${a}>
5629
5697
  <div class="h-3/5 w-3/5">
5630
- ${Ce(this.isChatWindowOpen, () => Nt, () => Qr)}
5698
+ ${$e(this.isChatWindowOpen, () => Nt, () => Qr)}
5631
5699
  </div>
5632
5700
  </div>
5633
5701
  `
@@ -5647,10 +5715,10 @@ at.styles = [Ne, ot`
5647
5715
  }
5648
5716
  `];
5649
5717
  ps([
5650
- F({ type: Object })
5718
+ W({ type: Object })
5651
5719
  ], at.prototype, "options", 2);
5652
5720
  ps([
5653
- F({ type: Boolean })
5721
+ W({ type: Boolean })
5654
5722
  ], at.prototype, "isChatWindowOpen", 2);
5655
5723
  ps([
5656
5724
  dt()
@@ -5718,7 +5786,7 @@ function on(s) {
5718
5786
  });
5719
5787
  } };
5720
5788
  }
5721
- class Sa {
5789
+ class Ea {
5722
5790
  constructor(e) {
5723
5791
  this.chatWsUrl = e, this._emitter = on(), this.on = this._emitter.on.bind(this._emitter), this.off = this._emitter.off.bind(this._emitter), this.reconnectCodes = /* @__PURE__ */ new Set([
5724
5792
  1006
@@ -5749,14 +5817,14 @@ class Sa {
5749
5817
  this.disconnect(), this._emitter.all.clear();
5750
5818
  }
5751
5819
  }
5752
- const Ta = as.AcknowledgeType, $a = "Anyone Home", Ea = "IB Chat Leasing - Development";
5753
- let Ca = "https://five9.ah.inhabit.work";
5820
+ const Ta = as.AcknowledgeType, Sa = "Anyone Home", Ca = "IB Chat Leasing - Development";
5821
+ let $a = "https://five9.ah.inhabit.work";
5754
5822
  const Aa = "https://five9.ah.inhabit.work".replace("http", "ws").replace(/\/$/, "");
5755
5823
  var be, Ue;
5756
5824
  const yt = class yt {
5757
5825
  constructor() {
5758
- Cs(this, be, void 0);
5759
- Cs(this, Ue, void 0);
5826
+ $s(this, be, void 0);
5827
+ $s(this, Ue, void 0);
5760
5828
  this._emitter = on(), this.on = this._emitter.on.bind(this._emitter), this.off = this._emitter.off.bind(this._emitter), Te(this, be, null), Te(this, Ue, null), this.conversationStarted = !1;
5761
5829
  }
5762
5830
  serialize() {
@@ -5780,7 +5848,7 @@ const yt = class yt {
5780
5848
  "Content-Type": "application/json",
5781
5849
  Accept: "application/json"
5782
5850
  },
5783
- body: JSON.stringify({ tenantName: $a })
5851
+ body: JSON.stringify({ tenantName: Sa })
5784
5852
  });
5785
5853
  return Te(this, be, await e.json()), zt(this, be);
5786
5854
  }
@@ -5801,7 +5869,7 @@ const yt = class yt {
5801
5869
  if (!this.conversationId)
5802
5870
  throw new Error("Conversation not started");
5803
5871
  this.five9WebSocket && this.five9WebSocket.destroy();
5804
- const e = new Sa(`${Aa}/conversations/${this.conversationId}/ws`);
5872
+ const e = new Ea(`${Aa}/conversations/${this.conversationId}/ws`);
5805
5873
  e.on("*", (t, i) => {
5806
5874
  this._emitter.emit(t, i);
5807
5875
  }), e.on("conversationCreated", (t) => {
@@ -5860,18 +5928,23 @@ const yt = class yt {
5860
5928
  async createConversation(e) {
5861
5929
  if (!this.sessionToken)
5862
5930
  throw new Error("Session not created");
5863
- const t = {
5931
+ const t = e.contact || {};
5932
+ Object.keys(t).forEach((r) => {
5933
+ const a = r;
5934
+ t[a] || delete t[a];
5935
+ });
5936
+ const i = {
5864
5937
  ...e,
5865
- campaignName: Ea,
5938
+ campaignName: Ca,
5866
5939
  tenantId: this.tenantId,
5867
- callbackUrl: Ca
5940
+ callbackUrl: $a
5868
5941
  };
5869
- console.log("body", t);
5870
- const i = await this.authenticatedFetch("/conversations", {
5942
+ console.log("body", i);
5943
+ const n = await this.authenticatedFetch("/conversations", {
5871
5944
  method: "POST",
5872
- body: JSON.stringify(t)
5945
+ body: JSON.stringify(i)
5873
5946
  });
5874
- return this.setConversationId(i.id), i;
5947
+ return this.setConversationId(n.id), n;
5875
5948
  }
5876
5949
  async sendMessage(e) {
5877
5950
  const { conversationId: t, conversationStarted: i } = this;
@@ -5955,18 +6028,12 @@ async function Oa({
5955
6028
  }) {
5956
6029
  t = t;
5957
6030
  const n = async () => {
5958
- t.removeMessage("transferMessageId"), await t.sendFunctionCallResponse(
5959
- s,
5960
- {
5961
- transfer: "Declined"
5962
- },
5963
- !0
5964
- ), t.setInputDisabled(!1);
6031
+ t.removeMessage("transferMessageId"), await t.sendFunctionCallResponse(s, { transfer: "Declined" }, !0), t.setInputDisabled(!1);
5965
6032
  }, r = async () => {
5966
6033
  t.setInputDisabled(!0), t.removeMessage("transferMessageId"), t.addMessage({
5967
6034
  role: "system",
5968
6035
  content: "Please wait while we connect you to a live agent"
5969
- });
6036
+ }), t.chatManager.stopInactivityTimers();
5970
6037
  const a = new os();
5971
6038
  await a.createSession();
5972
6039
  const { summary: o, subject: c, ...l } = e;
@@ -5976,10 +6043,7 @@ async function Oa({
5976
6043
  Question: c,
5977
6044
  "AI Summary": o
5978
6045
  }
5979
- }), localStorage.setItem(
5980
- gt(t.cleanOptions.config.historyKey),
5981
- a.serialize()
5982
- ), cn(t, a);
6046
+ }), localStorage.setItem(gt(t.cleanOptions.config.historyKey), a.serialize()), cn(t, a);
5983
6047
  };
5984
6048
  t.addMessage({
5985
6049
  id: "transferMessageId",
@@ -6135,14 +6199,14 @@ function Ia(s) {
6135
6199
  }, c = async ({ detail: p }) => {
6136
6200
  if (p.type !== "tourScheduled")
6137
6201
  return;
6138
- const { tourType: d, tourDate: b, tourTime: N } = p;
6202
+ const { tourType: d, tourDate: w, tourTime: N } = p;
6139
6203
  o(), n.addMessage({
6140
6204
  role: "system",
6141
6205
  content: "Your tour has been scheduled!"
6142
6206
  }), await n.sendFunctionCallResponse(t, {
6143
6207
  status: "scheduled",
6144
6208
  tourType: d,
6145
- tourDate: b,
6209
+ tourDate: w,
6146
6210
  tourTime: N
6147
6211
  }, !0);
6148
6212
  }, l = async () => {