@useago/sdk 1.13.2 → 1.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.js CHANGED
@@ -1,10 +1,10 @@
1
- import { a as Bi, c as Ro, n as Di, o as zo, s as Ho, t as $i } from "./types-D1ZrqVhr.js";
2
- import { n as Mi } from "./errors-BLfjXnLB.js";
3
- import { t as Wi } from "./createConversationSession-DrmOaZdO.js";
4
- import { r as ji, t as Pi } from "./createFormCollector-ki_GTlp9.js";
5
- import { $ as ee, A as bn, B as Ui, C as Ka, D as Y, E as Vi, F as xn, G as xo, H as Oo, I as qi, J as Gi, K as yn, L as Ki, M as Cn, N as Le, O as fe, P as Bo, Q as Mt, R as Do, S as Xa, T as wn, U as ye, V as tt, W as vn, X as Xi, Y as yo, Z as $o, _ as Yi, a as Qi, at as c, b as Ji, c as Zi, ct as er, d as Mo, dt as mn, et as tr, f as Wo, g as nr, h as or, i as ir, it as f, j as rr, k as nt, l as ar, lt as sr, m as lr, n as dr, nt as Co, o as cr, ot as pr, p as ur, q as jo, r as Fn, rt as fr, s as mr, st as gr, t as Ya, tt as hr, u as br, ut as wo, v as xr, w as ot, x as yr, y as Cr, z as jt } from "./speechToText-BV7qxqPF.js";
6
- var wr = 10 * 1024 * 1024;
7
- var vo = [
1
+ import { a as $i, c as Ho, n as Mi, o as Oo, s as Bo, t as Wi } from "./types-D1ZrqVhr.js";
2
+ import { n as ji } from "./errors-BLfjXnLB.js";
3
+ import { t as Pi } from "./createConversationSession-DrmOaZdO.js";
4
+ import { r as Ui, t as Vi } from "./createFormCollector-D6_N8wYq.js";
5
+ import { $ as te, A as bn, B as qi, C as Ya, D as Q, E as Gi, F as xn, G as Co, H as Do, I as Ki, J as Xi, K as yn, L as Yi, M as Cn, N as Le, O as fe, P as $o, Q as Mt, R as Mo, S as Qa, T as wn, U as ye, V as tt, W as vn, X as Qi, Y as wo, Z as Wo, _ as Ji, a as Zi, at as c, b as er, c as tr, ct as nr, d as jo, dt as mn, et as or, f as Po, g as ir, h as rr, i as ar, it as f, j as sr, k as nt, l as lr, lt as dr, m as cr, n as pr, nt as vo, o as ur, ot as fr, p as mr, q as Uo, r as Fn, rt as gr, s as hr, st as br, t as Ja, tt as xr, u as yr, ut as ko, v as Cr, w as ot, x as wr, y as vr, z as jt } from "./speechToText-BV7qxqPF.js";
6
+ var kr = 10 * 1024 * 1024;
7
+ var Eo = [
8
8
  "image/jpeg",
9
9
  "image/png",
10
10
  "image/gif",
@@ -27,19 +27,19 @@ var vo = [
27
27
  "text/html",
28
28
  "application/epub+zip"
29
29
  ];
30
- function ko(t) {
30
+ function So(t) {
31
31
  return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
32
32
  }
33
- function vr(t) {
33
+ function Er(t) {
34
34
  const e = t.look === "embed";
35
35
  let o = [];
36
36
  const n = /* @__PURE__ */ new Map(), i = document.createElement("form");
37
37
  i.className = e ? "ago-chat-input ago-chat-input--embed" : "ago-chat-input", e ? f(i, {
38
38
  width: "100%",
39
39
  borderRadius: "24px",
40
- border: `2px solid ${jo}`,
40
+ border: `2px solid ${Uo}`,
41
41
  backgroundColor: "#fff",
42
- boxShadow: Xi,
42
+ boxShadow: Qi,
43
43
  position: "relative",
44
44
  boxSizing: "border-box",
45
45
  display: "block",
@@ -49,7 +49,7 @@ function vr(t) {
49
49
  flexDirection: "column",
50
50
  gap: "8px",
51
51
  padding: "12px",
52
- borderTop: `1px solid ${Y}`,
52
+ borderTop: `1px solid ${Q}`,
53
53
  backgroundColor: ye
54
54
  });
55
55
  const a = c(e ? {
@@ -74,12 +74,12 @@ function vr(t) {
74
74
  alignItems: "flex-end"
75
75
  }), l = document.createElement("textarea");
76
76
  l.placeholder = t.placeholder, l.setAttribute("aria-label", t.placeholder), l.rows = 1, l.autocapitalize = "off", l.setAttribute("autocorrect", "off");
77
- const b = e ? 208 : 110;
77
+ const h = e ? 208 : 110;
78
78
  e ? f(l, {
79
79
  display: "block",
80
80
  width: "100%",
81
81
  minHeight: "40px",
82
- maxHeight: `${b}px`,
82
+ maxHeight: `${h}px`,
83
83
  overflowY: "auto",
84
84
  resize: "none",
85
85
  border: "none",
@@ -97,24 +97,24 @@ function vr(t) {
97
97
  resize: "none",
98
98
  boxSizing: "border-box",
99
99
  padding: "10px 12px",
100
- border: `1px solid ${Y}`,
100
+ border: `1px solid ${Q}`,
101
101
  borderRadius: "12px",
102
102
  fontSize: "16px",
103
103
  fontFamily: Le,
104
104
  lineHeight: "1.4",
105
- maxHeight: `${b}px`,
105
+ maxHeight: `${h}px`,
106
106
  overflowY: "hidden"
107
107
  });
108
108
  const m = () => {
109
- const g = e ? 0 : 2;
109
+ const b = e ? 0 : 2;
110
110
  l.style.height = "auto";
111
- const B = Math.min(l.scrollHeight + g, b);
112
- l.style.height = `${B}px`, l.style.overflowY = l.scrollHeight + g > b ? "auto" : "hidden";
111
+ const N = Math.min(l.scrollHeight + b, h);
112
+ l.style.height = `${N}px`, l.style.overflowY = l.scrollHeight + b > h ? "auto" : "hidden";
113
113
  };
114
114
  l.addEventListener("input", () => {
115
115
  m(), k();
116
116
  });
117
- const p = '<svg width="18" height="18" viewBox="0 -960 960 960" fill="currentColor" aria-hidden="true"><path d="M440-160v-487L216-423l-56-57 320-320 320 320-56 57-224-224v487h-80Z"/></svg>', y = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" style="animation: ago-spin 0.8s linear infinite"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>', H = '<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="5" y="5" width="14" height="14" rx="2"/></svg>', E = document.createElement("button");
117
+ const p = '<svg width="18" height="18" viewBox="0 -960 960 960" fill="currentColor" aria-hidden="true"><path d="M440-160v-487L216-423l-56-57 320-320 320 320-56 57-224-224v487h-80Z"/></svg>', y = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" style="animation: ago-spin 0.8s linear infinite"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>', O = '<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="5" y="5" width="14" height="14" rx="2"/></svg>', E = document.createElement("button");
118
118
  E.type = "submit", E.className = "ago-chat-input__send", E.setAttribute("aria-label", "Send"), e ? f(E, {
119
119
  flexShrink: "0",
120
120
  width: "40px",
@@ -122,7 +122,7 @@ function vr(t) {
122
122
  padding: "0",
123
123
  border: "none",
124
124
  borderRadius: "50%",
125
- backgroundColor: yo,
125
+ backgroundColor: wo,
126
126
  color: "#fafafa",
127
127
  display: "flex",
128
128
  alignItems: "center",
@@ -144,20 +144,20 @@ function vr(t) {
144
144
  cursor: "pointer"
145
145
  }));
146
146
  let u = !1, v = !1;
147
- const L = () => u && !!t.onStop, k = () => {
148
- const g = l.value.trim() !== "", B = L(), q = !B && (u || v || !g);
149
- if (E.disabled = q, E.type = B ? "button" : "submit", E.setAttribute("aria-label", B ? "Stop generating" : "Send"), e) {
150
- E.replaceChildren(B ? Cr({ size: 16 }) : mr({ size: 16 }));
151
- const U = q && !u;
152
- E.style.backgroundColor = U ? "#f1f5f9" : yo, E.style.color = U ? "#cbd5e1" : "#fafafa", E.style.pointerEvents = q ? "none" : "auto", E.style.cursor = q ? "default" : "pointer", te.style.opacity = u ? "0.5" : "1";
147
+ const F = () => u && !!t.onStop, k = () => {
148
+ const b = l.value.trim() !== "", N = F(), q = !N && (u || v || !b);
149
+ if (E.disabled = q, E.type = N ? "button" : "submit", E.setAttribute("aria-label", N ? "Stop generating" : "Send"), e) {
150
+ E.replaceChildren(N ? vr({ size: 16 }) : hr({ size: 16 }));
151
+ const V = q && !u;
152
+ E.style.backgroundColor = V ? "#f1f5f9" : wo, E.style.color = V ? "#cbd5e1" : "#fafafa", E.style.pointerEvents = q ? "none" : "auto", E.style.cursor = q ? "default" : "pointer", X.style.opacity = u ? "0.5" : "1";
153
153
  return;
154
154
  }
155
- E.innerHTML = B ? H : u ? y : p, E.style.opacity = q && !u ? "0.5" : "1", E.style.cursor = q ? "default" : "pointer";
155
+ E.innerHTML = N ? O : u ? y : p, E.style.opacity = q && !u ? "0.5" : "1", E.style.cursor = q ? "default" : "pointer";
156
156
  };
157
157
  E.addEventListener("click", () => {
158
- L() && t.onStop?.();
158
+ F() && t.onStop?.();
159
159
  });
160
- const N = c({
160
+ const L = c({
161
161
  display: "none",
162
162
  alignItems: "flex-start",
163
163
  justifyContent: "space-between",
@@ -171,7 +171,7 @@ function vr(t) {
171
171
  fontSize: "14px",
172
172
  lineHeight: "20px"
173
173
  });
174
- N.className = "ago-chat-input__error", N.setAttribute("role", "alert");
174
+ L.className = "ago-chat-input__error", L.setAttribute("role", "alert");
175
175
  const P = document.createElement("span"), w = document.createElement("button");
176
176
  w.type = "button", w.textContent = t.labels?.dismiss ?? "Dismiss", f(w, {
177
177
  border: "none",
@@ -183,35 +183,35 @@ function vr(t) {
183
183
  padding: "0",
184
184
  minHeight: "20px"
185
185
  }), w.addEventListener("click", () => {
186
- N.style.display = "none";
187
- }), N.append(P, w);
188
- const z = (g) => {
189
- P.textContent = g, N.style.display = "flex";
190
- }, C = (g, B) => g.replace(/\{(\w+)\}/g, (q, U) => B[U] ?? ""), S = (g) => {
191
- if (!e) return g;
192
- const B = t.labels, q = [];
193
- for (const U of g) {
186
+ L.style.display = "none";
187
+ }), L.append(P, w);
188
+ const z = (b) => {
189
+ P.textContent = b, L.style.display = "flex";
190
+ }, C = (b, N) => b.replace(/\{(\w+)\}/g, (q, V) => N[V] ?? ""), S = (b) => {
191
+ if (!e) return b;
192
+ const N = t.labels, q = [];
193
+ for (const V of b) {
194
194
  if (o.length + q.length >= 5) {
195
- z(C(B?.tooManyFiles ?? "Too many files. Maximum allowed: {max}", { max: String(5) }));
195
+ z(C(N?.tooManyFiles ?? "Too many files. Maximum allowed: {max}", { max: String(5) }));
196
196
  break;
197
197
  }
198
- if (U.type && !vo.includes(U.type)) {
199
- z(C(B?.invalidFileType ?? "Invalid file type: {name}", { name: U.name }));
198
+ if (V.type && !Eo.includes(V.type)) {
199
+ z(C(N?.invalidFileType ?? "Invalid file type: {name}", { name: V.name }));
200
200
  continue;
201
201
  }
202
- if (U.size > 10485760) {
203
- z(C(B?.fileTooLarge ?? "File too large: {name} (maximum {max})", {
204
- name: U.name,
205
- max: ko(wr)
202
+ if (V.size > 10485760) {
203
+ z(C(N?.fileTooLarge ?? "File too large: {name} (maximum {max})", {
204
+ name: V.name,
205
+ max: So(kr)
206
206
  }));
207
207
  continue;
208
208
  }
209
- q.push(U);
209
+ q.push(V);
210
210
  }
211
211
  return q;
212
212
  };
213
- let T = null, O = null;
214
- t.allowFiles && (T = document.createElement("input"), T.type = "file", T.multiple = !0, e && (T.accept = vo.join(",")), f(T, { display: "none" }), O = document.createElement("button"), O.type = "button", O.className = "ago-chat-input__attach", O.setAttribute("aria-label", t.labels?.attachFiles ?? "Attach file"), e ? (O.appendChild(Zi({ size: 16 })), f(O, {
213
+ let T = null, B = null;
214
+ t.allowFiles && (T = document.createElement("input"), T.type = "file", T.multiple = !0, e && (T.accept = Eo.join(",")), f(T, { display: "none" }), B = document.createElement("button"), B.type = "button", B.className = "ago-chat-input__attach", B.setAttribute("aria-label", t.labels?.attachFiles ?? "Attach file"), e ? (B.appendChild(tr({ size: 16 })), f(B, {
215
215
  height: "40px",
216
216
  padding: "8px",
217
217
  display: "flex",
@@ -223,7 +223,7 @@ function vr(t) {
223
223
  border: "none",
224
224
  cursor: "pointer",
225
225
  borderRadius: "6px"
226
- })) : (O.textContent = "📎", f(O, {
226
+ })) : (B.textContent = "📎", f(B, {
227
227
  flexShrink: "0",
228
228
  minWidth: "44px",
229
229
  minHeight: "44px",
@@ -231,26 +231,26 @@ function vr(t) {
231
231
  alignItems: "center",
232
232
  justifyContent: "center",
233
233
  padding: "0 12px",
234
- border: `1px solid ${Y}`,
234
+ border: `1px solid ${Q}`,
235
235
  borderRadius: "12px",
236
236
  backgroundColor: ye,
237
237
  cursor: "pointer",
238
238
  fontSize: "14px"
239
- })), O.addEventListener("click", () => T?.click()), T.addEventListener("change", () => {
240
- const g = Array.from(T?.files ?? []);
241
- o = [...o, ...S(g)], T && (T.value = ""), V();
239
+ })), B.addEventListener("click", () => T?.click()), T.addEventListener("change", () => {
240
+ const b = Array.from(T?.files ?? []);
241
+ o = [...o, ...S(b)], T && (T.value = ""), U();
242
242
  }));
243
- function G(g) {
244
- if (!e || !g.type.startsWith("image/") || typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
245
- let B = n.get(g);
246
- return B || (B = URL.createObjectURL(g), n.set(g, B)), B;
243
+ function G(b) {
244
+ if (!e || !b.type.startsWith("image/") || typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
245
+ let N = n.get(b);
246
+ return N || (N = URL.createObjectURL(b), n.set(b, N)), N;
247
247
  }
248
- function M(g) {
249
- const B = n.get(g);
250
- B && (URL.revokeObjectURL(B), n.delete(g));
248
+ function W(b) {
249
+ const N = n.get(b);
250
+ N && (URL.revokeObjectURL(N), n.delete(b));
251
251
  }
252
- function V() {
253
- a.replaceChildren(), e && (a.style.display = o.length > 0 ? "flex" : "none"), o.forEach((g, B) => {
252
+ function U() {
253
+ a.replaceChildren(), e && (a.style.display = o.length > 0 ? "flex" : "none"), o.forEach((b, N) => {
254
254
  const q = c(e ? {
255
255
  display: "flex",
256
256
  alignItems: "center",
@@ -266,39 +266,39 @@ function vr(t) {
266
266
  gap: "4px",
267
267
  padding: "4px 8px",
268
268
  backgroundColor: "#f0f4ff",
269
- border: `1px solid ${Y}`,
269
+ border: `1px solid ${Q}`,
270
270
  borderRadius: "8px",
271
271
  fontSize: "12px"
272
272
  });
273
273
  if (q.className = "ago-chat-input__file", e) {
274
- const le = G(g);
275
- if (le) {
274
+ const oe = G(b);
275
+ if (oe) {
276
276
  const ve = document.createElement("img");
277
- ve.src = le, ve.alt = "", f(ve, {
277
+ ve.src = oe, ve.alt = "", f(ve, {
278
278
  width: "32px",
279
279
  height: "32px",
280
280
  objectFit: "cover",
281
281
  borderRadius: "4px",
282
282
  flexShrink: "0"
283
283
  }), q.appendChild(ve);
284
- } else q.appendChild(ur({ size: 20 }));
284
+ } else q.appendChild(mr({ size: 20 }));
285
285
  }
286
- const U = document.createElement("span");
287
- if (U.textContent = g.name, U.title = g.name, e && f(U, {
286
+ const V = document.createElement("span");
287
+ if (V.textContent = b.name, V.title = b.name, e && f(V, {
288
288
  maxWidth: "150px",
289
289
  overflow: "hidden",
290
290
  textOverflow: "ellipsis",
291
291
  whiteSpace: "nowrap"
292
- }), q.appendChild(U), e) {
293
- const le = document.createElement("span");
294
- le.textContent = ko(g.size), f(le, {
292
+ }), q.appendChild(V), e) {
293
+ const oe = document.createElement("span");
294
+ oe.textContent = So(b.size), f(oe, {
295
295
  fontSize: "12px",
296
296
  lineHeight: "16px",
297
297
  color: "#6b7280"
298
- }), q.appendChild(le);
298
+ }), q.appendChild(oe);
299
299
  }
300
- const oe = document.createElement("button");
301
- oe.type = "button", oe.setAttribute("aria-label", `Remove ${g.name}`), e ? oe.appendChild(Mo({ size: 16 })) : oe.textContent = "×", f(oe, {
300
+ const ne = document.createElement("button");
301
+ ne.type = "button", ne.setAttribute("aria-label", `Remove ${b.name}`), e ? ne.appendChild(jo({ size: 16 })) : ne.textContent = "×", f(ne, {
302
302
  flexShrink: "0",
303
303
  width: "44px",
304
304
  height: "44px",
@@ -312,49 +312,49 @@ function vr(t) {
312
312
  fontSize: "14px",
313
313
  lineHeight: "1",
314
314
  color: "inherit"
315
- }), oe.addEventListener("click", () => {
316
- M(g), o = o.filter((le, ve) => ve !== B), V();
317
- }), q.appendChild(oe), a.appendChild(q);
315
+ }), ne.addEventListener("click", () => {
316
+ W(b), o = o.filter((oe, ve) => ve !== N), U();
317
+ }), q.appendChild(ne), a.appendChild(q);
318
318
  }), k();
319
319
  }
320
320
  const x = () => {
321
321
  $?.cancel();
322
- const g = l.value, B = o;
322
+ const b = l.value, N = o;
323
323
  l.value = "", m(), o = [];
324
- for (const q of B) M(q);
325
- return V(), {
326
- content: g,
327
- files: B
324
+ for (const q of N) W(q);
325
+ return U(), {
326
+ content: b,
327
+ files: N
328
328
  };
329
- }, F = () => {
329
+ }, H = () => {
330
330
  if (u || v || !l.value.trim()) return;
331
- const { content: g, files: B } = x();
332
- t.onSend(g.trim(), B.length > 0 ? B : void 0), e && typeof window < "u" && window.innerWidth < (t.blurOnSubmitBelow ?? 600) && l.blur();
331
+ const { content: b, files: N } = x();
332
+ t.onSend(b.trim(), N.length > 0 ? N : void 0), e && typeof window < "u" && window.innerWidth < (t.blurOnSubmitBelow ?? 600) && l.blur();
333
333
  };
334
- i.addEventListener("submit", (g) => {
335
- g.preventDefault(), F();
336
- }), l.addEventListener("keydown", (g) => {
337
- if (g.key === "Enter" && !g.shiftKey) {
338
- if (g.isComposing || g.keyCode === 229) return;
339
- g.preventDefault(), F();
334
+ i.addEventListener("submit", (b) => {
335
+ b.preventDefault(), H();
336
+ }), l.addEventListener("keydown", (b) => {
337
+ if (b.key === "Enter" && !b.shiftKey) {
338
+ if (b.isComposing || b.keyCode === 229) return;
339
+ b.preventDefault(), H();
340
340
  }
341
341
  });
342
- const $ = t.transcribeAudio ? dr({
342
+ const $ = t.transcribeAudio ? pr({
343
343
  transcribe: t.transcribeAudio,
344
344
  labels: t.speechToTextLabels,
345
- onBusy: (g) => {
346
- const B = v && !g && !u && i.contains(document.activeElement);
347
- v = g, l.disabled = u || g, e ? (te.style.display = g ? "none" : "", J.style.display = g ? "none" : "flex", d.style.padding = g ? "8px" : "16px", $ && (g ? d.append($.el) : J.prepend($.el))) : (l.style.display = g ? "none" : "", E.style.display = g ? "none" : "flex", O && (O.style.display = g ? "none" : "flex")), k(), B && l.focus();
345
+ onBusy: (b) => {
346
+ const N = v && !b && !u && i.contains(document.activeElement);
347
+ v = b, l.disabled = u || b, e ? (X.style.display = b ? "none" : "", J.style.display = b ? "none" : "flex", d.style.padding = b ? "8px" : "16px", $ && (b ? d.append($.el) : J.prepend($.el))) : (l.style.display = b ? "none" : "", E.style.display = b ? "none" : "flex", B && (B.style.display = b ? "none" : "flex")), k(), N && l.focus();
348
348
  },
349
- onText: (g) => {
350
- l.value += `${l.value && !/\s$/.test(l.value) ? " " : ""}${g}`, m(), k(), l.focus();
349
+ onText: (b) => {
350
+ l.value += `${l.value && !/\s$/.test(l.value) ? " " : ""}${b}`, m(), k(), l.focus();
351
351
  },
352
352
  onError: z
353
- }) : void 0, te = c({
353
+ }) : void 0, X = c({
354
354
  flex: "1",
355
355
  minWidth: "0"
356
356
  });
357
- te.className = "ago-chat-input__editor";
357
+ X.className = "ago-chat-input__editor";
358
358
  const J = c({
359
359
  display: "flex",
360
360
  alignItems: "flex-end",
@@ -362,40 +362,40 @@ function vr(t) {
362
362
  gap: "4px"
363
363
  });
364
364
  if (e) {
365
- te.append(N, a, l);
366
- const g = c({
365
+ X.append(L, a, l);
366
+ const b = c({
367
367
  display: "flex",
368
368
  alignItems: "center"
369
369
  });
370
- g.className = "ago-chat-input__toolbar", O && g.appendChild(O), O && te.appendChild(g), $ && J.appendChild($.el), J.appendChild(E), d.append(te, J), T && i.appendChild(T), i.appendChild(d), i.addEventListener("click", (B) => {
371
- (B.target instanceof Element ? B.target : null)?.closest("button,a,input,textarea") || l.focus();
370
+ b.className = "ago-chat-input__toolbar", B && b.appendChild(B), B && X.appendChild(b), $ && J.appendChild($.el), J.appendChild(E), d.append(X, J), T && i.appendChild(T), i.appendChild(d), i.addEventListener("click", (N) => {
371
+ (N.target instanceof Element ? N.target : null)?.closest("button,a,input,textarea") || l.focus();
372
372
  });
373
373
  } else
374
- O && d.appendChild(O), d.append(l), $ && d.appendChild($.el), d.append(E), T && i.appendChild(T), i.append(N, a, d);
374
+ B && d.appendChild(B), d.append(l), $ && d.appendChild($.el), d.append(E), T && i.appendChild(T), i.append(L, a, d);
375
375
  return k(), {
376
376
  inputRow: i,
377
377
  getValueAndClear: x,
378
- setDisabled: (g) => {
379
- u = g, $?.setDisabled(g), l.disabled = g || v, k();
378
+ setDisabled: (b) => {
379
+ u = b, $?.setDisabled(b), l.disabled = b || v, k();
380
380
  },
381
381
  focus: () => l.focus(),
382
382
  blur: () => l.blur(),
383
- restoreDraft: (g, B) => {
384
- g && !l.value.trim() && (l.value = g, m()), B?.length && (o = [...B, ...o], V()), k();
383
+ restoreDraft: (b, N) => {
384
+ b && !l.value.trim() && (l.value = b, m()), N?.length && (o = [...N, ...o], U()), k();
385
385
  },
386
- setPlaceholder: (g) => {
387
- l.placeholder = g, g && l.setAttribute("aria-label", g);
386
+ setPlaceholder: (b) => {
387
+ l.placeholder = b, b && l.setAttribute("aria-label", b);
388
388
  },
389
- setSpeechToTextEnabled: (g) => $?.setEnabled(g),
389
+ setSpeechToTextEnabled: (b) => $?.setEnabled(b),
390
390
  cancelRecording: () => $?.cancel(),
391
391
  destroy: () => {
392
392
  $?.destroy();
393
- for (const g of n.keys()) M(g);
393
+ for (const b of n.keys()) W(b);
394
394
  }
395
395
  };
396
396
  }
397
397
  var gn = "rgba(3, 24, 47, 0.07)";
398
- function kr(t) {
398
+ function Sr(t) {
399
399
  const e = document.createElement("footer");
400
400
  e.className = "ago-chat-widget__footer", f(e, {
401
401
  padding: "12px",
@@ -411,7 +411,7 @@ function kr(t) {
411
411
  });
412
412
  const n = /* @__PURE__ */ new Map();
413
413
  let i = "home";
414
- function a(l, b, m) {
414
+ function a(l, h, m) {
415
415
  const p = document.createElement("button");
416
416
  p.type = "button", p.className = "ago-chat-widget__tab", p.dataset.agoScreen = l, f(p, {
417
417
  flex: "1",
@@ -431,7 +431,7 @@ function kr(t) {
431
431
  font: "inherit"
432
432
  });
433
433
  const y = document.createElement("span");
434
- return y.textContent = b, f(y, {
434
+ return y.textContent = h, f(y, {
435
435
  fontSize: "12px",
436
436
  lineHeight: "16px",
437
437
  maxWidth: "100%",
@@ -444,11 +444,11 @@ function kr(t) {
444
444
  p.style.backgroundColor = i === l ? gn : "transparent";
445
445
  }), p.addEventListener("click", () => t.onNavigate(l)), n.set(l, p), p;
446
446
  }
447
- o.append(a("home", t.labels.home, or({ size: 24 })), a("history", t.labels.chats, Wo({ size: 24 }))), e.appendChild(o);
447
+ o.append(a("home", t.labels.home, rr({ size: 24 })), a("history", t.labels.chats, Po({ size: 24 }))), e.appendChild(o);
448
448
  const d = (l) => {
449
449
  i = l === "history" ? "history" : "home";
450
- for (const [b, m] of n) {
451
- const p = b === i;
450
+ for (const [h, m] of n) {
451
+ const p = h === i;
452
452
  m.style.color = p ? yn : fe, m.style.backgroundColor = p ? gn : "transparent", p ? m.setAttribute("aria-current", "page") : m.removeAttribute("aria-current");
453
453
  }
454
454
  };
@@ -483,7 +483,7 @@ function hn(t, e, o, n) {
483
483
  i.style.opacity = "0.8";
484
484
  }), i.addEventListener("click", n), i.appendChild(o), i;
485
485
  }
486
- function Er(t) {
486
+ function _r(t) {
487
487
  const e = document.createElement("header");
488
488
  e.className = "ago-chat-widget__header", f(e, {
489
489
  display: "flex",
@@ -492,7 +492,7 @@ function Er(t) {
492
492
  height: "56px",
493
493
  padding: "0 16px",
494
494
  boxSizing: "border-box",
495
- background: Bo,
495
+ background: $o,
496
496
  color: xn,
497
497
  borderBottom: "1px solid #e5e7eb",
498
498
  boxShadow: Mt,
@@ -503,7 +503,7 @@ function Er(t) {
503
503
  alignItems: "center",
504
504
  gap: "12px",
505
505
  minWidth: "0"
506
- }), n = hn("ago-chat-widget__back", t.labels.back, ar({ size: 20 }), t.onBack);
506
+ }), n = hn("ago-chat-widget__back", t.labels.back, lr({ size: 20 }), t.onBack);
507
507
  n.style.marginRight = "-8px";
508
508
  const i = document.createElement("span");
509
509
  i.className = "ago-chat-widget__title", f(i, {
@@ -520,28 +520,28 @@ function Er(t) {
520
520
  alignItems: "center",
521
521
  gap: "8px",
522
522
  flexShrink: "0"
523
- }), d = hn("ago-chat-widget__new", t.labels.newChat, Fn({ size: 20 }), t.onNewChat), l = hn("ago-chat-widget__close", t.labels.close, Mo({ size: 20 }), t.onClose);
523
+ }), d = hn("ago-chat-widget__new", t.labels.newChat, Fn({ size: 20 }), t.onNewChat), l = hn("ago-chat-widget__close", t.labels.close, jo({ size: 20 }), t.onClose);
524
524
  return a.append(d, l), e.append(o, a), {
525
525
  el: e,
526
- update: ({ screen: b }) => {
527
- n.style.display = b === "chat" ? "flex" : "none", d.style.display = b === "home" ? "none" : "flex", i.textContent = b === "history" ? t.labels.history : t.title;
526
+ update: ({ screen: h }) => {
527
+ n.style.display = h === "chat" ? "flex" : "none", d.style.display = h === "home" ? "none" : "flex", i.textContent = h === "history" ? t.labels.history : t.title;
528
528
  }
529
529
  };
530
530
  }
531
- var Po = {
531
+ var Vo = {
532
532
  minutes: "{n}min ago",
533
533
  hours: "{n}h ago",
534
534
  days: "{n}d ago",
535
535
  weeks: "{n} weeks ago",
536
536
  months: "{n} months ago"
537
- }, Sr = 60 * 1e3;
538
- function _r(t, e = Date.now(), o = Po) {
537
+ }, Tr = 60 * 1e3;
538
+ function Ar(t, e = Date.now(), o = Vo) {
539
539
  const n = t instanceof Date ? t.getTime() : new Date(t).getTime(), i = (p, y) => p.replace("{n}", String(y));
540
540
  if (!Number.isFinite(n)) return i(o.minutes, 0);
541
- const a = Math.max(0, Math.floor((e - n) / Sr)), d = Math.floor(a / 60), l = Math.floor(d / 24), b = Math.floor(l / 7), m = Math.max(1, Math.floor(l / 30));
542
- return a < 60 ? i(o.minutes, a) : d < 24 ? i(o.hours, d) : l < 7 ? i(o.days, l) : b < 4 ? i(o.weeks, b) : i(o.months, m);
541
+ const a = Math.max(0, Math.floor((e - n) / Tr)), d = Math.floor(a / 60), l = Math.floor(d / 24), h = Math.floor(l / 7), m = Math.max(1, Math.floor(l / 30));
542
+ return a < 60 ? i(o.minutes, a) : d < 24 ? i(o.hours, d) : l < 7 ? i(o.days, l) : h < 4 ? i(o.weeks, h) : i(o.months, m);
543
543
  }
544
- var Eo = {
544
+ var _o = {
545
545
  home: "Home",
546
546
  chats: "Chats",
547
547
  history: "History",
@@ -559,19 +559,19 @@ var Eo = {
559
559
  tooManyFiles: "Too many files. Maximum allowed: {max}",
560
560
  invalidFileType: "Invalid file type: {name}",
561
561
  fileTooLarge: "File too large: {name} (maximum {max})",
562
- timeAgo: Po
562
+ timeAgo: Vo
563
563
  };
564
- function Tr(t) {
564
+ function Fr(t) {
565
565
  return {
566
- ...Eo,
566
+ ..._o,
567
567
  ...t,
568
568
  timeAgo: {
569
- ...Eo.timeAgo,
569
+ ..._o.timeAgo,
570
570
  ...t?.timeAgo
571
571
  }
572
572
  };
573
573
  }
574
- var Ar = {
574
+ var Lr = {
575
575
  "&": "&amp;",
576
576
  "<": "&lt;",
577
577
  ">": "&gt;",
@@ -579,21 +579,21 @@ var Ar = {
579
579
  "'": "&#39;"
580
580
  };
581
581
  function Je(t) {
582
- return t.replace(/[&<>"']/g, (e) => Ar[e]);
582
+ return t.replace(/[&<>"']/g, (e) => Lr[e]);
583
583
  }
584
- function So(t) {
584
+ function To(t) {
585
585
  const e = t.trim();
586
586
  return /^(https?:|mailto:|tel:|#|\/|\.\/|\.\.\/)/i.test(e) || !/^[a-z][a-z0-9+.-]*:/i.test(e) ? e : null;
587
587
  }
588
- var Uo = '"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace', Bt = "";
588
+ var qo = '"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace', Bt = "";
589
589
  function Pe(t) {
590
590
  const e = [], o = (i) => (e.push(i), `${Bt}${e.length - 1}${Bt}`);
591
591
  let n = t;
592
- return n = n.replace(/`([^`]+)`/g, (i, a) => o(`<code style="background:#f0f2f5;padding:2px 5px;border-radius:4px;font-size:13px;font-family:${Uo}">${Je(a)}</code>`)), n = n.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (i, a, d) => {
593
- const l = So(d);
592
+ return n = n.replace(/`([^`]+)`/g, (i, a) => o(`<code style="background:#f0f2f5;padding:2px 5px;border-radius:4px;font-size:13px;font-family:${qo}">${Je(a)}</code>`)), n = n.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (i, a, d) => {
593
+ const l = To(d);
594
594
  return l ? o(`<img alt="${Je(a)}" src="${Je(l)}" style="max-width:100%;border-radius:8px;margin:4px 0" />`) : i;
595
595
  }), n = n.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (i, a, d) => {
596
- const l = So(d);
596
+ const l = To(d);
597
597
  return l ? o(`<a href="${Je(l)}" target="_blank" rel="noopener noreferrer" style="color:#1b5fc4;text-decoration:underline">${Pe(a)}</a>`) : i;
598
598
  }), n = Je(n), n = n.replace(/\*\*([^*]+?)\*\*/g, "<strong>$1</strong>").replace(/__([^_]+?)__/g, "<strong>$1</strong>").replace(/~~([^~]+?)~~/g, "<del>$1</del>").replace(/(^|[^*])\*(?!\s)([^*]+?)\*/g, "$1<em>$2</em>").replace(/(^|[^\w_])_(?!\s)([^_]+?)_/g, "$1<em>$2</em>"), n = n.replace(new RegExp(`${Bt}(\\d+)${Bt}`, "g"), (i, a) => e[Number(a)]), n;
599
599
  }
@@ -601,7 +601,7 @@ function ue(t, e, o) {
601
601
  const n = document.createElement(t);
602
602
  return Object.assign(n.style, e), o !== void 0 && (n.innerHTML = o), n;
603
603
  }
604
- var Vo = /^ {0,3}([-*_])( *\1){2,} *$/, qo = /^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/, Go = /^ {0,3}(```+|~~~+)/, Dt = /^ {0,3}>\s?/, et = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/, Fr = [
604
+ var Go = /^ {0,3}([-*_])( *\1){2,} *$/, Ko = /^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/, Xo = /^ {0,3}(```+|~~~+)/, Dt = /^ {0,3}>\s?/, et = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/, Nr = [
605
605
  "20px",
606
606
  "18px",
607
607
  "16px",
@@ -609,10 +609,10 @@ var Vo = /^ {0,3}([-*_])( *\1){2,} *$/, qo = /^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,
609
609
  "14px",
610
610
  "13px"
611
611
  ], kn = (t) => t.match(/^\s*/)?.[0].length ?? 0;
612
- function Lr(t) {
613
- return t.trim() === "" || Vo.test(t) || qo.test(t) || Go.test(t) || Dt.test(t) || et.test(t);
612
+ function Ir(t) {
613
+ return t.trim() === "" || Go.test(t) || Ko.test(t) || Xo.test(t) || Dt.test(t) || et.test(t);
614
614
  }
615
- function Ko(t) {
615
+ function Yo(t) {
616
616
  const e = t[0].match(et), o = e[1].length, n = /\d/.test(e[2]), i = ue(n ? "ol" : "ul", {
617
617
  margin: "0 0 8px 0",
618
618
  paddingLeft: "20px",
@@ -624,17 +624,17 @@ function Ko(t) {
624
624
  const d = t[a].match(et), l = [];
625
625
  for (a++; a < t.length && kn(t[a]) > o; )
626
626
  l.push(t[a]), a++;
627
- const b = ue("li", {
627
+ const h = ue("li", {
628
628
  display: "list-item",
629
629
  margin: "2px 0",
630
630
  lineHeight: "1.6"
631
631
  }), m = d[3].match(/^\[([ xX])\]\s+(.*)$/);
632
- m ? (b.style.listStyleType = "none", b.style.marginLeft = "-20px", b.innerHTML = `<span style="margin-right:6px">${m[1].toLowerCase() === "x" ? "☑" : "☐"}</span>${Pe(m[2])}`) : b.innerHTML = Pe(d[3]), l.filter((p) => et.test(p)).length > 0 && b.appendChild(Ko(l.filter((p) => p.trim() !== ""))), i.appendChild(b);
632
+ m ? (h.style.listStyleType = "none", h.style.marginLeft = "-20px", h.innerHTML = `<span style="margin-right:6px">${m[1].toLowerCase() === "x" ? "☑" : "☐"}</span>${Pe(m[2])}`) : h.innerHTML = Pe(d[3]), l.filter((p) => et.test(p)).length > 0 && h.appendChild(Yo(l.filter((p) => p.trim() !== ""))), i.appendChild(h);
633
633
  }
634
634
  return i;
635
635
  }
636
- function Nr(t) {
637
- const e = (l) => l.replace(/^\s*\|?/, "").replace(/\|?\s*$/, "").split("|").map((b) => b.trim()), o = ue("div", {
636
+ function Rr(t) {
637
+ const e = (l) => l.replace(/^\s*\|?/, "").replace(/\|?\s*$/, "").split("|").map((h) => h.trim()), o = ue("div", {
638
638
  overflowX: "auto",
639
639
  margin: "0 0 8px 0"
640
640
  }), n = ue("table", {
@@ -652,16 +652,16 @@ function Nr(t) {
652
652
  i.appendChild(a), n.appendChild(i);
653
653
  const d = document.createElement("tbody");
654
654
  for (const l of t.slice(2)) {
655
- const b = document.createElement("tr");
656
- for (const m of e(l)) b.appendChild(ue("td", {
655
+ const h = document.createElement("tr");
656
+ for (const m of e(l)) h.appendChild(ue("td", {
657
657
  border: "1px solid #dee3e8",
658
658
  padding: "6px 10px"
659
659
  }, Pe(m)));
660
- d.appendChild(b);
660
+ d.appendChild(h);
661
661
  }
662
662
  return n.appendChild(d), o.appendChild(n), o;
663
663
  }
664
- var Ir = (t) => !!t && /^\s*\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/.test(t);
664
+ var zr = (t) => !!t && /^\s*\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/.test(t);
665
665
  function it(t) {
666
666
  const e = document.createDocumentFragment(), o = t.replace(/\r\n?/g, `
667
667
  `).split(`
@@ -673,7 +673,7 @@ function it(t) {
673
673
  n++;
674
674
  continue;
675
675
  }
676
- const d = a.match(Go);
676
+ const d = a.match(Xo);
677
677
  if (d) {
678
678
  const m = d[1][0], p = [];
679
679
  for (n++; n < o.length && !new RegExp(`^ {0,3}${m === "`" ? "`{3,}" : "~{3,}"}\\s*$`).test(o[n]); )
@@ -687,13 +687,13 @@ function it(t) {
687
687
  borderRadius: "6px",
688
688
  fontSize: "13px",
689
689
  overflowX: "auto",
690
- fontFamily: Uo,
690
+ fontFamily: qo,
691
691
  whiteSpace: "pre"
692
692
  }, Je(p.join(`
693
693
  `)))), e.appendChild(y);
694
694
  continue;
695
695
  }
696
- if (Vo.test(a)) {
696
+ if (Go.test(a)) {
697
697
  e.appendChild(ue("hr", {
698
698
  border: "none",
699
699
  borderTop: "1px solid #dee3e8",
@@ -701,12 +701,12 @@ function it(t) {
701
701
  })), n++;
702
702
  continue;
703
703
  }
704
- const l = a.match(qo);
704
+ const l = a.match(Ko);
705
705
  if (l) {
706
706
  const m = l[1].length;
707
707
  e.appendChild(ue(`h${m}`, {
708
708
  margin: "16px 0 8px 0",
709
- fontSize: Fr[m - 1],
709
+ fontSize: Nr[m - 1],
710
710
  fontWeight: "600",
711
711
  lineHeight: "1.3"
712
712
  }, Pe(l[2]))), n++;
@@ -727,11 +727,11 @@ function it(t) {
727
727
  `))), e.appendChild(p);
728
728
  continue;
729
729
  }
730
- if (a.includes("|") && Ir(o[n + 1])) {
730
+ if (a.includes("|") && zr(o[n + 1])) {
731
731
  const m = [a, o[n + 1]];
732
732
  for (n += 2; n < o.length && o[n].includes("|") && o[n].trim(); )
733
733
  m.push(o[n]), n++;
734
- e.appendChild(Nr(m));
734
+ e.appendChild(Rr(m));
735
735
  continue;
736
736
  }
737
737
  if (et.test(a)) {
@@ -740,21 +740,21 @@ function it(t) {
740
740
  if (et.test(o[n]) || kn(o[n]) > p)
741
741
  m.push(o[n]), n++;
742
742
  else break;
743
- e.appendChild(Ko(m));
743
+ e.appendChild(Yo(m));
744
744
  continue;
745
745
  }
746
- const b = [a];
747
- for (n++; n < o.length && !Lr(o[n]); )
748
- b.push(o[n]), n++;
746
+ const h = [a];
747
+ for (n++; n < o.length && !Ir(o[n]); )
748
+ h.push(o[n]), n++;
749
749
  e.appendChild(ue("p", {
750
750
  margin: "0 0 8px 0",
751
751
  lineHeight: "1.6"
752
- }, b.map((m) => Pe(m)).join("<br>")));
752
+ }, h.map((m) => Pe(m)).join("<br>")));
753
753
  }
754
754
  const i = e.lastElementChild;
755
755
  return i && (i.style.marginBottom = "0"), e;
756
756
  }
757
- function Rr(t, e) {
757
+ function Hr(t, e) {
758
758
  const o = c({
759
759
  display: "flex",
760
760
  flexWrap: "wrap",
@@ -765,8 +765,8 @@ function Rr(t, e) {
765
765
  });
766
766
  o.className = "ago-message__attachments";
767
767
  for (const n of t) {
768
- const i = Ro(n.url);
769
- if (zo(n) && i) {
768
+ const i = Ho(n.url);
769
+ if (Oo(n) && i) {
770
770
  const p = document.createElement("a");
771
771
  p.href = i, p.target = "_blank", p.rel = "noopener noreferrer", f(p, {
772
772
  display: "inline-block",
@@ -778,7 +778,7 @@ function Rr(t, e) {
778
778
  maxHeight: "160px",
779
779
  objectFit: "cover",
780
780
  borderRadius: "10px",
781
- border: `1px solid ${Y}`,
781
+ border: `1px solid ${Q}`,
782
782
  display: "block"
783
783
  }), p.appendChild(y), o.appendChild(p);
784
784
  continue;
@@ -790,7 +790,7 @@ function Rr(t, e) {
790
790
  gap: "8px",
791
791
  padding: "8px 12px",
792
792
  borderRadius: "10px",
793
- border: `1px solid ${Y}`,
793
+ border: `1px solid ${Q}`,
794
794
  backgroundColor: e.cardBackground,
795
795
  color: e.cardColor,
796
796
  fontSize: "13px",
@@ -807,14 +807,14 @@ function Rr(t, e) {
807
807
  display: "flex",
808
808
  flexDirection: "column",
809
809
  minWidth: "0"
810
- }), b = c({
810
+ }), h = c({
811
811
  overflow: "hidden",
812
812
  textOverflow: "ellipsis",
813
813
  whiteSpace: "nowrap",
814
814
  maxWidth: "160px"
815
815
  });
816
- b.textContent = n.name, b.title = n.name, l.appendChild(b);
817
- const m = Ho(n.fileSize);
816
+ h.textContent = n.name, h.title = n.name, l.appendChild(h);
817
+ const m = Bo(n.fileSize);
818
818
  if (m) {
819
819
  const p = c({
820
820
  fontSize: "11px",
@@ -826,7 +826,7 @@ function Rr(t, e) {
826
826
  }
827
827
  return o;
828
828
  }
829
- function Xo(t, e) {
829
+ function Qo(t, e) {
830
830
  const o = e.look === "embed", n = c({
831
831
  display: "flex",
832
832
  flexWrap: "wrap",
@@ -855,9 +855,9 @@ function Xo(t, e) {
855
855
  padding: "6px 14px",
856
856
  fontSize: "14px",
857
857
  borderRadius: jt,
858
- border: `1px solid ${Y}`,
858
+ border: `1px solid ${Q}`,
859
859
  backgroundColor: ye,
860
- color: ee,
860
+ color: te,
861
861
  cursor: e.enabled ? "pointer" : "default",
862
862
  transition: "border-color 0.15s"
863
863
  }), e.handler) {
@@ -867,23 +867,23 @@ function Xo(t, e) {
867
867
  a.addEventListener("mouseenter", () => {
868
868
  o ? a.style.backgroundColor = "#fafafa" : a.style.borderColor = ot;
869
869
  }), a.addEventListener("mouseleave", () => {
870
- o ? a.style.backgroundColor = "#fff" : a.style.borderColor = Y;
870
+ o ? a.style.backgroundColor = "#fff" : a.style.borderColor = Q;
871
871
  }), n.appendChild(a);
872
872
  }
873
873
  return n;
874
874
  }
875
- function zr(t, e) {
876
- const { isLast: o, isLastOfBlock: n, bubbleStyle: i, showAgentName: a, agentBubble: d, followUpEnabled: l, followUpHandler: b, isMobile: m, feedbackRow: p } = e, y = t.role === "user", H = i === "imessage", E = c({
875
+ function Or(t, e) {
876
+ const { isLast: o, isLastOfBlock: n, bubbleStyle: i, showAgentName: a, agentBubble: d, followUpEnabled: l, followUpHandler: h, isMobile: m, feedbackRow: p } = e, y = t.role === "user", O = i === "imessage", E = c({
877
877
  display: "flex",
878
878
  flexDirection: "column",
879
879
  alignItems: y ? "flex-end" : "flex-start",
880
- marginBottom: H && !n ? "2px" : "16px"
880
+ marginBottom: O && !n ? "2px" : "16px"
881
881
  });
882
882
  if (E.className = `ago-message ago-message--${t.role}`, !y && a && t.agent) {
883
883
  const k = c({
884
884
  fontSize: "13px",
885
885
  fontWeight: "500",
886
- color: ee,
886
+ color: te,
887
887
  marginBottom: "6px",
888
888
  padding: "0 4px"
889
889
  });
@@ -898,18 +898,18 @@ function zr(t, e) {
898
898
  width: "100%",
899
899
  maxWidth: "85%"
900
900
  });
901
- k.className = "ago-message__sources", t.sources.forEach((N, P) => {
902
- const w = N.url ? document.createElement("a") : document.createElement("div");
903
- N.url && w instanceof HTMLAnchorElement && (w.href = N.url, w.target = "_blank", w.rel = "noopener noreferrer"), f(w, {
901
+ k.className = "ago-message__sources", t.sources.forEach((L, P) => {
902
+ const w = L.url ? document.createElement("a") : document.createElement("div");
903
+ L.url && w instanceof HTMLAnchorElement && (w.href = L.url, w.target = "_blank", w.rel = "noopener noreferrer"), f(w, {
904
904
  display: "flex",
905
905
  alignItems: "center",
906
906
  gap: "8px",
907
907
  padding: "8px 10px",
908
- border: `1px solid ${Y}`,
908
+ border: `1px solid ${Q}`,
909
909
  borderRadius: "8px",
910
910
  backgroundColor: ye,
911
911
  textDecoration: "none",
912
- color: ee,
912
+ color: te,
913
913
  fontSize: "12px",
914
914
  overflow: "hidden"
915
915
  });
@@ -933,30 +933,30 @@ function zr(t, e) {
933
933
  textOverflow: "ellipsis",
934
934
  whiteSpace: "nowrap"
935
935
  });
936
- C.textContent = N.title, C.title = N.title, w.append(z, C), k.appendChild(w);
936
+ C.textContent = L.title, C.title = L.title, w.append(z, C), k.appendChild(w);
937
937
  }), E.appendChild(k);
938
938
  }
939
- if (t.attachments && t.attachments.length > 0 && E.appendChild(Rr(t.attachments, {
939
+ if (t.attachments && t.attachments.length > 0 && E.appendChild(Hr(t.attachments, {
940
940
  isUser: y,
941
941
  cardBackground: y ? "rgba(255,255,255,0.12)" : ye,
942
- cardColor: y ? nt : ee
942
+ cardColor: y ? nt : te
943
943
  })), !y && e.renderToolCall && t.toolCalls?.length) for (const k of t.toolCalls) {
944
- const N = e.renderToolCall(k, t);
945
- N && E.appendChild(N);
944
+ const L = e.renderToolCall(k, t);
945
+ L && E.appendChild(L);
946
946
  }
947
- const u = y || d || H, v = !!t.content || t.status === "IN_PROGRESS" || t.status === "WAITING_CLIENT", L = c({
948
- maxWidth: u ? H || y ? m ? "88%" : "75%" : m ? "92%" : "85%" : "100%",
947
+ const u = y || d || O, v = !!t.content || t.status === "IN_PROGRESS" || t.status === "WAITING_CLIENT", F = c({
948
+ maxWidth: u ? O || y ? m ? "88%" : "75%" : m ? "92%" : "85%" : "100%",
949
949
  padding: u ? "10px 14px" : "2px 8px",
950
- borderRadius: H ? Ui : u ? jt : "0",
950
+ borderRadius: O ? qi : u ? jt : "0",
951
951
  backgroundColor: y ? fe : u ? wn : "transparent",
952
- color: y ? nt : ee,
952
+ color: y ? nt : te,
953
953
  overflowWrap: "break-word",
954
954
  textWrap: "pretty",
955
955
  fontSize: "16px",
956
956
  lineHeight: "1.6"
957
957
  });
958
- if (L.className = "ago-message__content", H && n) {
959
- L.style.position = "relative";
958
+ if (F.className = "ago-message__content", O && n) {
959
+ F.style.position = "relative";
960
960
  const k = c({
961
961
  position: "absolute",
962
962
  zIndex: "0",
@@ -966,23 +966,23 @@ function zr(t, e) {
966
966
  background: y ? fe : wn
967
967
  });
968
968
  k.className = "ago-message__tail";
969
- const N = c({
969
+ const L = c({
970
970
  position: "absolute",
971
971
  zIndex: "1",
972
972
  bottom: "-2px",
973
973
  width: "10px",
974
974
  height: "20px",
975
- background: Do
975
+ background: Mo
976
976
  });
977
- N.className = "ago-message__tail-mask", y ? (k.style.right = "-8px", k.style.borderBottomLeftRadius = "16px 14px", N.style.right = "-10px", N.style.borderBottomLeftRadius = "10px") : (k.style.left = "-7px", k.style.borderBottomRightRadius = "16px 14px", N.style.left = "-10px", N.style.borderBottomRightRadius = "10px"), L.append(k, N);
977
+ L.className = "ago-message__tail-mask", y ? (k.style.right = "-8px", k.style.borderBottomLeftRadius = "16px 14px", L.style.right = "-10px", L.style.borderBottomLeftRadius = "10px") : (k.style.left = "-7px", k.style.borderBottomRightRadius = "16px 14px", L.style.left = "-10px", L.style.borderBottomRightRadius = "10px"), F.append(k, L);
978
978
  }
979
- return t.content ? L.appendChild(it(t.content)) : (t.status === "IN_PROGRESS" || t.status === "WAITING_CLIENT") && L.appendChild(Or()), v && E.appendChild(L), !y && p && E.appendChild(p), o && t.followUpReplies && t.followUpReplies.length > 0 && E.appendChild(Xo(t.followUpReplies, {
979
+ return t.content ? F.appendChild(it(t.content)) : (t.status === "IN_PROGRESS" || t.status === "WAITING_CLIENT") && F.appendChild(Dr()), v && E.appendChild(F), !y && p && E.appendChild(p), o && t.followUpReplies && t.followUpReplies.length > 0 && E.appendChild(Qo(t.followUpReplies, {
980
980
  enabled: l,
981
- handler: b,
981
+ handler: h,
982
982
  look: "classic"
983
983
  })), E;
984
984
  }
985
- function Hr(t) {
985
+ function Br(t) {
986
986
  const e = c({
987
987
  display: "flex",
988
988
  alignItems: "center",
@@ -1001,7 +1001,7 @@ function Hr(t) {
1001
1001
  const n = document.createElement("span");
1002
1002
  return n.textContent = t, e.append(o, n), e;
1003
1003
  }
1004
- function Or() {
1004
+ function Dr() {
1005
1005
  const t = c({
1006
1006
  display: "flex",
1007
1007
  gap: "4px",
@@ -1021,13 +1021,13 @@ function Or() {
1021
1021
  }
1022
1022
  return t;
1023
1023
  }
1024
- function Br() {
1024
+ function $r() {
1025
1025
  const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
1026
1026
  e.setAttribute("width", "26"), e.setAttribute("height", "26"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("fill", "none");
1027
1027
  const o = document.createElementNS(t, "path");
1028
1028
  return o.setAttribute("d", "M21 11.5a8.38 8.38 0 0 1-8.5 8.5 8.5 8.5 0 0 1-3.8-.9L3 21l1.9-5.7a8.5 8.5 0 0 1-.9-3.8 8.38 8.38 0 0 1 8.5-8.5 8.38 8.38 0 0 1 8.5 8.5z"), o.setAttribute("stroke", "currentColor"), o.setAttribute("stroke-width", "2"), o.setAttribute("stroke-linecap", "round"), o.setAttribute("stroke-linejoin", "round"), e.appendChild(o), e;
1029
1029
  }
1030
- function Dr(t) {
1030
+ function Mr(t) {
1031
1031
  const e = document.createElement("button");
1032
1032
  if (e.type = "button", e.className = "ago-chat-widget-launcher", e.setAttribute("aria-label", `Open ${t.title}`), e.setAttribute("aria-expanded", "false"), t.look === "classic") {
1033
1033
  if (f(e, {
@@ -1054,7 +1054,7 @@ function Dr(t) {
1054
1054
  height: "26px",
1055
1055
  objectFit: "contain"
1056
1056
  }), e.appendChild(i);
1057
- } else e.appendChild(Br());
1057
+ } else e.appendChild($r());
1058
1058
  return e.addEventListener("click", t.onClick), {
1059
1059
  el: e,
1060
1060
  setOpen: (i) => {
@@ -1073,8 +1073,8 @@ function Dr(t) {
1073
1073
  boxSizing: "border-box",
1074
1074
  border: "none",
1075
1075
  borderRadius: "50%",
1076
- backgroundColor: qi,
1077
- color: Ki,
1076
+ backgroundColor: Ki,
1077
+ color: Yi,
1078
1078
  display: "flex",
1079
1079
  alignItems: "center",
1080
1080
  justifyContent: "center",
@@ -1099,9 +1099,9 @@ function Dr(t) {
1099
1099
  width: "32px",
1100
1100
  height: "32px",
1101
1101
  objectFit: "contain"
1102
- }), o = i, n = nr(), e.append(i, n);
1102
+ }), o = i, n = ir(), e.append(i, n);
1103
1103
  } else {
1104
- const i = Yi();
1104
+ const i = Ji();
1105
1105
  o = i.querySelector('[data-ago-path="open"]'), n = i.querySelector('[data-ago-path="close"]'), e.appendChild(i);
1106
1106
  }
1107
1107
  return n.style.display = "none", e.addEventListener("click", t.onClick), {
@@ -1111,7 +1111,7 @@ function Dr(t) {
1111
1111
  }
1112
1112
  };
1113
1113
  }
1114
- function $r(t) {
1114
+ function Wr(t) {
1115
1115
  const e = c({
1116
1116
  marginBottom: "12px",
1117
1117
  display: "flex",
@@ -1120,7 +1120,7 @@ function $r(t) {
1120
1120
  });
1121
1121
  e.className = "ago-message__attachments";
1122
1122
  for (const o of t.attachments ?? []) {
1123
- const n = Ro(o.url), i = c({
1123
+ const n = Ho(o.url), i = c({
1124
1124
  display: "flex",
1125
1125
  alignItems: "center",
1126
1126
  gap: "8px",
@@ -1132,7 +1132,7 @@ function $r(t) {
1132
1132
  maxWidth: "100%",
1133
1133
  boxSizing: "border-box"
1134
1134
  });
1135
- if (zo(o) && n) {
1135
+ if (Oo(o) && n) {
1136
1136
  const a = document.createElement("a");
1137
1137
  a.href = n, a.target = "_blank", a.rel = "noopener noreferrer", f(a, {
1138
1138
  display: "flex",
@@ -1175,15 +1175,15 @@ function $r(t) {
1175
1175
  overflow: "hidden",
1176
1176
  textOverflow: "ellipsis",
1177
1177
  whiteSpace: "nowrap"
1178
- }), a.append(lr({ size: 20 }), d);
1179
- const l = Ho(o.fileSize);
1178
+ }), a.append(cr({ size: 20 }), d);
1179
+ const l = Bo(o.fileSize);
1180
1180
  if (l) {
1181
- const b = document.createElement("span");
1182
- b.textContent = l, f(b, {
1181
+ const h = document.createElement("span");
1182
+ h.textContent = l, f(h, {
1183
1183
  fontSize: "12px",
1184
1184
  lineHeight: "16px",
1185
1185
  color: "#6b7280"
1186
- }), a.appendChild(b);
1186
+ }), a.appendChild(h);
1187
1187
  }
1188
1188
  i.appendChild(a);
1189
1189
  }
@@ -1191,7 +1191,7 @@ function $r(t) {
1191
1191
  }
1192
1192
  return e;
1193
1193
  }
1194
- function Mr(t) {
1194
+ function jr(t) {
1195
1195
  const e = c({
1196
1196
  display: "flex",
1197
1197
  justifyContent: "flex-end"
@@ -1200,20 +1200,20 @@ function Mr(t) {
1200
1200
  borderRadius: "16px",
1201
1201
  marginBottom: "16px",
1202
1202
  padding: "16px",
1203
- backgroundColor: tr,
1204
- color: hr,
1203
+ backgroundColor: or,
1204
+ color: xr,
1205
1205
  boxSizing: "border-box",
1206
1206
  fontSize: "14px",
1207
1207
  lineHeight: "24px"
1208
1208
  });
1209
- o.className = "ago-message__content", t.attachments?.length && o.appendChild($r(t));
1209
+ o.className = "ago-message__content", t.attachments?.length && o.appendChild(Wr(t));
1210
1210
  const n = c({
1211
1211
  whiteSpace: "pre-wrap",
1212
1212
  overflowWrap: "break-word"
1213
1213
  });
1214
1214
  return n.textContent = t.content, o.appendChild(n), e.appendChild(o), e;
1215
1215
  }
1216
- function Wr(t) {
1216
+ function Pr(t) {
1217
1217
  const e = c({
1218
1218
  display: "grid",
1219
1219
  gridTemplateColumns: "1fr 1fr",
@@ -1228,13 +1228,13 @@ function Wr(t) {
1228
1228
  height: "48px",
1229
1229
  justifyContent: "flex-start",
1230
1230
  padding: "8px 16px",
1231
- border: `1px solid ${Oo}`,
1231
+ border: `1px solid ${Do}`,
1232
1232
  backgroundColor: "#fff",
1233
1233
  borderRadius: "6px",
1234
1234
  boxShadow: Mt,
1235
1235
  fontSize: "14px",
1236
1236
  fontWeight: "500",
1237
- color: ee,
1237
+ color: te,
1238
1238
  textDecoration: "none",
1239
1239
  overflow: "hidden",
1240
1240
  boxSizing: "border-box",
@@ -1257,7 +1257,7 @@ function Wr(t) {
1257
1257
  borderRadius: "4px",
1258
1258
  border: `1px solid ${yn}`,
1259
1259
  color: yn,
1260
- backgroundColor: jo,
1260
+ backgroundColor: Uo,
1261
1261
  fontSize: "12px",
1262
1262
  lineHeight: "1",
1263
1263
  display: "flex",
@@ -1276,13 +1276,13 @@ function Wr(t) {
1276
1276
  l.textContent = o.title, l.title = o.title, a.append(d, l), i.appendChild(a), e.appendChild(i);
1277
1277
  }), e;
1278
1278
  }
1279
- function jr(t, e) {
1280
- return Yo({
1279
+ function Ur(t, e) {
1280
+ return Jo({
1281
1281
  errorTitle: t,
1282
1282
  errorDescription: e
1283
1283
  });
1284
1284
  }
1285
- function Yo(t) {
1285
+ function Jo(t) {
1286
1286
  const e = c({
1287
1287
  position: "relative",
1288
1288
  width: "100%",
@@ -1296,7 +1296,7 @@ function Yo(t) {
1296
1296
  boxSizing: "border-box"
1297
1297
  });
1298
1298
  e.className = "ago-message__error", e.setAttribute("role", "alert");
1299
- const o = ir({ size: 16 });
1299
+ const o = ar({ size: 16 });
1300
1300
  f(o, {
1301
1301
  position: "absolute",
1302
1302
  left: "16px",
@@ -1316,7 +1316,7 @@ function Yo(t) {
1316
1316
  });
1317
1317
  return i.textContent = t.errorDescription, e.append(o, n, i), e;
1318
1318
  }
1319
- function Pr() {
1319
+ function Vr() {
1320
1320
  const t = c({
1321
1321
  marginTop: "4px",
1322
1322
  animation: "ago-skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
@@ -1331,7 +1331,7 @@ function Pr() {
1331
1331
  });
1332
1332
  return t.appendChild(e), t;
1333
1333
  }
1334
- function Ur() {
1334
+ function qr() {
1335
1335
  const t = c({
1336
1336
  display: "flex",
1337
1337
  alignItems: "center",
@@ -1339,13 +1339,13 @@ function Ur() {
1339
1339
  gap: "8px"
1340
1340
  });
1341
1341
  t.className = "ago-message__spinner";
1342
- const e = xr({ size: 20 });
1342
+ const e = Cr({ size: 20 });
1343
1343
  return f(e, {
1344
1344
  color: "#a1a1aa",
1345
1345
  animation: "ago-spin 1s linear infinite"
1346
1346
  }), t.appendChild(e), t;
1347
1347
  }
1348
- function Vr(t, e) {
1348
+ function Gr(t, e) {
1349
1349
  const o = t.status === "IN_PROGRESS" || t.status === "WAITING_CLIENT", n = c({
1350
1350
  position: "relative",
1351
1351
  display: "flex",
@@ -1355,7 +1355,7 @@ function Vr(t, e) {
1355
1355
  marginBottom: "16px",
1356
1356
  boxSizing: "border-box"
1357
1357
  });
1358
- n.className = "ago-message__row", e.agentRowTinted && (n.style.backgroundColor = wn), e.agentRowTextTinted && (n.style.color = Vi);
1358
+ n.className = "ago-message__row", e.agentRowTinted && (n.style.backgroundColor = wn), e.agentRowTextTinted && (n.style.color = Gi);
1359
1359
  const i = c({
1360
1360
  flex: "1",
1361
1361
  minWidth: "0",
@@ -1364,27 +1364,27 @@ function Vr(t, e) {
1364
1364
  fontSize: "14px",
1365
1365
  lineHeight: "24px"
1366
1366
  });
1367
- if (i.className = "ago-message__body", o && i.appendChild(Ur()), t.sources?.length && i.appendChild(Wr(t)), e.renderToolCall && t.toolCalls?.length) for (const a of t.toolCalls) {
1367
+ if (i.className = "ago-message__body", o && i.appendChild(qr()), t.sources?.length && i.appendChild(Pr(t)), e.renderToolCall && t.toolCalls?.length) for (const a of t.toolCalls) {
1368
1368
  const d = e.renderToolCall(a, t);
1369
1369
  d && i.appendChild(d);
1370
1370
  }
1371
- if (t.status === "ERROR") i.appendChild(Yo(e.labels));
1371
+ if (t.status === "ERROR") i.appendChild(Jo(e.labels));
1372
1372
  else if (t.content) {
1373
1373
  const a = c({});
1374
1374
  a.className = "ago-message__markdown ago-message__content", a.appendChild(it(t.content)), i.appendChild(a);
1375
- } else o && i.appendChild(Pr());
1376
- return e.isLast && t.status === "DONE" && t.followUpReplies?.length && i.appendChild(Xo(t.followUpReplies, {
1375
+ } else o && i.appendChild(Vr());
1376
+ return e.isLast && t.status === "DONE" && t.followUpReplies?.length && i.appendChild(Qo(t.followUpReplies, {
1377
1377
  enabled: e.followUpEnabled,
1378
1378
  handler: e.followUpHandler,
1379
1379
  look: "embed"
1380
1380
  })), e.actionsRow && !o && i.appendChild(e.actionsRow), n.appendChild(i), n;
1381
1381
  }
1382
- function qr(t, e) {
1382
+ function Kr(t, e) {
1383
1383
  const o = c({});
1384
- return o.className = `ago-message ago-message--${t.role}`, o.dataset.messageId = t.id, o.dataset.messageRole = t.role, o.appendChild(t.role === "user" ? Mr(t) : Vr(t, e)), o;
1384
+ return o.className = `ago-message ago-message--${t.role}`, o.dataset.messageId = t.id, o.dataset.messageRole = t.role, o.appendChild(t.role === "user" ? jr(t) : Gr(t, e)), o;
1385
1385
  }
1386
1386
  var En = "ago-hs-form-ready";
1387
- function Gr(t, e) {
1387
+ function Xr(t, e) {
1388
1388
  const o = t.tagName === "TEXTAREA" ? Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value") : Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value"), n = t._valueTracker;
1389
1389
  n && n.setValue(""), t.focus(), t.dispatchEvent(new Event("focus", { bubbles: !0 })), o?.set ? o.set.call(t, e) : t.value = e, t.setAttribute("value", e), t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 })), t.dispatchEvent(new Event("blur", { bubbles: !0 }));
1390
1390
  }
@@ -1394,17 +1394,17 @@ function Wt(t, e) {
1394
1394
  for (const i of o) {
1395
1395
  if (i.type === "hidden" || i.type === "submit" || i.type === "button") continue;
1396
1396
  const a = e[i.name] ?? (i.name.includes("/") ? e[i.name.split("/").pop()] : void 0);
1397
- a && !i.value && (Gr(i, a), n = !0);
1397
+ a && !i.value && (Xr(i, a), n = !0);
1398
1398
  }
1399
1399
  return n;
1400
1400
  }
1401
- function Kr(t) {
1401
+ function Yr(t) {
1402
1402
  return `function($f){document.dispatchEvent(new CustomEvent(${JSON.stringify(En)},{detail:{token:${JSON.stringify(t)},form:$f}}))}`;
1403
1403
  }
1404
- function Xr(t, e, o) {
1405
- return !t || !e || Object.keys(e).length === 0 ? t : /hbspt\.forms\.create\s*\(\s*\{/.test(t) && !/onFormReady/.test(t) ? t.replace(/hbspt\.forms\.create\s*\(\s*\{/g, `hbspt.forms.create({onFormReady:${Kr(o)},`) : t;
1404
+ function Qr(t, e, o) {
1405
+ return !t || !e || Object.keys(e).length === 0 ? t : /hbspt\.forms\.create\s*\(\s*\{/.test(t) && !/onFormReady/.test(t) ? t.replace(/hbspt\.forms\.create\s*\(\s*\{/g, `hbspt.forms.create({onFormReady:${Yr(o)},`) : t;
1406
1406
  }
1407
- function Yr(t, e) {
1407
+ function Jr(t, e) {
1408
1408
  if (!t || Object.keys(t).length === 0) return () => {
1409
1409
  };
1410
1410
  const o = {};
@@ -1412,7 +1412,7 @@ function Yr(t, e) {
1412
1412
  const n = [], i = [], a = (d) => {
1413
1413
  const l = d.detail;
1414
1414
  if (!l || l.token !== e) return;
1415
- const b = l.form, m = b && typeof b == "object" && "jquery" in b && b.jquery ? b[0] : b;
1415
+ const h = l.form, m = h && typeof h == "object" && "jquery" in h && h.jquery ? h[0] : h;
1416
1416
  if (!m || typeof m.querySelectorAll != "function") return;
1417
1417
  Wt(m, o);
1418
1418
  const p = new MutationObserver(() => {
@@ -1427,10 +1427,10 @@ function Yr(t, e) {
1427
1427
  document.removeEventListener(En, a), n.forEach((d) => d.disconnect()), i.forEach((d) => clearTimeout(d));
1428
1428
  };
1429
1429
  }
1430
- function Qo() {
1430
+ function Zo() {
1431
1431
  return globalThis.HubSpotFormsV4;
1432
1432
  }
1433
- async function Jo(t, e) {
1433
+ async function ei(t, e) {
1434
1434
  let o = null;
1435
1435
  if (t.getFormFieldValues) try {
1436
1436
  const n = await t.getFormFieldValues();
@@ -1453,24 +1453,24 @@ async function Jo(t, e) {
1453
1453
  }
1454
1454
  }
1455
1455
  }
1456
- function _o(t) {
1456
+ function Ao(t) {
1457
1457
  if (!t || Object.keys(t).length === 0) return () => {
1458
1458
  };
1459
1459
  const e = (o) => {
1460
1460
  try {
1461
- const n = Qo()?.getFormFromEvent?.(o);
1461
+ const n = Zo()?.getFormFromEvent?.(o);
1462
1462
  if (!n?.setFieldValue) return;
1463
- Jo(n, t);
1463
+ ei(n, t);
1464
1464
  } catch {
1465
1465
  }
1466
1466
  };
1467
1467
  return window.addEventListener("hs-form-event:on-ready", e), () => window.removeEventListener("hs-form-event:on-ready", e);
1468
1468
  }
1469
- function Qr(t) {
1470
- const e = Qo()?.getForms?.();
1469
+ function Zr(t) {
1470
+ const e = Zo()?.getForms?.();
1471
1471
  if (!Array.isArray(e) || e.length === 0) return !1;
1472
1472
  for (const o of e)
1473
- o?.setFieldValue && Jo(o, t);
1473
+ o?.setFieldValue && ei(o, t);
1474
1474
  return !0;
1475
1475
  }
1476
1476
  var Sn = "ago-hs-form-submit", _n = "ago-hs-form-submitted";
@@ -1488,7 +1488,7 @@ function $t(t) {
1488
1488
  }
1489
1489
  return Object.keys(o).length > 0 ? o : null;
1490
1490
  }
1491
- function Jr(t) {
1491
+ function ea(t) {
1492
1492
  try {
1493
1493
  const e = new FormData(t), o = {};
1494
1494
  return e.forEach((n, i) => {
@@ -1498,30 +1498,30 @@ function Jr(t) {
1498
1498
  return null;
1499
1499
  }
1500
1500
  }
1501
- function To(t, e, o) {
1501
+ function Fo(t, e, o) {
1502
1502
  const n = o ? `{token:${JSON.stringify(e)},form:$f}` : `{token:${JSON.stringify(e)}}`;
1503
1503
  return `function(${o ? "$f" : ""}){document.dispatchEvent(new CustomEvent(${JSON.stringify(t)},{detail:${n}}))}`;
1504
1504
  }
1505
- function Zr(t, e) {
1506
- return t && (/hbspt\.forms\.create\s*\(\s*\{/.test(t) && !t.includes("ago-hs-form-submitted") ? t.replace(/hbspt\.forms\.create\s*\(\s*\{/g, `hbspt.forms.create({onFormSubmit:${To(Sn, e, !0)},onFormSubmitted:${To(_n, e, !1)},`) : t);
1505
+ function ta(t, e) {
1506
+ return t && (/hbspt\.forms\.create\s*\(\s*\{/.test(t) && !t.includes("ago-hs-form-submitted") ? t.replace(/hbspt\.forms\.create\s*\(\s*\{/g, `hbspt.forms.create({onFormSubmit:${Fo(Sn, e, !0)},onFormSubmitted:${Fo(_n, e, !1)},`) : t);
1507
1507
  }
1508
- function ea(t, e, o, n) {
1508
+ function na(t, e, o, n) {
1509
1509
  let i = !1, a = null;
1510
1510
  function d() {
1511
1511
  i || (i = !0, e($t(a)));
1512
1512
  }
1513
1513
  function l(u) {
1514
- if (a || (a = Jr(u)), u.closest(".hs-form, .hbspt-form, [data-hs-forms]")) {
1514
+ if (a || (a = ea(u)), u.closest(".hs-form, .hbspt-form, [data-hs-forms]")) {
1515
1515
  o?.();
1516
1516
  return;
1517
1517
  }
1518
1518
  d();
1519
1519
  }
1520
- const b = (u) => {
1520
+ const h = (u) => {
1521
1521
  const v = u.target;
1522
1522
  v?.tagName === "FORM" && l(v);
1523
1523
  };
1524
- t.addEventListener("submit", b, !0);
1524
+ t.addEventListener("submit", h, !0);
1525
1525
  const m = /* @__PURE__ */ new WeakSet();
1526
1526
  function p(u) {
1527
1527
  m.has(u) || (m.add(u), u.addEventListener("submit", () => l(u)));
@@ -1534,14 +1534,14 @@ function ea(t, e, o, n) {
1534
1534
  childList: !0,
1535
1535
  subtree: !0
1536
1536
  });
1537
- const H = (u) => {
1537
+ const O = (u) => {
1538
1538
  const v = u.detail;
1539
1539
  if (!(!v || v.token !== n))
1540
1540
  try {
1541
- const L = v.form, k = L && typeof L == "object" && "jquery" in L && L.jquery ? L[0] : L;
1541
+ const F = v.form, k = F && typeof F == "object" && "jquery" in F && F.jquery ? F[0] : F;
1542
1542
  if (k?.querySelectorAll) {
1543
- const N = k.querySelectorAll("input, textarea, select"), P = {};
1544
- for (const w of N) w.name && w.type !== "submit" && w.type !== "button" && (P[w.name] = w.value || "");
1543
+ const L = k.querySelectorAll("input, textarea, select"), P = {};
1544
+ for (const w of L) w.name && w.type !== "submit" && w.type !== "button" && (P[w.name] = w.value || "");
1545
1545
  Object.keys(P).length > 0 && (a = P);
1546
1546
  }
1547
1547
  } catch {
@@ -1550,69 +1550,69 @@ function ea(t, e, o, n) {
1550
1550
  const v = u.detail;
1551
1551
  !v || v.token !== n || d();
1552
1552
  };
1553
- return document.addEventListener(Sn, H), document.addEventListener(_n, E), () => {
1554
- t.removeEventListener("submit", b, !0), y.disconnect(), document.removeEventListener(Sn, H), document.removeEventListener(_n, E);
1553
+ return document.addEventListener(Sn, O), document.addEventListener(_n, E), () => {
1554
+ t.removeEventListener("submit", h, !0), y.disconnect(), document.removeEventListener(Sn, O), document.removeEventListener(_n, E);
1555
1555
  };
1556
1556
  }
1557
- function se(t) {
1557
+ function le(t) {
1558
1558
  return t.externalId || t.id;
1559
1559
  }
1560
- function Zo(t) {
1560
+ function ti(t) {
1561
1561
  return t.conditionalFieldValues?.length ? t.conditionalFieldValues : t.conditionalFieldValue?.split(",").map((e) => e.trim()).filter(Boolean) ?? [];
1562
1562
  }
1563
1563
  function Ln(t, e) {
1564
1564
  return !t.priorityTypologies?.length || !e || t.priorityTypologies.includes(e);
1565
1565
  }
1566
- function ei(t, e, o, n, i, a) {
1566
+ function ni(t, e, o, n, i, a) {
1567
1567
  if (!e || !o.length) return !0;
1568
1568
  const d = t.fields.find((l) => l.id === e || l.externalId === e);
1569
- return d ? Pt(t, d, n, i, a) && o.includes(n[se(d)]) : !0;
1569
+ return d ? Pt(t, d, n, i, a) && o.includes(n[le(d)]) : !0;
1570
1570
  }
1571
1571
  function Pt(t, e, o, n = "", i = /* @__PURE__ */ new Set()) {
1572
1572
  if (e.active === !1 || i.has(e.id) || e.title === "Priority" && !Ln(t, n)) return !1;
1573
1573
  const a = new Set(i).add(e.id);
1574
- return ei(t, e.conditionalFieldId, Zo(e), o, n, a);
1574
+ return ni(t, e.conditionalFieldId, ti(e), o, n, a);
1575
1575
  }
1576
- function ti(t, e, o, n = "") {
1577
- return e.options.filter((i) => ei(t, i.conditionalFieldId, i.conditionalFieldValues ?? [], o, n, /* @__PURE__ */ new Set())).sort((i, a) => (i.position ?? 0) - (a.position ?? 0));
1576
+ function oi(t, e, o, n = "") {
1577
+ return e.options.filter((i) => ni(t, i.conditionalFieldId, i.conditionalFieldValues ?? [], o, n, /* @__PURE__ */ new Set())).sort((i, a) => (i.position ?? 0) - (a.position ?? 0));
1578
1578
  }
1579
1579
  function Ze(t, e, o = "") {
1580
1580
  let n;
1581
1581
  do {
1582
1582
  n = !1;
1583
1583
  for (const i of t.fields) {
1584
- const a = se(i);
1584
+ const a = le(i);
1585
1585
  if (!(a in e)) continue;
1586
- const d = !i.options.length || !e[a] || ti(t, i, e, o).some((l) => (l.value ?? l.name ?? "") === e[a]);
1586
+ const d = !i.options.length || !e[a] || oi(t, i, e, o).some((l) => (l.value ?? l.name ?? "") === e[a]);
1587
1587
  (!Pt(t, i, e, o) || !d) && (delete e[a], n = !0);
1588
1588
  }
1589
1589
  } while (n);
1590
1590
  }
1591
- function ta(t, e, o = "") {
1591
+ function oa(t, e, o = "") {
1592
1592
  const n = [...t.fields].sort((i, a) => i.position - a.position).filter((i) => !i.hidden && Pt(t, i, e, o));
1593
1593
  return n.filter((i, a) => {
1594
- if (a === 0 || i.alwaysVisible || i.conditionalFieldId && Zo(i).length) return !0;
1594
+ if (a === 0 || i.alwaysVisible || i.conditionalFieldId && ti(i).length) return !0;
1595
1595
  const d = n[a - 1];
1596
- return d.type === "checkbox" || !!e[se(d)]?.trim();
1596
+ return d.type === "checkbox" || !!e[le(d)]?.trim();
1597
1597
  });
1598
1598
  }
1599
- var na = "var(--ago-send-button-background, var(--ago-accent-color, #003edf))", oa = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/;
1600
- function ia(t) {
1599
+ var ia = "var(--ago-send-button-background, var(--ago-accent-color, #003edf))", ra = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/;
1600
+ function aa(t) {
1601
1601
  return t.toLowerCase().trim().replace(/[^a-z0-9_]/g, "_");
1602
1602
  }
1603
- function ni(t, e, o) {
1603
+ function ii(t, e, o) {
1604
1604
  const n = {};
1605
1605
  if (e) {
1606
1606
  for (const i of e.fields) {
1607
1607
  if (i.active === !1) continue;
1608
1608
  const a = i.options.find((d) => d.default);
1609
- a && (n[se(i)] = a.value ?? a.name ?? "");
1609
+ a && (n[le(i)] = a.value ?? a.name ?? "");
1610
1610
  }
1611
1611
  if (t?.tag)
1612
- for (const i of e.fields) i.type === "tagger" && (n[se(i)] = t.tag);
1612
+ for (const i of e.fields) i.type === "tagger" && (n[le(i)] = t.tag);
1613
1613
  if (t?.custom_fields) for (const [i, a] of Object.entries(t.custom_fields)) {
1614
- const d = e.fields.find((l) => l.externalId === i || l.id === i || (l.title ? ia(l.title) === i : !1));
1615
- d && (n[se(d)] = a);
1614
+ const d = e.fields.find((l) => l.externalId === i || l.id === i || (l.title ? aa(l.title) === i : !1));
1615
+ d && (n[le(d)] = a);
1616
1616
  }
1617
1617
  }
1618
1618
  return e && Ze(e, n, t?.typology ?? "Question"), {
@@ -1632,31 +1632,31 @@ function ni(t, e, o) {
1632
1632
  submitError: null
1633
1633
  };
1634
1634
  }
1635
- function ra(t, e, o) {
1635
+ function sa(t, e, o) {
1636
1636
  t.customFields = {
1637
- ...ni(e, o, t.email).customFields,
1637
+ ...ii(e, o, t.email).customFields,
1638
1638
  ...t.customFields
1639
1639
  }, Ze(o, t.customFields, t.ticket.typology);
1640
1640
  }
1641
- function Ao(t, e) {
1641
+ function Lo(t, e) {
1642
1642
  return t.replace(/\{(\w+)\}/g, (o, n) => e[n] ?? "");
1643
1643
  }
1644
- function aa(t, e, o, n) {
1644
+ function la(t, e, o, n) {
1645
1645
  const i = {}, a = e.ticket;
1646
1646
  t.showSubject && !a.subject.trim() && (i.subject = o.subjectRequired), t.showTypology && !a.typology.trim() && (i.typology = o.typologyRequired), t.showPriority && Ln(t, a.typology) && !a.priority.trim() && (i.priority = o.priorityRequired), t.showBody && !a.body.trim() && (i.body = o.detailedContextRequired);
1647
1647
  for (const d of t.fields) {
1648
1648
  if (d.hidden || !Pt(t, d, e.customFields, a.typology)) continue;
1649
- const l = e.customFields[se(d)];
1650
- if (d.required && !l?.trim()) i[se(d)] = Ao(o.fieldRequired, { fieldTitle: d.title ?? "" });
1649
+ const l = e.customFields[le(d)];
1650
+ if (d.required && !l?.trim()) i[le(d)] = Lo(o.fieldRequired, { fieldTitle: d.title ?? "" });
1651
1651
  else if (d.regexpForValidation && l?.trim()) try {
1652
- new RegExp(d.regexpForValidation).test(l) || (i[se(d)] = Ao(o.fieldFormatInvalid, { fieldTitle: d.title ?? "" }));
1652
+ new RegExp(d.regexpForValidation).test(l) || (i[le(d)] = Lo(o.fieldFormatInvalid, { fieldTitle: d.title ?? "" }));
1653
1653
  } catch {
1654
1654
  }
1655
1655
  }
1656
- return n && (e.email.trim() ? oa.test(e.email) || (i.userEmail = o.emailInvalid) : i.userEmail = o.emailRequired), i;
1656
+ return n && (e.email.trim() ? ra.test(e.email) || (i.userEmail = o.emailInvalid) : i.userEmail = o.emailRequired), i;
1657
1657
  }
1658
- var sa = {
1659
- border: `1px solid ${Y}`,
1658
+ var da = {
1659
+ border: `1px solid ${Q}`,
1660
1660
  borderRadius: "4px",
1661
1661
  width: "100%",
1662
1662
  padding: "8px",
@@ -1664,7 +1664,7 @@ var sa = {
1664
1664
  fontSize: "16px",
1665
1665
  lineHeight: "24px",
1666
1666
  fontFamily: Le,
1667
- color: ee,
1667
+ color: te,
1668
1668
  backgroundColor: ye
1669
1669
  };
1670
1670
  function Me(t, e) {
@@ -1692,13 +1692,13 @@ function We() {
1692
1692
  return t.className = "ago-ticket-form__field", t;
1693
1693
  }
1694
1694
  function je(t, e, o) {
1695
- f(t, sa), e && (t.style.borderColor = "#ef4444"), t.disabled = o, o && (t.style.opacity = "0.5", t.style.cursor = "not-allowed"), t.addEventListener("focus", () => {
1695
+ f(t, da), e && (t.style.borderColor = "#ef4444"), t.disabled = o, o && (t.style.opacity = "0.5", t.style.cursor = "not-allowed"), t.addEventListener("focus", () => {
1696
1696
  t.style.outline = "2px solid var(--ago-accent-color, #003edf)", t.style.outlineOffset = "1px";
1697
1697
  }), t.addEventListener("blur", () => {
1698
1698
  t.style.outline = "", t.style.outlineOffset = "";
1699
1699
  });
1700
1700
  }
1701
- function oi(t) {
1701
+ function ri(t) {
1702
1702
  const e = c({
1703
1703
  padding: "16px",
1704
1704
  borderRadius: "4px",
@@ -1729,7 +1729,7 @@ function oi(t) {
1729
1729
  }
1730
1730
  return e;
1731
1731
  }
1732
- function la(t) {
1732
+ function ca(t) {
1733
1733
  const e = c({
1734
1734
  width: "100%",
1735
1735
  padding: "16px",
@@ -1764,7 +1764,7 @@ function la(t) {
1764
1764
  const n = c({ minWidth: "0" });
1765
1765
  return n.appendChild(it(t)), e.append(o, n), e;
1766
1766
  }
1767
- function da(t) {
1767
+ function pa(t) {
1768
1768
  const { state: e, labels: o } = t;
1769
1769
  let n = t.ticketForm, i = t.configLoading, a = t.allowFiles;
1770
1770
  const d = c({
@@ -1776,14 +1776,14 @@ function da(t) {
1776
1776
  paddingBottom: "16px",
1777
1777
  fontSize: "16px",
1778
1778
  lineHeight: "24px",
1779
- color: ee,
1779
+ color: te,
1780
1780
  boxSizing: "border-box"
1781
1781
  });
1782
1782
  d.className = "ago-ticket-form";
1783
1783
  function l() {
1784
- return n ? (e.errors = aa(n, e, o, t.requireEmail), Object.keys(e.errors).length === 0) : !1;
1784
+ return n ? (e.errors = la(n, e, o, t.requireEmail), Object.keys(e.errors).length === 0) : !1;
1785
1785
  }
1786
- async function b() {
1786
+ async function h() {
1787
1787
  if (!(e.loading || !n)) {
1788
1788
  if (Ze(n, e.customFields, e.ticket.typology), e.submittedOnce = !0, e.submitError = null, !l()) {
1789
1789
  e.submitError = `${o.validationFailed}: ${o.pleaseCheckFields}`, E();
@@ -1797,9 +1797,9 @@ function da(t) {
1797
1797
  priority: e.ticket.priority || "Normal",
1798
1798
  body: e.ticket.body,
1799
1799
  files: e.files,
1800
- customFields: Object.entries(e.customFields).map(([v, L]) => ({
1800
+ customFields: Object.entries(e.customFields).map(([v, F]) => ({
1801
1801
  id: v,
1802
- value: L
1802
+ value: F
1803
1803
  })),
1804
1804
  email: t.requireEmail ? e.email : void 0,
1805
1805
  ticketFormId: n.id
@@ -1810,21 +1810,21 @@ function da(t) {
1810
1810
  }, E(), t.onCreated(u, e);
1811
1811
  } catch (u) {
1812
1812
  e.loading = !1;
1813
- const v = u instanceof Error ? u : new Error(String(u)), L = v.status;
1814
- let k = o.submissionFailed, N = o.submissionFailedDescription;
1815
- L === 413 ? k = o.fileTooLarge : L === 403 ? k = o.permissionDenied : L === 422 ? (k = o.validationFailed, N = v.message || o.pleaseCheckFields) : v.message && (N = v.message), e.submitError = `${k}: ${N}`, E(), t.onError?.(v);
1813
+ const v = u instanceof Error ? u : new Error(String(u)), F = v.status;
1814
+ let k = o.submissionFailed, L = o.submissionFailedDescription;
1815
+ F === 413 ? k = o.fileTooLarge : F === 403 ? k = o.permissionDenied : F === 422 ? (k = o.validationFailed, L = v.message || o.pleaseCheckFields) : v.message && (L = v.message), e.submitError = `${k}: ${L}`, E(), t.onError?.(v);
1816
1816
  }
1817
1817
  }
1818
1818
  }
1819
1819
  function m(u, v) {
1820
- const L = se(u);
1821
- e.customFields[L] = v, n && Ze(n, e.customFields, e.ticket.typology), e.submittedOnce && l(), E();
1820
+ const F = le(u);
1821
+ e.customFields[F] = v, n && Ze(n, e.customFields, e.ticket.typology), e.submittedOnce && l(), E();
1822
1822
  }
1823
1823
  function p() {
1824
1824
  e.submittedOnce && l();
1825
1825
  }
1826
1826
  function y(u) {
1827
- const v = se(u), L = `ago-ticket-field-${v}`, k = e.customFields[v] ?? "", N = e.loading, P = e.errors[v];
1827
+ const v = le(u), F = `ago-ticket-field-${v}`, k = e.customFields[v] ?? "", L = e.loading, P = e.errors[v];
1828
1828
  if (u.type === "checkbox") {
1829
1829
  const S = c({
1830
1830
  display: "flex",
@@ -1834,34 +1834,34 @@ function da(t) {
1834
1834
  });
1835
1835
  S.className = "ago-ticket-form__field";
1836
1836
  const T = document.createElement("input");
1837
- T.type = "checkbox", T.id = L, T.checked = k === "true", T.disabled = N, f(T, {
1837
+ T.type = "checkbox", T.id = F, T.checked = k === "true", T.disabled = L, f(T, {
1838
1838
  width: "16px",
1839
1839
  height: "16px",
1840
1840
  margin: "0"
1841
1841
  }), T.addEventListener("change", () => m(u, T.checked ? "true" : "false"));
1842
- const O = document.createElement("label");
1843
- return O.htmlFor = L, O.textContent = u.title ?? "", O.style.fontWeight = "600", S.append(T, O), P && S.appendChild(we(P)), S;
1842
+ const B = document.createElement("label");
1843
+ return B.htmlFor = F, B.textContent = u.title ?? "", B.style.fontWeight = "600", S.append(T, B), P && S.appendChild(we(P)), S;
1844
1844
  }
1845
1845
  const w = We();
1846
- w.appendChild(Me(u.title ?? "", L));
1847
- const z = ti(n, u, e.customFields, e.ticket.typology).filter((S) => !S.noDisplay);
1846
+ w.appendChild(Me(u.title ?? "", F));
1847
+ const z = oi(n, u, e.customFields, e.ticket.typology).filter((S) => !S.noDisplay);
1848
1848
  if (u.options.length > 0) {
1849
1849
  const S = document.createElement("select");
1850
- S.id = L;
1850
+ S.id = F;
1851
1851
  const T = document.createElement("option");
1852
1852
  T.value = "", T.textContent = "----", S.appendChild(T);
1853
- const O = /* @__PURE__ */ new Map();
1854
- for (const M of z) {
1855
- const V = document.createElement("option");
1856
- if (V.value = M.value ?? M.name ?? "", V.textContent = M.name ?? M.value ?? "", M.group) {
1857
- let x = O.get(M.group);
1858
- x || (x = document.createElement("optgroup"), x.label = M.group, O.set(M.group, x), S.appendChild(x)), x.appendChild(V);
1859
- } else S.appendChild(V);
1853
+ const B = /* @__PURE__ */ new Map();
1854
+ for (const W of z) {
1855
+ const U = document.createElement("option");
1856
+ if (U.value = W.value ?? W.name ?? "", U.textContent = W.name ?? W.value ?? "", W.group) {
1857
+ let x = B.get(W.group);
1858
+ x || (x = document.createElement("optgroup"), x.label = W.group, B.set(W.group, x), S.appendChild(x)), x.appendChild(U);
1859
+ } else S.appendChild(U);
1860
1860
  }
1861
- S.value = k, je(S, !!P, N), S.addEventListener("change", () => m(u, S.value)), w.appendChild(S);
1862
- const G = z.find((M) => (M.value ?? M.name) === k);
1861
+ S.value = k, je(S, !!P, L), S.addEventListener("change", () => m(u, S.value)), w.appendChild(S);
1862
+ const G = z.find((W) => (W.value ?? W.name) === k);
1863
1863
  if (P && w.appendChild(we(P)), G?.message) {
1864
- const M = {
1864
+ const W = {
1865
1865
  info: {
1866
1866
  bg: "#eff6ff",
1867
1867
  border: "#bfdbfe",
@@ -1877,30 +1877,30 @@ function da(t) {
1877
1877
  border: "#fca5a5",
1878
1878
  text: "#7f1d1d"
1879
1879
  }
1880
- }[G.messageType ?? "info"], V = document.createElement("p");
1881
- V.className = "ago-ticket-form__option-message", V.textContent = G.message, f(V, {
1880
+ }[G.messageType ?? "info"], U = document.createElement("p");
1881
+ U.className = "ago-ticket-form__option-message", U.textContent = G.message, f(U, {
1882
1882
  fontSize: "14px",
1883
1883
  lineHeight: "20px",
1884
- border: `1px solid ${M.border}`,
1885
- backgroundColor: M.bg,
1886
- color: M.text,
1884
+ border: `1px solid ${W.border}`,
1885
+ backgroundColor: W.bg,
1886
+ color: W.text,
1887
1887
  borderRadius: "4px",
1888
1888
  padding: "8px",
1889
1889
  whiteSpace: "pre-line",
1890
1890
  margin: "0"
1891
- }), w.appendChild(V);
1891
+ }), w.appendChild(U);
1892
1892
  }
1893
1893
  return w;
1894
1894
  }
1895
1895
  const C = document.createElement("input");
1896
- return C.type = "text", C.id = L, C.value = k, je(C, !!P, N), C.addEventListener("input", () => {
1897
- e.customFields[v] = C.value, n && Ze(n, e.customFields, e.ticket.typology), e.submittedOnce && (l(), H());
1896
+ return C.type = "text", C.id = F, C.value = k, je(C, !!P, L), C.addEventListener("input", () => {
1897
+ e.customFields[v] = C.value, n && Ze(n, e.customFields, e.ticket.typology), e.submittedOnce && (l(), O());
1898
1898
  }), C.addEventListener("change", () => E()), w.appendChild(C), P && w.appendChild(we(P)), w;
1899
1899
  }
1900
- function H() {
1900
+ function O() {
1901
1901
  for (const u of d.querySelectorAll("[data-ago-error-for]")) {
1902
- const v = u.dataset.agoErrorFor, L = u.querySelector(".ago-ticket-form__error"), k = e.errors[v], N = u.querySelector("input, select, textarea");
1903
- N && (N.style.borderColor = k ? "#ef4444" : ""), N && !k && (N.style.border = `1px solid ${Y}`), k && !L ? u.appendChild(we(k)) : k && L ? L.textContent = k : !k && L && L.remove();
1902
+ const v = u.dataset.agoErrorFor, F = u.querySelector(".ago-ticket-form__error"), k = e.errors[v], L = u.querySelector("input, select, textarea");
1903
+ L && (L.style.borderColor = k ? "#ef4444" : ""), L && !k && (L.style.border = `1px solid ${Q}`), k && !F ? u.appendChild(we(k)) : k && F ? F.textContent = k : !k && F && F.remove();
1904
1904
  }
1905
1905
  }
1906
1906
  function E() {
@@ -1915,7 +1915,7 @@ function da(t) {
1915
1915
  x.className = "ago-ticket-form__message", x.textContent = t.message, d.appendChild(x);
1916
1916
  }
1917
1917
  if (e.submitted) {
1918
- d.appendChild(oi({
1918
+ d.appendChild(ri({
1919
1919
  text: t.successMessage || n?.successMessageText || o.ticketSubmitted,
1920
1920
  ticketUrl: e.submitted.ticketUrl,
1921
1921
  urlLabel: t.successUrlLabel || n?.successMessageUrlLabel || o.findTicketHere
@@ -1958,53 +1958,53 @@ function da(t) {
1958
1958
  });
1959
1959
  x.className = "ago-ticket-form__loading", x.setAttribute("role", "status"), x.textContent = o.loading, d.appendChild(x);
1960
1960
  }
1961
- const L = c({
1961
+ const F = c({
1962
1962
  fontWeight: "600",
1963
1963
  backgroundColor: "#bfdbfe",
1964
1964
  padding: "16px",
1965
1965
  borderRadius: "4px"
1966
1966
  });
1967
- if (L.className = "ago-ticket-form__intro", L.textContent = o.useFormToCreateTicket, d.appendChild(L), t.requireEmail) {
1967
+ if (F.className = "ago-ticket-form__intro", F.textContent = o.useFormToCreateTicket, d.appendChild(F), t.requireEmail) {
1968
1968
  const x = We();
1969
1969
  x.dataset.agoErrorFor = "userEmail", x.appendChild(Me(`${o.yourEmail} *`, "ago-ticket-email"));
1970
- const F = document.createElement("input");
1971
- F.type = "email", F.id = "ago-ticket-email", F.placeholder = o.emailPlaceholder, F.value = e.email, je(F, !!e.errors.userEmail, v), F.addEventListener("input", () => {
1972
- e.email = F.value, e.submittedOnce && (l(), H());
1973
- }), x.appendChild(F), e.errors.userEmail && x.appendChild(we(e.errors.userEmail)), d.appendChild(x);
1970
+ const H = document.createElement("input");
1971
+ H.type = "email", H.id = "ago-ticket-email", H.placeholder = o.emailPlaceholder, H.value = e.email, je(H, !!e.errors.userEmail, v), H.addEventListener("input", () => {
1972
+ e.email = H.value, e.submittedOnce && (l(), O());
1973
+ }), x.appendChild(H), e.errors.userEmail && x.appendChild(we(e.errors.userEmail)), d.appendChild(x);
1974
1974
  }
1975
- const k = u.showSubject && !!e.ticket.subject || !u.showSubject, N = k && (!!e.ticket.typology || !u.showTypology), P = u.showPriority && Ln(u, e.ticket.typology), w = N && (!!e.ticket.priority || !P);
1975
+ const k = u.showSubject && !!e.ticket.subject || !u.showSubject, L = k && (!!e.ticket.typology || !u.showTypology), P = u.showPriority && Ln(u, e.ticket.typology), w = L && (!!e.ticket.priority || !P);
1976
1976
  if (u.showSubject) {
1977
1977
  const x = We();
1978
1978
  x.dataset.agoErrorFor = "subject", x.appendChild(Me(o.subject, "ago-ticket-subject"));
1979
- const F = document.createElement("input");
1980
- F.type = "text", F.id = "ago-ticket-subject", F.value = e.ticket.subject, je(F, !!e.errors.subject, v), F.addEventListener("input", () => {
1981
- e.ticket.subject = F.value, p(), H();
1982
- }), F.addEventListener("change", () => E()), x.appendChild(F), e.errors.subject && x.appendChild(we(e.errors.subject)), d.appendChild(x);
1979
+ const H = document.createElement("input");
1980
+ H.type = "text", H.id = "ago-ticket-subject", H.value = e.ticket.subject, je(H, !!e.errors.subject, v), H.addEventListener("input", () => {
1981
+ e.ticket.subject = H.value, p(), O();
1982
+ }), H.addEventListener("change", () => E()), x.appendChild(H), e.errors.subject && x.appendChild(we(e.errors.subject)), d.appendChild(x);
1983
1983
  }
1984
1984
  if (k && u.showTypology) {
1985
1985
  const x = We();
1986
1986
  x.dataset.agoErrorFor = "typology", x.appendChild(Me(o.typology, "ago-ticket-typology"));
1987
- const F = document.createElement("select");
1988
- F.id = "ago-ticket-typology";
1989
- for (const [$, te] of [
1987
+ const H = document.createElement("select");
1988
+ H.id = "ago-ticket-typology";
1989
+ for (const [$, X] of [
1990
1990
  ["", o.selectTypology],
1991
1991
  ["Question", o.question],
1992
1992
  ["Task", o.task],
1993
1993
  ["Incident", o.incident]
1994
1994
  ]) {
1995
1995
  const J = document.createElement("option");
1996
- J.value = $, J.textContent = te, F.appendChild(J);
1996
+ J.value = $, J.textContent = X, H.appendChild(J);
1997
1997
  }
1998
- F.value = e.ticket.typology, je(F, !!e.errors.typology, v), F.addEventListener("change", () => {
1999
- e.ticket.typology = F.value, Ze(u, e.customFields, e.ticket.typology), p(), E();
2000
- }), x.appendChild(F), e.errors.typology && x.appendChild(we(e.errors.typology)), d.appendChild(x);
1998
+ H.value = e.ticket.typology, je(H, !!e.errors.typology, v), H.addEventListener("change", () => {
1999
+ e.ticket.typology = H.value, Ze(u, e.customFields, e.ticket.typology), p(), E();
2000
+ }), x.appendChild(H), e.errors.typology && x.appendChild(we(e.errors.typology)), d.appendChild(x);
2001
2001
  }
2002
- if (N && P) {
2002
+ if (L && P) {
2003
2003
  const x = We();
2004
2004
  x.dataset.agoErrorFor = "priority", x.appendChild(Me(o.priority, "ago-ticket-priority"));
2005
- const F = document.createElement("select");
2006
- F.id = "ago-ticket-priority";
2007
- for (const [$, te] of [
2005
+ const H = document.createElement("select");
2006
+ H.id = "ago-ticket-priority";
2007
+ for (const [$, X] of [
2008
2008
  ["", o.selectPriority],
2009
2009
  ["Low", o.low],
2010
2010
  ["Normal", o.normal],
@@ -2012,18 +2012,18 @@ function da(t) {
2012
2012
  ["Urgent", o.urgent]
2013
2013
  ]) {
2014
2014
  const J = document.createElement("option");
2015
- J.value = $, J.textContent = te, F.appendChild(J);
2015
+ J.value = $, J.textContent = X, H.appendChild(J);
2016
2016
  }
2017
- F.value = e.ticket.priority, je(F, !!e.errors.priority, v), F.addEventListener("change", () => {
2018
- e.ticket.priority = F.value, p(), E();
2019
- }), x.appendChild(F), e.errors.priority && x.appendChild(we(e.errors.priority)), d.appendChild(x);
2017
+ H.value = e.ticket.priority, je(H, !!e.errors.priority, v), H.addEventListener("change", () => {
2018
+ e.ticket.priority = H.value, p(), E();
2019
+ }), x.appendChild(H), e.errors.priority && x.appendChild(we(e.errors.priority)), d.appendChild(x);
2020
2020
  }
2021
2021
  if (w) {
2022
- const x = new Set(ta(u, e.customFields, e.ticket.typology));
2023
- for (const F of [...u.fields].sort(($, te) => $.position - te.position)) {
2024
- if (!x.has(F) && !e.errors[se(F)]) continue;
2025
- const $ = y(F);
2026
- $.dataset.agoErrorFor = se(F), d.appendChild($);
2022
+ const x = new Set(oa(u, e.customFields, e.ticket.typology));
2023
+ for (const H of [...u.fields].sort(($, X) => $.position - X.position)) {
2024
+ if (!x.has(H) && !e.errors[le(H)]) continue;
2025
+ const $ = y(H);
2026
+ $.dataset.agoErrorFor = le(H), d.appendChild($);
2027
2027
  }
2028
2028
  }
2029
2029
  const z = We();
@@ -2045,16 +2045,16 @@ function da(t) {
2045
2045
  const T = () => {
2046
2046
  const x = e.ticket.body.length;
2047
2047
  S.style.display = x > 6e4 ? "block" : "none", S.style.color = x > 65535 ? "#dc2626" : "#d97706", S.textContent = `${x} / 65,535 · ${o.maxCharacters}`;
2048
- }, O = () => {
2048
+ }, B = () => {
2049
2049
  C.style.height = "auto", C.style.height = `${C.scrollHeight}px`;
2050
2050
  };
2051
2051
  if (C.addEventListener("input", () => {
2052
- e.ticket.body = C.value, p(), H(), T(), O();
2052
+ e.ticket.body = C.value, p(), O(), T(), B();
2053
2053
  }), z.append(C, S), T(), e.errors.body && z.appendChild(we(e.errors.body)), d.appendChild(z), a) {
2054
2054
  const x = We();
2055
2055
  x.className = "ago-ticket-form__field ago-ticket-form__attachments", x.appendChild(Me(o.attachments, "ago-ticket-files"));
2056
- const F = document.createElement("label");
2057
- F.htmlFor = "ago-ticket-files", F.textContent = o.selectFile, f(F, {
2056
+ const H = document.createElement("label");
2057
+ H.htmlFor = "ago-ticket-files", H.textContent = o.selectFile, f(H, {
2058
2058
  display: "inline-block",
2059
2059
  alignSelf: "flex-start",
2060
2060
  backgroundColor: "#e5e7eb",
@@ -2067,14 +2067,14 @@ function da(t) {
2067
2067
  const $ = document.createElement("input");
2068
2068
  $.type = "file", $.id = "ago-ticket-files", $.multiple = !0, $.disabled = v, f($, { display: "none" }), $.addEventListener("change", () => {
2069
2069
  e.files = [...e.files, ...Array.from($.files ?? [])], $.value = "", E();
2070
- }), x.append(F, $);
2071
- const te = c({
2070
+ }), x.append(H, $);
2071
+ const X = c({
2072
2072
  display: "flex",
2073
2073
  flexDirection: "column",
2074
2074
  gap: "4px"
2075
2075
  });
2076
- e.files.forEach((J, g) => {
2077
- const B = c({
2076
+ e.files.forEach((J, b) => {
2077
+ const N = c({
2078
2078
  display: "flex",
2079
2079
  alignItems: "center",
2080
2080
  justifyContent: "space-between",
@@ -2083,8 +2083,8 @@ function da(t) {
2083
2083
  borderRadius: "4px"
2084
2084
  }), q = document.createElement("span");
2085
2085
  q.textContent = `${J.name} - ${(J.size / 1024).toFixed(1)} KB`;
2086
- const U = document.createElement("button");
2087
- U.type = "button", U.textContent = "×", U.setAttribute("aria-label", `Remove ${J.name}`), U.disabled = v, f(U, {
2086
+ const V = document.createElement("button");
2087
+ V.type = "button", V.textContent = "×", V.setAttribute("aria-label", `Remove ${J.name}`), V.disabled = v, f(V, {
2088
2088
  color: "#dc2626",
2089
2089
  fontWeight: "700",
2090
2090
  background: "none",
@@ -2095,10 +2095,10 @@ function da(t) {
2095
2095
  width: "44px",
2096
2096
  height: "44px",
2097
2097
  margin: "-10px -12px -10px 0"
2098
- }), U.addEventListener("click", () => {
2099
- e.files = e.files.filter((oe, le) => le !== g), E();
2100
- }), B.append(q, U), te.appendChild(B);
2101
- }), x.appendChild(te), d.appendChild(x);
2098
+ }), V.addEventListener("click", () => {
2099
+ e.files = e.files.filter((ne, oe) => oe !== b), E();
2100
+ }), N.append(q, V), X.appendChild(N);
2101
+ }), x.appendChild(X), d.appendChild(x);
2102
2102
  }
2103
2103
  if (e.submitError) {
2104
2104
  const x = we(e.submitError);
@@ -2107,7 +2107,7 @@ function da(t) {
2107
2107
  const G = document.createElement("button");
2108
2108
  G.type = "button", G.className = "ago-ticket-form__submit", G.disabled = v, f(G, {
2109
2109
  width: "100%",
2110
- backgroundColor: na,
2110
+ backgroundColor: ia,
2111
2111
  color: nt,
2112
2112
  padding: "8px 16px",
2113
2113
  borderRadius: "4px",
@@ -2123,19 +2123,19 @@ function da(t) {
2123
2123
  font: "inherit",
2124
2124
  transition: "filter 0.15s"
2125
2125
  });
2126
- const M = document.createElement("span");
2127
- M.textContent = o.submit;
2128
- const V = document.createElement("span");
2129
- V.textContent = "→", V.setAttribute("aria-hidden", "true"), f(V, {
2126
+ const W = document.createElement("span");
2127
+ W.textContent = o.submit;
2128
+ const U = document.createElement("span");
2129
+ U.textContent = "→", U.setAttribute("aria-hidden", "true"), f(U, {
2130
2130
  fontSize: "20px",
2131
2131
  lineHeight: "1",
2132
2132
  transition: "transform 0.15s"
2133
- }), G.append(M, V), G.addEventListener("mouseenter", () => {
2134
- G.style.filter = "brightness(0.9)", V.style.transform = "translateX(4px)";
2133
+ }), G.append(W, U), G.addEventListener("mouseenter", () => {
2134
+ G.style.filter = "brightness(0.9)", U.style.transform = "translateX(4px)";
2135
2135
  }), G.addEventListener("mouseleave", () => {
2136
- G.style.filter = "", V.style.transform = "";
2136
+ G.style.filter = "", U.style.transform = "";
2137
2137
  }), G.addEventListener("click", () => {
2138
- b();
2138
+ h();
2139
2139
  }), d.appendChild(G);
2140
2140
  }
2141
2141
  return E(), {
@@ -2145,8 +2145,8 @@ function da(t) {
2145
2145
  }
2146
2146
  };
2147
2147
  }
2148
- var ca = 0;
2149
- async function pa(t) {
2148
+ var ua = 0;
2149
+ async function fa(t) {
2150
2150
  const e = Array.from(t.querySelectorAll("script"));
2151
2151
  for (const o of e) {
2152
2152
  const n = document.createElement("script");
@@ -2156,7 +2156,7 @@ async function pa(t) {
2156
2156
  }) : (n.textContent = o.textContent, o.parentNode?.replaceChild(n, o));
2157
2157
  }
2158
2158
  }
2159
- function ua(t, e) {
2159
+ function ma(t, e) {
2160
2160
  const o = {};
2161
2161
  if (t)
2162
2162
  for (const [n, i] of Object.entries(t)) if (n === "custom_fields" && i && typeof i == "object")
@@ -2164,7 +2164,7 @@ function ua(t, e) {
2164
2164
  else typeof i == "string" && i && (o[n] = i);
2165
2165
  return e && (o.email = e), Object.keys(o).length > 0 ? o : null;
2166
2166
  }
2167
- function fa(t) {
2167
+ function ga(t) {
2168
2168
  const e = c({
2169
2169
  fontWeight: "500",
2170
2170
  color: "#1e40af",
@@ -2176,13 +2176,13 @@ function fa(t) {
2176
2176
  });
2177
2177
  return e.className = "ago-ticket-form__message", e.textContent = t, e;
2178
2178
  }
2179
- function ma(t) {
2180
- const { state: e, labels: o } = t, n = `ago-embed-${Date.now().toString(36)}-${++ca}`, i = c({
2179
+ function ha(t) {
2180
+ const { state: e, labels: o } = t, n = `ago-embed-${Date.now().toString(36)}-${++ua}`, i = c({
2181
2181
  display: "flex",
2182
2182
  flexDirection: "column",
2183
2183
  gap: "16px"
2184
2184
  });
2185
- i.className = "ago-embed-form", t.message && i.appendChild(fa(t.message));
2185
+ i.className = "ago-embed-form", t.message && i.appendChild(ga(t.message));
2186
2186
  const a = c({
2187
2187
  display: "flex",
2188
2188
  flexDirection: "column",
@@ -2190,35 +2190,35 @@ function ma(t) {
2190
2190
  });
2191
2191
  a.className = "ago-embed-form__body", i.appendChild(a);
2192
2192
  const d = [];
2193
- let l, b = !1, m = e.status === "submitted", p = null;
2194
- const y = ua(t.ticket, t.email), H = (C) => {
2195
- m || b || (m = !0, l && (clearTimeout(l), l = void 0), e.status = "submitted", e.captured = C ?? null, z(), t.onSubmitted(C ?? null));
2193
+ let l, h = !1, m = e.status === "submitted", p = null;
2194
+ const y = ma(t.ticket, t.email), O = (C) => {
2195
+ m || h || (m = !0, l && (clearTimeout(l), l = void 0), e.status = "submitted", e.captured = C ?? null, z(), t.onSubmitted(C ?? null));
2196
2196
  }, E = () => {
2197
- m || l || (b = !1, l = setTimeout(() => {
2197
+ m || l || (h = !1, l = setTimeout(() => {
2198
2198
  m || (l = void 0, e.status = "timeout", z());
2199
2199
  }, 3e4));
2200
2200
  }, u = () => {
2201
2201
  try {
2202
2202
  const C = globalThis.HubSpotFormsV4?.getForms?.()?.[0];
2203
2203
  if (C?.getFormFieldValues) {
2204
- const S = new Promise((T, O) => setTimeout(() => O(/* @__PURE__ */ new Error("timeout")), 3e3));
2205
- Promise.race([C.getFormFieldValues(), S]).then((T) => H($t(T))).catch(() => H(p));
2204
+ const S = new Promise((T, B) => setTimeout(() => B(/* @__PURE__ */ new Error("timeout")), 3e3));
2205
+ Promise.race([C.getFormFieldValues(), S]).then((T) => O($t(T))).catch(() => O(p));
2206
2206
  return;
2207
2207
  }
2208
2208
  } catch {
2209
2209
  }
2210
- H(p);
2210
+ O(p);
2211
2211
  };
2212
2212
  window.addEventListener("hs-form-event:on-submission:success", u), d.push(() => window.removeEventListener("hs-form-event:on-submission:success", u));
2213
- const v = [], L = (C) => {
2213
+ const v = [], F = (C) => {
2214
2214
  const S = C.data;
2215
2215
  if (S?.type === "hsFormCallback" && S.eventName === "onFormSubmit") {
2216
2216
  try {
2217
2217
  const T = S.data;
2218
2218
  if (Array.isArray(T)) {
2219
- const O = {};
2220
- for (const M of T) M?.name && M.value !== void 0 && (O[M.name] = M.value);
2221
- const G = $t(O);
2219
+ const B = {};
2220
+ for (const W of T) W?.name && W.value !== void 0 && (B[W.name] = W.value);
2221
+ const G = $t(B);
2222
2222
  G && (p = G);
2223
2223
  }
2224
2224
  } catch {
@@ -2226,44 +2226,44 @@ function ma(t) {
2226
2226
  return;
2227
2227
  }
2228
2228
  if (S?.type === "hsFormCallback" && S.eventName === "onFormSubmitted") {
2229
- H(p);
2229
+ O(p);
2230
2230
  return;
2231
2231
  }
2232
2232
  if (S?.type === "HS_CTA_PARENT_INIT" && C.ports?.[0]) {
2233
- const T = C.ports[0], O = (G) => {
2234
- const M = G.data;
2235
- if (M?.type === "HS_SEND_FORM_FIELD_VALUES") {
2236
- const V = M.payload?.formFieldValues;
2237
- if (V && typeof V == "object") {
2238
- const x = $t(V);
2233
+ const T = C.ports[0], B = (G) => {
2234
+ const W = G.data;
2235
+ if (W?.type === "HS_SEND_FORM_FIELD_VALUES") {
2236
+ const U = W.payload?.formFieldValues;
2237
+ if (U && typeof U == "object") {
2238
+ const x = $t(U);
2239
2239
  x && (p = x);
2240
2240
  }
2241
2241
  }
2242
- M?.type === "HS_SEND_FORM_SUBMISSION_SUCCESS" && H(p);
2242
+ W?.type === "HS_SEND_FORM_SUBMISSION_SUCCESS" && O(p);
2243
2243
  };
2244
- T.addEventListener("message", O), T.start(), v.push(() => T.removeEventListener("message", O));
2244
+ T.addEventListener("message", B), T.start(), v.push(() => T.removeEventListener("message", B));
2245
2245
  }
2246
2246
  };
2247
- window.addEventListener("message", L), d.push(() => {
2248
- window.removeEventListener("message", L), v.forEach((C) => C());
2247
+ window.addEventListener("message", F), d.push(() => {
2248
+ window.removeEventListener("message", F), v.forEach((C) => C());
2249
2249
  });
2250
2250
  let k;
2251
- function N(C) {
2251
+ function L(C) {
2252
2252
  if (!t.embedHtml) return;
2253
- let S = Xr(t.embedHtml, y, n);
2254
- S = Zr(S, n);
2255
- const T = Yr(y, n), O = _o(y);
2253
+ let S = Qr(t.embedHtml, y, n);
2254
+ S = ta(S, n);
2255
+ const T = Jr(y, n), B = Ao(y);
2256
2256
  C.innerHTML = S;
2257
- const G = ea(C, H, E, n);
2258
- let M, V, x;
2259
- pa(C).catch(() => {
2257
+ const G = na(C, O, E, n);
2258
+ let W, U, x;
2259
+ fa(C).catch(() => {
2260
2260
  }).then(() => {
2261
- e.status === "loading" && (e.status = "ready", P.style.display = "none", y && (Wt(C, y), Qr(y), x = _o(y), M = new MutationObserver(() => Wt(C, y)), M.observe(C, {
2261
+ e.status === "loading" && (e.status = "ready", P.style.display = "none", y && (Wt(C, y), Zr(y), x = Ao(y), W = new MutationObserver(() => Wt(C, y)), W.observe(C, {
2262
2262
  childList: !0,
2263
2263
  subtree: !0
2264
- }), V = setTimeout(() => M?.disconnect(), 1e4)));
2264
+ }), U = setTimeout(() => W?.disconnect(), 1e4)));
2265
2265
  }), k = () => {
2266
- T(), O(), G(), M?.disconnect(), V && clearTimeout(V), x?.(), C.innerHTML = "";
2266
+ T(), B(), G(), W?.disconnect(), U && clearTimeout(U), x?.(), C.innerHTML = "";
2267
2267
  };
2268
2268
  }
2269
2269
  const P = c({
@@ -2304,8 +2304,8 @@ function ma(t) {
2304
2304
  color: "#854d0e",
2305
2305
  margin: "0"
2306
2306
  });
2307
- const O = document.createElement("button");
2308
- O.type = "button", O.textContent = o.tryAgain, f(O, {
2307
+ const B = document.createElement("button");
2308
+ B.type = "button", B.textContent = o.tryAgain, f(B, {
2309
2309
  alignSelf: "flex-start",
2310
2310
  fontSize: "14px",
2311
2311
  fontWeight: "500",
@@ -2317,13 +2317,13 @@ function ma(t) {
2317
2317
  cursor: "pointer",
2318
2318
  minHeight: "44px",
2319
2319
  font: "inherit"
2320
- }), O.addEventListener("click", () => {
2321
- b = !0, m = !1, l = void 0, e.status = "ready", z();
2322
- }), S.append(T, O), a.appendChild(S);
2320
+ }), B.addEventListener("click", () => {
2321
+ h = !0, m = !1, l = void 0, e.status = "ready", z();
2322
+ }), S.append(T, B), a.appendChild(S);
2323
2323
  return;
2324
2324
  }
2325
2325
  if (e.status === "submitted") {
2326
- a.appendChild(oi({
2326
+ a.appendChild(ri({
2327
2327
  text: t.successMessage || o.embeddedFormSubmitted,
2328
2328
  urlLabel: o.findTicketHere
2329
2329
  }));
@@ -2340,7 +2340,7 @@ function ma(t) {
2340
2340
  const C = c({
2341
2341
  position: "relative",
2342
2342
  borderRadius: "8px",
2343
- border: `1px solid ${Y}`,
2343
+ border: `1px solid ${Q}`,
2344
2344
  overflow: "hidden"
2345
2345
  });
2346
2346
  if (C.className = "ago-embed-form__frame", t.embedHtml) {
@@ -2349,7 +2349,7 @@ function ma(t) {
2349
2349
  width: "100%",
2350
2350
  minHeight: "200px"
2351
2351
  });
2352
- S.className = "ago-embed-form__host", C.appendChild(S), k?.(), N(S);
2352
+ S.className = "ago-embed-form__host", C.appendChild(S), k?.(), L(S);
2353
2353
  } else {
2354
2354
  const S = c({
2355
2355
  padding: "24px",
@@ -2368,29 +2368,29 @@ function ma(t) {
2368
2368
  }
2369
2369
  };
2370
2370
  }
2371
- function ga(t) {
2371
+ function ba(t) {
2372
2372
  return t.type === "form" && t.toolName === "ago_ticketing";
2373
2373
  }
2374
- function ha(t) {
2374
+ function xa(t) {
2375
2375
  let e = null;
2376
2376
  for (const o of t) for (const n of o.toolCalls ?? []) n.type === "form" && (e = n.id);
2377
2377
  return e;
2378
2378
  }
2379
- function ba(t) {
2379
+ function ya(t) {
2380
2380
  return t.some((e) => (e.toolCalls ?? []).some((o) => {
2381
2381
  if (o.type !== "form") return !1;
2382
2382
  const n = o.data;
2383
2383
  return n?.success === !0 && !!n.ticket?.ticket_id;
2384
2384
  }));
2385
2385
  }
2386
- function Fo(t) {
2386
+ function No(t) {
2387
2387
  const e = t.data;
2388
2388
  return e?.success !== !0 || !e.ticket?.ticket_id ? null : {
2389
2389
  ticketId: String(e.ticket.ticket_id),
2390
2390
  ticketUrl: typeof e.ticket.ticket_url == "string" && e.ticket.ticket_url ? e.ticket.ticket_url : void 0
2391
2391
  };
2392
2392
  }
2393
- var xa = {
2393
+ var Ca = {
2394
2394
  info: {
2395
2395
  border: "#bfdbfe",
2396
2396
  bg: "#eff6ff",
@@ -2412,8 +2412,8 @@ var xa = {
2412
2412
  text: "#991b1b"
2413
2413
  }
2414
2414
  };
2415
- function ya(t, e = "info", o) {
2416
- const n = xa[e], i = c({
2415
+ function wa(t, e = "info", o) {
2416
+ const n = Ca[e], i = c({
2417
2417
  margin: "8px 0",
2418
2418
  padding: "12px 16px",
2419
2419
  border: `1px solid ${n.border}`,
@@ -2438,7 +2438,7 @@ function ya(t, e = "info", o) {
2438
2438
  const a = document.createElement("span");
2439
2439
  return a.textContent = t, a.style.whiteSpace = "pre-wrap", i.appendChild(a), i;
2440
2440
  }
2441
- function Ca(t, e) {
2441
+ function va(t, e) {
2442
2442
  const o = c({
2443
2443
  margin: "8px 0",
2444
2444
  padding: "12px 16px",
@@ -2486,7 +2486,7 @@ function Ca(t, e) {
2486
2486
  }
2487
2487
  return o.appendChild(i), o;
2488
2488
  }
2489
- var wa = {
2489
+ var ka = {
2490
2490
  useFormToCreateTicket: "You can use the following form to create a ticket",
2491
2491
  yourEmail: "Your Email",
2492
2492
  emailPlaceholder: "Enter your email address",
@@ -2538,7 +2538,7 @@ var wa = {
2538
2538
  ticketCreatedBlocked: `A ticket has been created for this conversation.
2539
2539
  Please create a new conversation to continue.`,
2540
2540
  newConversation: "New conversation"
2541
- }, Lo = {
2541
+ }, Io = {
2542
2542
  helpful: "Helpful",
2543
2543
  notHelpful: "Not helpful",
2544
2544
  whatWentWrong: "What went wrong?",
@@ -2552,7 +2552,7 @@ var wa = {
2552
2552
  send: "Send",
2553
2553
  thanks: "Thanks, this was reported."
2554
2554
  };
2555
- function va() {
2555
+ function Ea() {
2556
2556
  return {
2557
2557
  detailsOpen: !1,
2558
2558
  reasons: /* @__PURE__ */ new Set(),
@@ -2560,7 +2560,7 @@ function va() {
2560
2560
  reported: !1
2561
2561
  };
2562
2562
  }
2563
- var ka = {
2563
+ var Sa = {
2564
2564
  display: "inline-flex",
2565
2565
  alignItems: "center",
2566
2566
  justifyContent: "center",
@@ -2575,16 +2575,16 @@ var ka = {
2575
2575
  cursor: "pointer",
2576
2576
  lineHeight: "1"
2577
2577
  };
2578
- function Ea(t) {
2578
+ function _a(t) {
2579
2579
  const { state: e, labels: o, askWhy: n, onRate: i, onReport: a } = t, d = t.look === "embed", l = d ? {
2580
2580
  idle: "#78716c",
2581
2581
  hover: "#1c1917",
2582
2582
  active: "#1c1917"
2583
2583
  } : {
2584
2584
  idle: tt,
2585
- hover: ee,
2585
+ hover: te,
2586
2586
  active: ot
2587
- }, b = c(d ? {
2587
+ }, h = c(d ? {
2588
2588
  display: "flex",
2589
2589
  justifyContent: "space-between",
2590
2590
  alignItems: "center",
@@ -2595,38 +2595,38 @@ function Ea(t) {
2595
2595
  width: "100%",
2596
2596
  maxWidth: "85%"
2597
2597
  });
2598
- b.className = "ago-feedback";
2598
+ h.className = "ago-feedback";
2599
2599
  const m = c({
2600
2600
  display: "flex",
2601
2601
  alignItems: "center",
2602
2602
  gap: d ? "8px" : "2px"
2603
2603
  });
2604
2604
  m.className = "ago-feedback__actions";
2605
- const p = No("up", o.helpful, e.rating === "positive", l, d);
2605
+ const p = Ro("up", o.helpful, e.rating === "positive", l, d);
2606
2606
  p.addEventListener("click", () => {
2607
2607
  e.rating = "positive", e.detailsOpen = !1, E(), u(), i("positive");
2608
2608
  });
2609
- const y = No("down", o.notHelpful, e.rating === "negative", l, d);
2609
+ const y = Ro("down", o.notHelpful, e.rating === "negative", l, d);
2610
2610
  y.addEventListener("click", () => {
2611
2611
  e.rating = "negative", i("negative"), n && !e.reported && (e.detailsOpen = !0), E(), u();
2612
- }), m.append(p, y), d && b.appendChild(c({ flex: "1" })), b.appendChild(m);
2613
- const H = c();
2614
- H.className = "ago-feedback__panel-slot", d && (H.style.flexBasis = "100%"), b.appendChild(H);
2612
+ }), m.append(p, y), d && h.appendChild(c({ flex: "1" })), h.appendChild(m);
2613
+ const O = c();
2614
+ O.className = "ago-feedback__panel-slot", d && (O.style.flexBasis = "100%"), h.appendChild(O);
2615
2615
  function E() {
2616
2616
  Tn(p, e.rating === "positive", l), Tn(y, e.rating === "negative", l);
2617
2617
  }
2618
2618
  function u() {
2619
- if (H.replaceChildren(), e.reported) {
2620
- H.appendChild(Ta(o.thanks));
2619
+ if (O.replaceChildren(), e.reported) {
2620
+ O.appendChild(Fa(o.thanks));
2621
2621
  return;
2622
2622
  }
2623
- e.detailsOpen && H.appendChild(_a(e, o, async (v) => await a(e.rating ?? "negative", v) ? (e.reported = !0, e.detailsOpen = !1, u(), !0) : !1));
2623
+ e.detailsOpen && O.appendChild(Aa(e, o, async (v) => await a(e.rating ?? "negative", v) ? (e.reported = !0, e.detailsOpen = !1, u(), !0) : !1));
2624
2624
  }
2625
- return E(), u(), b;
2625
+ return E(), u(), h;
2626
2626
  }
2627
- function No(t, e, o, n, i = !1) {
2627
+ function Ro(t, e, o, n, i = !1) {
2628
2628
  const a = document.createElement("button");
2629
- return a.type = "button", a.className = `ago-feedback__thumb ago-feedback__thumb--${t}`, a.setAttribute("aria-label", e), a.title = e, f(a, ka), i ? (a.style.margin = "-14px", a.appendChild(t === "up" ? yr({ size: 18 }) : Ji({ size: 18 }))) : a.appendChild(Sa(t)), Tn(a, o, n), a.addEventListener("mouseenter", () => {
2629
+ return a.type = "button", a.className = `ago-feedback__thumb ago-feedback__thumb--${t}`, a.setAttribute("aria-label", e), a.title = e, f(a, Sa), i ? (a.style.margin = "-14px", a.appendChild(t === "up" ? wr({ size: 18 }) : er({ size: 18 }))) : a.appendChild(Ta(t)), Tn(a, o, n), a.addEventListener("mouseenter", () => {
2630
2630
  a.getAttribute("aria-pressed") !== "true" && (a.style.color = n.hover);
2631
2631
  }), a.addEventListener("mouseleave", () => {
2632
2632
  a.getAttribute("aria-pressed") !== "true" && (a.style.color = n.idle);
@@ -2635,7 +2635,7 @@ function No(t, e, o, n, i = !1) {
2635
2635
  function Tn(t, e, o) {
2636
2636
  t.setAttribute("aria-pressed", e ? "true" : "false"), t.style.color = e ? o.active : o.idle;
2637
2637
  }
2638
- function Sa(t) {
2638
+ function Ta(t) {
2639
2639
  const e = "http://www.w3.org/2000/svg", o = document.createElementNS(e, "svg");
2640
2640
  o.setAttribute("width", "16"), o.setAttribute("height", "16"), o.setAttribute("viewBox", "0 0 24 24"), o.setAttribute("fill", "none"), o.setAttribute("aria-hidden", "true");
2641
2641
  const n = document.createElementNS(e, "path");
@@ -2643,11 +2643,11 @@ function Sa(t) {
2643
2643
  const i = document.createElementNS(e, "path");
2644
2644
  return i.setAttribute("d", "M7 22V12H4.5A1.5 1.5 0 0 0 3 13.5v7A1.5 1.5 0 0 0 4.5 22z"), i.setAttribute("stroke", "currentColor"), i.setAttribute("stroke-width", "1.8"), i.setAttribute("stroke-linejoin", "round"), o.append(n, i), t === "down" && (o.style.transform = "rotate(180deg)"), o;
2645
2645
  }
2646
- function _a(t, e, o) {
2646
+ function Aa(t, e, o) {
2647
2647
  const n = c({
2648
2648
  marginTop: "8px",
2649
2649
  padding: "12px",
2650
- border: `1px solid ${Y}`,
2650
+ border: `1px solid ${Q}`,
2651
2651
  borderRadius: jt,
2652
2652
  backgroundColor: ye
2653
2653
  });
@@ -2655,7 +2655,7 @@ function _a(t, e, o) {
2655
2655
  const i = c({
2656
2656
  fontSize: "13px",
2657
2657
  fontWeight: "500",
2658
- color: ee,
2658
+ color: te,
2659
2659
  marginBottom: "8px"
2660
2660
  });
2661
2661
  i.textContent = e.whatWentWrong, n.appendChild(i);
@@ -2666,7 +2666,7 @@ function _a(t, e, o) {
2666
2666
  marginBottom: "8px"
2667
2667
  });
2668
2668
  a.className = "ago-feedback__reasons";
2669
- for (const m of $i) {
2669
+ for (const m of Wi) {
2670
2670
  const p = document.createElement("button");
2671
2671
  p.type = "button", p.className = "ago-feedback__reason", p.textContent = e.reasons[m], f(p, {
2672
2672
  minHeight: "44px",
@@ -2674,17 +2674,17 @@ function _a(t, e, o) {
2674
2674
  fontSize: "13px",
2675
2675
  fontFamily: "inherit",
2676
2676
  borderRadius: "999px",
2677
- border: `1px solid ${Y}`,
2677
+ border: `1px solid ${Q}`,
2678
2678
  backgroundColor: "transparent",
2679
- color: ee,
2679
+ color: te,
2680
2680
  cursor: "pointer"
2681
2681
  });
2682
2682
  const y = () => {
2683
- const H = t.reasons.has(m);
2684
- p.setAttribute("aria-pressed", H ? "true" : "false"), p.style.borderColor = H ? ot : Y, p.style.color = H ? ot : ee;
2683
+ const O = t.reasons.has(m);
2684
+ p.setAttribute("aria-pressed", O ? "true" : "false"), p.style.borderColor = O ? ot : Q, p.style.color = O ? ot : te;
2685
2685
  };
2686
2686
  p.addEventListener("click", () => {
2687
- t.reasons.has(m) ? t.reasons.delete(m) : t.reasons.add(m), y(), b();
2687
+ t.reasons.has(m) ? t.reasons.delete(m) : t.reasons.add(m), y(), h();
2688
2688
  }), y(), a.appendChild(p);
2689
2689
  }
2690
2690
  n.appendChild(a);
@@ -2695,13 +2695,13 @@ function _a(t, e, o) {
2695
2695
  padding: "8px 10px",
2696
2696
  fontSize: "14px",
2697
2697
  fontFamily: "inherit",
2698
- color: ee,
2699
- border: `1px solid ${Y}`,
2698
+ color: te,
2699
+ border: `1px solid ${Q}`,
2700
2700
  borderRadius: "10px",
2701
2701
  backgroundColor: "transparent",
2702
2702
  resize: "vertical"
2703
2703
  }), d.addEventListener("input", () => {
2704
- t.comment = d.value, b();
2704
+ t.comment = d.value, h();
2705
2705
  }), n.appendChild(d);
2706
2706
  const l = document.createElement("button");
2707
2707
  return l.type = "button", l.className = "ago-feedback__send", l.textContent = e.send, f(l, {
@@ -2720,15 +2720,15 @@ function _a(t, e, o) {
2720
2720
  reasons: [...t.reasons],
2721
2721
  comment: t.comment.trim()
2722
2722
  }).then((m) => {
2723
- m || b();
2723
+ m || h();
2724
2724
  }));
2725
- }), n.appendChild(l), b(), n;
2726
- function b() {
2725
+ }), n.appendChild(l), h(), n;
2726
+ function h() {
2727
2727
  const m = t.reasons.size > 0 || t.comment.trim().length > 0;
2728
2728
  l.disabled = !m, l.style.opacity = m ? "1" : "0.5", l.style.cursor = m ? "pointer" : "default";
2729
2729
  }
2730
2730
  }
2731
- function Ta(t) {
2731
+ function Fa(t) {
2732
2732
  const e = c({
2733
2733
  marginTop: "6px",
2734
2734
  fontSize: "13px",
@@ -2736,7 +2736,7 @@ function Ta(t) {
2736
2736
  });
2737
2737
  return e.className = "ago-feedback__thanks", e.setAttribute("role", "status"), e.textContent = t, e;
2738
2738
  }
2739
- function Aa(t) {
2739
+ function La(t) {
2740
2740
  const e = c({
2741
2741
  display: "flex",
2742
2742
  flexDirection: "column",
@@ -2772,21 +2772,21 @@ function Aa(t) {
2772
2772
  composerSlot: n
2773
2773
  };
2774
2774
  }
2775
- var Fa = 7200 * 1e3;
2775
+ var Na = 7200 * 1e3;
2776
2776
  function An(t) {
2777
2777
  const e = t.lastMessageDate instanceof Date ? t.lastMessageDate.getTime() : new Date(t.lastMessageDate).getTime();
2778
2778
  return Number.isFinite(e) ? e : Number.NEGATIVE_INFINITY;
2779
2779
  }
2780
- function ii(t) {
2780
+ function ai(t) {
2781
2781
  return [...t].sort((e, o) => An(o) - An(e));
2782
2782
  }
2783
- function La(t, e = Date.now(), o = Fa) {
2784
- const n = ii(t)[0];
2783
+ function Ia(t, e = Date.now(), o = Na) {
2784
+ const n = ai(t)[0];
2785
2785
  if (!n) return null;
2786
2786
  const i = An(n);
2787
2787
  return Number.isFinite(i) && e - i < o ? n : null;
2788
2788
  }
2789
- function Na(t) {
2789
+ function Ra(t) {
2790
2790
  const e = c({
2791
2791
  position: "relative",
2792
2792
  display: "flex",
@@ -2857,7 +2857,7 @@ function Na(t) {
2857
2857
  });
2858
2858
  y.setAttribute("role", "status"), p.appendChild(y), o.replaceChildren(p);
2859
2859
  }
2860
- function b() {
2860
+ function h() {
2861
2861
  const p = c({
2862
2862
  display: "flex",
2863
2863
  flex: "1",
@@ -2866,14 +2866,14 @@ function Na(t) {
2866
2866
  justifyContent: "center"
2867
2867
  });
2868
2868
  p.className = "ago-chat-widget__history-empty", d(p);
2869
- const y = Wo({ size: 36 });
2869
+ const y = Po({ size: 36 });
2870
2870
  y.style.marginBottom = "8px";
2871
- const H = document.createElement("p");
2872
- H.textContent = t.labels.noHistory, f(H, {
2871
+ const O = document.createElement("p");
2872
+ O.textContent = t.labels.noHistory, f(O, {
2873
2873
  fontSize: "14px",
2874
2874
  lineHeight: "20px",
2875
2875
  margin: "0"
2876
- }), p.append(y, H), o.replaceChildren(p);
2876
+ }), p.append(y, O), o.replaceChildren(p);
2877
2877
  }
2878
2878
  function m(p) {
2879
2879
  const y = c({
@@ -2883,8 +2883,8 @@ function Na(t) {
2883
2883
  minHeight: "0"
2884
2884
  });
2885
2885
  y.className = "ago-chat-widget__history-list";
2886
- const H = ii(p);
2887
- H.forEach((E, u) => {
2886
+ const O = ai(p);
2887
+ O.forEach((E, u) => {
2888
2888
  const v = document.createElement("button");
2889
2889
  if (v.type = "button", v.className = "ago-chat-widget__thread", v.dataset.agoConversationId = E.id, f(v, {
2890
2890
  display: "flex",
@@ -2895,7 +2895,7 @@ function Na(t) {
2895
2895
  textAlign: "left",
2896
2896
  backgroundColor: "transparent",
2897
2897
  border: "none",
2898
- borderBottom: u === H.length - 1 ? "none" : `1px solid ${rr}`,
2898
+ borderBottom: u === O.length - 1 ? "none" : `1px solid ${sr}`,
2899
2899
  cursor: "pointer",
2900
2900
  font: "inherit",
2901
2901
  color: "inherit"
@@ -2907,7 +2907,7 @@ function Na(t) {
2907
2907
  v.style.backgroundColor = "transparent";
2908
2908
  });
2909
2909
  }
2910
- const L = c({
2910
+ const F = c({
2911
2911
  flex: "1",
2912
2912
  minWidth: "0",
2913
2913
  display: "flex",
@@ -2924,23 +2924,23 @@ function Na(t) {
2924
2924
  overflow: "hidden",
2925
2925
  textOverflow: "ellipsis"
2926
2926
  });
2927
- const N = document.createElement("span");
2928
- N.textContent = _r(E.lastMessageDate, Date.now(), t.labels.timeAgo), f(N, {
2927
+ const L = document.createElement("span");
2928
+ L.textContent = Ar(E.lastMessageDate, Date.now(), t.labels.timeAgo), f(L, {
2929
2929
  fontSize: "12px",
2930
2930
  lineHeight: "16px"
2931
- }), d(N), L.append(k, N);
2932
- const P = br({ size: 16 });
2933
- t.customFont ? P.style.opacity = "0.6" : P.style.color = fe, v.append(L, P), v.addEventListener("click", () => t.onSelect(E)), y.appendChild(v);
2931
+ }), d(L), F.append(k, L);
2932
+ const P = yr({ size: 16 });
2933
+ t.customFont ? P.style.opacity = "0.6" : P.style.color = fe, v.append(F, P), v.addEventListener("click", () => t.onSelect(E)), y.appendChild(v);
2934
2934
  }), o.replaceChildren(y);
2935
2935
  }
2936
2936
  return {
2937
2937
  el: e,
2938
2938
  render: ({ threads: p, loading: y }) => {
2939
- y ? l() : p.length === 0 ? b() : m(p);
2939
+ y ? l() : p.length === 0 ? h() : m(p);
2940
2940
  }
2941
2941
  };
2942
2942
  }
2943
- function Ia(t) {
2943
+ function za(t) {
2944
2944
  const e = c({
2945
2945
  position: "relative",
2946
2946
  display: "flex",
@@ -2977,7 +2977,7 @@ function Ia(t) {
2977
2977
  letterSpacing: "-0.03em",
2978
2978
  fontWeight: "700",
2979
2979
  textAlign: "center",
2980
- color: ee
2980
+ color: te
2981
2981
  });
2982
2982
  i.className = "ago-chat-widget__home-title", n.appendChild(i);
2983
2983
  const a = c({
@@ -2998,7 +2998,7 @@ function Ia(t) {
2998
2998
  a.replaceChildren(), a.style.display = w ? "" : "none", w && a.appendChild(it(w));
2999
2999
  };
3000
3000
  d(t.title), l(t.subtitle);
3001
- const b = c({
3001
+ const h = c({
3002
3002
  flex: "1",
3003
3003
  display: "flex",
3004
3004
  flexDirection: "column",
@@ -3019,10 +3019,10 @@ function Ia(t) {
3019
3019
  m.className = "ago-chat-widget__starters";
3020
3020
  const p = [];
3021
3021
  let y = null;
3022
- const H = (w) => {
3022
+ const O = (w) => {
3023
3023
  m.replaceChildren(), p.length = 0;
3024
3024
  for (const z of w) E(z);
3025
- w.length > 0 ? m.parentNode || b.insertBefore(m, u) : m.remove();
3025
+ w.length > 0 ? m.parentNode || h.insertBefore(m, u) : m.remove();
3026
3026
  };
3027
3027
  function E(w) {
3028
3028
  const z = document.createElement("button");
@@ -3036,7 +3036,7 @@ function Ia(t) {
3036
3036
  transition: "all 0.2s",
3037
3037
  cursor: "pointer",
3038
3038
  font: "inherit",
3039
- color: ee,
3039
+ color: te,
3040
3040
  position: "relative"
3041
3041
  });
3042
3042
  const C = c({
@@ -3053,13 +3053,13 @@ function Ia(t) {
3053
3053
  overflow: "hidden"
3054
3054
  });
3055
3055
  S.style.setProperty("-webkit-line-clamp", "2"), S.style.setProperty("-webkit-box-orient", "vertical"), S.textContent = w.label;
3056
- const T = cr({ size: 16 });
3056
+ const T = ur({ size: 16 });
3057
3057
  f(T, {
3058
3058
  marginTop: "2px",
3059
3059
  color: "rgba(113, 113, 122, 0.5)",
3060
3060
  transition: "all 0.15s"
3061
3061
  }), C.append(S, T), z.appendChild(C), z.addEventListener("mouseenter", () => {
3062
- z.disabled || (z.style.borderColor = "#e4e4e7", z.style.boxShadow = $o, z.style.transform = "translateY(-2px)", T.style.color = ee, T.style.transform = "translate(2px, -2px)");
3062
+ z.disabled || (z.style.borderColor = "#e4e4e7", z.style.boxShadow = Wo, z.style.transform = "translateY(-2px)", T.style.color = te, T.style.transform = "translate(2px, -2px)");
3063
3063
  }), z.addEventListener("mouseleave", () => {
3064
3064
  z.style.borderColor = "rgba(228, 228, 231, 0.6)", z.style.boxShadow = Mt, z.style.transform = "", T.style.color = "rgba(113, 113, 122, 0.5)", T.style.transform = "";
3065
3065
  }), z.addEventListener("click", () => {
@@ -3070,15 +3070,15 @@ function Ia(t) {
3070
3070
  }), m.appendChild(z);
3071
3071
  }
3072
3072
  const u = c({ width: "100%" });
3073
- u.className = "ago-chat-widget__home-composer", b.appendChild(u), H(t.starters);
3073
+ u.className = "ago-chat-widget__home-composer", h.appendChild(u), O(t.starters);
3074
3074
  const v = c({ flex: "1" });
3075
- o.append(n, b, v), e.appendChild(o);
3076
- const L = t.twoColumnsFrom ?? 640, k = () => {
3077
- const w = typeof window < "u" && window.innerWidth >= L;
3075
+ o.append(n, h, v), e.appendChild(o);
3076
+ const F = t.twoColumnsFrom ?? 640, k = () => {
3077
+ const w = typeof window < "u" && window.innerWidth >= F;
3078
3078
  m.style.gridTemplateColumns = w ? "1fr 1fr" : "1fr";
3079
3079
  };
3080
3080
  k();
3081
- const N = (w) => {
3081
+ const L = (w) => {
3082
3082
  y = w;
3083
3083
  for (const { starter: z, btn: C } of p) {
3084
3084
  const S = z === w;
@@ -3091,13 +3091,13 @@ function Ia(t) {
3091
3091
  el: e,
3092
3092
  composerSlot: u,
3093
3093
  syncColumns: k,
3094
- setPending: N,
3094
+ setPending: L,
3095
3095
  setContent: (w) => {
3096
- w.title !== void 0 && d(w.title), w.subtitle !== void 0 && l(w.subtitle), w.starters && (H(w.starters), k(), y && N(y));
3096
+ w.title !== void 0 && d(w.title), w.subtitle !== void 0 && l(w.subtitle), w.starters && (O(w.starters), k(), y && L(y));
3097
3097
  }
3098
3098
  };
3099
3099
  }
3100
- function Ra(t) {
3100
+ function Ha(t) {
3101
3101
  const e = c({
3102
3102
  position: "fixed",
3103
3103
  bottom: "80px",
@@ -3172,8 +3172,8 @@ function Ra(t) {
3172
3172
  remove: a
3173
3173
  };
3174
3174
  }
3175
- var Io = "Form submitted.";
3176
- function za(t) {
3175
+ var zo = "Form submitted.";
3176
+ function Oa(t) {
3177
3177
  if (typeof t == "string") return t || null;
3178
3178
  if (!t || typeof t != "object") return null;
3179
3179
  const e = t;
@@ -3186,69 +3186,69 @@ function za(t) {
3186
3186
  }
3187
3187
  return null;
3188
3188
  }
3189
- var Ha = 0, Oa = "Hello, how can I help you today?", Ba = 6, Da = 800, $a = /^(?:\d+(?:\.\d+)?(?:px|rem|em|vw|vmin|vmax|%)|(?:min|max|clamp|calc)\([^;{}]+\))$/i;
3190
- function Ma(t) {
3189
+ var Ba = 0, Da = "Hello, how can I help you today?", $a = 6, Ma = 800, Wa = /^(?:\d+(?:\.\d+)?(?:px|rem|em|vw|vmin|vmax|%)|(?:min|max|clamp|calc)\([^;{}]+\))$/i;
3190
+ function ja(t) {
3191
3191
  const e = typeof t == "number" ? `${t}px` : String(t).trim();
3192
- return !$a.test(e) || typeof CSS < "u" && typeof CSS.supports == "function" && !CSS.supports("width", `min(max(400px, ${e}), 100% - 40px)`) ? null : e;
3192
+ return !Wa.test(e) || typeof CSS < "u" && typeof CSS.supports == "function" && !CSS.supports("width", `min(max(400px, ${e}), 100% - 40px)`) ? null : e;
3193
3193
  }
3194
- function Wa(t) {
3194
+ function Pa(t) {
3195
3195
  const e = typeof t == "string" ? document.querySelector(t) : t;
3196
3196
  if (!e) throw new Error(`mountChatWidget: target "${String(t)}" not found.`);
3197
3197
  return e;
3198
3198
  }
3199
- function Qa(t, e) {
3200
- const o = e.placement ?? "inline", n = o === "bubble", { welcomeMessage: i = "Hello! How can I help you today?", allowFiles: a = !1, allowStop: d = !0, autoScroll: l = !0, height: b = 500, defaultOpen: m = !1, logoUrl: p, showAgentName: y = !1, agentBubble: H = !1, bubbleStyle: E = "default", showHeader: u = !0, forms: v, formSubmittedMessage: L = Io, onFollowUpClick: k, onMessageSent: N, onMessageReceived: P, onFormSubmitted: w, onFormError: z, onOpen: C, onClose: S, icon: T, subtitle: O, conversationStarters: G = [], autoResume: M = !0, hideFooter: V = !1, loadHomeConfig: x = !1 } = e, F = e.title ?? (n ? "AGO Chatbot" : "Chat"), $ = e.width ?? (n ? 550 : 400), te = e.loadThreads ?? n, J = e.feedback ?? n, g = Tr(e.labels), B = e.placeholder ?? (n ? g.askQuestion : "Type a message..."), q = e.prompt === void 0 ? Oa : e.prompt, U = n ? {
3201
- ...fr(e.colors),
3199
+ function Za(t, e) {
3200
+ const o = e.placement ?? "inline", n = o === "bubble", { welcomeMessage: i = "Hello! How can I help you today?", allowFiles: a = !1, allowStop: d = !0, autoScroll: l = !0, height: h = 500, defaultOpen: m = !1, logoUrl: p, showAgentName: y = !1, agentBubble: O = !1, bubbleStyle: E = "default", showHeader: u = !0, forms: v, formSubmittedMessage: F = zo, onFollowUpClick: k, onMessageSent: L, onMessageReceived: P, onFormSubmitting: w, onFormSubmitted: z, onFormError: C, onOpen: S, onClose: T, icon: B, subtitle: G, conversationStarters: W = [], autoResume: U = !0, hideFooter: x = !1, loadHomeConfig: H = !1 } = e, $ = e.title ?? (n ? "AGO Chatbot" : "Chat"), X = e.width ?? (n ? 550 : 400), J = e.loadThreads ?? n, b = e.feedback ?? n, N = Fr(e.labels), q = e.placeholder ?? (n ? N.askQuestion : "Type a message..."), V = e.prompt === void 0 ? Da : e.prompt, ne = n ? {
3201
+ ...gr(e.colors),
3202
3202
  ...e.theme
3203
3203
  } : e.theme, oe = typeof i == "string" ? {
3204
3204
  message: i,
3205
3205
  mode: "static"
3206
- } : i, le = oe.message, ve = oe.mode ?? "static", ri = "speed" in oe && oe.speed || 45, Nn = "followUpReplies" in oe && oe.followUpReplies || void 0;
3207
- if (!e.client && !e.config?.baseUrl) throw new Mi("mountChatWidget requires either `client` or `config` (with a baseUrl).", "config_missing_base_url");
3208
- const W = e.client ?? new Di(e.config), Ut = Wa(t), wt = o === "left" || o === "right", de = wt || n, ai = de && (e.launcher ?? !0);
3209
- let ie = de ? m : !0, Vt = !1;
3210
- const si = e.mobile?.breakpoint ?? (n ? 450 : 768), qt = e.mobile?.trigger ?? "tap", In = typeof window < "u" && !!window.matchMedia, re = In ? window.matchMedia(`(max-width: ${si}px), (max-height: 500px) and (orientation: landscape)`) : void 0, li = In ? window.matchMedia("(prefers-reduced-motion: reduce)") : void 0, di = !!re, rt = !de && !!re, at = /* @__PURE__ */ Symbol("ago-scroll-lock");
3211
- let ne = !1;
3212
- const Gt = e.persistConversation ?? (n ? !0 : void 0), Ue = Gt ? Wi(Gt === !0 ? {} : Gt) : void 0;
3213
- let Q = e.conversationId ?? Ue?.getLastActiveThread() ?? void 0, R = [], vt = [], ce = !1, ke = null, Ne;
3206
+ } : i, ve = oe.message, Nn = oe.mode ?? "static", si = "speed" in oe && oe.speed || 45, In = "followUpReplies" in oe && oe.followUpReplies || void 0;
3207
+ if (!e.client && !e.config?.baseUrl) throw new ji("mountChatWidget requires either `client` or `config` (with a baseUrl).", "config_missing_base_url");
3208
+ const M = e.client ?? new Mi(e.config), Ut = Pa(t), wt = o === "left" || o === "right", de = wt || n, li = de && (e.launcher ?? !0);
3209
+ let re = de ? m : !0, Vt = !1;
3210
+ const di = e.mobile?.breakpoint ?? (n ? 450 : 768), qt = e.mobile?.trigger ?? "tap", Rn = typeof window < "u" && !!window.matchMedia, ae = Rn ? window.matchMedia(`(max-width: ${di}px), (max-height: 500px) and (orientation: landscape)`) : void 0, ci = Rn ? window.matchMedia("(prefers-reduced-motion: reduce)") : void 0, pi = !!ae, rt = !de && !!ae, at = /* @__PURE__ */ Symbol("ago-scroll-lock");
3211
+ let ie = !1;
3212
+ const Gt = e.persistConversation ?? (n ? !0 : void 0), Ue = Gt ? Pi(Gt === !0 ? {} : Gt) : void 0;
3213
+ let Z = e.conversationId ?? Ue?.getLastActiveThread() ?? void 0, R = [], vt = [], ce = !1, ke = null, Ne;
3214
3214
  const st = [];
3215
- function ci(r) {
3216
- if (typeof L == "function") {
3217
- const h = L(r);
3218
- if (typeof h == "string" && h) return h;
3215
+ function ui(r) {
3216
+ if (typeof F == "function") {
3217
+ const g = F(r);
3218
+ if (typeof g == "string" && g) return g;
3219
3219
  }
3220
- const s = za(r);
3221
- return s || (typeof L == "string" ? L : Io);
3220
+ const s = Oa(r);
3221
+ return s || (typeof F == "string" ? F : zo);
3222
3222
  }
3223
3223
  const Ee = [], A = c({
3224
3224
  display: "flex",
3225
3225
  flexDirection: "column",
3226
- height: wt ? "100%" : typeof b == "number" ? `${b}px` : b,
3227
- border: `1px solid ${Y}`,
3228
- borderRadius: Gi,
3226
+ height: wt ? "100%" : typeof h == "number" ? `${h}px` : h,
3227
+ border: `1px solid ${Q}`,
3228
+ borderRadius: Xi,
3229
3229
  overflow: "hidden",
3230
3230
  backgroundColor: ye,
3231
3231
  fontFamily: Le,
3232
3232
  textAlign: "left",
3233
3233
  boxShadow: "rgba(15, 15, 15, 0.08) 0px 2px 16px 0px"
3234
3234
  });
3235
- A.className = "ago-chat-widget", Co(A, U), n && (f(A, {
3235
+ A.className = "ago-chat-widget", vo(A, ne), n && (f(A, {
3236
3236
  height: "100%",
3237
3237
  width: "100%",
3238
3238
  border: "none",
3239
3239
  borderRadius: "0",
3240
3240
  boxShadow: "none",
3241
3241
  backgroundColor: bn,
3242
- color: ee,
3242
+ color: te,
3243
3243
  fontSize: "14px",
3244
3244
  lineHeight: "24px"
3245
- }), U?.headerText || A.style.setProperty("--ago-header-text-color", sr(U?.headerBg ?? U?.brand ?? "#03182f")));
3245
+ }), ne?.headerText || A.style.setProperty("--ago-header-text-color", dr(ne?.headerBg ?? ne?.brand ?? "#03182f")));
3246
3246
  let me;
3247
3247
  if (u && !n) {
3248
3248
  if (me = c({
3249
3249
  padding: "14px 16px",
3250
- borderBottom: `1px solid ${Y}`,
3251
- backgroundColor: Bo,
3250
+ borderBottom: `1px solid ${Q}`,
3251
+ backgroundColor: $o,
3252
3252
  color: xn,
3253
3253
  display: "flex",
3254
3254
  alignItems: "center",
@@ -3261,7 +3261,7 @@ function Qa(t, e) {
3261
3261
  }), me.appendChild(s);
3262
3262
  }
3263
3263
  const r = document.createElement("h3");
3264
- if (r.textContent = F, f(r, {
3264
+ if (r.textContent = $, f(r, {
3265
3265
  margin: "0",
3266
3266
  fontSize: "15px",
3267
3267
  fontWeight: "600"
@@ -3286,26 +3286,26 @@ function Qa(t, e) {
3286
3286
  }), s.addEventListener("click", () => Qe()), me.appendChild(s);
3287
3287
  }
3288
3288
  }
3289
- const Z = c({
3289
+ const ee = c({
3290
3290
  flex: "1",
3291
3291
  overflow: "auto",
3292
3292
  overflowAnchor: l ? "auto" : "none",
3293
3293
  overscrollBehavior: "contain",
3294
3294
  padding: "16px",
3295
- backgroundColor: Do
3295
+ backgroundColor: Mo
3296
3296
  });
3297
- Z.className = "ago-chat-widget__messages", Z.setAttribute("role", "log"), Z.setAttribute("aria-live", "polite"), Z.setAttribute("aria-relevant", "additions text"), Z.setAttribute("aria-atomic", "false");
3297
+ ee.className = "ago-chat-widget__messages", ee.setAttribute("role", "log"), ee.setAttribute("aria-live", "polite"), ee.setAttribute("aria-relevant", "additions text"), ee.setAttribute("aria-atomic", "false");
3298
3298
  const ge = n ? c({
3299
3299
  maxWidth: "768px",
3300
3300
  margin: "0 auto",
3301
3301
  padding: "0 8px",
3302
3302
  boxSizing: "border-box"
3303
- }) : Z;
3304
- n && (f(Z, {
3303
+ }) : ee;
3304
+ n && (f(ee, {
3305
3305
  padding: "16px 0",
3306
3306
  backgroundColor: "transparent"
3307
- }), ge.className = "ago-chat-widget__list", Z.appendChild(ge));
3308
- const pi = 48;
3307
+ }), ge.className = "ago-chat-widget__list", ee.appendChild(ge));
3308
+ const fi = 48;
3309
3309
  let Ie = !0, Kt = 0;
3310
3310
  function Xt(r) {
3311
3311
  Kt++;
@@ -3318,11 +3318,11 @@ function Qa(t, e) {
3318
3318
  typeof queueMicrotask == "function" ? queueMicrotask(s) : s();
3319
3319
  }
3320
3320
  }
3321
- function Rn() {
3322
- return Z.scrollHeight - Z.scrollTop - Z.clientHeight <= pi;
3321
+ function zn() {
3322
+ return ee.scrollHeight - ee.scrollTop - ee.clientHeight <= fi;
3323
3323
  }
3324
- const ae = document.createElement("button");
3325
- ae.type = "button", ae.className = "ago-chat-widget__jump", ae.setAttribute("aria-label", "Jump to latest message"), ae.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M19 12l-7 7-7-7"/></svg>', f(ae, {
3324
+ const se = document.createElement("button");
3325
+ se.type = "button", se.className = "ago-chat-widget__jump", se.setAttribute("aria-label", "Jump to latest message"), se.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M19 12l-7 7-7-7"/></svg>', f(se, {
3326
3326
  position: "absolute",
3327
3327
  left: "50%",
3328
3328
  bottom: "12px",
@@ -3332,53 +3332,53 @@ function Qa(t, e) {
3332
3332
  display: "none",
3333
3333
  alignItems: "center",
3334
3334
  justifyContent: "center",
3335
- border: `1px solid ${Y}`,
3335
+ border: `1px solid ${Q}`,
3336
3336
  borderRadius: "50%",
3337
3337
  backgroundColor: ye,
3338
- color: ee,
3338
+ color: te,
3339
3339
  boxShadow: "rgba(15, 15, 15, 0.16) 0px 2px 10px 0px",
3340
3340
  cursor: "pointer",
3341
3341
  zIndex: "2"
3342
- }), n && (ae.setAttribute("aria-label", g.scrollToBottom), ae.replaceChildren(Qi({ size: 20 })), f(ae, {
3342
+ }), n && (se.setAttribute("aria-label", N.scrollToBottom), se.replaceChildren(Zi({ size: 20 })), f(se, {
3343
3343
  display: "flex",
3344
3344
  width: "36px",
3345
3345
  height: "36px",
3346
3346
  padding: "8px",
3347
3347
  boxSizing: "border-box",
3348
- border: `1px solid ${Oo}`,
3348
+ border: `1px solid ${Do}`,
3349
3349
  backgroundColor: "#fff",
3350
- boxShadow: $o,
3350
+ boxShadow: Wo,
3351
3351
  transition: "opacity 0.3s",
3352
3352
  opacity: "0",
3353
3353
  pointerEvents: "none"
3354
3354
  }));
3355
- function zn() {
3355
+ function Hn() {
3356
3356
  Ie = !0, Xt(() => {
3357
- Z.scrollTop = Z.scrollHeight;
3357
+ ee.scrollTop = ee.scrollHeight;
3358
3358
  }), Yt();
3359
3359
  }
3360
- ae.addEventListener("click", zn);
3360
+ se.addEventListener("click", Hn);
3361
3361
  function Yt() {
3362
- const r = l ? Ie : Rn();
3362
+ const r = l ? Ie : zn();
3363
3363
  if (n) {
3364
- ae.style.opacity = r ? "0" : "1", ae.style.pointerEvents = r ? "none" : "auto";
3364
+ se.style.opacity = r ? "0" : "1", se.style.pointerEvents = r ? "none" : "auto";
3365
3365
  return;
3366
3366
  }
3367
- ae.style.display = r ? "none" : "flex";
3367
+ se.style.display = r ? "none" : "flex";
3368
3368
  }
3369
3369
  function Qt() {
3370
3370
  l && Ie && Xt(() => {
3371
- Z.scrollTop = Z.scrollHeight;
3371
+ ee.scrollTop = ee.scrollHeight;
3372
3372
  }), Yt();
3373
3373
  }
3374
- function Hn(r) {
3374
+ function On(r) {
3375
3375
  Xt(() => {
3376
- const s = Z.scrollTop;
3377
- r(), (!l || !Ie) && (Z.scrollTop = s);
3376
+ const s = ee.scrollTop;
3377
+ r(), (!l || !Ie) && (ee.scrollTop = s);
3378
3378
  }), Qt();
3379
3379
  }
3380
- Z.addEventListener("scroll", () => {
3381
- Kt > 0 || (Ie = Rn(), Yt());
3380
+ ee.addEventListener("scroll", () => {
3381
+ Kt > 0 || (Ie = zn(), Yt());
3382
3382
  });
3383
3383
  const Jt = c({
3384
3384
  position: "relative",
@@ -3386,11 +3386,11 @@ function Qa(t, e) {
3386
3386
  display: "flex",
3387
3387
  minHeight: "0"
3388
3388
  });
3389
- Jt.append(Z, ae);
3390
- const { inputRow: Se, setDisabled: ui, focus: kt, restoreDraft: fi, setPlaceholder: On, getValueAndClear: mi, setSpeechToTextEnabled: gi, cancelRecording: lt, destroy: hi } = vr({
3391
- placeholder: B,
3389
+ Jt.append(ee, se);
3390
+ const { inputRow: Se, setDisabled: mi, focus: kt, restoreDraft: gi, setPlaceholder: Bn, getValueAndClear: hi, setSpeechToTextEnabled: bi, cancelRecording: lt, destroy: xi } = Er({
3391
+ placeholder: q,
3392
3392
  allowFiles: a,
3393
- transcribeAudio: e.speechToText ? (r, s) => W.transcribeAudio(r, s) : void 0,
3393
+ transcribeAudio: e.speechToText ? (r, s) => M.transcribeAudio(r, s) : void 0,
3394
3394
  speechToTextLabels: typeof e.speechToText == "object" ? e.speechToText.labels : void 0,
3395
3395
  onSend: (r, s) => {
3396
3396
  Ye(r, s);
@@ -3400,27 +3400,27 @@ function Qa(t, e) {
3400
3400
  } : void 0,
3401
3401
  look: n ? "embed" : "classic",
3402
3402
  labels: n ? {
3403
- attachFiles: g.attachFiles,
3404
- dismiss: g.dismiss,
3405
- tooManyFiles: g.tooManyFiles,
3406
- invalidFileType: g.invalidFileType,
3407
- fileTooLarge: g.fileTooLarge
3403
+ attachFiles: N.attachFiles,
3404
+ dismiss: N.dismiss,
3405
+ tooManyFiles: N.tooManyFiles,
3406
+ invalidFileType: N.invalidFileType,
3407
+ fileTooLarge: N.fileTooLarge
3408
3408
  } : void 0
3409
3409
  });
3410
- pr(), e.speechToText && W.getConfig().then((r) => {
3411
- ne || gi(r.permissions.some((s) => s.speechToTextEnabled));
3410
+ fr(), e.speechToText && M.getConfig().then((r) => {
3411
+ ie || bi(r.permissions.some((s) => s.speechToTextEnabled));
3412
3412
  }).catch(() => {
3413
3413
  }), n || A.append(...me ? [me] : [], Jt, Se);
3414
3414
  let dt = A, j, pe, Zt;
3415
3415
  const ct = o === "left" ? "left" : "right";
3416
- let en, Et, _e, Ve, St, pt, he, Be, qe, Te = "home", _t = "home", Ge = !1, Tt = te, ut = !1, ft = !1, tn;
3416
+ let en, Et, _e, Ve, St, pt, he, Be, qe, Te = "home", _t = "home", Ge = !1, Tt = J, ut = !1, ft = !1, tn;
3417
3417
  if (n) {
3418
3418
  if (j = c({
3419
3419
  position: "fixed",
3420
3420
  right: "20px",
3421
3421
  bottom: "80px",
3422
3422
  top: "max(40px, calc(100% - 880px))",
3423
- width: `min(max(400px, ${xo}), var(--ago-panel-max, calc(100% - 40px)))`,
3423
+ width: `min(max(400px, ${Co}), var(--ago-panel-max, calc(100% - 40px)))`,
3424
3424
  height: "auto",
3425
3425
  borderRadius: "16px",
3426
3426
  boxShadow: vn,
@@ -3430,13 +3430,13 @@ function Qa(t, e) {
3430
3430
  backgroundColor: bn,
3431
3431
  display: "none",
3432
3432
  fontFamily: Le
3433
- }), j.className = "ago-chat-widget-bubble", j.dataset.agoLayout = "panel", Co(j, U), !U?.panelWidth) {
3434
- const s = Ma($);
3435
- s ? j.style.setProperty("--ago-panel-width", s) : console.warn(`[AGO] mountChatWidget width "${String($)}" is not a valid CSS length, ignoring. Expected e.g. 700 or "45rem". Falling back to 550px.`);
3433
+ }), j.className = "ago-chat-widget-bubble", j.dataset.agoLayout = "panel", vo(j, ne), !ne?.panelWidth) {
3434
+ const s = ja(X);
3435
+ s ? j.style.setProperty("--ago-panel-width", s) : console.warn(`[AGO] mountChatWidget width "${String(X)}" is not a valid CSS length, ignoring. Expected e.g. 700 or "45rem". Falling back to 550px.`);
3436
3436
  }
3437
- u && (en = Er({
3438
- title: F,
3439
- labels: g,
3437
+ u && (en = _r({
3438
+ title: $,
3439
+ labels: N,
3440
3440
  onBack: () => Oe(_t, { byUser: !0 }),
3441
3441
  onNewChat: () => It(),
3442
3442
  onClose: () => Qe()
@@ -3446,29 +3446,29 @@ function Qa(t, e) {
3446
3446
  flexDirection: "column",
3447
3447
  minHeight: "0",
3448
3448
  overflow: "hidden"
3449
- }), pt.className = "ago-chat-widget__main", A.appendChild(pt), V || (Et = kr({
3450
- labels: g,
3449
+ }), pt.className = "ago-chat-widget__main", A.appendChild(pt), x || (Et = Sr({
3450
+ labels: N,
3451
3451
  onNavigate: (s) => Oe(s, { byUser: !0 })
3452
- }), A.appendChild(Et.el)), _e = Ia({
3453
- title: F,
3454
- subtitle: O,
3455
- starters: G,
3452
+ }), A.appendChild(Et.el)), _e = za({
3453
+ title: $,
3454
+ subtitle: G,
3455
+ starters: W,
3456
3456
  onStarter: (s) => {
3457
3457
  _e?.setPending(s), Ye(s.message ?? s.label, void 0, { agentId: s.agentId }).finally(() => _e?.setPending(null));
3458
3458
  }
3459
3459
  });
3460
3460
  const r = e.colors?.background;
3461
- Ve = Na({
3462
- labels: g,
3461
+ Ve = Ra({
3462
+ labels: N,
3463
3463
  onSelect: (s) => {
3464
3464
  Ge = !0, _t = "history", bt(s.id);
3465
3465
  },
3466
3466
  onNew: () => It(),
3467
- hoverBackground: r && gr(r) ? er(r, 10) : void 0,
3467
+ hoverBackground: r && br(r) ? nr(r, 10) : void 0,
3468
3468
  customFont: !!e.colors?.font
3469
- }), St = Aa({
3469
+ }), St = La({
3470
3470
  messagesWrap: Jt,
3471
- jumpBtn: ae
3471
+ jumpBtn: se
3472
3472
  }), j.appendChild(A), dt = j;
3473
3473
  }
3474
3474
  wt && (j = c({
@@ -3476,7 +3476,7 @@ function Qa(t, e) {
3476
3476
  top: "0",
3477
3477
  bottom: "0",
3478
3478
  [ct]: "0",
3479
- width: typeof $ == "number" ? `${$}px` : $,
3479
+ width: typeof X == "number" ? `${X}px` : X,
3480
3480
  maxWidth: "100vw",
3481
3481
  display: "flex",
3482
3482
  zIndex: "2147483000",
@@ -3488,15 +3488,15 @@ function Qa(t, e) {
3488
3488
  borderRadius: "0",
3489
3489
  border: "none",
3490
3490
  boxShadow: "none",
3491
- [ct === "left" ? "borderRight" : "borderLeft"]: `1px solid ${Y}`
3492
- }), j.appendChild(A), dt = j), ai && (Zt = Dr({
3491
+ [ct === "left" ? "borderRight" : "borderLeft"]: `1px solid ${Q}`
3492
+ }), j.appendChild(A), dt = j), li && (Zt = Mr({
3493
3493
  look: n ? "bubble" : "classic",
3494
3494
  edge: ct,
3495
- title: F,
3496
- icon: n ? T : p,
3497
- onClick: () => n ? po() : Ht()
3495
+ title: $,
3496
+ icon: n ? B : p,
3497
+ onClick: () => n ? fo() : Ht()
3498
3498
  }), pe = Zt.el);
3499
- const mt = rt ? `ago-vt-${++Ha}` : "", Bn = 52;
3499
+ const mt = rt ? `ago-vt-${++Ba}` : "", Dn = 52;
3500
3500
  let Ae = !1, Re = 0, Ke = 0, be, gt, ze;
3501
3501
  const At = {
3502
3502
  height: A.style.height,
@@ -3504,33 +3504,33 @@ function Qa(t, e) {
3504
3504
  borderRadius: A.style.borderRadius,
3505
3505
  boxShadow: A.style.boxShadow
3506
3506
  };
3507
- Ut.appendChild(dt), pe && Ut.appendChild(pe), zt(), n && (q !== !1 && !ie && (Be = setTimeout(Ai, 1e3)), document.addEventListener("keydown", ao), window.addEventListener("resize", so)), rt && (be = zi(), A.insertBefore(be, A.firstChild), gt = document.createElement("style"), gt.id = mt, gt.textContent = `::view-transition-group(${mt}),::view-transition-group(${mt}-bar){animation-duration:0.3s;animation-timing-function:cubic-bezier(0.4,0,0.2,1)}`, document.head.appendChild(gt), (qt === "focus" || qt === "tap") && (A.addEventListener("pointerdown", (r) => {
3508
- if (Ae || !re?.matches) return;
3507
+ Ut.appendChild(dt), pe && Ut.appendChild(pe), zt(), n && (V !== !1 && !re && (Be = setTimeout(Li, 1e3)), document.addEventListener("keydown", lo), window.addEventListener("resize", co)), rt && (be = Oi(), A.insertBefore(be, A.firstChild), gt = document.createElement("style"), gt.id = mt, gt.textContent = `::view-transition-group(${mt}),::view-transition-group(${mt}-bar){animation-duration:0.3s;animation-timing-function:cubic-bezier(0.4,0,0.2,1)}`, document.head.appendChild(gt), (qt === "focus" || qt === "tap") && (A.addEventListener("pointerdown", (r) => {
3508
+ if (Ae || !ae?.matches) return;
3509
3509
  const s = Se.contains(r.target);
3510
3510
  if (qt === "tap") {
3511
3511
  if ((r.target instanceof Element ? r.target : null)?.closest("button,a[href],[role='button']")) return;
3512
3512
  } else if (!s) return;
3513
3513
  s && r.preventDefault(), yt();
3514
3514
  }, !0), A.addEventListener("focusin", (r) => {
3515
- re?.matches && Se.contains(r.target) && yt();
3516
- }))), di && document.addEventListener("keydown", uo), re && re.addEventListener("change", fo);
3517
- const Dn = k !== !1, $n = k === !1 ? void 0 : k ?? ((r) => {
3518
- rt && re?.matches && !Ae ? yt().then(() => Ye(r)) : Ye(r);
3519
- }), Xe = J === !0 ? {} : J || null, bi = {
3520
- ...Lo,
3515
+ ae?.matches && Se.contains(r.target) && yt();
3516
+ }))), pi && document.addEventListener("keydown", mo), ae && ae.addEventListener("change", go);
3517
+ const $n = k !== !1, Mn = k === !1 ? void 0 : k ?? ((r) => {
3518
+ rt && ae?.matches && !Ae ? yt().then(() => Ye(r)) : Ye(r);
3519
+ }), Xe = b === !0 ? {} : b || null, yi = {
3520
+ ...Io,
3521
3521
  ...Xe?.labels,
3522
3522
  reasons: {
3523
- ...Lo.reasons,
3523
+ ...Io.reasons,
3524
3524
  ...Xe?.labels?.reasons
3525
3525
  }
3526
3526
  }, Ft = /* @__PURE__ */ new Map();
3527
- function Mn(r) {
3527
+ function Wn(r) {
3528
3528
  if (!Xe || !r.id || !r.conversationId || r.status !== "DONE" || !r.content) return null;
3529
3529
  let s = Ft.get(r.id);
3530
- s || (s = va(), Ft.set(r.id, s));
3531
- const h = async (_, D) => {
3530
+ s || (s = Ea(), Ft.set(r.id, s));
3531
+ const g = async (_, D) => {
3532
3532
  try {
3533
- return await W.submitFeedback(r.id, _, D), Xe.onSubmit?.({
3533
+ return await M.submitFeedback(r.id, _, D), Xe.onSubmit?.({
3534
3534
  messageId: r.id,
3535
3535
  rating: _,
3536
3536
  reasons: D?.reasons ?? [],
@@ -3540,33 +3540,33 @@ function Qa(t, e) {
3540
3540
  return Xe.onError?.(I instanceof Error ? I : new Error(String(I))), !1;
3541
3541
  }
3542
3542
  };
3543
- return Ea({
3543
+ return _a({
3544
3544
  state: s,
3545
- labels: bi,
3545
+ labels: yi,
3546
3546
  askWhy: Xe.askWhy ?? !n,
3547
3547
  onRate: (_) => {
3548
- h(_);
3548
+ g(_);
3549
3549
  },
3550
- onReport: (_, D) => h(_, D),
3550
+ onReport: (_, D) => g(_, D),
3551
3551
  look: n ? "embed" : "classic"
3552
3552
  });
3553
3553
  }
3554
3554
  const xe = e.toolCallForm ?? {}, Fe = {
3555
- ...wa,
3555
+ ...ka,
3556
3556
  ...xe.labels
3557
- }, Wn = W.getUserIdentity(), nn = xe.userEmail ?? Wn.email, jn = !nn && !Wn.hasJwt;
3558
- let De = null, Pn = !1, Un, on = !1;
3557
+ }, jn = M.getUserIdentity(), nn = xe.userEmail ?? jn.email, Pn = !nn && !jn.hasJwt;
3558
+ let De = null, Un = !1, Vn, on = !1;
3559
3559
  const ht = /* @__PURE__ */ new Map(), Lt = /* @__PURE__ */ new Set();
3560
- function xi() {
3561
- Un || (Un = W.getConfig().then((r) => {
3560
+ function Ci() {
3561
+ Vn || (Vn = M.getConfig().then((r) => {
3562
3562
  const s = r.permissions[0];
3563
3563
  De = s?.ticketForm ?? null, on = !!s?.fileAttachmentsEnabled;
3564
3564
  }).catch(() => {
3565
3565
  De = null;
3566
3566
  }).then(() => {
3567
- if (Pn = !0, !ne)
3567
+ if (Un = !0, !ie)
3568
3568
  for (const r of ht.values())
3569
- r.kind === "ticket" && (De && ra(r.state, r.call.ticket, De), r.view.rebuild({
3569
+ r.kind === "ticket" && (De && sa(r.state, r.call.ticket, De), r.view.rebuild({
3570
3570
  ticketForm: De,
3571
3571
  configLoading: !1,
3572
3572
  allowFiles: a || on
@@ -3577,32 +3577,32 @@ function Qa(t, e) {
3577
3577
  for (const r of ht.values()) r.kind === "embed" && r.view.destroy();
3578
3578
  ht.clear(), Lt.clear();
3579
3579
  }
3580
- function yi(r) {
3580
+ function wi(r) {
3581
3581
  for (const s of R) {
3582
- const h = s.toolCalls?.find((_) => _.id === r);
3583
- if (h) return h;
3582
+ const g = s.toolCalls?.find((_) => _.id === r);
3583
+ if (g) return g;
3584
3584
  }
3585
3585
  }
3586
- function Ci(r) {
3586
+ function vi(r) {
3587
3587
  const s = ht.get(r.id);
3588
3588
  if (s) return s;
3589
- let h;
3589
+ let g;
3590
3590
  if (r.allowedToCreateTicket === !1) {
3591
3591
  const _ = c({
3592
3592
  display: "flex",
3593
3593
  flexDirection: "column",
3594
3594
  gap: "16px"
3595
3595
  });
3596
- _.className = "ago-ticket-form ago-ticket-form--denied", _.appendChild(la(Fe.notAllowed)), h = {
3596
+ _.className = "ago-ticket-form ago-ticket-form--denied", _.appendChild(ca(Fe.notAllowed)), g = {
3597
3597
  kind: "static",
3598
3598
  el: _
3599
3599
  };
3600
3600
  } else if (r.mode === "embed") {
3601
- const _ = { status: Fo(r) ? "submitted" : "loading" };
3602
- h = {
3601
+ const _ = { status: No(r) ? "submitted" : "loading" };
3602
+ g = {
3603
3603
  kind: "embed",
3604
3604
  state: _,
3605
- view: ma({
3605
+ view: ha({
3606
3606
  state: _,
3607
3607
  embedHtml: r.embedHtml,
3608
3608
  description: r.embedDescription,
@@ -3612,10 +3612,10 @@ function Qa(t, e) {
3612
3612
  message: r.message,
3613
3613
  successMessage: xe.successMessage,
3614
3614
  onSubmitted: (D) => {
3615
- Lt.add(r.id), W.submitToolCallForm(r.id, {
3615
+ Lt.add(r.id), M.submitToolCallForm(r.id, {
3616
3616
  success: !0,
3617
3617
  source: "embed",
3618
- thread_id: Q,
3618
+ thread_id: Z,
3619
3619
  captured_form_data: D
3620
3620
  }).then((I) => {
3621
3621
  const K = I.ticket ?? I.result?.ticket;
@@ -3632,33 +3632,33 @@ function Qa(t, e) {
3632
3632
  }).catch((I) => {
3633
3633
  xe.onError?.(I instanceof Error ? I : new Error(String(I)));
3634
3634
  }).finally(() => {
3635
- ne || X();
3635
+ ie || Y();
3636
3636
  });
3637
3637
  }
3638
3638
  })
3639
3639
  };
3640
3640
  } else {
3641
- xi();
3642
- const _ = ni(r.ticket, De, nn ?? ""), D = Fo(r);
3643
- D && (_.submitted = D), h = {
3641
+ Ci();
3642
+ const _ = ii(r.ticket, De, nn ?? ""), D = No(r);
3643
+ D && (_.submitted = D), g = {
3644
3644
  kind: "ticket",
3645
3645
  state: _,
3646
- view: da({
3646
+ view: pa({
3647
3647
  state: _,
3648
3648
  ticketForm: De,
3649
- configLoading: !Pn,
3649
+ configLoading: !Un,
3650
3650
  labels: Fe,
3651
3651
  message: r.message,
3652
- requireEmail: jn,
3652
+ requireEmail: Pn,
3653
3653
  allowFiles: a || on,
3654
3654
  successMessage: xe.successMessage,
3655
3655
  successUrlLabel: xe.successUrlLabel,
3656
- createTicket: (I) => W.createTicket({
3656
+ createTicket: (I) => M.createTicket({
3657
3657
  subject: I.subject,
3658
3658
  body: I.body,
3659
3659
  priority: I.priority,
3660
3660
  typology: I.typology,
3661
- conversationId: Q,
3661
+ conversationId: Z,
3662
3662
  email: I.email,
3663
3663
  customFields: I.customFields,
3664
3664
  files: I.files,
@@ -3666,11 +3666,11 @@ function Qa(t, e) {
3666
3666
  }),
3667
3667
  onCreated: (I, K) => {
3668
3668
  Lt.add(r.id);
3669
- const Ce = Object.entries(K.customFields).map(([$e, Oi]) => ({
3669
+ const Ce = Object.entries(K.customFields).map(([$e, Di]) => ({
3670
3670
  id: $e,
3671
- value: Oi
3671
+ value: Di
3672
3672
  }));
3673
- W.submitToolCallForm(r.id, {
3673
+ M.submitToolCallForm(r.id, {
3674
3674
  success: !0,
3675
3675
  ticket_id: I.id,
3676
3676
  ticket_url: I.url,
@@ -3695,9 +3695,9 @@ function Qa(t, e) {
3695
3695
  values: {
3696
3696
  ...K.ticket,
3697
3697
  custom_fields: K.customFields,
3698
- email: jn ? K.email : void 0
3698
+ email: Pn ? K.email : void 0
3699
3699
  }
3700
- }), ne || X();
3700
+ }), ie || Y();
3701
3701
  });
3702
3702
  },
3703
3703
  onError: xe.onError
@@ -3705,22 +3705,22 @@ function Qa(t, e) {
3705
3705
  call: r
3706
3706
  };
3707
3707
  }
3708
- return ht.set(r.id, h), h;
3708
+ return ht.set(r.id, g), g;
3709
3709
  }
3710
- function Vn(r) {
3710
+ function qn(r) {
3711
3711
  if (r.type !== "form" || r.displayMode === "collapsible") return null;
3712
- const s = ha(R);
3712
+ const s = xa(R);
3713
3713
  if (s && s !== r.id) {
3714
- const _ = yi(s), D = !!_?.askToTalkToHuman && _.allowedToCreateTicket === !1;
3715
- return ya(D ? Fe.contactFormRejected : Fe.contactFormCreated, D ? "warning" : "info");
3714
+ const _ = wi(s), D = !!_?.askToTalkToHuman && _.allowedToCreateTicket === !1;
3715
+ return wa(D ? Fe.contactFormRejected : Fe.contactFormCreated, D ? "warning" : "info");
3716
3716
  }
3717
- if (!ga(r)) return Ca(r, Fe);
3718
- const h = Ci(r);
3719
- return h.kind === "static" ? h.el : h.view.el;
3717
+ if (!ba(r)) return va(r, Fe);
3718
+ const g = vi(r);
3719
+ return g.kind === "static" ? g.el : g.view.el;
3720
3720
  }
3721
3721
  let He;
3722
- function wi() {
3723
- const r = R.some((_) => _.toolCalls?.some((D) => D.type === "form")), s = Lt.size > 0 || ba(R);
3722
+ function ki() {
3723
+ const r = R.some((_) => _.toolCalls?.some((D) => D.type === "form")), s = Lt.size > 0 || ya(R);
3724
3724
  if (!r && !s) {
3725
3725
  Se.style.display = "", He?.remove();
3726
3726
  return;
@@ -3728,7 +3728,7 @@ function Qa(t, e) {
3728
3728
  He || (He = c({
3729
3729
  margin: "12px",
3730
3730
  borderRadius: "24px",
3731
- border: `1px solid ${Y}`,
3731
+ border: `1px solid ${Q}`,
3732
3732
  boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)",
3733
3733
  backgroundColor: ye,
3734
3734
  display: "flex",
@@ -3739,14 +3739,14 @@ function Qa(t, e) {
3739
3739
  textAlign: "center",
3740
3740
  fontFamily: Le
3741
3741
  }), He.className = "ago-chat-blocked"), He.replaceChildren();
3742
- const h = document.createElement("p");
3743
- if (h.textContent = s ? Fe.ticketCreatedBlocked : Fe.formPending, f(h, {
3742
+ const g = document.createElement("p");
3743
+ if (g.textContent = s ? Fe.ticketCreatedBlocked : Fe.formPending, f(g, {
3744
3744
  color: tt,
3745
3745
  lineHeight: "1.625",
3746
3746
  fontSize: "16px",
3747
3747
  margin: "0",
3748
3748
  whiteSpace: "pre-line"
3749
- }), He.appendChild(h), s) {
3749
+ }), He.appendChild(g), s) {
3750
3750
  const _ = document.createElement("button");
3751
3751
  _.type = "button", _.className = "ago-chat-blocked__new", f(_, {
3752
3752
  display: "inline-flex",
@@ -3770,51 +3770,51 @@ function Qa(t, e) {
3770
3770
  }
3771
3771
  Se.style.display = "none", Se.parentElement?.insertBefore(He, Se);
3772
3772
  }
3773
- function qn(r) {
3773
+ function Gn(r) {
3774
3774
  const s = R[r];
3775
- return n ? qr(s, {
3775
+ return n ? Kr(s, {
3776
3776
  isLast: r === R.length - 1,
3777
- followUpEnabled: Dn,
3778
- followUpHandler: $n,
3779
- agentRowTinted: !!U?.agentBubbleBg,
3780
- agentRowTextTinted: !!U?.agentBubbleText,
3781
- labels: g,
3782
- actionsRow: Mn(s),
3783
- renderToolCall: Vn
3784
- }) : zr(s, {
3785
- ...vi(r),
3786
- renderToolCall: Vn
3777
+ followUpEnabled: $n,
3778
+ followUpHandler: Mn,
3779
+ agentRowTinted: !!ne?.agentBubbleBg,
3780
+ agentRowTextTinted: !!ne?.agentBubbleText,
3781
+ labels: N,
3782
+ actionsRow: Wn(s),
3783
+ renderToolCall: qn
3784
+ }) : Or(s, {
3785
+ ...Ei(r),
3786
+ renderToolCall: qn
3787
3787
  });
3788
3788
  }
3789
- function vi(r) {
3789
+ function Ei(r) {
3790
3790
  const s = R.length - 1;
3791
3791
  return {
3792
3792
  isLast: r === s,
3793
3793
  isLastOfBlock: r === s || R[r + 1].role !== R[r].role,
3794
3794
  bubbleStyle: E,
3795
3795
  showAgentName: y,
3796
- agentBubble: H,
3797
- followUpEnabled: Dn,
3798
- followUpHandler: $n,
3799
- isMobile: !!re?.matches,
3800
- feedbackRow: Mn(R[r])
3796
+ agentBubble: O,
3797
+ followUpEnabled: $n,
3798
+ followUpHandler: Mn,
3799
+ isMobile: !!ae?.matches,
3800
+ feedbackRow: Wn(R[r])
3801
3801
  };
3802
3802
  }
3803
- function ki() {
3803
+ function Si() {
3804
3804
  if (ke || st.length > 0) return !1;
3805
3805
  const r = R.length - 1, s = R[r];
3806
3806
  if (!s || s.role !== "assistant") return !1;
3807
- const h = vt[r];
3808
- if (!h || h.parentNode !== ge) return !1;
3809
- const _ = qn(r), D = document.activeElement, I = D instanceof HTMLElement && h.contains(D) ? D : null;
3810
- return Hn(() => ge.replaceChild(_, h)), I && _.contains(I) && I.focus({ preventScroll: !0 }), vt[r] = _, !0;
3807
+ const g = vt[r];
3808
+ if (!g || g.parentNode !== ge) return !1;
3809
+ const _ = Gn(r), D = document.activeElement, I = D instanceof HTMLElement && g.contains(D) ? D : null;
3810
+ return On(() => ge.replaceChild(_, g)), I && _.contains(I) && I.focus({ preventScroll: !0 }), vt[r] = _, !0;
3811
3811
  }
3812
- function X() {
3813
- Hn(Ei);
3812
+ function Y() {
3813
+ On(_i);
3814
3814
  const r = R[R.length - 1], s = ce && r?.role === "assistant" && (r.status === "IN_PROGRESS" || r.status === "WAITING_CLIENT");
3815
- Z.setAttribute("aria-busy", s ? "true" : "false"), ui(s), wi();
3815
+ ee.setAttribute("aria-busy", s ? "true" : "false"), mi(s), ki();
3816
3816
  }
3817
- function Ei() {
3817
+ function _i() {
3818
3818
  if (ge.replaceChildren(), vt = [], R.length === 0) {
3819
3819
  if (n) {
3820
3820
  if (ut) {
@@ -3833,7 +3833,7 @@ function Qa(t, e) {
3833
3833
  });
3834
3834
  s.setAttribute("role", "status"), r.appendChild(s), ge.appendChild(r);
3835
3835
  }
3836
- } else if (ve === "static") {
3836
+ } else if (Nn === "static") {
3837
3837
  const r = c({
3838
3838
  textAlign: "center",
3839
3839
  color: tt,
@@ -3841,16 +3841,16 @@ function Qa(t, e) {
3841
3841
  fontSize: "16px",
3842
3842
  lineHeight: "1.5"
3843
3843
  });
3844
- r.appendChild(it(le)), ge.appendChild(r);
3844
+ r.appendChild(it(ve)), ge.appendChild(r);
3845
3845
  }
3846
3846
  } else R.forEach((r, s) => {
3847
- const h = qn(s);
3848
- vt[s] = h, ge.appendChild(h);
3847
+ const g = Gn(s);
3848
+ vt[s] = g, ge.appendChild(g);
3849
3849
  });
3850
- for (const r of st) ge.appendChild(Hr(r));
3850
+ for (const r of st) ge.appendChild(Br(r));
3851
3851
  if (ke) {
3852
3852
  if (n) {
3853
- ge.appendChild(jr(g.errorTitle, ke));
3853
+ ge.appendChild(Ur(N.errorTitle, ke));
3854
3854
  return;
3855
3855
  }
3856
3856
  const r = c({
@@ -3871,27 +3871,27 @@ function Qa(t, e) {
3871
3871
  if (s.role === "assistant" && (s.status === "IN_PROGRESS" || s.status === "WAITING_CLIENT")) return s;
3872
3872
  }
3873
3873
  }
3874
- const Gn = (r) => {
3875
- Q || (Q = r.conversationId);
3876
- }, Kn = (r) => {
3877
- const s = an();
3878
- s && (s.content += r.content, ki() || X());
3874
+ const Kn = (r) => {
3875
+ Z || (Z = r.conversationId);
3879
3876
  }, Xn = (r) => {
3880
- const s = R.findIndex((h) => h.id === r.id || h.role === "assistant" && h.status === "IN_PROGRESS");
3881
- s >= 0 ? R[s] = r : R.push(r), X(), xt() || kt();
3877
+ const s = an();
3878
+ s && (s.content += r.content, Si() || Y());
3882
3879
  }, Yn = (r) => {
3883
- const s = R.findIndex((h) => h.id === r.id || h.role === "assistant" && h.status === "IN_PROGRESS");
3884
- s >= 0 ? R[s] = r : R.push(r), ce = !1, X(), r.status === "DONE" && P?.({
3880
+ const s = R.findIndex((g) => g.id === r.id || g.role === "assistant" && g.status === "IN_PROGRESS");
3881
+ s >= 0 ? R[s] = r : R.push(r), Y(), xt() || kt();
3882
+ }, Qn = (r) => {
3883
+ const s = R.findIndex((g) => g.id === r.id || g.role === "assistant" && g.status === "IN_PROGRESS");
3884
+ s >= 0 ? R[s] = r : R.push(r), ce = !1, Y(), r.status === "DONE" && P?.({
3885
3885
  id: r.id,
3886
3886
  content: r.content
3887
3887
  });
3888
- }, Qn = () => {
3888
+ }, Jn = () => {
3889
3889
  const r = an();
3890
- r && (r.content ? r.status = "CANCELED" : R = R.filter((s) => s !== r)), ce = !1, X();
3891
- }, Jn = (r) => {
3892
- ke = r.error, ce = !1, R = R.filter((s) => !s.id.startsWith("temp-")), X();
3890
+ r && (r.content ? r.status = "CANCELED" : R = R.filter((s) => s !== r)), ce = !1, Y();
3891
+ }, Zn = (r) => {
3892
+ ke = r.error, ce = !1, R = R.filter((s) => !s.id.startsWith("temp-")), Y();
3893
3893
  };
3894
- function Si(r) {
3894
+ function Ti(r) {
3895
3895
  const s = {
3896
3896
  id: `ago-intro-${Date.now()}`,
3897
3897
  conversationId: "",
@@ -3900,50 +3900,50 @@ function Qa(t, e) {
3900
3900
  status: "IN_PROGRESS",
3901
3901
  createdAt: /* @__PURE__ */ new Date()
3902
3902
  };
3903
- R.push(s), X();
3904
- const h = r.match(/\S+\s*/g) ?? [r];
3903
+ R.push(s), Y();
3904
+ const g = r.match(/\S+\s*/g) ?? [r];
3905
3905
  let _ = 0;
3906
3906
  Ne = setInterval(() => {
3907
- if (_ >= h.length) {
3908
- clearInterval(Ne), Ne = void 0, s.status = "DONE", Nn && (s.followUpReplies = Nn), X();
3907
+ if (_ >= g.length) {
3908
+ clearInterval(Ne), Ne = void 0, s.status = "DONE", In && (s.followUpReplies = In), Y();
3909
3909
  return;
3910
3910
  }
3911
- s.content += h[_], _++, X();
3912
- }, ri);
3911
+ s.content += g[_], _++, Y();
3912
+ }, si);
3913
3913
  }
3914
- const Zn = (r) => {
3915
- const s = Ee.find((h) => h.id === r.conversationId);
3914
+ const eo = (r) => {
3915
+ const s = Ee.find((g) => g.id === r.conversationId);
3916
3916
  s && (s.title = r.title), n && Te === "history" && Ve?.render({
3917
3917
  threads: Ee,
3918
3918
  loading: Tt
3919
3919
  });
3920
- }, eo = (r) => {
3920
+ }, to = (r) => {
3921
3921
  if (r.type !== "form") return;
3922
3922
  const s = an() ?? [...R].reverse().find((D) => D.role === "assistant");
3923
3923
  if (!s) return;
3924
- const h = s.toolCalls ?? [], _ = h.findIndex((D) => D.id === r.id);
3925
- _ >= 0 ? h[_] = r : h.push(r), s.toolCalls = h, X();
3924
+ const g = s.toolCalls ?? [], _ = g.findIndex((D) => D.id === r.id);
3925
+ _ >= 0 ? g[_] = r : g.push(r), s.toolCalls = g, Y();
3926
3926
  };
3927
- W.on("message:start", Gn), W.on("message:chunk", Kn), W.on("message:answer-complete", Xn), W.on("message:complete", Yn), W.on("message:stopped", Qn), W.on("message:error", Jn), W.on("conversation:title", Zn), W.on("toolCall:received", eo);
3928
- const to = (r) => w?.(r), no = (r) => z?.(r);
3929
- w && W.on("form:submitted", to), z && W.on("form:error", no);
3927
+ M.on("message:start", Kn), M.on("message:chunk", Xn), M.on("message:answer-complete", Yn), M.on("message:complete", Qn), M.on("message:stopped", Jn), M.on("message:error", Zn), M.on("conversation:title", eo), M.on("toolCall:received", to);
3928
+ const no = (r) => w?.(r), oo = (r) => z?.(r), io = (r) => C?.(r);
3929
+ w && M.on("form:submitting", no), z && M.on("form:submitted", oo), C && M.on("form:error", io);
3930
3930
  const sn = [];
3931
- let oo = !1;
3932
- const io = (r) => {
3933
- if (oo) return;
3934
- sn.push(r.install(W));
3931
+ let ro = !1;
3932
+ const ao = (r) => {
3933
+ if (ro) return;
3934
+ sn.push(r.install(M));
3935
3935
  let s = r.store.get().submitted;
3936
- const h = r.store.subscribe((_) => {
3937
- _.submitted && !s && (st.push(ci(_.submitResult)), X()), s = _.submitted;
3936
+ const g = r.store.subscribe((_) => {
3937
+ _.submitted && !s && (st.push(ui(_.submitResult)), Y()), s = _.submitted;
3938
3938
  });
3939
- sn.push(h);
3939
+ sn.push(g);
3940
3940
  };
3941
- for (const r of v ?? []) r.schema != null ? io(Pi(r)) : ji(W, r).then((s) => io(s)).catch(() => {
3941
+ for (const r of v ?? []) r.schema != null ? ao(Vi(r)) : Ui(M, r).then((s) => ao(s)).catch(() => {
3942
3942
  });
3943
- async function Ye(r, s, h) {
3943
+ async function Ye(r, s, g) {
3944
3944
  const _ = r.trim();
3945
3945
  if (!_ || ce) return;
3946
- if (n && Te !== "chat" && (_t = "home", Oe("chat", { byUser: !0 })), N?.(_), ce = !0, ke = null, Ie = !0, Ne) {
3946
+ if (n && Te !== "chat" && (_t = "home", Oe("chat", { byUser: !0 })), L?.(_), ce = !0, ke = null, Ie = !0, Ne) {
3947
3947
  clearInterval(Ne), Ne = void 0;
3948
3948
  const I = R.find((K) => K.id.startsWith("ago-intro-"));
3949
3949
  I && !I.content ? R = R.filter((K) => K !== I) : I && (I.status = "DONE");
@@ -3951,94 +3951,94 @@ function Qa(t, e) {
3951
3951
  const D = Date.now();
3952
3952
  R.push({
3953
3953
  id: `temp-user-${D}`,
3954
- conversationId: Q || "",
3954
+ conversationId: Z || "",
3955
3955
  content: _,
3956
3956
  role: "user",
3957
3957
  status: "DONE",
3958
- attachments: s && s.length > 0 ? Bi(s) : void 0,
3958
+ attachments: s && s.length > 0 ? $i(s) : void 0,
3959
3959
  createdAt: /* @__PURE__ */ new Date()
3960
3960
  }), R.push({
3961
3961
  id: `temp-assistant-${D}`,
3962
- conversationId: Q || "",
3962
+ conversationId: Z || "",
3963
3963
  content: "",
3964
3964
  role: "assistant",
3965
3965
  status: "IN_PROGRESS",
3966
3966
  createdAt: /* @__PURE__ */ new Date()
3967
- }), X(), l || zn();
3967
+ }), Y(), l || Hn();
3968
3968
  try {
3969
- const I = await W.sendMessage(_, {
3970
- conversationId: Q,
3969
+ const I = await M.sendMessage(_, {
3970
+ conversationId: Z,
3971
3971
  files: s,
3972
- ...h?.agentId ? { agentId: h.agentId } : {}
3972
+ ...g?.agentId ? { agentId: g.agentId } : {}
3973
3973
  });
3974
- I.conversationId && (Q || (Q = I.conversationId), Ue?.setActiveThread(I.conversationId, I.createdAt));
3974
+ I.conversationId && (Z || (Z = I.conversationId), Ue?.setActiveThread(I.conversationId, I.createdAt));
3975
3975
  const K = R.find((Ce) => Ce.id === `temp-user-${D}`);
3976
3976
  if (K && (K.id = `user-${D}`, K.conversationId = I.conversationId), I.id && !R.some((Ce) => Ce.id === I.id)) {
3977
3977
  const Ce = R.findIndex(($e) => $e.id === `temp-assistant-${D}`);
3978
3978
  Ce >= 0 ? R[Ce] = I : R.push(I);
3979
3979
  }
3980
- R = R.filter((Ce) => !Ce.id.startsWith("temp-")), I.status !== "WAITING_CLIENT" && (ce = !1), X(), te && ln();
3980
+ R = R.filter((Ce) => !Ce.id.startsWith("temp-")), I.status !== "WAITING_CLIENT" && (ce = !1), Y(), J && ln();
3981
3981
  } catch (I) {
3982
- ke = I instanceof Error ? I.message : "Failed to send message", ce = !1, R = R.filter((K) => !K.id.startsWith("temp-")), fi(_, s), X();
3982
+ ke = I instanceof Error ? I.message : "Failed to send message", ce = !1, R = R.filter((K) => !K.id.startsWith("temp-")), gi(_, s), Y();
3983
3983
  }
3984
3984
  }
3985
3985
  async function Nt() {
3986
- ce && await W.stop();
3986
+ ce && await M.stop();
3987
3987
  }
3988
3988
  async function ln() {
3989
3989
  try {
3990
- const { data: r } = await W.getConversations();
3990
+ const { data: r } = await M.getConversations();
3991
3991
  Ee.splice(0, Ee.length, ...r);
3992
3992
  } catch {
3993
3993
  }
3994
- return Tt = !1, n && !ne && (Te === "history" && Ve?.render({
3994
+ return Tt = !1, n && !ie && (Te === "history" && Ve?.render({
3995
3995
  threads: Ee,
3996
3996
  loading: !1
3997
- }), _i()), Ee;
3997
+ }), Ai()), Ee;
3998
3998
  }
3999
- async function ro(r) {
3999
+ async function so(r) {
4000
4000
  try {
4001
- const s = await W.getConversation(r);
4002
- if (Q !== r) return;
4003
- const h = s?.messages ?? [];
4004
- ut = !1, h.length > 0 && R.length === 0 ? (R = h, X()) : n && X(), n && Ue?.setActiveThread(r, s.lastMessageDate);
4001
+ const s = await M.getConversation(r);
4002
+ if (Z !== r) return;
4003
+ const g = s?.messages ?? [];
4004
+ ut = !1, g.length > 0 && R.length === 0 ? (R = g, Y()) : n && Y(), n && Ue?.setActiveThread(r, s.lastMessageDate);
4005
4005
  } catch {
4006
- if (Q !== r) return;
4007
- ut = !1, R.length === 0 && (Ue?.clear(), Q = void 0, n && (Te === "chat" && Oe("home"), X()));
4006
+ if (Z !== r) return;
4007
+ ut = !1, R.length === 0 && (Ue?.clear(), Z = void 0, n && (Te === "chat" && Oe("home"), Y()));
4008
4008
  }
4009
4009
  }
4010
4010
  function Oe(r, s) {
4011
4011
  if (!n || !pt || !_e || !St || !Ve) return;
4012
- s?.byUser && (Ge = !0), Te !== r && lt(), Te = r, r === "home" ? (_e.composerSlot.appendChild(Se), On(B)) : r === "chat" && (St.composerSlot.appendChild(Se), On(""));
4013
- const h = r === "home" ? _e.el : r === "chat" ? St.el : Ve.el;
4014
- pt.replaceChildren(h), r === "history" && Ve.render({
4012
+ s?.byUser && (Ge = !0), Te !== r && lt(), Te = r, r === "home" ? (_e.composerSlot.appendChild(Se), Bn(q)) : r === "chat" && (St.composerSlot.appendChild(Se), Bn(""));
4013
+ const g = r === "home" ? _e.el : r === "chat" ? St.el : Ve.el;
4014
+ pt.replaceChildren(g), r === "history" && Ve.render({
4015
4015
  threads: Ee,
4016
4016
  loading: Tt
4017
4017
  }), r === "chat" && (Ie = !0, Qt()), en?.update({ screen: r }), Et?.setActive(r), Et?.setVisible(r !== "chat");
4018
4018
  }
4019
4019
  async function bt(r) {
4020
- n && (lt(), ce && await Nt(), Q = r, R = [], ke = null, st.length = 0, Ft.clear(), rn(), ut = !0, Oe("chat"), X(), await ro(r));
4020
+ n && (lt(), ce && await Nt(), Z = r, R = [], ke = null, st.length = 0, Ft.clear(), rn(), ut = !0, Oe("chat"), Y(), await so(r));
4021
4021
  }
4022
4022
  function It() {
4023
- ce && Nt(), Q = void 0, R = [], ke = null, st.length = 0, Ft.clear(), rn(), ut = !1, Ue?.clear(), mi(), _e?.setPending(null), _t = "home", n && Oe("home", { byUser: !0 }), X();
4023
+ ce && Nt(), Z = void 0, R = [], ke = null, st.length = 0, Ft.clear(), rn(), ut = !1, Ue?.clear(), hi(), _e?.setPending(null), _t = "home", n && Oe("home", { byUser: !0 }), Y();
4024
4024
  }
4025
- function _i() {
4025
+ function Ai() {
4026
4026
  if (!n || ft) return;
4027
- if (ft = !0, !M || Ge || Te !== "home" || R.length > 0 || Q) {
4027
+ if (ft = !0, !U || Ge || Te !== "home" || R.length > 0 || Z) {
4028
4028
  Rt();
4029
4029
  return;
4030
4030
  }
4031
- const r = La(Ee);
4031
+ const r = Ia(Ee);
4032
4032
  r && bt(r.id), Rt();
4033
4033
  }
4034
- async function Ti() {
4034
+ async function Fi() {
4035
4035
  let r;
4036
4036
  try {
4037
- r = (await W.getConfig()).permissions[0]?.homePage;
4037
+ r = (await M.getConfig()).permissions[0]?.homePage;
4038
4038
  } catch {
4039
4039
  return;
4040
4040
  }
4041
- ne || !r || (_e?.setContent({
4041
+ ie || !r || (_e?.setContent({
4042
4042
  title: r.title || void 0,
4043
4043
  subtitle: r.subtitle || void 0,
4044
4044
  starters: r.starters.length ? r.starters.map((s) => ({
@@ -4050,11 +4050,11 @@ function Qa(t, e) {
4050
4050
  }
4051
4051
  function Rt() {
4052
4052
  const r = tn;
4053
- !r || ne || ie && (Tt && !ft || (tn = void 0, !(Ge || Q || R.length > 0 || ce || Te !== "home") && Ye(r.message, void 0, { agentId: r.agentId })));
4053
+ !r || ie || re && (Tt && !ft || (tn = void 0, !(Ge || Z || R.length > 0 || ce || Te !== "home") && Ye(r.message, void 0, { agentId: r.agentId })));
4054
4054
  }
4055
- function Ai() {
4056
- Be = void 0, !(ne || ie || q === !1 || he) && (he = Ra({
4057
- text: q,
4055
+ function Li() {
4056
+ Be = void 0, !(ie || re || V === !1 || he) && (he = Ha({
4057
+ text: V,
4058
4058
  edge: ct,
4059
4059
  onOpen: () => Ht(),
4060
4060
  onDismiss: () => {
@@ -4064,32 +4064,32 @@ function Qa(t, e) {
4064
4064
  }
4065
4065
  function dn() {
4066
4066
  if (!n || !j || !pe || xt() || !pe.offsetHeight) return;
4067
- const r = getComputedStyle(pe), s = parseFloat(r.bottom), h = parseFloat(r.right);
4068
- if (Number.isNaN(s) || Number.isNaN(h)) return;
4069
- const _ = Math.round(s + pe.offsetHeight) + Ba, D = Math.round(h), I = [j];
4067
+ const r = getComputedStyle(pe), s = parseFloat(r.bottom), g = parseFloat(r.right);
4068
+ if (Number.isNaN(s) || Number.isNaN(g)) return;
4069
+ const _ = Math.round(s + pe.offsetHeight) + $a, D = Math.round(g), I = [j];
4070
4070
  he && I.push(he.el);
4071
4071
  for (const K of I)
4072
4072
  K.style.setProperty("bottom", `${_}px`, "important"), K.style.setProperty("right", `${D}px`, "important");
4073
- j.style.setProperty("top", `max(40px, calc(100% - ${_ + Da}px))`, "important"), j.style.setProperty("--ago-panel-max", `calc(100% - ${D + 20}px)`);
4073
+ j.style.setProperty("top", `max(40px, calc(100% - ${_ + Ma}px))`, "important"), j.style.setProperty("--ago-panel-max", `calc(100% - ${D + 20}px)`);
4074
4074
  }
4075
- function ao(r) {
4076
- r.key !== "Escape" || !ie || r.defaultPrevented || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || cn() || Qe();
4075
+ function lo(r) {
4076
+ r.key !== "Escape" || !re || r.defaultPrevented || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || cn() || Qe();
4077
4077
  }
4078
- function so() {
4078
+ function co() {
4079
4079
  qe && clearTimeout(qe), qe = setTimeout(() => {
4080
- qe = void 0, !ne && (dn(), _e?.syncColumns());
4080
+ qe = void 0, !ie && (dn(), _e?.syncColumns());
4081
4081
  }, 150);
4082
4082
  }
4083
- n ? (Oe("home"), X(), x && Ti(), e.conversationId ? (Ge = !0, ft = !0, bt(e.conversationId)) : Q && M ? (ft = !0, bt(Q)) : Q = void 0) : (X(), rt && re?.matches || kt(), Q ? ro(Q) : ve === "streaming" && Si(le)), te && ln();
4084
- const lo = {
4085
- client: W,
4083
+ n ? (Oe("home"), Y(), H && Fi(), e.conversationId ? (Ge = !0, ft = !0, bt(e.conversationId)) : Z && U ? (ft = !0, bt(Z)) : Z = void 0) : (Y(), rt && ae?.matches || kt(), Z ? so(Z) : Nn === "streaming" && Ti(ve)), J && ln();
4084
+ const po = {
4085
+ client: M,
4086
4086
  element: dt,
4087
4087
  sendMessage: Ye,
4088
4088
  stop: Nt,
4089
4089
  ...de || rt ? {
4090
- open: Fi,
4091
- close: Li,
4092
- toggle: Ni
4090
+ open: Ni,
4091
+ close: Ii,
4092
+ toggle: Ri
4093
4093
  } : {},
4094
4094
  newConversation: It,
4095
4095
  ...n ? {
@@ -4100,31 +4100,31 @@ function Qa(t, e) {
4100
4100
  threads: Ee,
4101
4101
  refreshThreads: ln,
4102
4102
  destroy() {
4103
- ne || (ne = !0, hi(), Ne && clearInterval(Ne), Be && clearTimeout(Be), qe && clearTimeout(qe), he?.remove(), W.off("message:start", Gn), W.off("message:chunk", Kn), W.off("message:answer-complete", Xn), W.off("message:complete", Yn), W.off("message:stopped", Qn), W.off("message:error", Jn), W.off("conversation:title", Zn), W.off("toolCall:received", eo), rn(), w && W.off("form:submitted", to), z && W.off("form:error", no), oo = !0, sn.forEach((r) => r()), dt.remove(), pe?.remove(), be?.remove(), document.removeEventListener("keydown", ao), window.removeEventListener("resize", so), gt?.remove(), ze?.remove(), re?.removeEventListener("change", fo), document.removeEventListener("keydown", uo), fn(), Vt = !1, mn(at), e.client || W.destroy());
4103
+ ie || (ie = !0, xi(), Ne && clearInterval(Ne), Be && clearTimeout(Be), qe && clearTimeout(qe), he?.remove(), M.off("message:start", Kn), M.off("message:chunk", Xn), M.off("message:answer-complete", Yn), M.off("message:complete", Qn), M.off("message:stopped", Jn), M.off("message:error", Zn), M.off("conversation:title", eo), M.off("toolCall:received", to), rn(), w && M.off("form:submitting", no), z && M.off("form:submitted", oo), C && M.off("form:error", io), ro = !0, sn.forEach((r) => r()), dt.remove(), pe?.remove(), be?.remove(), document.removeEventListener("keydown", lo), window.removeEventListener("resize", co), gt?.remove(), ze?.remove(), ae?.removeEventListener("change", go), document.removeEventListener("keydown", mo), fn(), Vt = !1, mn(at), e.client || M.destroy());
4104
4104
  }
4105
4105
  };
4106
- return n && Object.defineProperty(lo, "screen", {
4106
+ return n && Object.defineProperty(po, "screen", {
4107
4107
  get: () => Te,
4108
4108
  enumerable: !0
4109
- }), lo;
4109
+ }), po;
4110
4110
  function zt() {
4111
4111
  if (!j) return;
4112
- if (n) co();
4112
+ if (n) uo();
4113
4113
  else {
4114
4114
  const s = ct === "left" ? "border-right" : "border-left";
4115
- re?.matches ? (j.style.width = "100%", A.style.borderRadius = "0", A.style.removeProperty(s)) : (j.style.width = typeof $ == "number" ? `${$}px` : $, A.style.setProperty(s, `1px solid ${Y}`));
4116
- const h = o === "left" ? "translateX(-100%)" : "translateX(100%)";
4117
- j.style.transform = ie ? "translateX(0)" : h, pe && (pe.style.display = ie ? "none" : "flex");
4115
+ ae?.matches ? (j.style.width = "100%", A.style.borderRadius = "0", A.style.removeProperty(s)) : (j.style.width = typeof X == "number" ? `${X}px` : X, A.style.setProperty(s, `1px solid ${Q}`));
4116
+ const g = o === "left" ? "translateX(-100%)" : "translateX(100%)";
4117
+ j.style.transform = re ? "translateX(0)" : g, pe && (pe.style.display = re ? "none" : "flex");
4118
4118
  }
4119
- j.setAttribute("aria-hidden", ie ? "false" : "true");
4119
+ j.setAttribute("aria-hidden", re ? "false" : "true");
4120
4120
  const r = cn();
4121
- r !== Vt && (Vt = r, r ? (A.setAttribute("role", "dialog"), A.setAttribute("aria-modal", "true"), A.setAttribute("aria-label", F), A.tabIndex = -1, A.style.paddingBottom = "env(safe-area-inset-bottom)", wo(at), Re = pn(), un(), mo()) : (fn(), Ri(), Re = 0, A.removeAttribute("role"), A.removeAttribute("aria-modal"), A.removeAttribute("aria-label"), A.style.removeProperty("padding-bottom"), mn(at)));
4121
+ r !== Vt && (Vt = r, r ? (A.setAttribute("role", "dialog"), A.setAttribute("aria-modal", "true"), A.setAttribute("aria-label", $), A.tabIndex = -1, A.style.paddingBottom = "env(safe-area-inset-bottom)", ko(at), Re = pn(), un(), ho()) : (fn(), Hi(), Re = 0, A.removeAttribute("role"), A.removeAttribute("aria-modal"), A.removeAttribute("aria-label"), A.style.removeProperty("padding-bottom"), mn(at)));
4122
4122
  }
4123
- function co() {
4123
+ function uo() {
4124
4124
  if (!j) return;
4125
- j.style.display = ie ? "block" : "none", Zt?.setOpen(ie);
4125
+ j.style.display = re ? "block" : "none", Zt?.setOpen(re);
4126
4126
  const r = xt();
4127
- if (pe && (pe.style.display = r && ie ? "none" : "flex"), r) {
4127
+ if (pe && (pe.style.display = r && re ? "none" : "flex"), r) {
4128
4128
  for (const s of [
4129
4129
  "bottom",
4130
4130
  "right",
@@ -4145,7 +4145,7 @@ function Qa(t, e) {
4145
4145
  paddingLeft: "env(safe-area-inset-left, 0px)",
4146
4146
  paddingRight: "env(safe-area-inset-right, 0px)",
4147
4147
  boxSizing: "border-box"
4148
- }), j.dataset.agoLayout = "fullscreen", ie && (he?.remove(), he = void 0);
4148
+ }), j.dataset.agoLayout = "fullscreen", re && (he?.remove(), he = void 0);
4149
4149
  } else {
4150
4150
  for (const s of [
4151
4151
  "left",
@@ -4159,120 +4159,120 @@ function Qa(t, e) {
4159
4159
  right: "20px",
4160
4160
  bottom: "80px",
4161
4161
  top: "max(40px, calc(100% - 880px))",
4162
- width: `min(max(400px, ${xo}), var(--ago-panel-max, calc(100% - 40px)))`,
4162
+ width: `min(max(400px, ${Co}), var(--ago-panel-max, calc(100% - 40px)))`,
4163
4163
  height: "auto",
4164
4164
  borderRadius: "16px"
4165
4165
  }), j.dataset.agoLayout = "panel", dn();
4166
4166
  }
4167
4167
  }
4168
4168
  function Ht() {
4169
- ie = !0, Be && (clearTimeout(Be), Be = void 0), he?.remove(), he = void 0, zt(), xt() ? A.focus({ preventScroll: !0 }) : kt(), Rt(), C?.();
4169
+ re = !0, Be && (clearTimeout(Be), Be = void 0), he?.remove(), he = void 0, zt(), xt() ? A.focus({ preventScroll: !0 }) : kt(), Rt(), S?.();
4170
4170
  }
4171
4171
  function Qe() {
4172
- lt(), ie = !1, zt(), S?.();
4172
+ lt(), re = !1, zt(), T?.();
4173
4173
  }
4174
- function po() {
4175
- ie ? Qe() : Ht();
4174
+ function fo() {
4175
+ re ? Qe() : Ht();
4176
4176
  }
4177
- function Fi() {
4177
+ function Ni() {
4178
4178
  de ? Ht() : yt();
4179
4179
  }
4180
- function Li() {
4180
+ function Ii() {
4181
4181
  lt(), de ? Qe() : Ct();
4182
4182
  }
4183
- function Ni() {
4184
- de ? po() : Ae ? Ct() : yt();
4183
+ function Ri() {
4184
+ de ? fo() : Ae ? Ct() : yt();
4185
4185
  }
4186
4186
  function xt() {
4187
- return !!re?.matches;
4187
+ return !!ae?.matches;
4188
4188
  }
4189
4189
  function cn() {
4190
- return xt() && (de ? ie : Ae);
4190
+ return xt() && (de ? re : Ae);
4191
4191
  }
4192
- function Ii() {
4192
+ function zi() {
4193
4193
  return Array.from(A.querySelectorAll('a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])')).filter((r) => r.getClientRects().length > 0);
4194
4194
  }
4195
- function uo(r) {
4195
+ function mo(r) {
4196
4196
  if (!cn()) return;
4197
4197
  if (r.key === "Escape") {
4198
4198
  de ? Qe() : Ct();
4199
4199
  return;
4200
4200
  }
4201
4201
  if (r.key !== "Tab") return;
4202
- const s = Ii();
4202
+ const s = zi();
4203
4203
  if (s.length === 0) {
4204
4204
  r.preventDefault();
4205
4205
  return;
4206
4206
  }
4207
- const h = s[0], _ = s[s.length - 1], D = document.activeElement;
4208
- r.shiftKey && (D === h || !A.contains(D)) ? (r.preventDefault(), _.focus()) : !r.shiftKey && (D === _ || !A.contains(D)) && (r.preventDefault(), h.focus());
4207
+ const g = s[0], _ = s[s.length - 1], D = document.activeElement;
4208
+ r.shiftKey && (D === g || !A.contains(D)) ? (r.preventDefault(), _.focus()) : !r.shiftKey && (D === _ || !A.contains(D)) && (r.preventDefault(), g.focus());
4209
4209
  }
4210
- function fo(r) {
4211
- de ? zt() : !r.matches && Ae && Ct(), X();
4210
+ function go(r) {
4211
+ de ? zt() : !r.matches && Ae && Ct(), Y();
4212
4212
  }
4213
4213
  function pn() {
4214
4214
  return window.visualViewport?.height ?? window.innerHeight;
4215
4215
  }
4216
4216
  function un() {
4217
- const r = window.visualViewport, s = r?.offsetTop ?? 0, h = r?.height ?? Re;
4217
+ const r = window.visualViewport, s = r?.offsetTop ?? 0, g = r?.height ?? Re;
4218
4218
  if (de) {
4219
4219
  if (!j) return;
4220
- const D = window.innerHeight || Re, I = Math.max(0, D - (s + h));
4220
+ const D = window.innerHeight || Re, I = Math.max(0, D - (s + g));
4221
4221
  j.style.bottom = `${I}px`, j.style.top = `${s}px`;
4222
4222
  return;
4223
4223
  }
4224
- const _ = Math.min(0, s + h - Re);
4224
+ const _ = Math.min(0, s + g - Re);
4225
4225
  A.style.top = `${_}px`, be && (be.style.top = `${s}px`);
4226
4226
  }
4227
- function Ri() {
4228
- de && j && (j.style.removeProperty("bottom"), j.style.removeProperty("top"), n && !ne && co());
4227
+ function Hi() {
4228
+ de && j && (j.style.removeProperty("bottom"), j.style.removeProperty("top"), n && !ie && uo());
4229
4229
  }
4230
4230
  function Ot() {
4231
4231
  Ke || (Ke = requestAnimationFrame(() => {
4232
- Ke = 0, !ne && un();
4232
+ Ke = 0, !ie && un();
4233
4233
  }));
4234
4234
  }
4235
- function mo() {
4235
+ function ho() {
4236
4236
  window.visualViewport?.addEventListener("resize", Ot), window.visualViewport?.addEventListener("scroll", Ot);
4237
4237
  }
4238
4238
  function fn() {
4239
4239
  window.visualViewport?.removeEventListener("resize", Ot), window.visualViewport?.removeEventListener("scroll", Ot), Ke && (cancelAnimationFrame(Ke), Ke = 0);
4240
4240
  }
4241
- function go() {
4241
+ function bo() {
4242
4242
  Ie = !0, Qt();
4243
4243
  }
4244
- function zi() {
4244
+ function Oi() {
4245
4245
  const r = c({
4246
4246
  position: "fixed",
4247
4247
  top: "0",
4248
4248
  left: "0",
4249
4249
  right: "0",
4250
- height: `calc(${Bn}px + env(safe-area-inset-top))`,
4250
+ height: `calc(${Dn}px + env(safe-area-inset-top))`,
4251
4251
  display: "none",
4252
4252
  alignItems: "center",
4253
4253
  justifyContent: "space-between",
4254
4254
  padding: "env(safe-area-inset-top) 14px 0",
4255
4255
  backgroundColor: ye,
4256
- borderBottom: `1px solid ${Y}`,
4256
+ borderBottom: `1px solid ${Q}`,
4257
4257
  zIndex: "2147483001",
4258
4258
  fontFamily: Le
4259
4259
  });
4260
4260
  if (r.className = "ago-chat-widget-mobile-bar", p) {
4261
- const h = document.createElement("img");
4262
- h.src = p, h.alt = "", f(h, {
4261
+ const g = document.createElement("img");
4262
+ g.src = p, g.alt = "", f(g, {
4263
4263
  height: "28px",
4264
4264
  width: "auto"
4265
- }), r.appendChild(h);
4266
- } else if (F) {
4267
- const h = document.createElement("span");
4268
- h.textContent = F, f(h, {
4265
+ }), r.appendChild(g);
4266
+ } else if ($) {
4267
+ const g = document.createElement("span");
4268
+ g.textContent = $, f(g, {
4269
4269
  fontSize: "15px",
4270
4270
  fontWeight: "600",
4271
- color: ee,
4271
+ color: te,
4272
4272
  overflow: "hidden",
4273
4273
  whiteSpace: "nowrap",
4274
4274
  textOverflow: "ellipsis"
4275
- }), r.appendChild(h);
4275
+ }), r.appendChild(g);
4276
4276
  } else r.appendChild(c({}));
4277
4277
  const s = document.createElement("button");
4278
4278
  return s.type = "button", s.setAttribute("aria-label", "Close"), s.textContent = "×", f(s, {
@@ -4287,28 +4287,28 @@ function Qa(t, e) {
4287
4287
  background: "transparent",
4288
4288
  fontSize: "26px",
4289
4289
  lineHeight: "1",
4290
- color: ee,
4290
+ color: te,
4291
4291
  cursor: "pointer",
4292
4292
  padding: "0"
4293
4293
  }), s.addEventListener("click", () => {
4294
4294
  Ct();
4295
4295
  }), r.appendChild(s), r;
4296
4296
  }
4297
- function Hi() {
4298
- return typeof document.startViewTransition == "function" && !li?.matches && !!re?.matches;
4297
+ function Bi() {
4298
+ return typeof document.startViewTransition == "function" && !ci?.matches && !!ae?.matches;
4299
4299
  }
4300
- function ho(r) {
4300
+ function xo(r) {
4301
4301
  const s = document;
4302
- if (Hi() && s.startViewTransition) {
4302
+ if (Bi() && s.startViewTransition) {
4303
4303
  A.style.setProperty("view-transition-name", mt), be?.style.setProperty("view-transition-name", `${mt}-bar`);
4304
- const h = () => {
4304
+ const g = () => {
4305
4305
  A.style.removeProperty("view-transition-name"), be?.style.removeProperty("view-transition-name");
4306
4306
  };
4307
- return s.startViewTransition(r).finished.then(h, h);
4307
+ return s.startViewTransition(r).finished.then(g, g);
4308
4308
  }
4309
4309
  return r(), Promise.resolve();
4310
4310
  }
4311
- function bo(r) {
4311
+ function yo(r) {
4312
4312
  if (r)
4313
4313
  ze && A.parentElement?.insertBefore(ze, A), f(A, {
4314
4314
  position: "fixed",
@@ -4321,9 +4321,9 @@ function Qa(t, e) {
4321
4321
  border: "none",
4322
4322
  borderRadius: "0",
4323
4323
  boxShadow: "none",
4324
- paddingTop: `calc(${Bn}px + env(safe-area-inset-top))`,
4324
+ paddingTop: `calc(${Dn}px + env(safe-area-inset-top))`,
4325
4325
  paddingBottom: "env(safe-area-inset-bottom)"
4326
- }), A.setAttribute("role", "dialog"), A.setAttribute("aria-modal", "true"), A.setAttribute("aria-label", F), me && (me.style.display = "none"), be && (be.style.display = "flex");
4326
+ }), A.setAttribute("role", "dialog"), A.setAttribute("aria-modal", "true"), A.setAttribute("aria-label", $), me && (me.style.display = "none"), be && (be.style.display = "flex");
4327
4327
  else {
4328
4328
  ze?.remove(), ze = void 0;
4329
4329
  for (const s of [
@@ -4340,36 +4340,36 @@ function Qa(t, e) {
4340
4340
  }
4341
4341
  }
4342
4342
  function yt() {
4343
- if (ne || Ae || !re?.matches) return Promise.resolve();
4343
+ if (ie || Ae || !ae?.matches) return Promise.resolve();
4344
4344
  const r = A.getBoundingClientRect();
4345
4345
  if (r.height >= pn() * 0.8) return Promise.resolve();
4346
4346
  Ae = !0, ze = c({
4347
4347
  width: `${r.width}px`,
4348
4348
  height: `${r.height}px`
4349
- }), ze.className = "ago-chat-widget-spacer", ze.setAttribute("aria-hidden", "true"), Re = pn(), A.style.setProperty("--ago-vh", `${Re}px`), un(), mo(), wo(at);
4350
- const s = ho(() => bo(!0));
4349
+ }), ze.className = "ago-chat-widget-spacer", ze.setAttribute("aria-hidden", "true"), Re = pn(), A.style.setProperty("--ago-vh", `${Re}px`), un(), ho(), ko(at);
4350
+ const s = xo(() => yo(!0));
4351
4351
  return s.then(() => {
4352
- ne || (go(), kt());
4353
- }), go(), C?.(), s;
4352
+ ie || (bo(), kt());
4353
+ }), bo(), S?.(), s;
4354
4354
  }
4355
4355
  function Ct() {
4356
4356
  if (!Ae) return Promise.resolve();
4357
4357
  lt(), Ae = !1, fn(), mn(at), A.querySelector("textarea")?.blur();
4358
- const r = ho(() => bo(!1));
4358
+ const r = xo(() => yo(!1));
4359
4359
  return r.then(() => {
4360
- ne || A.style.removeProperty("--ago-vh");
4361
- }), Re = 0, S?.(), r;
4360
+ ie || A.style.removeProperty("--ago-vh");
4361
+ }), Re = 0, T?.(), r;
4362
4362
  }
4363
4363
  }
4364
4364
  export {
4365
- Lo as DEFAULT_FEEDBACK_LABELS,
4366
- Ya as DEFAULT_SPEECH_TO_TEXT_LABELS,
4367
- wa as DEFAULT_TOOL_CALL_FORM_LABELS,
4368
- Eo as DEFAULT_WIDGET_LABELS,
4369
- fr as colorsToTheme,
4370
- Xa as compactMediaQuery,
4371
- Ka as createSheetController,
4372
- Qa as mountChatWidget,
4373
- sr as readableTextColor,
4365
+ Io as DEFAULT_FEEDBACK_LABELS,
4366
+ Ja as DEFAULT_SPEECH_TO_TEXT_LABELS,
4367
+ ka as DEFAULT_TOOL_CALL_FORM_LABELS,
4368
+ _o as DEFAULT_WIDGET_LABELS,
4369
+ gr as colorsToTheme,
4370
+ Qa as compactMediaQuery,
4371
+ Ya as createSheetController,
4372
+ Za as mountChatWidget,
4373
+ dr as readableTextColor,
4374
4374
  it as renderMarkdown
4375
4375
  };