@useago/sdk 1.13.3 → 1.14.1

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/angular.cjs +1 -1
  3. package/dist/angular.d.cts +7 -0
  4. package/dist/angular.d.ts +7 -0
  5. package/dist/angular.js +1 -1
  6. package/dist/{createConversationSession-DrmOaZdO.js → createConversationSession-CybQdMpK.js} +1 -1
  7. package/dist/{createConversationSession-Digvn0GQ.cjs → createConversationSession-jwSXhTLe.cjs} +1 -1
  8. package/dist/{createFormCollector-D_5SDuk9.cjs → createFormCollector-B_hSKcLd.cjs} +1 -1
  9. package/dist/{createFormCollector-D6_N8wYq.js → createFormCollector-DJjms78E.js} +1 -1
  10. package/dist/devtools.d.cts +7 -0
  11. package/dist/devtools.d.ts +7 -0
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.d.cts +7 -0
  14. package/dist/index.d.ts +7 -0
  15. package/dist/index.js +6 -6
  16. package/dist/react.cjs +4 -4
  17. package/dist/react.d.cts +8 -1
  18. package/dist/react.d.ts +8 -1
  19. package/dist/react.js +901 -912
  20. package/dist/speechToText-BB25_zVM.cjs +7 -0
  21. package/dist/speechToText-BLvTis4S.js +1496 -0
  22. package/dist/testing.d.cts +7 -0
  23. package/dist/testing.d.ts +7 -0
  24. package/dist/{types-D1ZrqVhr.js → types-C39MJUE3.js} +284 -259
  25. package/dist/{types-DNr6XEwI.cjs → types-PGXnhAmQ.cjs} +7 -7
  26. package/dist/vue.cjs +1 -1
  27. package/dist/vue.d.cts +7 -0
  28. package/dist/vue.d.ts +7 -0
  29. package/dist/vue.js +1 -1
  30. package/dist/widget.cjs +6 -6
  31. package/dist/widget.d.cts +12 -4
  32. package/dist/widget.d.ts +12 -4
  33. package/dist/widget.js +1918 -1867
  34. package/llms-full.txt +23 -3
  35. package/package.json +1 -1
  36. package/dist/speechToText-BV7qxqPF.js +0 -704
  37. package/dist/speechToText-ZciRyyJE.cjs +0 -1
@@ -1,704 +0,0 @@
1
- var q = /* @__PURE__ */ new WeakMap(), te = [
2
- "position",
3
- "top",
4
- "left",
5
- "right",
6
- "width"
7
- ];
8
- function P(e, t) {
9
- return t.map((n) => ({
10
- style: e,
11
- prop: n,
12
- value: e.getPropertyValue(n),
13
- priority: e.getPropertyPriority(n)
14
- }));
15
- }
16
- function ne(e) {
17
- for (const { style: t, prop: n, value: a, priority: r } of e) a ? t.setProperty(n, a, r) : t.removeProperty(n);
18
- }
19
- function Ae(e, t = document) {
20
- const n = q.get(t);
21
- if (n) {
22
- n.owners.add(e);
23
- return;
24
- }
25
- const a = t.body, r = t.documentElement, s = t.defaultView?.scrollY ?? 0;
26
- q.set(t, {
27
- owners: /* @__PURE__ */ new Set([e]),
28
- saved: [...P(a.style, te), ...P(r.style, ["overflow"])],
29
- scrollY: s
30
- }), a.style.position = "fixed", a.style.top = `-${s}px`, a.style.left = "0", a.style.right = "0", a.style.width = "100%", r.style.overflow = "hidden";
31
- }
32
- function Te(e, t = document) {
33
- const n = q.get(t);
34
- !n || !n.owners.delete(e) || n.owners.size > 0 || (q.delete(t), ne(n.saved), t.defaultView?.scrollTo(0, n.scrollY));
35
- }
36
- function Se(e, t) {
37
- const n = e.replace("#", ""), a = Number.parseInt(n.substring(0, 2), 16), r = Number.parseInt(n.substring(2, 4), 16), s = Number.parseInt(n.substring(4, 6), 16), o = (l) => Math.min(255, Math.round(l + (255 - l) * (t / 100))), c = (l) => l.toString(16).padStart(2, "0");
38
- return `#${c(o(a))}${c(o(r))}${c(o(s))}`;
39
- }
40
- function we(e) {
41
- return /^#?[0-9A-F]{6}$/i.test(e);
42
- }
43
- function ae(e, t, n) {
44
- const a = (1 - Math.abs(2 * n - 1)) * t, r = (e % 360 + 360) % 360 / 60, s = r | 0, o = a * (1 - Math.abs(r % 2 - 1)), [c, l, b] = [
45
- [
46
- a,
47
- o,
48
- 0
49
- ],
50
- [
51
- o,
52
- a,
53
- 0
54
- ],
55
- [
56
- 0,
57
- a,
58
- o
59
- ],
60
- [
61
- 0,
62
- o,
63
- a
64
- ],
65
- [
66
- o,
67
- 0,
68
- a
69
- ],
70
- [
71
- a,
72
- 0,
73
- o
74
- ]
75
- ][s], x = n - a / 2;
76
- return [
77
- Math.round((c + x) * 255),
78
- Math.round((l + x) * 255),
79
- Math.round((b + x) * 255)
80
- ];
81
- }
82
- function re(e) {
83
- const t = e.trim(), n = /^hsla?\(\s*([\d.-]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/i.exec(t);
84
- if (n) {
85
- const [o, c, l] = n.slice(1, 4).map(Number);
86
- return [
87
- o,
88
- c,
89
- l
90
- ].some(Number.isNaN) ? null : ae(o, Math.min(c, 100) / 100, Math.min(l, 100) / 100);
91
- }
92
- const a = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);
93
- if (a) {
94
- const o = a.slice(1, 4).map(Number);
95
- return o.some((c) => Number.isNaN(c) || c < 0 || c > 255) ? null : o;
96
- }
97
- const r = t.replace("#", ""), s = r.length === 3 ? r.split("").map((o) => o + o).join("") : r;
98
- return /^[0-9a-f]{6}$/i.test(s) ? [
99
- Number.parseInt(s.substring(0, 2), 16),
100
- Number.parseInt(s.substring(2, 4), 16),
101
- Number.parseInt(s.substring(4, 6), 16)
102
- ] : null;
103
- }
104
- function z(e) {
105
- const t = re(e);
106
- if (!t) return null;
107
- const [n, a, r] = t.map((s) => {
108
- const o = s / 255;
109
- return o <= 0.03928 ? o / 12.92 : ((o + 0.055) / 1.055) ** 2.4;
110
- });
111
- return 0.2126 * n + 0.7152 * a + 0.0722 * r;
112
- }
113
- function oe(e, t) {
114
- const n = z(e), a = z(t);
115
- return n === null || a === null ? null : (Math.max(n, a) + 0.05) / (Math.min(n, a) + 0.05);
116
- }
117
- var ie = /(?:repeating-)?(?:linear|radial|conic)-gradient\(/i;
118
- function se(e) {
119
- return !!e && ie.test(e);
120
- }
121
- function ce(e) {
122
- return e.match(/#[0-9a-f]{3,8}|(?:rgba?|hsla?)\([^()]*\)|\btransparent\b/gi) ?? [];
123
- }
124
- function le(e) {
125
- const t = e.trim().toLowerCase();
126
- if (t === "transparent") return !0;
127
- const n = /\/\s*([\d.]+)%?\s*\)$/.exec(t);
128
- if (n) return Number.parseFloat(n[1]) === 0;
129
- const a = /^(?:rgba|hsla)\([^)]*,\s*([\d.]+)%?\s*\)$/.exec(t);
130
- if (a) return Number.parseFloat(a[1]) === 0;
131
- if (!t.startsWith("#")) return !1;
132
- const r = t.slice(1);
133
- return /^[0-9a-f]+$/.test(r) ? r.length === 8 ? r.slice(6) === "00" : r.length === 4 ? r[3] === "0" : !1 : !1;
134
- }
135
- var O = "#FFFFFF", ue = "#000000", de = "#FFFFFF";
136
- function fe(e) {
137
- if (!e) return O;
138
- const t = se(e) ? ce(e) : [e], n = (t.some(le) ? [...t, de] : t).map((a) => oe(a, O)).filter((a) => a !== null);
139
- return n.length && Math.min(...n) < 3 ? ue : O;
140
- }
141
- var ge = '"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', $ = `var(--ago-font, ${ge})`, G = {
142
- font: "--ago-font",
143
- radius: "--ago-radius",
144
- messageRadius: "--ago-message-radius",
145
- brand: "--ago-brand-color",
146
- brandText: "--ago-brand-text-color",
147
- headerBg: "--ago-header-background",
148
- headerText: "--ago-header-text-color",
149
- panelBg: "--ago-panel-background",
150
- messagesBg: "--ago-messages-background",
151
- text: "--ago-text-color",
152
- mutedText: "--ago-muted-text-color",
153
- border: "--ago-border-color",
154
- accent: "--ago-accent-color",
155
- agentBubbleBg: "--ago-agent-bubble-background",
156
- agentBubbleText: "--ago-agent-bubble-text-color",
157
- userBubbleBg: "--ago-user-bubble-background",
158
- userBubbleText: "--ago-user-bubble-text-color",
159
- launcherBg: "--ago-launcher-background",
160
- launcherText: "--ago-launcher-text-color",
161
- sendBg: "--ago-send-button-background",
162
- panelWidth: "--ago-panel-width"
163
- }, he = "var(--ago-brand-color, #03182f)", Re = "var(--ago-brand-text-color, #fff)", _e = "var(--ago-header-background, var(--ago-brand-color, #03182f))", ke = "var(--ago-header-text-color, #e8f0fe)", Be = "var(--ago-panel-background, #fff)", De = "var(--ago-messages-background, #fbfbfb)", Ne = "var(--ago-text-color, #30373e)", Y = "var(--ago-muted-text-color, #6b6d6f)", He = "var(--ago-border-color, #dee3e8)", Le = "var(--ago-accent-color, #1b5fc4)", Ie = "var(--ago-agent-bubble-background, #f1f3f5)", W = "var(--ago-radius, 16px)", Oe = "var(--ago-message-radius, 16px)", qe = "var(--ago-message-radius, 20px)", Fe = "var(--ago-launcher-background, #007bff)", Ze = "var(--ago-launcher-text-color, #fff)", Ue = "var(--ago-send-button-background, var(--ago-brand-color, #03182f))", Pe = "var(--ago-user-bubble-background, #fff)", ze = "var(--ago-user-bubble-text-color, #0a0a0a)", $e = "var(--ago-agent-bubble-text-color, var(--ago-text-color, #30373e))", Ge = "var(--ago-panel-background, #f8faff)", We = "var(--ago-accent-color, #003edf)", Ve = "#e3edff", Xe = "#e5e5e5", Ke = "var(--ago-border-color, #e4e4e7)", Ye = "var(--ago-muted-text-color, #71717a)", je = "var(--ago-panel-width, 550px)", Qe = "0 1px 2px 0 rgba(0,0,0,0.05)", Je = "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)", et = "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)", tt = "rgba(15, 15, 15, 0.16) 0px 5px 40px 0px";
164
- function nt(e, t) {
165
- if (t)
166
- for (const n of Object.keys(G)) {
167
- const a = t[n];
168
- a != null && e.style.setProperty(G[n], a);
169
- }
170
- }
171
- function at(e) {
172
- if (!e) return {};
173
- const t = {};
174
- return e.button && (t.launcherBg = e.button, t.sendBg = e.button), e.header && (t.headerBg = e.header, t.headerText = fe(e.header)), e.agentMessage && (t.agentBubbleBg = e.agentMessage), e.agentMessageFont && (t.agentBubbleText = e.agentMessageFont), e.background && (t.panelBg = e.background, t.messagesBg = e.background), e.font && (t.text = e.font), e.userMessage && (t.userBubbleBg = e.userMessage), e.userMessageFont && (t.userBubbleText = e.userMessageFont), t;
175
- }
176
- function H(e, t) {
177
- Object.assign(e.style, t);
178
- }
179
- function V(e = {}) {
180
- const t = document.createElement("div");
181
- return H(t, e), t;
182
- }
183
- var X = "ago-chat-widget-keyframes";
184
- function rt() {
185
- if (typeof document > "u" || document.getElementById(X)) return;
186
- const e = document.createElement("style");
187
- e.id = X, e.textContent = "@keyframes ago-pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }@keyframes ago-spin { to { transform: rotate(360deg); } }@keyframes ago-scale-in { 50% { transform: translateX(-10px) translateY(-5px) scale(1.1); } }@keyframes ago-appear { 0%, 98% { opacity: 0; } 100% { opacity: 1; } }@keyframes ago-skeleton-pulse { 50% { opacity: 0.5; } }.ago-chat-input--embed textarea::placeholder { font-style: italic; color: #9ca3af; opacity: 1; }", document.head.appendChild(e);
188
- }
189
- var pe = "2147483000";
190
- function ve(e, t = "0px") {
191
- return e === void 0 ? t : typeof e == "number" ? `${e}px` : e;
192
- }
193
- function be(e) {
194
- return `(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`;
195
- }
196
- function ot(e = {}) {
197
- const t = e.breakpoint ?? 768, n = e.peekHeight ?? 152, a = ve(e.bottomOffset), r = e.initialState ?? "peek", s = /* @__PURE__ */ new Set();
198
- let o = r, c = !1;
199
- const l = typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(be(t)) : void 0;
200
- let b = d();
201
- const x = f(!1, r);
202
- function y(u, A) {
203
- if (!u) return {
204
- style: {},
205
- attrs: {
206
- role: null,
207
- "aria-modal": null,
208
- "aria-label": null
209
- }
210
- };
211
- const T = {
212
- position: "fixed",
213
- left: "0",
214
- right: "0",
215
- bottom: a,
216
- zIndex: pe,
217
- display: "flex",
218
- flexDirection: "column",
219
- borderRadius: A === "full" ? "0" : `${W} ${W} 0 0`,
220
- paddingBottom: "env(safe-area-inset-bottom)"
221
- };
222
- return A === "full" ? {
223
- style: {
224
- ...T,
225
- top: "0",
226
- height: "auto",
227
- paddingTop: "env(safe-area-inset-top)"
228
- },
229
- attrs: {
230
- role: "dialog",
231
- "aria-modal": "true",
232
- tabindex: "-1"
233
- }
234
- } : {
235
- style: {
236
- ...T,
237
- top: "auto",
238
- minHeight: `calc(${n}px + env(safe-area-inset-bottom))`,
239
- height: "auto"
240
- },
241
- attrs: {
242
- role: null,
243
- "aria-modal": null,
244
- tabindex: "-1"
245
- }
246
- };
247
- }
248
- function f(u, A) {
249
- return {
250
- compact: u,
251
- state: A,
252
- isModal: u && A === "full",
253
- surface: y(u, A)
254
- };
255
- }
256
- function d() {
257
- return f(!!l?.matches, o);
258
- }
259
- function h() {
260
- b = d();
261
- for (const u of s) u();
262
- }
263
- function p(u, A) {
264
- c || o === u || (o = u, h(), e.onStateChange?.(u, A));
265
- }
266
- function m() {
267
- if (!c) {
268
- if (!l?.matches && o !== r) {
269
- o = r, h(), e.onStateChange?.(r, "breakpoint");
270
- return;
271
- }
272
- h();
273
- }
274
- }
275
- let E = !1;
276
- function S() {
277
- E || !l || (l.addEventListener("change", m), E = !0, b = d());
278
- }
279
- function M() {
280
- !E || !l || (l.removeEventListener("change", m), E = !1);
281
- }
282
- return {
283
- subscribe(u) {
284
- return s.add(u), s.size === 1 && S(), () => {
285
- s.delete(u), s.size === 0 && M();
286
- };
287
- },
288
- getSnapshot: () => b,
289
- getServerSnapshot: () => x,
290
- expand: (u = "api") => p("full", u),
291
- collapse: (u = "api") => p("peek", u),
292
- toggle: (u = "api") => p(o === "full" ? "peek" : "full", u),
293
- destroy() {
294
- c || (c = !0, M(), s.clear());
295
- }
296
- };
297
- }
298
- var L = "http://www.w3.org/2000/svg";
299
- function me(e = {}) {
300
- return B(["M9 5a3 3 0 0 1 6 0v7a3 3 0 0 1-6 0Z", "M5 10v2a7 7 0 0 0 14 0v-2M12 19v3M8 22h8"], e);
301
- }
302
- function xe(e = {}) {
303
- return B(["M5 12l4 4L19 6"], e);
304
- }
305
- function ye(e = {}) {
306
- return B(["M21 12a9 9 0 1 1-6.219-8.56"], e);
307
- }
308
- function I(e, t, n) {
309
- const a = document.createElementNS(L, "svg");
310
- return a.setAttribute("xmlns", L), a.setAttribute("viewBox", e), a.setAttribute("width", String(t)), a.setAttribute("height", String(t)), a.setAttribute("aria-hidden", "true"), a.setAttribute("focusable", "false"), a.style.flexShrink = "0", a.style.display = "block", n && a.setAttribute("class", n), a;
311
- }
312
- function D(e, t) {
313
- const n = document.createElementNS(L, "path");
314
- return n.setAttribute("d", e), n.setAttribute("fill", "currentColor"), t && n.setAttribute("data-ago-path", t), n;
315
- }
316
- function C(e, t = {}) {
317
- const n = I("0 -960 960 960", t.size ?? 24, t.className);
318
- return n.appendChild(D(e)), n;
319
- }
320
- function B(e, t = {}) {
321
- const n = I("0 0 24 24", t.size ?? 24, t.className);
322
- n.setAttribute("fill", "none"), n.setAttribute("stroke", "currentColor"), n.setAttribute("stroke-width", String(t.strokeWidth ?? 2)), n.setAttribute("stroke-linecap", "round"), n.setAttribute("stroke-linejoin", "round");
323
- for (const a of e) {
324
- const r = document.createElementNS(L, "path");
325
- r.setAttribute("d", a), n.appendChild(r);
326
- }
327
- return n;
328
- }
329
- var Ee = "M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM880-80 720-240H160q-33 0-56.5-23.5T80-320v-480q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v720ZM160-320h594l46 45v-525H160v480Zm0 0v-480 480Z", j = "M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z";
330
- function it() {
331
- const e = I("0 -960 960 960", 48);
332
- return e.appendChild(D(Ee, "open")), e.appendChild(D(j, "close")), e;
333
- }
334
- function st() {
335
- const e = I("0 -960 960 960", 48);
336
- return e.appendChild(D(j, "close")), e;
337
- }
338
- function ct(e) {
339
- return C("M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z", e);
340
- }
341
- function lt(e) {
342
- return C("M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z", e);
343
- }
344
- function Me(e) {
345
- return C("m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z", e);
346
- }
347
- function ut(e) {
348
- return C("M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z", e);
349
- }
350
- function dt(e) {
351
- return C("M440-160v-487L216-423l-56-57 320-320 320 320-56 57-224-224v487h-80Z", e);
352
- }
353
- function ft(e) {
354
- return C("M440-800v487L216-537l-56 57 320 320 320-320-56-57-224 224v-487h-80Z", e);
355
- }
356
- function gt(e) {
357
- return C("M240-240v-480h480v480H240Z", e);
358
- }
359
- function ht(e) {
360
- return C("M720-120H280v-520l280-280 50 50q7 7 11.5 19t4.5 23v14l-44 174h258q32 0 56 24t24 56v80q0 7-2 15t-4 15L794-168q-9 20-30 34t-44 14Zm-360-80h360l120-280v-80H480l54-220-174 174v406Zm0-406v406-406Zm-80-34v80H160v360h120v80H80v-520h200Z", e);
361
- }
362
- function pt(e) {
363
- return C("M240-840h440v520L400-40l-50-50q-7-7-11.5-19t-4.5-23v-14l44-174H120q-32 0-56-24t-24-56v-80q0-7 2-15t4-15l120-282q9-20 30-34t44-14Zm360 80H240L120-480v80h360l-54 220 174-174v-406Zm0 406v-406 406Zm80 34v-80h120v-360H680v-80h200v520H680Z", e);
364
- }
365
- function vt(e) {
366
- return C("M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z", e);
367
- }
368
- function bt(e) {
369
- return C("M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z", e);
370
- }
371
- function mt(e) {
372
- return C("M720-330q0 104-73 177T470-80q-104 0-177-73t-73-177v-370q0-75 52.5-127.5T400-880q75 0 127.5 52.5T580-700v350q0 46-32 78t-78 32q-46 0-78-32t-32-78v-370h80v370q0 13 8.5 21.5T470-320q13 0 21.5-8.5T500-350v-350q-1-42-29.5-71T400-800q-42 0-71 29t-29 71v370q-1 71 49 120.5T470-160q70 0 119-49.5T640-330v-390h80v390Z", e);
373
- }
374
- function xt(e) {
375
- return B(["M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8", "M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"], {
376
- ...e,
377
- strokeWidth: 1.5
378
- });
379
- }
380
- function yt(e) {
381
- return B(["M7 7h10v10", "M7 17 17 7"], e);
382
- }
383
- function Et(e) {
384
- const t = B(["M12 8v4", "M12 16h.01"], e), n = document.createElementNS(L, "circle");
385
- return n.setAttribute("cx", "12"), n.setAttribute("cy", "12"), n.setAttribute("r", "10"), t.insertBefore(n, t.firstChild), t;
386
- }
387
- function Mt(e) {
388
- return B(["M12 3v3m6.366-.366-2.12 2.12M21 12h-3m.366 6.366-2.12-2.12M12 21v-3m-6.366.366 2.12-2.12M3 12h3m-.366-6.366 2.12 2.12"], {
389
- size: 20,
390
- ...e,
391
- strokeWidth: 1.5
392
- });
393
- }
394
- function Ct(e) {
395
- const t = I("0 0 24 24", e?.size ?? 24, e?.className);
396
- return t.setAttribute("fill", "none"), t.appendChild(D("M21.5166 5.68457C21.5166 5.43995 21.4185 5.20337 21.2402 5.02734C21.0616 4.85106 20.8173 4.75009 20.5605 4.75H6.90723C6.65037 4.75 6.40524 4.85098 6.22656 5.02734C6.04838 5.20336 5.9502 5.44001 5.9502 5.68457V19.0518L7.58691 17.4365C8.04823 16.9811 8.67203 16.7267 9.32031 16.7266H20.5605C20.8173 16.7265 21.0616 16.6255 21.2402 16.4492C21.4185 16.2732 21.5166 16.0366 21.5166 15.792V5.68457ZM23.0166 15.792C23.0166 16.4408 22.7556 17.0608 22.2939 17.5166C21.8326 17.972 21.2088 18.2265 20.5605 18.2266H9.32031C9.09545 18.2266 8.87996 18.3038 8.70996 18.4414L8.64062 18.5039L6.76172 20.3584C6.57148 20.5461 6.32948 20.6733 6.06836 20.7246C5.80739 20.7758 5.53645 20.7492 5.29004 20.6484C5.0436 20.5476 4.83171 20.3759 4.68164 20.1543C4.53151 19.9325 4.45027 19.671 4.4502 19.4023V5.68457C4.4502 5.03587 4.71129 4.41572 5.17285 3.95996C5.63429 3.50449 6.25881 3.25 6.90723 3.25H20.5605C21.2088 3.25009 21.8326 3.50457 22.2939 3.95996C22.7556 4.41574 23.0166 5.0358 23.0166 5.68457V15.792Z")), t.appendChild(D("M1.25 7.81793C1.25 7.16923 1.5111 6.54909 1.97266 6.09332C2.4341 5.63785 3.05861 5.38336 3.70703 5.38336C4.12108 5.38356 4.45703 5.71927 4.45703 6.13336C4.45703 6.54745 4.12108 6.88316 3.70703 6.88336C3.45018 6.88336 3.20505 6.98434 3.02637 7.16071C2.84819 7.33672 2.75 7.57337 2.75 7.81793V19.1304C3.02293 19.0188 3.34839 19.0755 3.56836 19.2984C3.85897 19.5932 3.85612 20.0681 3.56152 20.3589C3.37129 20.5467 3.12929 20.6729 2.86816 20.7242C2.60717 20.7754 2.33628 20.7497 2.08984 20.649C1.84341 20.5482 1.63154 20.3764 1.48145 20.1548C1.33122 19.933 1.25004 19.6707 1.25 19.4019V7.81793Z")), t;
397
- }
398
- function Ce() {
399
- const e = document.createElement("canvas");
400
- e.className = "ago-chat-input__waveform", e.setAttribute("aria-hidden", "true"), H(e, {
401
- width: "100%",
402
- height: "40px",
403
- display: "block",
404
- color: Y
405
- });
406
- let t, n, a, r, s, o = null, c = [], l = 0;
407
- function b() {
408
- if (!o) return;
409
- o.clearRect(0, 0, l, 40), o.fillStyle = getComputedStyle(e).color;
410
- const d = Math.min(300, Math.floor(l / 4));
411
- for (let h = 0; h < d; h++) {
412
- const p = c[c.length - d + h] ?? 0, m = 2 + p * 30;
413
- o.globalAlpha = p > 0.02 ? 0.85 : 0.3, o.fillRect(h * 4, (40 - m) / 2, 2, m);
414
- }
415
- }
416
- function x() {
417
- l = e.clientWidth;
418
- const d = window.devicePixelRatio || 1;
419
- e.width = Math.round(l * d), e.height = 40 * d, o?.setTransform(d, 0, 0, d, 0, 0), b();
420
- }
421
- function y() {
422
- r !== void 0 && cancelAnimationFrame(r), r = void 0, s?.disconnect(), s = void 0, n?.disconnect(), n = void 0, a?.disconnect(), a = void 0, t && t.state !== "closed" && t.close().catch(() => {
423
- }), t = void 0;
424
- }
425
- function f(d) {
426
- if (y(), c = [], !(typeof AudioContext > "u"))
427
- try {
428
- if (o = e.getContext("2d"), !o || (x(), typeof ResizeObserver < "u" && (s = new ResizeObserver(x), s.observe(e)), window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)) return;
429
- t = new AudioContext(), n = t.createMediaStreamSource(d), a = t.createAnalyser(), a.fftSize = 256, n.connect(a), t.state === "suspended" && t.resume().catch(() => {
430
- });
431
- const h = new Uint8Array(a.fftSize);
432
- let p = 0;
433
- const m = (E) => {
434
- if (a) {
435
- if (E - p >= 50) {
436
- p = E, a.getByteTimeDomainData(h);
437
- let S = 0;
438
- for (const M of h) S += ((M - 128) / 128) ** 2;
439
- c.push(Math.min(1, Math.sqrt(S / h.length) * 4)), c.length > 300 && c.shift(), b();
440
- }
441
- r = requestAnimationFrame(m);
442
- }
443
- };
444
- r = requestAnimationFrame(m);
445
- } catch {
446
- y();
447
- }
448
- }
449
- return {
450
- canvas: e,
451
- start: f,
452
- stop: y,
453
- reset() {
454
- y(), c = [], b();
455
- }
456
- };
457
- }
458
- var K = {
459
- start: "Dictate a message",
460
- finish: "Finish recording",
461
- cancel: "Cancel dictation",
462
- requesting: "Waiting for microphone…",
463
- recording: "Recording…",
464
- transcribing: "Transcribing…",
465
- limitApproaching: "Recording will finish in 10 seconds.",
466
- permissionDenied: "Allow microphone access in your browser to dictate a message.",
467
- recordingFailed: "Could not record audio. Check your microphone and try again.",
468
- tooLarge: "Recording is too large. Try a shorter message.",
469
- noSpeech: "No audio was recorded. Please try again.",
470
- transcriptionFailed: "Transcription failed. Please try again."
471
- };
472
- function At(e) {
473
- let t = {
474
- ...K,
475
- ...e.labels
476
- };
477
- const n = V({
478
- display: "none",
479
- alignItems: "center",
480
- minWidth: "0",
481
- gap: "4px",
482
- flex: "1"
483
- });
484
- n.className = "ago-chat-input__speech";
485
- const a = document.createElement("button");
486
- a.type = "button", a.className = "ago-chat-input__microphone";
487
- const r = document.createElement("button");
488
- r.type = "button", r.append(Me({ size: 18 }));
489
- for (const i of [a, r]) H(i, {
490
- width: "44px",
491
- height: "44px",
492
- border: "none",
493
- borderRadius: "50%",
494
- background: "transparent",
495
- color: he,
496
- cursor: "pointer",
497
- display: "flex",
498
- alignItems: "center",
499
- justifyContent: "center",
500
- flexShrink: "0"
501
- });
502
- const s = document.createElement("span");
503
- s.setAttribute("role", "status"), H(s, {
504
- position: "absolute",
505
- width: "1px",
506
- height: "1px",
507
- overflow: "hidden",
508
- clipPath: "inset(50%)",
509
- fontFamily: $
510
- });
511
- const o = Ce(), c = V({
512
- flex: "1",
513
- minWidth: "0",
514
- padding: "0 8px"
515
- });
516
- c.append(o.canvas);
517
- const l = document.createElement("span");
518
- l.setAttribute("aria-hidden", "true"), H(l, {
519
- fontFamily: $,
520
- fontSize: "12px",
521
- color: Y,
522
- fontVariantNumeric: "tabular-nums"
523
- }), n.append(c, l, s, r, a);
524
- let b = !1, x = !1, y = !1, f = "idle", d = 0, h, p, m, E, S, M = 0, u;
525
- function A() {
526
- return typeof MediaRecorder < "u" && !!navigator.mediaDevices?.getUserMedia;
527
- }
528
- function T() {
529
- u?.cancel(), u = void 0, n.style.display = b && A() ? "flex" : "none", a.disabled = x || f === "requesting" || f === "transcribing", a.style.opacity = a.disabled ? "0.5" : "1";
530
- const i = f === "recording", g = f !== "idle";
531
- n.style.flex = g ? "1" : "0 0 auto";
532
- const R = i ? t.finish : f === "requesting" ? t.requesting : f === "transcribing" ? t.transcribing : t.start;
533
- a.setAttribute("aria-label", R), a.title = R;
534
- const v = i ? xe({ size: 20 }) : g ? ye({ size: 20 }) : me({ size: 20 });
535
- g && !i && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches && (u = v.animate?.([{ transform: "rotate(0deg)" }, { transform: "rotate(360deg)" }], {
536
- duration: 800,
537
- iterations: 1 / 0
538
- })), a.replaceChildren(v), r.setAttribute("aria-label", t.cancel), r.title = t.cancel, r.style.display = f === "idle" ? "none" : "flex", c.style.display = g ? "block" : "none", l.style.display = i ? "inline" : "none", l.textContent = `${Math.floor(M / 60)}:${String(M % 60).padStart(2, "0")}`, s.textContent = i ? t.recording : f === "transcribing" ? t.transcribing : f === "requesting" ? t.requesting : "";
539
- }
540
- function F() {
541
- o.stop(), h?.getTracks().forEach((i) => i.stop()), h = void 0, E && clearTimeout(E), E = void 0, S && clearInterval(S), S = void 0;
542
- }
543
- function w() {
544
- d++, m?.abort(), m = void 0;
545
- const i = p;
546
- p = void 0, i && i.state !== "inactive" && i.stop(), F(), o.reset(), M = 0, f = "idle", e.onBusy(!1), T();
547
- }
548
- function N(i) {
549
- w(), e.onError(i);
550
- }
551
- async function Q() {
552
- if (!b || x || y || f !== "idle" || !A()) return;
553
- const i = ++d;
554
- f = "requesting", e.onBusy(!0), T(), r.focus();
555
- try {
556
- const g = await navigator.mediaDevices.getUserMedia({ audio: !0 });
557
- if (i !== d || y) {
558
- g.getTracks().forEach((k) => k.stop());
559
- return;
560
- }
561
- h = g;
562
- const R = [
563
- "audio/webm;codecs=opus",
564
- "audio/mp4",
565
- "audio/ogg;codecs=opus"
566
- ].find((k) => MediaRecorder.isTypeSupported(k)), v = new MediaRecorder(g, R ? { mimeType: R } : void 0);
567
- p = v;
568
- const _ = [];
569
- let U = 0;
570
- v.ondataavailable = (k) => {
571
- if (!(i !== d || !k.data.size)) {
572
- if (U += k.data.size, U > 25e6) {
573
- N(t.tooLarge);
574
- return;
575
- }
576
- _.push(k.data);
577
- }
578
- }, v.onerror = () => {
579
- i === d && N(t.recordingFailed);
580
- }, v.onstop = () => {
581
- i === d && (F(), p = void 0, J(_, v.mimeType || R || "", i));
582
- }, v.start(1e3), f = "recording", T(), o.start(g), a.focus();
583
- const ee = Date.now();
584
- S = setInterval(() => {
585
- M = Math.floor((Date.now() - ee) / 1e3), l.textContent = `${Math.floor(M / 60)}:${String(M % 60).padStart(2, "0")}`, M === 110 && (s.textContent = t.limitApproaching);
586
- }, 1e3), E = setTimeout(() => {
587
- v.state === "recording" && v.stop();
588
- }, 12e4);
589
- } catch (g) {
590
- if (i !== d) return;
591
- N(typeof g == "object" && g !== null && "name" in g && g.name === "NotAllowedError" ? t.permissionDenied : t.recordingFailed);
592
- }
593
- }
594
- async function J(i, g, R) {
595
- const v = g.includes("mp4") ? "mp4" : g.includes("webm") ? "webm" : g.includes("ogg") ? "ogg" : void 0;
596
- if (!v || i.length === 0) {
597
- N(t.noSpeech);
598
- return;
599
- }
600
- f = "transcribing", T(), r.focus(), m = new AbortController();
601
- try {
602
- const { text: _ } = await e.transcribe(new File(i, `recording.${v}`, { type: g }), { signal: m.signal });
603
- if (R !== d || y) return;
604
- w(), _.trim() ? e.onText(_.trim()) : e.onError(t.noSpeech);
605
- } catch (_) {
606
- if (R !== d || y) return;
607
- N(_ instanceof Error ? _.message : t.transcriptionFailed);
608
- }
609
- }
610
- a.addEventListener("click", () => {
611
- f === "recording" ? p?.state === "recording" && p.stop() : Q();
612
- }), r.addEventListener("click", w), n.addEventListener("keydown", (i) => {
613
- i.key === "Escape" && f !== "idle" && (i.preventDefault(), i.stopPropagation(), w());
614
- });
615
- const Z = () => {
616
- document.hidden && w();
617
- };
618
- return document.addEventListener("visibilitychange", Z), T(), {
619
- el: n,
620
- cancel: w,
621
- setLabels(i) {
622
- t = {
623
- ...K,
624
- ...i
625
- }, T();
626
- },
627
- setEnabled(i) {
628
- b = i, i || w(), T();
629
- },
630
- setDisabled(i) {
631
- x = i, i && w(), T();
632
- },
633
- destroy() {
634
- y = !0, w(), document.removeEventListener("visibilitychange", Z);
635
- }
636
- };
637
- }
638
- export {
639
- Ne as $,
640
- Ge as A,
641
- qe as B,
642
- ot as C,
643
- He as D,
644
- $e as E,
645
- ke as F,
646
- je as G,
647
- Xe as H,
648
- Fe as I,
649
- W as J,
650
- We as K,
651
- Ze as L,
652
- Ye as M,
653
- $ as N,
654
- he as O,
655
- _e as P,
656
- Qe as Q,
657
- De as R,
658
- be as S,
659
- Ie as T,
660
- Be as U,
661
- Y as V,
662
- tt as W,
663
- Je as X,
664
- Ue as Y,
665
- et as Z,
666
- it as _,
667
- ft as a,
668
- V as at,
669
- pt as b,
670
- mt as c,
671
- Se as ct,
672
- Me as d,
673
- Te as dt,
674
- Pe as et,
675
- Ct as f,
676
- st as g,
677
- xt as h,
678
- Et as i,
679
- H as it,
680
- Ke as j,
681
- Re as k,
682
- ct as l,
683
- fe as lt,
684
- bt as m,
685
- At as n,
686
- nt,
687
- yt as o,
688
- rt as ot,
689
- vt as p,
690
- Ve as q,
691
- ut as r,
692
- at as rt,
693
- dt as s,
694
- we as st,
695
- K as t,
696
- ze as tt,
697
- lt as u,
698
- Ae as ut,
699
- Mt as v,
700
- Le as w,
701
- ht as x,
702
- gt as y,
703
- Oe as z
704
- };