@d-id/client-sdk 1.2.1 → 1.2.2-staging.345
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-CneVgQpS.js → index-mLVHYcMn.js} +594 -569
- package/dist/index.js +24 -23
- package/dist/index.umd.cjs +5 -5
- package/dist/{livekit-manager-DXAfWjwR.js → livekit-manager-BXw0Zc-y.js} +1 -1
- package/dist/src/errors/network-error.d.ts +15 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/version.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ye = Object.defineProperty;
|
|
2
2
|
var Qe = (e, t, r) => t in e ? Ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
4
|
-
class
|
|
3
|
+
var W = (e, t, r) => Qe(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
class X extends Error {
|
|
5
5
|
constructor(t, r = "Error", a) {
|
|
6
6
|
super(t), this.kind = r, this.originalError = a, Object.setPrototypeOf(this, new.target.prototype);
|
|
7
7
|
}
|
|
@@ -14,15 +14,15 @@ class G extends Error {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function hr(e) {
|
|
18
18
|
return e instanceof Error && typeof e.kind == "string";
|
|
19
19
|
}
|
|
20
|
-
class Ze extends
|
|
20
|
+
class Ze extends X {
|
|
21
21
|
constructor(t, r) {
|
|
22
22
|
super(`Failed to create ${r ? "persistent" : ""} chat, mode: ${t}`, "ChatCreationFailed");
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
class et extends
|
|
25
|
+
class et extends X {
|
|
26
26
|
constructor(t) {
|
|
27
27
|
super(`Chat mode downgraded to ${t}`, "ChatModeDowngraded");
|
|
28
28
|
}
|
|
@@ -35,13 +35,13 @@ function tt(e) {
|
|
|
35
35
|
} catch {
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
class ze extends
|
|
38
|
+
class ze extends X {
|
|
39
39
|
constructor(r, a, c = {}) {
|
|
40
|
-
const
|
|
41
|
-
super(((
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
const i = tt(a);
|
|
41
|
+
super(((i == null ? void 0 : i.description) ?? a).slice(0, 256), (i == null ? void 0 : i.kind) ?? "HttpError");
|
|
42
|
+
W(this, "status");
|
|
43
|
+
W(this, "url");
|
|
44
|
+
W(this, "method");
|
|
45
45
|
this.status = r, this.url = c.url, this.method = c.method;
|
|
46
46
|
}
|
|
47
47
|
toJson() {
|
|
@@ -53,28 +53,44 @@ class ze extends G {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
class rt extends
|
|
57
|
-
constructor(
|
|
58
|
-
super("Network request failed", "NetworkError",
|
|
56
|
+
class rt extends X {
|
|
57
|
+
constructor(r, a = {}) {
|
|
58
|
+
super("Network request failed", "NetworkError", r);
|
|
59
|
+
W(this, "endpoint");
|
|
60
|
+
W(this, "method");
|
|
61
|
+
W(this, "durationMs");
|
|
62
|
+
W(this, "online");
|
|
63
|
+
W(this, "visibility");
|
|
64
|
+
this.endpoint = a.url, this.method = a.method, this.durationMs = a.durationMs, this.online = a.online, this.visibility = a.visibility;
|
|
65
|
+
}
|
|
66
|
+
toJson() {
|
|
67
|
+
return {
|
|
68
|
+
...super.toJson(),
|
|
69
|
+
...this.endpoint ? { endpoint: this.endpoint } : {},
|
|
70
|
+
...this.method ? { method: this.method } : {},
|
|
71
|
+
...this.durationMs !== void 0 ? { durationMs: this.durationMs } : {},
|
|
72
|
+
...this.online !== void 0 ? { online: this.online } : {},
|
|
73
|
+
...this.visibility ? { visibility: this.visibility } : {}
|
|
74
|
+
};
|
|
59
75
|
}
|
|
60
76
|
}
|
|
61
|
-
class Ne extends
|
|
77
|
+
class Ne extends X {
|
|
62
78
|
constructor(t, r) {
|
|
63
79
|
super(t, "StreamError", r);
|
|
64
80
|
}
|
|
65
81
|
}
|
|
66
|
-
class $ extends
|
|
82
|
+
class $ extends X {
|
|
67
83
|
constructor(t, r) {
|
|
68
84
|
super(t, "ValidationError"), this.key = r;
|
|
69
85
|
}
|
|
70
86
|
}
|
|
71
|
-
class nt extends
|
|
87
|
+
class nt extends X {
|
|
72
88
|
constructor(t) {
|
|
73
89
|
super(t, "WSError");
|
|
74
90
|
}
|
|
75
91
|
}
|
|
76
|
-
var at = /* @__PURE__ */ ((e) => (e.TRIAL = "trial", e.BASIC = "basic", e.ENTERPRISE = "enterprise", e.LITE = "lite", e.ADVANCED = "advanced", e))(at || {}),
|
|
77
|
-
const
|
|
92
|
+
var at = /* @__PURE__ */ ((e) => (e.TRIAL = "trial", e.BASIC = "basic", e.ENTERPRISE = "enterprise", e.LITE = "lite", e.ADVANCED = "advanced", e))(at || {}), it = /* @__PURE__ */ ((e) => (e.TRIAL = "deid-trial", e.PRO = "deid-pro", e.ENTERPRISE = "deid-enterprise", e.LITE = "deid-lite", e.ADVANCED = "deid-advanced", e.BUILD = "deid-api-build", e.LAUNCH = "deid-api-launch", e.SCALE = "deid-api-scale", e))(it || {}), st = /* @__PURE__ */ ((e) => (e.Created = "created", e.Started = "started", e.Done = "done", e.Error = "error", e.Rejected = "rejected", e.Ready = "ready", e))(st || {}), ot = /* @__PURE__ */ ((e) => (e.Unrated = "Unrated", e.Positive = "Positive", e.Negative = "Negative", e))(ot || {}), b = /* @__PURE__ */ ((e) => (e.Functional = "Functional", e.TextOnly = "TextOnly", e.Maintenance = "Maintenance", e.Playground = "Playground", e.DirectPlayback = "DirectPlayback", e.Off = "Off", e))(b || {}), z = /* @__PURE__ */ ((e) => (e.Embed = "embed", e.Query = "query", e.Partial = "partial", e.Answer = "answer", e.Transcribe = "transcribe", e.Complete = "done", e))(z || {}), ct = /* @__PURE__ */ ((e) => (e.KnowledgeProcessing = "knowledge/processing", e.KnowledgeIndexing = "knowledge/indexing", e.KnowledgeFailed = "knowledge/error", e.KnowledgeDone = "knowledge/done", e))(ct || {}), dt = /* @__PURE__ */ ((e) => (e.Knowledge = "knowledge", e.Document = "document", e.Record = "record", e))(dt || {}), lt = /* @__PURE__ */ ((e) => (e.Pdf = "pdf", e.Text = "text", e.Html = "html", e.Word = "word", e.Json = "json", e.Markdown = "markdown", e.Csv = "csv", e.Excel = "excel", e.Powerpoint = "powerpoint", e.Archive = "archive", e.Image = "image", e.Audio = "audio", e.Video = "video", e))(lt || {}), Fe = /* @__PURE__ */ ((e) => (e.Clip = "clip", e.Talk = "talk", e.Expressive = "expressive", e))(Fe || {});
|
|
93
|
+
const pr = (e) => {
|
|
78
94
|
switch (e) {
|
|
79
95
|
case "clip":
|
|
80
96
|
return "clip";
|
|
@@ -86,9 +102,9 @@ const hr = (e) => {
|
|
|
86
102
|
throw new Error(`Unknown video type: ${e}`);
|
|
87
103
|
}
|
|
88
104
|
};
|
|
89
|
-
var S = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(S || {}),
|
|
90
|
-
const
|
|
91
|
-
}, Ve = (e) => new Promise((t) => setTimeout(t, e)),
|
|
105
|
+
var S = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(S || {}), re = /* @__PURE__ */ ((e) => (e.Strong = "STRONG", e.Weak = "WEAK", e.Unknown = "UNKNOWN", e))(re || {}), ae = /* @__PURE__ */ ((e) => (e.Idle = "IDLE", e.Loading = "LOADING", e.Talking = "TALKING", e.ToolActive = "TOOL_ACTIVE", e))(ae || {}), x = /* @__PURE__ */ ((e) => (e.ChatAnswer = "chat/answer", e.ChatPartial = "chat/partial", e.ChatAudioTranscribed = "chat/audio-transcribed", e.StreamDone = "stream/done", e.StreamStarted = "stream/started", e.StreamFailed = "stream/error", e.StreamReady = "stream/ready", e.StreamCreated = "stream/created", e.StreamInterrupt = "stream/interrupt", e.StreamVideoCreated = "stream-video/started", e.StreamVideoDone = "stream-video/done", e.StreamVideoError = "stream-video/error", e.StreamVideoRejected = "stream-video/rejected", e.ToolCallStarted = "tool-call/started", e.ToolCallDone = "tool-call/done", e.ToolCallError = "tool-call/error", e))(x || {}), A = /* @__PURE__ */ ((e) => (e.New = "new", e.Fail = "fail", e.Connected = "connected", e.Connecting = "connecting", e.Closed = "closed", e.Completed = "completed", e.Disconnecting = "disconnecting", e.Disconnected = "disconnected", e))(A || {}), H = /* @__PURE__ */ ((e) => (e.Legacy = "legacy", e.Fluent = "fluent", e))(H || {}), pe = /* @__PURE__ */ ((e) => (e.Livekit = "livekit", e))(pe || {}), ut = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.AzureOpenAi = "azure-openai", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(ut || {}), mt = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(mt || {});
|
|
106
|
+
const wr = (...e) => {
|
|
107
|
+
}, Ve = (e) => new Promise((t) => setTimeout(t, e)), Z = (e = 16) => {
|
|
92
108
|
const t = new Uint8Array(e);
|
|
93
109
|
return window.crypto.getRandomValues(t), Array.from(t, (r) => r.toString(16).padStart(2, "0")).join("").slice(0, 13);
|
|
94
110
|
};
|
|
@@ -97,14 +113,14 @@ function me(e) {
|
|
|
97
113
|
return window.localStorage.setItem("did_external_key_id", e), e;
|
|
98
114
|
let t = window.localStorage.getItem("did_external_key_id");
|
|
99
115
|
if (!t) {
|
|
100
|
-
let r =
|
|
116
|
+
let r = Z();
|
|
101
117
|
window.localStorage.setItem("did_external_key_id", r), t = r;
|
|
102
118
|
}
|
|
103
119
|
return t;
|
|
104
120
|
}
|
|
105
|
-
let Je =
|
|
121
|
+
let Je = Z();
|
|
106
122
|
function ft() {
|
|
107
|
-
Je =
|
|
123
|
+
Je = Z();
|
|
108
124
|
}
|
|
109
125
|
function Ue(e, t) {
|
|
110
126
|
if (e.type === "bearer")
|
|
@@ -124,12 +140,12 @@ const gt = 45 * 1e3, ht = "X-Playground-Chat", ke = 2e3, le = "https://api.d-id.
|
|
|
124
140
|
case "talk":
|
|
125
141
|
return "v2";
|
|
126
142
|
}
|
|
127
|
-
}, yt = (e) => e.type === "talk" ? e.source_url : e.presenter_id, we = (e) => e === Fe.Expressive, Ct = (e) => [
|
|
143
|
+
}, yt = (e) => e.type === "talk" ? e.source_url : e.presenter_id, we = (e) => e === Fe.Expressive, Ct = (e) => [b.TextOnly, b.Playground, b.Maintenance].includes(e), We = (e) => e && [b.DirectPlayback, b.Off].includes(e), Re = /\[!\[([^\[\]]*)\]\(([^)\s]+)\)\]\(([^)\s]+)\)/g, Me = /!\[([^\[\]]*)\]\(([^)\s]+)\)/g, St = [".mp4", ".webm", ".mkv", ".mov", ".m4v", ".ogv"];
|
|
128
144
|
function kt(e) {
|
|
129
145
|
const t = e.split("?")[0].split("#")[0].toLowerCase();
|
|
130
146
|
return St.some((r) => t.endsWith(r));
|
|
131
147
|
}
|
|
132
|
-
const
|
|
148
|
+
const De = new RegExp("(?<!!)\\[([^\\[\\]]+)\\]\\(([^)\\s]+)\\)", "g"), Ie = /<a\s+href="([^"]*)"[^>]*?>([^<]*)<\/a>/gi;
|
|
133
149
|
function Rt(e) {
|
|
134
150
|
if (e.length === 0)
|
|
135
151
|
return [];
|
|
@@ -141,19 +157,19 @@ function Rt(e) {
|
|
|
141
157
|
length: r[0].length,
|
|
142
158
|
part: { type: "video", src: r[3], alt: r[1], thumbnail: r[2] }
|
|
143
159
|
});
|
|
144
|
-
for (
|
|
160
|
+
for (Me.lastIndex = 0; (r = Me.exec(e)) !== null; )
|
|
145
161
|
if (!t.some((o) => r.index >= o.index && r.index < o.index + o.length)) {
|
|
146
162
|
const o = r[2], n = r[1];
|
|
147
|
-
let
|
|
148
|
-
kt(o) ?
|
|
163
|
+
let s;
|
|
164
|
+
kt(o) ? s = { type: "video", src: o, alt: n } : (s = { type: "image", src: o, alt: n }, o.toLowerCase().endsWith(".gif") && (s.mimeType = "image/gif")), t.push({ index: r.index, length: r[0].length, part: s });
|
|
149
165
|
}
|
|
150
|
-
for (
|
|
166
|
+
for (De.lastIndex = 0; (r = De.exec(e)) !== null; )
|
|
151
167
|
t.some((o) => r.index >= o.index && r.index < o.index + o.length) || t.push({
|
|
152
168
|
index: r.index,
|
|
153
169
|
length: r[0].length,
|
|
154
170
|
part: { type: "link", href: r[2], label: r[1] }
|
|
155
171
|
});
|
|
156
|
-
for (
|
|
172
|
+
for (Ie.lastIndex = 0; (r = Ie.exec(e)) !== null; )
|
|
157
173
|
t.some((o) => r.index >= o.index && r.index < o.index + o.length) || t.push({
|
|
158
174
|
index: r.index,
|
|
159
175
|
length: r[0].length,
|
|
@@ -161,22 +177,22 @@ function Rt(e) {
|
|
|
161
177
|
});
|
|
162
178
|
if (t.length === 0)
|
|
163
179
|
return [{ type: "text", text: e }];
|
|
164
|
-
t.sort((
|
|
180
|
+
t.sort((i, o) => i.index - o.index);
|
|
165
181
|
const a = [];
|
|
166
182
|
let c = 0;
|
|
167
|
-
for (const
|
|
168
|
-
|
|
183
|
+
for (const i of t)
|
|
184
|
+
i.index > c && a.push({ type: "text", text: e.slice(c, i.index) }), a.push(i.part), c = i.index + i.length;
|
|
169
185
|
return c < e.length && a.push({ type: "text", text: e.slice(c) }), a;
|
|
170
186
|
}
|
|
171
187
|
let Ee = "", ue = [];
|
|
172
|
-
function
|
|
188
|
+
function ne(e) {
|
|
173
189
|
return e === Ee || (Ee = e, ue = Rt(e)), ue;
|
|
174
190
|
}
|
|
175
|
-
function
|
|
191
|
+
function Mt(e, t) {
|
|
176
192
|
let r;
|
|
177
193
|
return {
|
|
178
|
-
promise: new Promise((c,
|
|
179
|
-
r = setTimeout(() =>
|
|
194
|
+
promise: new Promise((c, i) => {
|
|
195
|
+
r = setTimeout(() => i(new Error(t)), e);
|
|
180
196
|
}),
|
|
181
197
|
clear: () => clearTimeout(r)
|
|
182
198
|
};
|
|
@@ -196,31 +212,31 @@ async function fe(e, t) {
|
|
|
196
212
|
try {
|
|
197
213
|
if (!r.timeout)
|
|
198
214
|
return await e();
|
|
199
|
-
const { promise:
|
|
200
|
-
return await Promise.race([n,
|
|
201
|
-
} catch (
|
|
202
|
-
if (a =
|
|
203
|
-
throw
|
|
204
|
-
await Ve(r.delayMs), r.onRetry(
|
|
215
|
+
const { promise: i, clear: o } = Mt(r.timeout, r.timeoutErrorMessage), n = e().finally(o);
|
|
216
|
+
return await Promise.race([n, i]);
|
|
217
|
+
} catch (i) {
|
|
218
|
+
if (a = i, !r.shouldRetryFn(i) || c >= r.limit)
|
|
219
|
+
throw i;
|
|
220
|
+
await Ve(r.delayMs), r.onRetry(i);
|
|
205
221
|
}
|
|
206
222
|
throw a;
|
|
207
223
|
}
|
|
208
|
-
const
|
|
224
|
+
const Dt = (e) => fe(e, {
|
|
209
225
|
limit: 3,
|
|
210
226
|
delayMs: 1e3,
|
|
211
227
|
timeout: 0,
|
|
212
228
|
shouldRetryFn: (t) => t.status === 429
|
|
213
229
|
});
|
|
214
230
|
function He(e, t = le, r, a) {
|
|
215
|
-
const c = async (
|
|
216
|
-
const { skipErrorHandler: n, ...
|
|
217
|
-
let
|
|
231
|
+
const c = async (i, o) => {
|
|
232
|
+
const { skipErrorHandler: n, ...s } = o || {}, d = s.method ?? "GET", f = performance.now();
|
|
233
|
+
let m;
|
|
218
234
|
try {
|
|
219
|
-
|
|
220
|
-
() => fetch(t + (
|
|
221
|
-
...
|
|
235
|
+
m = await Dt(
|
|
236
|
+
() => fetch(t + (i != null && i.startsWith("/") ? i : `/${i}`), {
|
|
237
|
+
...s,
|
|
222
238
|
headers: {
|
|
223
|
-
...
|
|
239
|
+
...s.headers,
|
|
224
240
|
Authorization: Ue(e, a),
|
|
225
241
|
"Content-Type": "application/json"
|
|
226
242
|
}
|
|
@@ -229,73 +245,79 @@ function He(e, t = le, r, a) {
|
|
|
229
245
|
} catch (u) {
|
|
230
246
|
if ((u == null ? void 0 : u.name) === "AbortError")
|
|
231
247
|
throw u;
|
|
232
|
-
const
|
|
233
|
-
|
|
248
|
+
const y = new rt(u, {
|
|
249
|
+
url: i,
|
|
250
|
+
method: d,
|
|
251
|
+
durationMs: Math.round(performance.now() - f),
|
|
252
|
+
online: typeof navigator < "u" ? navigator.onLine : void 0,
|
|
253
|
+
visibility: typeof document < "u" ? document.visibilityState : void 0
|
|
254
|
+
});
|
|
255
|
+
throw n || r == null || r(y, { url: i, options: s }), y;
|
|
234
256
|
}
|
|
235
|
-
if (!
|
|
236
|
-
const u = await
|
|
237
|
-
throw n || r == null || r(
|
|
257
|
+
if (!m.ok) {
|
|
258
|
+
const u = await m.text().catch(() => `Failed to fetch with status ${m.status}`), p = new ze(m.status, u, { url: i, method: d });
|
|
259
|
+
throw n || r == null || r(p, { url: i, options: s, headers: m.headers }), p;
|
|
238
260
|
}
|
|
239
|
-
return
|
|
261
|
+
return m.json();
|
|
240
262
|
};
|
|
241
263
|
return {
|
|
242
|
-
get(
|
|
243
|
-
return c(
|
|
264
|
+
get(i, o) {
|
|
265
|
+
return c(i, { ...o, method: "GET" });
|
|
244
266
|
},
|
|
245
|
-
post(
|
|
246
|
-
return c(
|
|
267
|
+
post(i, o, n) {
|
|
268
|
+
return c(i, { ...n, body: JSON.stringify(o), method: "POST" });
|
|
247
269
|
},
|
|
248
|
-
delete(
|
|
249
|
-
return c(
|
|
270
|
+
delete(i, o, n) {
|
|
271
|
+
return c(i, { ...n, body: JSON.stringify(o), method: "DELETE" });
|
|
250
272
|
},
|
|
251
|
-
patch(
|
|
252
|
-
return c(
|
|
273
|
+
patch(i, o, n) {
|
|
274
|
+
return c(i, { ...n, body: JSON.stringify(o), method: "PATCH" });
|
|
253
275
|
}
|
|
254
276
|
};
|
|
255
277
|
}
|
|
256
|
-
function
|
|
278
|
+
function It(e, t = le, r, a) {
|
|
257
279
|
const c = He(e, `${t}/agents`, r, a);
|
|
258
280
|
return {
|
|
259
|
-
create(
|
|
260
|
-
return c.post("/",
|
|
281
|
+
create(i, o) {
|
|
282
|
+
return c.post("/", i, o);
|
|
261
283
|
},
|
|
262
|
-
getAgents(
|
|
263
|
-
return c.get(`/${
|
|
284
|
+
getAgents(i, o) {
|
|
285
|
+
return c.get(`/${i ? `?tag=${i}` : ""}`, o).then((n) => n ?? []);
|
|
264
286
|
},
|
|
265
|
-
getById(
|
|
266
|
-
return c.get(`/${
|
|
287
|
+
getById(i, o) {
|
|
288
|
+
return c.get(`/${i}`, o);
|
|
267
289
|
},
|
|
268
|
-
delete(
|
|
269
|
-
return c.delete(`/${
|
|
290
|
+
delete(i, o) {
|
|
291
|
+
return c.delete(`/${i}`, void 0, o);
|
|
270
292
|
},
|
|
271
|
-
update(
|
|
272
|
-
return c.patch(`/${
|
|
293
|
+
update(i, o, n) {
|
|
294
|
+
return c.patch(`/${i}`, o, n);
|
|
273
295
|
},
|
|
274
|
-
newChat(
|
|
275
|
-
return c.post(`/${
|
|
296
|
+
newChat(i, o, n) {
|
|
297
|
+
return c.post(`/${i}/chat`, o, n);
|
|
276
298
|
},
|
|
277
|
-
chat(
|
|
278
|
-
return c.post(`/${
|
|
299
|
+
chat(i, o, n, s) {
|
|
300
|
+
return c.post(`/${i}/chat/${o}`, n, s);
|
|
279
301
|
},
|
|
280
|
-
createRating(
|
|
281
|
-
return c.post(`/${
|
|
302
|
+
createRating(i, o, n, s) {
|
|
303
|
+
return c.post(`/${i}/chat/${o}/ratings`, n, s);
|
|
282
304
|
},
|
|
283
|
-
updateRating(
|
|
284
|
-
return c.patch(`/${
|
|
305
|
+
updateRating(i, o, n, s, d) {
|
|
306
|
+
return c.patch(`/${i}/chat/${o}/ratings/${n}`, s, d);
|
|
285
307
|
},
|
|
286
|
-
deleteRating(
|
|
287
|
-
return c.delete(`/${
|
|
308
|
+
deleteRating(i, o, n, s) {
|
|
309
|
+
return c.delete(`/${i}/chat/${o}/ratings/${n}`, s);
|
|
288
310
|
},
|
|
289
|
-
getSTTToken(
|
|
290
|
-
return c.get(`/${
|
|
311
|
+
getSTTToken(i, o) {
|
|
312
|
+
return c.get(`/${i}/stt-token`, o);
|
|
291
313
|
}
|
|
292
314
|
};
|
|
293
315
|
}
|
|
294
316
|
function Et(e) {
|
|
295
|
-
var c,
|
|
317
|
+
var c, i, o, n;
|
|
296
318
|
const t = () => /Mobi|Android/i.test(navigator.userAgent) ? "Mobile" : "Desktop", r = () => {
|
|
297
|
-
const
|
|
298
|
-
return
|
|
319
|
+
const s = navigator.platform;
|
|
320
|
+
return s.toLowerCase().includes("win") ? "Windows" : s.toLowerCase().includes("mac") ? "Mac OS X" : s.toLowerCase().includes("linux") ? "Linux" : "Unknown";
|
|
299
321
|
}, a = e.presenter;
|
|
300
322
|
return {
|
|
301
323
|
$os: `${r()}`,
|
|
@@ -304,13 +326,13 @@ function Et(e) {
|
|
|
304
326
|
origin: window.location.origin,
|
|
305
327
|
agentType: Ke(a),
|
|
306
328
|
agentVoice: {
|
|
307
|
-
voiceId: (
|
|
329
|
+
voiceId: (i = (c = e.presenter) == null ? void 0 : c.voice) == null ? void 0 : i.voice_id,
|
|
308
330
|
provider: (n = (o = e.presenter) == null ? void 0 : o.voice) == null ? void 0 : n.type
|
|
309
331
|
}
|
|
310
332
|
};
|
|
311
333
|
}
|
|
312
334
|
function _t(e) {
|
|
313
|
-
var r, a, c,
|
|
335
|
+
var r, a, c, i, o, n;
|
|
314
336
|
const t = (r = e.llm) == null ? void 0 : r.prompt_customization;
|
|
315
337
|
return {
|
|
316
338
|
agentType: Ke(e.presenter),
|
|
@@ -323,7 +345,7 @@ function _t(e) {
|
|
|
323
345
|
personality: t == null ? void 0 : t.personality,
|
|
324
346
|
instructions: (c = e.llm) == null ? void 0 : c.instructions
|
|
325
347
|
},
|
|
326
|
-
temperature: (
|
|
348
|
+
temperature: (i = e.llm) == null ? void 0 : i.temperature,
|
|
327
349
|
knowledgeSource: t == null ? void 0 : t.knowledge_source,
|
|
328
350
|
starterQuestionsCount: (n = (o = e.knowledge) == null ? void 0 : o.starter_message) == null ? void 0 : n.length,
|
|
329
351
|
topicsToAvoid: t == null ? void 0 : t.topics_to_avoid,
|
|
@@ -340,26 +362,26 @@ const Tt = (e) => {
|
|
|
340
362
|
} catch {
|
|
341
363
|
return "Unknown error";
|
|
342
364
|
}
|
|
343
|
-
},
|
|
344
|
-
function
|
|
345
|
-
var
|
|
346
|
-
const { event: a, ...c } = e, { template:
|
|
365
|
+
}, bt = (e) => e.reduce((t, r) => t + r, 0), _e = (e) => bt(e) / e.length;
|
|
366
|
+
function At(e, t, r) {
|
|
367
|
+
var s, d, f;
|
|
368
|
+
const { event: a, ...c } = e, { template: i } = (t == null ? void 0 : t.llm) || {}, { language: o } = ((s = t == null ? void 0 : t.presenter) == null ? void 0 : s.voice) || {};
|
|
347
369
|
return {
|
|
348
370
|
...c,
|
|
349
|
-
llm: { ...c.llm, template:
|
|
371
|
+
llm: { ...c.llm, template: i },
|
|
350
372
|
script: { ...c.script, provider: { ...(d = c == null ? void 0 : c.script) == null ? void 0 : d.provider, language: o } },
|
|
351
|
-
stitch: (t == null ? void 0 : t.presenter.type) === "talk" ? (
|
|
373
|
+
stitch: (t == null ? void 0 : t.presenter.type) === "talk" ? (f = t == null ? void 0 : t.presenter) == null ? void 0 : f.stitch : void 0,
|
|
352
374
|
...r
|
|
353
375
|
};
|
|
354
376
|
}
|
|
355
377
|
function Te(e) {
|
|
356
378
|
"requestIdleCallback" in window ? requestIdleCallback(e, { timeout: 2e3 }) : setTimeout(e, 0);
|
|
357
379
|
}
|
|
358
|
-
function
|
|
359
|
-
return e instanceof
|
|
380
|
+
function be(e) {
|
|
381
|
+
return e instanceof X ? e.toJson() : { kind: "UnknownError", message: Tt(e) || "UnknownError" };
|
|
360
382
|
}
|
|
361
|
-
const xt = "https://api-js.mixpanel.com/track/?verbose=1&ip=1";
|
|
362
|
-
function
|
|
383
|
+
const xt = "1.2.2-staging.345", Lt = "https://api-js.mixpanel.com/track/?verbose=1&ip=1";
|
|
384
|
+
function Pt(e) {
|
|
363
385
|
const t = window != null && window.hasOwnProperty("DID_AGENTS_API") ? "agents-ui" : "agents-sdk", r = {};
|
|
364
386
|
return {
|
|
365
387
|
token: e.token || "testKey",
|
|
@@ -370,14 +392,14 @@ function Lt(e) {
|
|
|
370
392
|
...e.mixpanelAdditionalProperties || {}
|
|
371
393
|
},
|
|
372
394
|
isEnabled: e.isEnabled ?? !0,
|
|
373
|
-
getRandom:
|
|
395
|
+
getRandom: Z,
|
|
374
396
|
enrich(a) {
|
|
375
397
|
this.additionalProperties = { ...this.additionalProperties, ...a };
|
|
376
398
|
},
|
|
377
|
-
async track(a, c,
|
|
399
|
+
async track(a, c, i) {
|
|
378
400
|
if (!this.isEnabled)
|
|
379
401
|
return Promise.resolve();
|
|
380
|
-
const { audioPath: o, ...n } = c || {},
|
|
402
|
+
const { audioPath: o, ...n } = c || {}, s = i || Date.now(), d = {
|
|
381
403
|
method: "POST",
|
|
382
404
|
headers: {
|
|
383
405
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -391,8 +413,10 @@ function Lt(e) {
|
|
|
391
413
|
...n,
|
|
392
414
|
agentId: this.agentId,
|
|
393
415
|
source: t,
|
|
416
|
+
emittedBy: "agents-sdk",
|
|
417
|
+
sdkVersion: xt,
|
|
394
418
|
token: this.token,
|
|
395
|
-
time:
|
|
419
|
+
time: s,
|
|
396
420
|
$insert_id: this.getRandom(),
|
|
397
421
|
origin: window.location.href,
|
|
398
422
|
"Screen Height": window.screen.height || window.innerWidth,
|
|
@@ -403,19 +427,19 @@ function Lt(e) {
|
|
|
403
427
|
])
|
|
404
428
|
})
|
|
405
429
|
};
|
|
406
|
-
return fetch(
|
|
430
|
+
return fetch(Lt, d).catch((f) => console.error("Analytics tracking error:", f)), Promise.resolve();
|
|
407
431
|
},
|
|
408
|
-
linkTrack(a, c,
|
|
409
|
-
r[a] || (r[a] = { events: {}, resolvedDependencies: [] }), o.includes(
|
|
432
|
+
linkTrack(a, c, i, o) {
|
|
433
|
+
r[a] || (r[a] = { events: {}, resolvedDependencies: [] }), o.includes(i) || o.push(i);
|
|
410
434
|
const n = r[a];
|
|
411
|
-
if (n.events[
|
|
435
|
+
if (n.events[i] = { props: c }, n.resolvedDependencies.push(i), o.every(
|
|
412
436
|
(d) => n.resolvedDependencies.includes(d)
|
|
413
437
|
)) {
|
|
414
|
-
const d = o.reduce((
|
|
438
|
+
const d = o.reduce((f, m) => n.events[m] ? { ...f, ...n.events[m].props } : f, {});
|
|
415
439
|
this.track(a, d), n.resolvedDependencies = n.resolvedDependencies.filter(
|
|
416
|
-
(
|
|
417
|
-
), o.forEach((
|
|
418
|
-
delete n.events[
|
|
440
|
+
(f) => !o.includes(f)
|
|
441
|
+
), o.forEach((f) => {
|
|
442
|
+
delete n.events[f];
|
|
419
443
|
});
|
|
420
444
|
}
|
|
421
445
|
}
|
|
@@ -429,36 +453,36 @@ function ve() {
|
|
|
429
453
|
get: (t = !1) => t ? Date.now() - e : e
|
|
430
454
|
};
|
|
431
455
|
}
|
|
432
|
-
const
|
|
456
|
+
const G = ve(), ge = ve(), Ae = ve();
|
|
433
457
|
function Oe(e) {
|
|
434
|
-
return e ===
|
|
458
|
+
return e === b.Playground ? { headers: { [ht]: "true" } } : {};
|
|
435
459
|
}
|
|
436
|
-
async function qe(e, t, r, a, c = !1,
|
|
437
|
-
return !
|
|
460
|
+
async function qe(e, t, r, a, c = !1, i) {
|
|
461
|
+
return !i && !We(a) && (i = await t.newChat(e.id, { persist: c }, Oe(a)), r.track("agent-chat", {
|
|
438
462
|
event: "created",
|
|
439
|
-
chatId:
|
|
463
|
+
chatId: i.id,
|
|
440
464
|
mode: a
|
|
441
|
-
})), { chat:
|
|
465
|
+
})), { chat: i, chatMode: (i == null ? void 0 : i.chat_mode) ?? a };
|
|
442
466
|
}
|
|
443
|
-
function
|
|
467
|
+
function jt(e) {
|
|
444
468
|
return e && e.length > 0 ? e : [];
|
|
445
469
|
}
|
|
446
|
-
function
|
|
470
|
+
function Bt(e) {
|
|
447
471
|
return new Promise((t, r) => {
|
|
448
|
-
const { callbacks: a, host: c, auth:
|
|
449
|
-
|
|
450
|
-
console.error(
|
|
451
|
-
},
|
|
452
|
-
|
|
472
|
+
const { callbacks: a, host: c, auth: i, externalId: o } = e, { onMessage: n = null, onOpen: s = null, onClose: d = null, onError: f = null } = a || {}, m = new WebSocket(`${c}?authorization=${encodeURIComponent(Ue(i, o))}`);
|
|
473
|
+
m.onmessage = n, m.onclose = d, m.onerror = (u) => {
|
|
474
|
+
console.error(u), f == null || f("Websocket failed to connect", u), r(u);
|
|
475
|
+
}, m.onopen = (u) => {
|
|
476
|
+
s == null || s(u), t(m);
|
|
453
477
|
};
|
|
454
478
|
});
|
|
455
479
|
}
|
|
456
|
-
async function
|
|
480
|
+
async function $t(e) {
|
|
457
481
|
const { retries: t = 1 } = e;
|
|
458
482
|
let r = null;
|
|
459
483
|
for (let a = 0; (r == null ? void 0 : r.readyState) !== WebSocket.OPEN; a++)
|
|
460
484
|
try {
|
|
461
|
-
r = await
|
|
485
|
+
r = await Bt(e);
|
|
462
486
|
} catch (c) {
|
|
463
487
|
if (a === t)
|
|
464
488
|
throw c;
|
|
@@ -466,8 +490,8 @@ async function Bt(e) {
|
|
|
466
490
|
}
|
|
467
491
|
return r;
|
|
468
492
|
}
|
|
469
|
-
async function
|
|
470
|
-
const c = r != null && r.onMessage ? [r.onMessage] : [],
|
|
493
|
+
async function zt(e, t, r, a) {
|
|
494
|
+
const c = r != null && r.onMessage ? [r.onMessage] : [], i = await $t({
|
|
471
495
|
auth: e,
|
|
472
496
|
host: t,
|
|
473
497
|
externalId: a,
|
|
@@ -478,13 +502,13 @@ async function $t(e, t, r, a) {
|
|
|
478
502
|
},
|
|
479
503
|
onMessage(o) {
|
|
480
504
|
const n = JSON.parse(o.data);
|
|
481
|
-
c.forEach((
|
|
505
|
+
c.forEach((s) => s(n.event, n));
|
|
482
506
|
}
|
|
483
507
|
}
|
|
484
508
|
});
|
|
485
509
|
return {
|
|
486
|
-
socket:
|
|
487
|
-
disconnect: () =>
|
|
510
|
+
socket: i,
|
|
511
|
+
disconnect: () => i.close(),
|
|
488
512
|
subscribeToEvents: (o) => c.push(o)
|
|
489
513
|
};
|
|
490
514
|
}
|
|
@@ -496,22 +520,22 @@ function xe(e) {
|
|
|
496
520
|
r += e[t++];
|
|
497
521
|
return r;
|
|
498
522
|
}
|
|
499
|
-
function
|
|
523
|
+
function Nt(e, t, r) {
|
|
500
524
|
if (!e.content)
|
|
501
525
|
return;
|
|
502
526
|
const a = {
|
|
503
527
|
id: e.id || `user-${Date.now()}`,
|
|
504
528
|
role: e.role,
|
|
505
529
|
content: e.content,
|
|
506
|
-
parts:
|
|
530
|
+
parts: ne(e.content),
|
|
507
531
|
created_at: e.created_at || (/* @__PURE__ */ new Date()).toISOString(),
|
|
508
532
|
transcribed: !0
|
|
509
533
|
};
|
|
510
534
|
t.messages.push(a), r == null || r([...t.messages], "user");
|
|
511
535
|
}
|
|
512
|
-
function
|
|
536
|
+
function Ft(e, t, r, a, c, i, o) {
|
|
513
537
|
if (e === z.Transcribe && t.content) {
|
|
514
|
-
|
|
538
|
+
Nt(t, a, c);
|
|
515
539
|
return;
|
|
516
540
|
}
|
|
517
541
|
if (!(e === z.Partial || e === z.Answer))
|
|
@@ -520,115 +544,115 @@ function Nt(e, t, r, a, c, s, o) {
|
|
|
520
544
|
if (e === z.Answer && (n == null ? void 0 : n.role) === "user" && o === "partial")
|
|
521
545
|
return;
|
|
522
546
|
const d = o === "answer";
|
|
523
|
-
let
|
|
547
|
+
let f;
|
|
524
548
|
if ((n == null ? void 0 : n.role) === "assistant" && !d)
|
|
525
|
-
|
|
549
|
+
f = n;
|
|
526
550
|
else if (!n || n.role === "user" || d)
|
|
527
|
-
d &&
|
|
551
|
+
d && i(), f = {
|
|
528
552
|
id: t.id || `assistant-${Date.now()}`,
|
|
529
553
|
role: t.role || "assistant",
|
|
530
554
|
content: t.content || "",
|
|
531
555
|
parts: [],
|
|
532
556
|
created_at: t.created_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
533
|
-
}, a.messages.push(
|
|
557
|
+
}, a.messages.push(f);
|
|
534
558
|
else
|
|
535
559
|
return;
|
|
536
|
-
const { content:
|
|
560
|
+
const { content: m, sequence: u } = t;
|
|
537
561
|
if (e === z.Partial)
|
|
538
|
-
r[
|
|
562
|
+
r[u] = m;
|
|
539
563
|
else {
|
|
540
564
|
const y = xe(r);
|
|
541
|
-
!!(
|
|
565
|
+
!!(m && m.length < y.length) && (f.interrupted = !0), r.answer = m;
|
|
542
566
|
}
|
|
543
|
-
const
|
|
544
|
-
(
|
|
567
|
+
const p = xe(r);
|
|
568
|
+
(f.content !== p || e === z.Answer) && (f.content = p, f.parts = ne(p), c == null || c([...a.messages], e));
|
|
545
569
|
}
|
|
546
|
-
function
|
|
547
|
-
const
|
|
548
|
-
for (const d of Object.keys(
|
|
549
|
-
delete
|
|
570
|
+
function Vt(e, t, r, a, c) {
|
|
571
|
+
const i = {}, o = () => {
|
|
572
|
+
for (const d of Object.keys(i))
|
|
573
|
+
delete i[d];
|
|
550
574
|
};
|
|
551
575
|
let n = null;
|
|
552
|
-
const
|
|
553
|
-
var
|
|
554
|
-
|
|
576
|
+
const s = (d, f) => {
|
|
577
|
+
var m, u;
|
|
578
|
+
f === "user" && o(), (u = (m = r.callbacks).onNewMessage) == null || u.call(m, d, f);
|
|
555
579
|
};
|
|
556
580
|
return {
|
|
557
581
|
clearQueue: o,
|
|
558
|
-
onMessage: (d,
|
|
559
|
-
var
|
|
560
|
-
if ("content" in
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
s,
|
|
566
|
-
t,
|
|
582
|
+
onMessage: (d, f) => {
|
|
583
|
+
var m, u;
|
|
584
|
+
if ("content" in f) {
|
|
585
|
+
const p = d === x.ChatAnswer ? z.Answer : d === x.ChatAudioTranscribed ? z.Transcribe : d;
|
|
586
|
+
Ft(
|
|
587
|
+
p,
|
|
588
|
+
f,
|
|
567
589
|
i,
|
|
590
|
+
t,
|
|
591
|
+
s,
|
|
568
592
|
o,
|
|
569
593
|
n
|
|
570
|
-
),
|
|
571
|
-
content:
|
|
594
|
+
), p === z.Partial ? n = "partial" : p === z.Answer && (n = "answer", o()), p === z.Answer && e.track("agent-message-received", {
|
|
595
|
+
content: f.content,
|
|
572
596
|
messages: t.messages.length,
|
|
573
597
|
mode: t.chatMode
|
|
574
598
|
});
|
|
575
599
|
} else {
|
|
576
|
-
const
|
|
577
|
-
if (d = d, d ===
|
|
600
|
+
const p = x, y = [p.StreamVideoDone, p.StreamVideoError, p.StreamVideoRejected], j = [p.StreamFailed, p.StreamVideoError, p.StreamVideoRejected], I = At(f, a, { mode: t.chatMode });
|
|
601
|
+
if (d = d, d === p.StreamVideoCreated && (e.linkTrack("agent-video", I, p.StreamVideoCreated, ["start"]), f.sentiment)) {
|
|
578
602
|
const _ = t.messages[t.messages.length - 1];
|
|
579
603
|
if ((_ == null ? void 0 : _.role) === "assistant") {
|
|
580
|
-
const L = { ..._, sentiment:
|
|
581
|
-
t.messages[t.messages.length - 1] = L,
|
|
604
|
+
const L = { ..._, sentiment: f.sentiment };
|
|
605
|
+
t.messages[t.messages.length - 1] = L, s == null || s([...t.messages], n ?? "answer");
|
|
582
606
|
}
|
|
583
607
|
}
|
|
584
608
|
if (y.includes(d)) {
|
|
585
609
|
const _ = d.split("/")[1];
|
|
586
|
-
j.includes(d) ? e.track("agent-video", { ...
|
|
610
|
+
j.includes(d) ? e.track("agent-video", { ...I, event: _ }) : e.linkTrack("agent-video", { ...I, event: _ }, d, ["done"]);
|
|
587
611
|
}
|
|
588
|
-
j.includes(d) && ((
|
|
612
|
+
j.includes(d) && ((u = (m = r.callbacks).onError) == null || u.call(m, new Ne(`Stream failed with event ${d}`), { data: f })), f.event === p.StreamDone && c();
|
|
589
613
|
}
|
|
590
614
|
}
|
|
591
615
|
};
|
|
592
616
|
}
|
|
593
|
-
function
|
|
617
|
+
function Jt(e, t, r, a) {
|
|
594
618
|
const c = He(e, `${t}/agents/${r}`, a);
|
|
595
619
|
return {
|
|
596
|
-
createStream(
|
|
597
|
-
return c.post("/streams",
|
|
620
|
+
createStream(i, o) {
|
|
621
|
+
return c.post("/streams", i, { signal: o });
|
|
598
622
|
},
|
|
599
|
-
startConnection(
|
|
623
|
+
startConnection(i, o, n, s) {
|
|
600
624
|
return c.post(
|
|
601
|
-
`/streams/${
|
|
625
|
+
`/streams/${i}/sdp`,
|
|
602
626
|
{
|
|
603
627
|
session_id: n,
|
|
604
628
|
answer: o
|
|
605
629
|
},
|
|
606
|
-
{ signal:
|
|
630
|
+
{ signal: s }
|
|
607
631
|
);
|
|
608
632
|
},
|
|
609
|
-
addIceCandidate(
|
|
633
|
+
addIceCandidate(i, o, n, s) {
|
|
610
634
|
return c.post(
|
|
611
|
-
`/streams/${
|
|
635
|
+
`/streams/${i}/ice`,
|
|
612
636
|
{
|
|
613
637
|
session_id: n,
|
|
614
638
|
...o
|
|
615
639
|
},
|
|
616
|
-
{ signal:
|
|
640
|
+
{ signal: s }
|
|
617
641
|
);
|
|
618
642
|
},
|
|
619
|
-
sendStreamRequest(
|
|
620
|
-
return c.post(`/streams/${
|
|
643
|
+
sendStreamRequest(i, o, n) {
|
|
644
|
+
return c.post(`/streams/${i}`, {
|
|
621
645
|
session_id: o,
|
|
622
646
|
...n
|
|
623
647
|
});
|
|
624
648
|
},
|
|
625
|
-
close(
|
|
626
|
-
return c.delete(`/streams/${
|
|
649
|
+
close(i, o) {
|
|
650
|
+
return c.delete(`/streams/${i}`, { session_id: o });
|
|
627
651
|
}
|
|
628
652
|
};
|
|
629
653
|
}
|
|
630
|
-
const
|
|
631
|
-
function
|
|
654
|
+
const Ut = (e, t) => (r, a) => e && console.log(`[${t}] ${r}`, a ?? "");
|
|
655
|
+
function Kt(e, t, r) {
|
|
632
656
|
const a = (t.timestamp - e.timestamp) / 1e3;
|
|
633
657
|
return {
|
|
634
658
|
duration: a,
|
|
@@ -648,7 +672,7 @@ function Ut(e, t, r) {
|
|
|
648
672
|
lowFpsCount: r
|
|
649
673
|
};
|
|
650
674
|
}
|
|
651
|
-
function
|
|
675
|
+
function Wt(e) {
|
|
652
676
|
return e.filter(
|
|
653
677
|
(t) => t.freezeCount > 0 || t.framesPerSecond < 21 || t.framesDropped > 0 || t.packetsLost > 0
|
|
654
678
|
).map((t) => {
|
|
@@ -659,7 +683,7 @@ function Kt(e) {
|
|
|
659
683
|
};
|
|
660
684
|
});
|
|
661
685
|
}
|
|
662
|
-
function
|
|
686
|
+
function Ht(e) {
|
|
663
687
|
var o;
|
|
664
688
|
let t = "", r = 0, a = null;
|
|
665
689
|
const c = /* @__PURE__ */ new Map();
|
|
@@ -668,56 +692,17 @@ function Wt(e) {
|
|
|
668
692
|
if (n.type === "codec" && ((o = n.mimeType) != null && o.startsWith("video")))
|
|
669
693
|
c.set(n.id, n.mimeType.split("/")[1]);
|
|
670
694
|
else if (n.type === "candidate-pair") {
|
|
671
|
-
const
|
|
672
|
-
d > 0 && (
|
|
695
|
+
const s = n, d = s.currentRoundTripTime ?? 0;
|
|
696
|
+
d > 0 && (s.nominated === !0 || r === 0) && (r = d);
|
|
673
697
|
} else n.type === "inbound-rtp" && n.kind === "video" && (a = n);
|
|
674
698
|
if (!a)
|
|
675
699
|
return {};
|
|
676
|
-
const
|
|
677
|
-
return
|
|
700
|
+
const i = a;
|
|
701
|
+
return i.codecId && c.has(i.codecId) ? t = c.get(i.codecId) : c.size > 0 && (t = c.values().next().value ?? ""), {
|
|
678
702
|
codec: t,
|
|
679
703
|
rtt: r,
|
|
680
|
-
timestamp: s.timestamp,
|
|
681
|
-
bytesReceived: s.bytesReceived,
|
|
682
|
-
packetsReceived: s.packetsReceived,
|
|
683
|
-
packetsLost: s.packetsLost,
|
|
684
|
-
framesDropped: s.framesDropped,
|
|
685
|
-
framesDecoded: s.framesDecoded,
|
|
686
|
-
jitter: s.jitter,
|
|
687
|
-
jitterBufferDelay: s.jitterBufferDelay,
|
|
688
|
-
jitterBufferEmittedCount: s.jitterBufferEmittedCount,
|
|
689
|
-
avgJitterDelayInInterval: s.jitterBufferDelay / s.jitterBufferEmittedCount,
|
|
690
|
-
frameWidth: s.frameWidth,
|
|
691
|
-
frameHeight: s.frameHeight,
|
|
692
|
-
framesPerSecond: s.framesPerSecond,
|
|
693
|
-
freezeCount: s.freezeCount,
|
|
694
|
-
freezeDuration: s.totalFreezesDuration
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
function Le(e, t, r) {
|
|
698
|
-
const a = e.map((i, d) => d === 0 ? r ? {
|
|
699
704
|
timestamp: i.timestamp,
|
|
700
|
-
duration: 0,
|
|
701
|
-
rtt: i.rtt,
|
|
702
|
-
bytesReceived: i.bytesReceived - r.bytesReceived,
|
|
703
|
-
bitrate: (i.bytesReceived - r.bytesReceived) * 8 / (t / 1e3),
|
|
704
|
-
packetsReceived: i.packetsReceived - r.packetsReceived,
|
|
705
|
-
packetsLost: i.packetsLost - r.packetsLost,
|
|
706
|
-
framesDropped: i.framesDropped - r.framesDropped,
|
|
707
|
-
framesDecoded: i.framesDecoded - r.framesDecoded,
|
|
708
|
-
jitter: i.jitter,
|
|
709
|
-
jitterBufferDelay: i.jitterBufferDelay - r.jitterBufferDelay,
|
|
710
|
-
jitterBufferEmittedCount: i.jitterBufferEmittedCount - r.jitterBufferEmittedCount,
|
|
711
|
-
avgJitterDelayInInterval: (i.jitterBufferDelay - r.jitterBufferDelay) / (i.jitterBufferEmittedCount - r.jitterBufferEmittedCount),
|
|
712
|
-
framesPerSecond: i.framesPerSecond,
|
|
713
|
-
freezeCount: i.freezeCount - r.freezeCount,
|
|
714
|
-
freezeDuration: i.freezeDuration - r.freezeDuration
|
|
715
|
-
} : {
|
|
716
|
-
timestamp: i.timestamp,
|
|
717
|
-
rtt: i.rtt,
|
|
718
|
-
duration: 0,
|
|
719
705
|
bytesReceived: i.bytesReceived,
|
|
720
|
-
bitrate: i.bytesReceived * 8 / (t / 1e3),
|
|
721
706
|
packetsReceived: i.packetsReceived,
|
|
722
707
|
packetsLost: i.packetsLost,
|
|
723
708
|
framesDropped: i.framesDropped,
|
|
@@ -726,34 +711,73 @@ function Le(e, t, r) {
|
|
|
726
711
|
jitterBufferDelay: i.jitterBufferDelay,
|
|
727
712
|
jitterBufferEmittedCount: i.jitterBufferEmittedCount,
|
|
728
713
|
avgJitterDelayInInterval: i.jitterBufferDelay / i.jitterBufferEmittedCount,
|
|
714
|
+
frameWidth: i.frameWidth,
|
|
715
|
+
frameHeight: i.frameHeight,
|
|
729
716
|
framesPerSecond: i.framesPerSecond,
|
|
730
717
|
freezeCount: i.freezeCount,
|
|
731
|
-
freezeDuration: i.
|
|
718
|
+
freezeDuration: i.totalFreezesDuration
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
function Le(e, t, r) {
|
|
722
|
+
const a = e.map((s, d) => d === 0 ? r ? {
|
|
723
|
+
timestamp: s.timestamp,
|
|
724
|
+
duration: 0,
|
|
725
|
+
rtt: s.rtt,
|
|
726
|
+
bytesReceived: s.bytesReceived - r.bytesReceived,
|
|
727
|
+
bitrate: (s.bytesReceived - r.bytesReceived) * 8 / (t / 1e3),
|
|
728
|
+
packetsReceived: s.packetsReceived - r.packetsReceived,
|
|
729
|
+
packetsLost: s.packetsLost - r.packetsLost,
|
|
730
|
+
framesDropped: s.framesDropped - r.framesDropped,
|
|
731
|
+
framesDecoded: s.framesDecoded - r.framesDecoded,
|
|
732
|
+
jitter: s.jitter,
|
|
733
|
+
jitterBufferDelay: s.jitterBufferDelay - r.jitterBufferDelay,
|
|
734
|
+
jitterBufferEmittedCount: s.jitterBufferEmittedCount - r.jitterBufferEmittedCount,
|
|
735
|
+
avgJitterDelayInInterval: (s.jitterBufferDelay - r.jitterBufferDelay) / (s.jitterBufferEmittedCount - r.jitterBufferEmittedCount),
|
|
736
|
+
framesPerSecond: s.framesPerSecond,
|
|
737
|
+
freezeCount: s.freezeCount - r.freezeCount,
|
|
738
|
+
freezeDuration: s.freezeDuration - r.freezeDuration
|
|
732
739
|
} : {
|
|
733
|
-
timestamp:
|
|
740
|
+
timestamp: s.timestamp,
|
|
741
|
+
rtt: s.rtt,
|
|
742
|
+
duration: 0,
|
|
743
|
+
bytesReceived: s.bytesReceived,
|
|
744
|
+
bitrate: s.bytesReceived * 8 / (t / 1e3),
|
|
745
|
+
packetsReceived: s.packetsReceived,
|
|
746
|
+
packetsLost: s.packetsLost,
|
|
747
|
+
framesDropped: s.framesDropped,
|
|
748
|
+
framesDecoded: s.framesDecoded,
|
|
749
|
+
jitter: s.jitter,
|
|
750
|
+
jitterBufferDelay: s.jitterBufferDelay,
|
|
751
|
+
jitterBufferEmittedCount: s.jitterBufferEmittedCount,
|
|
752
|
+
avgJitterDelayInInterval: s.jitterBufferDelay / s.jitterBufferEmittedCount,
|
|
753
|
+
framesPerSecond: s.framesPerSecond,
|
|
754
|
+
freezeCount: s.freezeCount,
|
|
755
|
+
freezeDuration: s.freezeDuration
|
|
756
|
+
} : {
|
|
757
|
+
timestamp: s.timestamp,
|
|
734
758
|
duration: t * d / 1e3,
|
|
735
|
-
rtt:
|
|
736
|
-
bytesReceived:
|
|
737
|
-
bitrate: (
|
|
738
|
-
packetsReceived:
|
|
739
|
-
packetsLost:
|
|
740
|
-
framesDropped:
|
|
741
|
-
framesDecoded:
|
|
742
|
-
jitter:
|
|
743
|
-
jitterBufferDelay:
|
|
744
|
-
jitterBufferEmittedCount:
|
|
745
|
-
avgJitterDelayInInterval: (
|
|
746
|
-
framesPerSecond:
|
|
747
|
-
freezeCount:
|
|
748
|
-
freezeDuration:
|
|
749
|
-
}), c =
|
|
759
|
+
rtt: s.rtt,
|
|
760
|
+
bytesReceived: s.bytesReceived - e[d - 1].bytesReceived,
|
|
761
|
+
bitrate: (s.bytesReceived - e[d - 1].bytesReceived) * 8 / (t / 1e3),
|
|
762
|
+
packetsReceived: s.packetsReceived - e[d - 1].packetsReceived,
|
|
763
|
+
packetsLost: s.packetsLost - e[d - 1].packetsLost,
|
|
764
|
+
framesDropped: s.framesDropped - e[d - 1].framesDropped,
|
|
765
|
+
framesDecoded: s.framesDecoded - e[d - 1].framesDecoded,
|
|
766
|
+
jitter: s.jitter,
|
|
767
|
+
jitterBufferDelay: s.jitterBufferDelay - e[d - 1].jitterBufferDelay,
|
|
768
|
+
jitterBufferEmittedCount: s.jitterBufferEmittedCount - e[d - 1].jitterBufferEmittedCount,
|
|
769
|
+
avgJitterDelayInInterval: (s.jitterBufferDelay - e[d - 1].jitterBufferDelay) / (s.jitterBufferEmittedCount - e[d - 1].jitterBufferEmittedCount),
|
|
770
|
+
framesPerSecond: s.framesPerSecond,
|
|
771
|
+
freezeCount: s.freezeCount - e[d - 1].freezeCount,
|
|
772
|
+
freezeDuration: s.freezeDuration - e[d - 1].freezeDuration
|
|
773
|
+
}), c = Wt(a), i = c.reduce((s, d) => s + (d.causes.includes("low fps") ? 1 : 0), 0), o = a.filter((s) => !!s.avgJitterDelayInInterval).map((s) => s.avgJitterDelayInInterval), n = a.filter((s) => !!s.rtt).map((s) => s.rtt);
|
|
750
774
|
return {
|
|
751
775
|
webRTCStats: {
|
|
752
776
|
anomalies: c,
|
|
753
777
|
minRtt: Math.min(...n),
|
|
754
778
|
avgRtt: _e(n),
|
|
755
779
|
maxRtt: Math.max(...n),
|
|
756
|
-
aggregateReport:
|
|
780
|
+
aggregateReport: Kt(e[0], e[e.length - 1], i),
|
|
757
781
|
minJitterDelayInInterval: Math.min(...o),
|
|
758
782
|
maxJitterDelayInInterval: Math.max(...o),
|
|
759
783
|
avgJitterDelayInInterval: _e(o)
|
|
@@ -768,110 +792,110 @@ function Ge(e, t) {
|
|
|
768
792
|
return r;
|
|
769
793
|
return null;
|
|
770
794
|
}
|
|
771
|
-
const
|
|
772
|
-
function
|
|
773
|
-
let r = !1, a = !1, c = null,
|
|
774
|
-
async function
|
|
795
|
+
const te = 10;
|
|
796
|
+
function vr(e, t) {
|
|
797
|
+
let r = !1, a = !1, c = null, i = 0, o = 0, n = {};
|
|
798
|
+
async function s() {
|
|
775
799
|
if (r) {
|
|
776
800
|
try {
|
|
777
801
|
const d = await e();
|
|
778
802
|
if (!d) {
|
|
779
|
-
c = setTimeout(
|
|
803
|
+
c = setTimeout(s, te);
|
|
780
804
|
return;
|
|
781
805
|
}
|
|
782
|
-
const
|
|
783
|
-
if (!
|
|
784
|
-
c = setTimeout(
|
|
806
|
+
const f = Ge(d, "audio");
|
|
807
|
+
if (!f) {
|
|
808
|
+
c = setTimeout(s, te);
|
|
785
809
|
return;
|
|
786
810
|
}
|
|
787
|
-
const
|
|
811
|
+
const m = f.totalAudioEnergy ?? 0, u = f.totalSamplesReceived ?? 0;
|
|
788
812
|
if (!a) {
|
|
789
|
-
|
|
813
|
+
i = m, o = u, a = !0, c = setTimeout(s, te);
|
|
790
814
|
return;
|
|
791
815
|
}
|
|
792
|
-
const
|
|
793
|
-
if (
|
|
816
|
+
const p = m - i, y = u - o;
|
|
817
|
+
if (i = m, o = u, y > 0 && p > 0) {
|
|
794
818
|
r = !1, t(n);
|
|
795
819
|
return;
|
|
796
820
|
}
|
|
797
821
|
} catch {
|
|
798
822
|
}
|
|
799
|
-
r && (c = setTimeout(
|
|
823
|
+
r && (c = setTimeout(s, te));
|
|
800
824
|
}
|
|
801
825
|
}
|
|
802
826
|
return {
|
|
803
827
|
arm(d = {}) {
|
|
804
|
-
n = d, r = !0, a = !1, performance.now(), c !== null && clearTimeout(c), c = setTimeout(
|
|
828
|
+
n = d, r = !0, a = !1, performance.now(), c !== null && clearTimeout(c), c = setTimeout(s, te);
|
|
805
829
|
},
|
|
806
830
|
destroy() {
|
|
807
831
|
r = !1, c !== null && (clearTimeout(c), c = null);
|
|
808
832
|
}
|
|
809
833
|
};
|
|
810
834
|
}
|
|
811
|
-
const de = 100,
|
|
812
|
-
function
|
|
835
|
+
const de = 100, Ot = Math.max(Math.ceil(400 / de), 1), qt = 0.25, Gt = 0.28;
|
|
836
|
+
function Xt() {
|
|
813
837
|
let e = 0, t, r, a = 0;
|
|
814
838
|
return (c) => {
|
|
815
|
-
const
|
|
816
|
-
if (!
|
|
839
|
+
const i = Ge(c, "video");
|
|
840
|
+
if (!i)
|
|
817
841
|
return { isReceiving: !1, avgJitterDelayInInterval: a };
|
|
818
|
-
const o =
|
|
842
|
+
const o = i.jitterBufferDelay, n = i.jitterBufferEmittedCount;
|
|
819
843
|
if (r && n > r) {
|
|
820
|
-
const
|
|
821
|
-
a =
|
|
844
|
+
const f = o - t, m = n - r;
|
|
845
|
+
a = f / m;
|
|
822
846
|
}
|
|
823
847
|
t = o, r = n;
|
|
824
|
-
const
|
|
825
|
-
return e =
|
|
848
|
+
const s = i.framesDecoded, d = s - e > 0;
|
|
849
|
+
return e = s, { isReceiving: d, avgJitterDelayInInterval: a, freezeCount: i.freezeCount };
|
|
826
850
|
};
|
|
827
851
|
}
|
|
828
|
-
function
|
|
829
|
-
let
|
|
830
|
-
const y =
|
|
852
|
+
function Yt(e, t, r, a, c) {
|
|
853
|
+
let i = null, o = [], n, s = 0, d = !1, f = re.Unknown, m = re.Unknown, u = 0, p = 0;
|
|
854
|
+
const y = Xt();
|
|
831
855
|
async function j() {
|
|
832
|
-
const
|
|
833
|
-
if (!
|
|
856
|
+
const I = await e();
|
|
857
|
+
if (!I)
|
|
834
858
|
return;
|
|
835
|
-
const { isReceiving: _, avgJitterDelayInInterval: L, freezeCount: E } = y(
|
|
859
|
+
const { isReceiving: _, avgJitterDelayInInterval: L, freezeCount: E } = y(I), Y = Ht(I);
|
|
836
860
|
if (_)
|
|
837
|
-
|
|
838
|
-
else if (d && (
|
|
839
|
-
const
|
|
840
|
-
a == null || a(S.Stop,
|
|
861
|
+
s = 0, u = E - p, m = L < qt ? re.Strong : L > Gt && u > 1 ? re.Weak : f, m !== f && (c == null || c(m), f = m, p += u, u = 0), d || (a == null || a(S.Start), n = o[o.length - 1], o = [], d = !0), o.push(Y);
|
|
862
|
+
else if (d && (s++, s >= Ot)) {
|
|
863
|
+
const O = Le(o, de, n);
|
|
864
|
+
a == null || a(S.Stop, O), t() || r(), p = E, d = !1;
|
|
841
865
|
}
|
|
842
866
|
}
|
|
843
867
|
return {
|
|
844
868
|
start: () => {
|
|
845
|
-
|
|
869
|
+
i || (i = setInterval(j, de));
|
|
846
870
|
},
|
|
847
871
|
stop: () => {
|
|
848
|
-
|
|
872
|
+
i && (clearInterval(i), i = null);
|
|
849
873
|
},
|
|
850
874
|
getReport: () => Le(o, de, n)
|
|
851
875
|
};
|
|
852
876
|
}
|
|
853
|
-
const
|
|
877
|
+
const Qt = (window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection).bind(window);
|
|
854
878
|
function Pe(e) {
|
|
855
879
|
switch (e) {
|
|
856
880
|
case "connected":
|
|
857
|
-
return
|
|
881
|
+
return A.Connected;
|
|
858
882
|
case "checking":
|
|
859
|
-
return
|
|
883
|
+
return A.Connecting;
|
|
860
884
|
case "failed":
|
|
861
|
-
return
|
|
885
|
+
return A.Fail;
|
|
862
886
|
case "new":
|
|
863
|
-
return
|
|
887
|
+
return A.New;
|
|
864
888
|
case "closed":
|
|
865
|
-
return
|
|
889
|
+
return A.Closed;
|
|
866
890
|
case "disconnected":
|
|
867
|
-
return
|
|
891
|
+
return A.Disconnected;
|
|
868
892
|
case "completed":
|
|
869
|
-
return
|
|
893
|
+
return A.Completed;
|
|
870
894
|
default:
|
|
871
|
-
return
|
|
895
|
+
return A.New;
|
|
872
896
|
}
|
|
873
897
|
}
|
|
874
|
-
const
|
|
898
|
+
const Zt = (e) => (t) => {
|
|
875
899
|
const [r, a = ""] = t.split(/:(.+)/);
|
|
876
900
|
try {
|
|
877
901
|
const c = JSON.parse(a);
|
|
@@ -880,7 +904,7 @@ const Qt = (e) => (t) => {
|
|
|
880
904
|
return e("Failed to parse data channel message, returning data as string", { subject: r, rawData: a, error: c }), { subject: r, data: a };
|
|
881
905
|
}
|
|
882
906
|
};
|
|
883
|
-
function
|
|
907
|
+
function er({
|
|
884
908
|
statsSignal: e,
|
|
885
909
|
dataChannelSignal: t,
|
|
886
910
|
onVideoStateChange: r,
|
|
@@ -889,15 +913,15 @@ function Zt({
|
|
|
889
913
|
}) {
|
|
890
914
|
e === S.Start && t === S.Start ? (c("CALLBACK: onVideoStateChange(Start)"), r == null || r(S.Start)) : e === S.Stop && t === S.Stop && (c("CALLBACK: onVideoStateChange(Stop)"), r == null || r(S.Stop, a));
|
|
891
915
|
}
|
|
892
|
-
function
|
|
916
|
+
function tr({
|
|
893
917
|
statsSignal: e,
|
|
894
918
|
dataChannelSignal: t,
|
|
895
919
|
onVideoStateChange: r,
|
|
896
920
|
onAgentActivityStateChange: a,
|
|
897
921
|
report: c,
|
|
898
|
-
log:
|
|
922
|
+
log: i
|
|
899
923
|
}) {
|
|
900
|
-
e === S.Start ? (
|
|
924
|
+
e === S.Start ? (i("CALLBACK: onVideoStateChange(Start)"), r == null || r(S.Start)) : e === S.Stop && (i("CALLBACK: onVideoStateChange(Stop)"), r == null || r(S.Stop, c)), t === S.Start ? a == null || a(ae.Talking) : t === S.Stop && (a == null || a(ae.Idle));
|
|
901
925
|
}
|
|
902
926
|
function je({
|
|
903
927
|
statsSignal: e,
|
|
@@ -905,67 +929,67 @@ function je({
|
|
|
905
929
|
onVideoStateChange: r,
|
|
906
930
|
onAgentActivityStateChange: a,
|
|
907
931
|
streamType: c,
|
|
908
|
-
report:
|
|
932
|
+
report: i,
|
|
909
933
|
log: o
|
|
910
934
|
}) {
|
|
911
|
-
c ===
|
|
935
|
+
c === H.Legacy ? er({ statsSignal: e, dataChannelSignal: t, onVideoStateChange: r, report: i, log: o }) : c === H.Fluent && tr({
|
|
912
936
|
statsSignal: e,
|
|
913
937
|
dataChannelSignal: t,
|
|
914
938
|
onVideoStateChange: r,
|
|
915
939
|
onAgentActivityStateChange: a,
|
|
916
|
-
report:
|
|
940
|
+
report: i,
|
|
917
941
|
log: o
|
|
918
942
|
});
|
|
919
943
|
}
|
|
920
|
-
async function
|
|
944
|
+
async function rr(e, t, { debug: r = !1, callbacks: a, auth: c, baseURL: i = le, analytics: o }, n) {
|
|
921
945
|
var F;
|
|
922
|
-
const
|
|
923
|
-
let
|
|
924
|
-
const { startConnection: y, sendStreamRequest: j, close:
|
|
946
|
+
const s = Ut(r, "WebRTCStreamingManager"), d = Zt(s);
|
|
947
|
+
let f = !1, m = !1, u = S.Stop, p = S.Stop;
|
|
948
|
+
const { startConnection: y, sendStreamRequest: j, close: I, createStream: _, addIceCandidate: L } = Jt(
|
|
925
949
|
c,
|
|
926
|
-
|
|
950
|
+
i,
|
|
927
951
|
e,
|
|
928
952
|
a.onError
|
|
929
953
|
), {
|
|
930
954
|
id: E,
|
|
931
|
-
offer:
|
|
932
|
-
ice_servers:
|
|
955
|
+
offer: Y,
|
|
956
|
+
ice_servers: O,
|
|
933
957
|
session_id: V,
|
|
934
|
-
fluent:
|
|
935
|
-
interrupt_enabled:
|
|
958
|
+
fluent: ie,
|
|
959
|
+
interrupt_enabled: Q
|
|
936
960
|
} = await _(t, n);
|
|
937
961
|
(F = a.onStreamCreated) == null || F.call(a, { stream_id: E, session_id: V, agent_id: e });
|
|
938
|
-
const
|
|
962
|
+
const M = new Qt({ iceServers: O }), q = M.createDataChannel("JanusDataChannel");
|
|
939
963
|
if (!V)
|
|
940
964
|
throw new Error("Could not create session_id");
|
|
941
|
-
const J =
|
|
965
|
+
const J = ie ? H.Fluent : H.Legacy;
|
|
942
966
|
o.enrich({
|
|
943
967
|
"stream-type": J
|
|
944
968
|
});
|
|
945
|
-
const se = t.stream_warmup && !
|
|
969
|
+
const se = t.stream_warmup && !ie, oe = () => f, ee = () => {
|
|
946
970
|
var g;
|
|
947
|
-
|
|
948
|
-
}, l =
|
|
949
|
-
() =>
|
|
950
|
-
|
|
951
|
-
|
|
971
|
+
f = !0, m && (s("CALLBACK: onConnectionStateChange(Connected)"), (g = a.onConnectionStateChange) == null || g.call(a, A.Connected));
|
|
972
|
+
}, l = Yt(
|
|
973
|
+
() => M.getStats(),
|
|
974
|
+
oe,
|
|
975
|
+
ee,
|
|
952
976
|
(g, h) => je({
|
|
953
|
-
statsSignal:
|
|
954
|
-
dataChannelSignal: J ===
|
|
977
|
+
statsSignal: p = g,
|
|
978
|
+
dataChannelSignal: J === H.Legacy ? u : void 0,
|
|
955
979
|
onVideoStateChange: a.onVideoStateChange,
|
|
956
980
|
onAgentActivityStateChange: a.onAgentActivityStateChange,
|
|
957
981
|
report: h,
|
|
958
982
|
streamType: J,
|
|
959
|
-
log:
|
|
983
|
+
log: s
|
|
960
984
|
}),
|
|
961
985
|
(g) => {
|
|
962
986
|
var h;
|
|
963
987
|
return (h = a.onConnectivityStateChange) == null ? void 0 : h.call(a, g);
|
|
964
988
|
}
|
|
965
989
|
);
|
|
966
|
-
l.start(),
|
|
990
|
+
l.start(), M.onicecandidate = (g) => {
|
|
967
991
|
var h;
|
|
968
|
-
|
|
992
|
+
s("peerConnection.onicecandidate", g);
|
|
969
993
|
try {
|
|
970
994
|
g.candidate && g.candidate.sdpMid && g.candidate.sdpMLineIndex !== null ? L(
|
|
971
995
|
E,
|
|
@@ -977,68 +1001,68 @@ async function tr(e, t, { debug: r = !1, callbacks: a, auth: c, baseURL: s = le,
|
|
|
977
1001
|
V,
|
|
978
1002
|
n
|
|
979
1003
|
) : L(E, { candidate: null }, V, n);
|
|
980
|
-
} catch (
|
|
981
|
-
(h = a.onError) == null || h.call(a,
|
|
1004
|
+
} catch (D) {
|
|
1005
|
+
(h = a.onError) == null || h.call(a, D, { streamId: E });
|
|
982
1006
|
}
|
|
983
|
-
},
|
|
984
|
-
|
|
1007
|
+
}, q.onopen = () => {
|
|
1008
|
+
m = !0, (!se || f) && ee();
|
|
985
1009
|
};
|
|
986
|
-
let
|
|
1010
|
+
let w = null;
|
|
987
1011
|
const v = (g) => {
|
|
988
1012
|
var h;
|
|
989
|
-
|
|
1013
|
+
w = g, (h = a.onVideoIdChange) == null || h.call(a, g);
|
|
990
1014
|
};
|
|
991
1015
|
function C(g, h) {
|
|
992
1016
|
if (g === x.StreamStarted && typeof h == "object" && "metadata" in h) {
|
|
993
|
-
const
|
|
994
|
-
v(
|
|
1017
|
+
const D = h.metadata;
|
|
1018
|
+
v(D.videoId);
|
|
995
1019
|
}
|
|
996
|
-
g === x.StreamDone && v(null),
|
|
997
|
-
statsSignal: J ===
|
|
998
|
-
dataChannelSignal:
|
|
1020
|
+
g === x.StreamDone && v(null), u = g === x.StreamStarted ? S.Start : S.Stop, je({
|
|
1021
|
+
statsSignal: J === H.Legacy ? p : void 0,
|
|
1022
|
+
dataChannelSignal: u,
|
|
999
1023
|
onVideoStateChange: a.onVideoStateChange,
|
|
1000
1024
|
onAgentActivityStateChange: a.onAgentActivityStateChange,
|
|
1001
1025
|
streamType: J,
|
|
1002
|
-
log:
|
|
1026
|
+
log: s
|
|
1003
1027
|
});
|
|
1004
1028
|
}
|
|
1005
1029
|
function k(g, h) {
|
|
1006
1030
|
var B;
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1031
|
+
const D = typeof h == "string" ? h : h == null ? void 0 : h.metadata;
|
|
1032
|
+
D && o.enrich({ streamMetadata: D }), (B = a.onStreamReady) == null || B.call(a);
|
|
1009
1033
|
}
|
|
1010
1034
|
const R = {
|
|
1011
1035
|
[x.StreamStarted]: C,
|
|
1012
1036
|
[x.StreamDone]: C,
|
|
1013
1037
|
[x.StreamReady]: k
|
|
1014
1038
|
};
|
|
1015
|
-
|
|
1039
|
+
q.onmessage = (g) => {
|
|
1016
1040
|
var B;
|
|
1017
|
-
const { subject: h, data:
|
|
1018
|
-
(B = R[h]) == null || B.call(R, h,
|
|
1019
|
-
},
|
|
1041
|
+
const { subject: h, data: D } = d(g.data);
|
|
1042
|
+
(B = R[h]) == null || B.call(R, h, D);
|
|
1043
|
+
}, M.oniceconnectionstatechange = () => {
|
|
1020
1044
|
var h;
|
|
1021
|
-
|
|
1022
|
-
const g = Pe(
|
|
1023
|
-
g !==
|
|
1024
|
-
},
|
|
1045
|
+
s("peerConnection.oniceconnectionstatechange => " + M.iceConnectionState);
|
|
1046
|
+
const g = Pe(M.iceConnectionState);
|
|
1047
|
+
g !== A.Connected && ((h = a.onConnectionStateChange) == null || h.call(a, g));
|
|
1048
|
+
}, M.ontrack = (g) => {
|
|
1025
1049
|
var h;
|
|
1026
|
-
|
|
1027
|
-
}, await
|
|
1028
|
-
const P = await
|
|
1029
|
-
|
|
1050
|
+
s("peerConnection.ontrack", g), s("CALLBACK: onSrcObjectReady"), (h = a.onSrcObjectReady) == null || h.call(a, g.streams[0]);
|
|
1051
|
+
}, await M.setRemoteDescription(Y), s("set remote description OK");
|
|
1052
|
+
const P = await M.createAnswer();
|
|
1053
|
+
s("create answer OK"), await M.setLocalDescription(P), s("set local description OK"), await y(E, P, V, n), s("start connection OK");
|
|
1030
1054
|
function N(g) {
|
|
1031
|
-
var h,
|
|
1032
|
-
if (!
|
|
1033
|
-
|
|
1055
|
+
var h, D;
|
|
1056
|
+
if (!f || q.readyState !== "open") {
|
|
1057
|
+
s("Data channel is not ready for sending messages"), (h = a.onError) == null || h.call(a, new Ne("Data channel is not ready for sending messages"), {
|
|
1034
1058
|
streamId: E
|
|
1035
1059
|
});
|
|
1036
1060
|
return;
|
|
1037
1061
|
}
|
|
1038
1062
|
try {
|
|
1039
|
-
|
|
1063
|
+
q.send(g);
|
|
1040
1064
|
} catch (B) {
|
|
1041
|
-
|
|
1065
|
+
s("Error sending data channel message", B), (D = a.onError) == null || D.call(a, B, { streamId: E });
|
|
1042
1066
|
}
|
|
1043
1067
|
}
|
|
1044
1068
|
return {
|
|
@@ -1055,21 +1079,21 @@ async function tr(e, t, { debug: r = !1, callbacks: a, auth: c, baseURL: s = le,
|
|
|
1055
1079
|
async disconnect() {
|
|
1056
1080
|
var g;
|
|
1057
1081
|
if (E) {
|
|
1058
|
-
const h = Pe(
|
|
1059
|
-
if (
|
|
1060
|
-
if (h ===
|
|
1082
|
+
const h = Pe(M.iceConnectionState);
|
|
1083
|
+
if (M) {
|
|
1084
|
+
if (h === A.New) {
|
|
1061
1085
|
l.stop();
|
|
1062
1086
|
return;
|
|
1063
1087
|
}
|
|
1064
|
-
|
|
1088
|
+
M.close(), M.oniceconnectionstatechange = null, M.onnegotiationneeded = null, M.onicecandidate = null, M.ontrack = null;
|
|
1065
1089
|
}
|
|
1066
1090
|
try {
|
|
1067
|
-
h ===
|
|
1091
|
+
h === A.Connected && await I(E, V).catch((D) => {
|
|
1068
1092
|
});
|
|
1069
|
-
} catch (
|
|
1070
|
-
|
|
1093
|
+
} catch (D) {
|
|
1094
|
+
s("Error on close stream connection", D);
|
|
1071
1095
|
}
|
|
1072
|
-
(g = a.onAgentActivityStateChange) == null || g.call(a,
|
|
1096
|
+
(g = a.onAgentActivityStateChange) == null || g.call(a, ae.Idle), l.stop();
|
|
1073
1097
|
}
|
|
1074
1098
|
},
|
|
1075
1099
|
sendDataChannelMessage: N,
|
|
@@ -1082,18 +1106,18 @@ async function tr(e, t, { debug: r = !1, callbacks: a, auth: c, baseURL: s = le,
|
|
|
1082
1106
|
*/
|
|
1083
1107
|
streamId: E,
|
|
1084
1108
|
streamType: J,
|
|
1085
|
-
interruptAvailable:
|
|
1109
|
+
interruptAvailable: Q ?? !1,
|
|
1086
1110
|
isInterruptible: !0,
|
|
1087
1111
|
interrupt(g) {
|
|
1088
|
-
if (!
|
|
1112
|
+
if (!Q)
|
|
1089
1113
|
throw new Error("Interrupt is not enabled for this stream");
|
|
1090
|
-
if (J !==
|
|
1114
|
+
if (J !== H.Fluent)
|
|
1091
1115
|
throw new Error("Interrupt only available for Fluent streams");
|
|
1092
|
-
if (!
|
|
1116
|
+
if (!w)
|
|
1093
1117
|
throw new Error("No active video to interrupt");
|
|
1094
1118
|
const h = {
|
|
1095
1119
|
type: x.StreamInterrupt,
|
|
1096
|
-
videoId:
|
|
1120
|
+
videoId: w,
|
|
1097
1121
|
timestamp: Date.now()
|
|
1098
1122
|
};
|
|
1099
1123
|
N(JSON.stringify(h));
|
|
@@ -1101,18 +1125,18 @@ async function tr(e, t, { debug: r = !1, callbacks: a, auth: c, baseURL: s = le,
|
|
|
1101
1125
|
};
|
|
1102
1126
|
}
|
|
1103
1127
|
var he = /* @__PURE__ */ ((e) => (e.V1 = "v1", e.V2 = "v2", e))(he || {});
|
|
1104
|
-
async function
|
|
1128
|
+
async function nr(e, t, r, a) {
|
|
1105
1129
|
const c = e.id;
|
|
1106
1130
|
switch (t.version) {
|
|
1107
1131
|
case "v1": {
|
|
1108
|
-
const { version:
|
|
1109
|
-
return
|
|
1132
|
+
const { version: i, ...o } = t;
|
|
1133
|
+
return rr(c, o, r, a);
|
|
1110
1134
|
}
|
|
1111
1135
|
case "v2": {
|
|
1112
|
-
const { version:
|
|
1136
|
+
const { version: i, ...o } = t;
|
|
1113
1137
|
switch (o.transport.provider) {
|
|
1114
1138
|
case pe.Livekit:
|
|
1115
|
-
const { createLiveKitStreamingManager: n } = await import("./livekit-manager-
|
|
1139
|
+
const { createLiveKitStreamingManager: n } = await import("./livekit-manager-BXw0Zc-y.js");
|
|
1116
1140
|
return n(c, o, r);
|
|
1117
1141
|
default:
|
|
1118
1142
|
throw new Error(`Unsupported transport provider: ${o.transport.provider}`);
|
|
@@ -1122,8 +1146,8 @@ async function rr(e, t, r, a) {
|
|
|
1122
1146
|
throw new Error(`Invalid stream version: ${t.version}`);
|
|
1123
1147
|
}
|
|
1124
1148
|
}
|
|
1125
|
-
const
|
|
1126
|
-
function
|
|
1149
|
+
const ar = "cht";
|
|
1150
|
+
function ir() {
|
|
1127
1151
|
return {
|
|
1128
1152
|
transport: {
|
|
1129
1153
|
provider: pe.Livekit
|
|
@@ -1131,9 +1155,9 @@ function ar() {
|
|
|
1131
1155
|
};
|
|
1132
1156
|
}
|
|
1133
1157
|
function sr(e) {
|
|
1134
|
-
var c,
|
|
1158
|
+
var c, i;
|
|
1135
1159
|
const { streamOptions: t } = e ?? {}, r = ((c = e == null ? void 0 : e.mixpanelAdditionalProperties) == null ? void 0 : c.plan) !== void 0 ? {
|
|
1136
|
-
plan: (
|
|
1160
|
+
plan: (i = e.mixpanelAdditionalProperties) == null ? void 0 : i.plan
|
|
1137
1161
|
} : void 0;
|
|
1138
1162
|
return { ...{
|
|
1139
1163
|
output_resolution: t == null ? void 0 : t.outputResolution,
|
|
@@ -1143,16 +1167,16 @@ function sr(e) {
|
|
|
1143
1167
|
fluent: t == null ? void 0 : t.fluent
|
|
1144
1168
|
}, ...r && { end_user_data: r } };
|
|
1145
1169
|
}
|
|
1146
|
-
function
|
|
1147
|
-
return we(e.presenter.type) ? { version: he.V2, ...
|
|
1170
|
+
function or(e, t) {
|
|
1171
|
+
return we(e.presenter.type) ? { version: he.V2, ...ir() } : { version: he.V1, ...sr(t) };
|
|
1148
1172
|
}
|
|
1149
|
-
function
|
|
1173
|
+
function cr(e, t, r) {
|
|
1150
1174
|
r.track("agent-connection-state-change", { state: e, ...t && { reason: t } });
|
|
1151
1175
|
}
|
|
1152
|
-
function cr(e, t, r, a, c) {
|
|
1153
|
-
c === W.Fluent ? dr(e, t, r, a, c) : lr(e, t, r, a, c);
|
|
1154
|
-
}
|
|
1155
1176
|
function dr(e, t, r, a, c) {
|
|
1177
|
+
c === H.Fluent ? lr(e, t, r, a, c) : ur(e, t, r, a, c);
|
|
1178
|
+
}
|
|
1179
|
+
function lr(e, t, r, a, c) {
|
|
1156
1180
|
e === S.Start ? a.track("stream-session", { event: "start", "stream-type": c }) : e === S.Stop && a.track("stream-session", {
|
|
1157
1181
|
event: "stop",
|
|
1158
1182
|
is_greenscreen: t.presenter.type === "clip" && t.presenter.is_greenscreen,
|
|
@@ -1176,10 +1200,10 @@ function Be(e, t, r, a, c) {
|
|
|
1176
1200
|
[x.StreamVideoDone]
|
|
1177
1201
|
);
|
|
1178
1202
|
}
|
|
1179
|
-
function
|
|
1203
|
+
function ur(e, t, r, a, c) {
|
|
1180
1204
|
e === S.Start ? a.linkTrack(
|
|
1181
1205
|
"agent-video",
|
|
1182
|
-
{ event: "start", latency:
|
|
1206
|
+
{ event: "start", latency: G.get(!0), "stream-type": c },
|
|
1183
1207
|
"start",
|
|
1184
1208
|
[x.StreamVideoCreated]
|
|
1185
1209
|
) : e === S.Stop && a.linkTrack(
|
|
@@ -1195,7 +1219,7 @@ function lr(e, t, r, a, c) {
|
|
|
1195
1219
|
[x.StreamVideoDone]
|
|
1196
1220
|
);
|
|
1197
1221
|
}
|
|
1198
|
-
function
|
|
1222
|
+
function mr(e, t, r) {
|
|
1199
1223
|
const a = {
|
|
1200
1224
|
call_id: t.call_id,
|
|
1201
1225
|
name: t.name
|
|
@@ -1213,40 +1237,40 @@ function ur(e, t, r) {
|
|
|
1213
1237
|
});
|
|
1214
1238
|
}
|
|
1215
1239
|
function $e(e, t, r, a) {
|
|
1216
|
-
return
|
|
1240
|
+
return G.reset(), Ae.update(), new Promise(async (c, i) => {
|
|
1217
1241
|
try {
|
|
1218
1242
|
let o, n = !1;
|
|
1219
|
-
const
|
|
1243
|
+
const s = or(e, t);
|
|
1220
1244
|
r.enrich({
|
|
1221
|
-
"stream-version":
|
|
1245
|
+
"stream-version": s.version.toString()
|
|
1222
1246
|
});
|
|
1223
1247
|
let d = null;
|
|
1224
|
-
const
|
|
1225
|
-
o = await
|
|
1248
|
+
const f = e.presenter.type === "expressive";
|
|
1249
|
+
o = await nr(
|
|
1226
1250
|
e,
|
|
1227
|
-
|
|
1251
|
+
s,
|
|
1228
1252
|
{
|
|
1229
1253
|
...t,
|
|
1230
1254
|
analytics: r,
|
|
1231
1255
|
callbacks: {
|
|
1232
1256
|
...t.callbacks,
|
|
1233
|
-
onConnectionStateChange: (
|
|
1234
|
-
var
|
|
1235
|
-
(y = (
|
|
1257
|
+
onConnectionStateChange: (m, u) => {
|
|
1258
|
+
var p, y;
|
|
1259
|
+
(y = (p = t.callbacks).onConnectionStateChange) == null || y.call(p, m), cr(m, u, r), m === A.Connected && (o ? c(o) : n = !0);
|
|
1236
1260
|
},
|
|
1237
|
-
onVideoStateChange: (
|
|
1238
|
-
var
|
|
1239
|
-
(y = (
|
|
1240
|
-
f,
|
|
1241
|
-
e,
|
|
1261
|
+
onVideoStateChange: (m, u) => {
|
|
1262
|
+
var p, y;
|
|
1263
|
+
(y = (p = t.callbacks).onVideoStateChange) == null || y.call(p, m), dr(
|
|
1242
1264
|
m,
|
|
1265
|
+
e,
|
|
1266
|
+
u,
|
|
1243
1267
|
r,
|
|
1244
1268
|
o.streamType
|
|
1245
1269
|
);
|
|
1246
1270
|
},
|
|
1247
|
-
onAgentActivityStateChange: (
|
|
1248
|
-
var
|
|
1249
|
-
(
|
|
1271
|
+
onAgentActivityStateChange: (m) => {
|
|
1272
|
+
var u, p;
|
|
1273
|
+
(p = (u = t.callbacks).onAgentActivityStateChange) == null || p.call(u, m), m === ae.Talking ? (ge.update(), d = (y) => {
|
|
1250
1274
|
Be(
|
|
1251
1275
|
S.Start,
|
|
1252
1276
|
e,
|
|
@@ -1254,55 +1278,55 @@ function $e(e, t, r, a) {
|
|
|
1254
1278
|
o.streamType,
|
|
1255
1279
|
y
|
|
1256
1280
|
), d = null;
|
|
1257
|
-
},
|
|
1281
|
+
}, f || d({ latency: G.get(!0) })) : (ge.reset(), d = null, Be(
|
|
1258
1282
|
S.Stop,
|
|
1259
1283
|
e,
|
|
1260
1284
|
r,
|
|
1261
1285
|
o.streamType
|
|
1262
1286
|
));
|
|
1263
1287
|
},
|
|
1264
|
-
onFirstAudioDetected: (
|
|
1265
|
-
d == null || d(
|
|
1288
|
+
onFirstAudioDetected: (m) => {
|
|
1289
|
+
d == null || d(m);
|
|
1266
1290
|
},
|
|
1267
1291
|
onStreamReady: () => {
|
|
1268
|
-
const
|
|
1269
|
-
r.track("agent-chat", { event: "ready", latency:
|
|
1292
|
+
const m = Ae.get(!0);
|
|
1293
|
+
r.track("agent-chat", { event: "ready", latency: m });
|
|
1270
1294
|
},
|
|
1271
|
-
onToolEvent: ((
|
|
1272
|
-
var
|
|
1273
|
-
(y = (
|
|
1295
|
+
onToolEvent: ((m, u) => {
|
|
1296
|
+
var p, y;
|
|
1297
|
+
(y = (p = t.callbacks).onToolEvent) == null || y.call(p, m, u), mr(m, u, r);
|
|
1274
1298
|
})
|
|
1275
1299
|
}
|
|
1276
1300
|
},
|
|
1277
1301
|
a
|
|
1278
1302
|
), n && c(o);
|
|
1279
1303
|
} catch (o) {
|
|
1280
|
-
|
|
1304
|
+
i(o);
|
|
1281
1305
|
}
|
|
1282
1306
|
});
|
|
1283
1307
|
}
|
|
1284
|
-
async function
|
|
1285
|
-
var
|
|
1286
|
-
const
|
|
1308
|
+
async function fr(e, t, r, a, c) {
|
|
1309
|
+
var f, m, u, p;
|
|
1310
|
+
const i = async () => {
|
|
1287
1311
|
if (we(e.presenter.type)) {
|
|
1288
|
-
const y = await $e(e, t, a), j = `${
|
|
1312
|
+
const y = await $e(e, t, a), j = `${ar}_${y.sessionId}`, I = (/* @__PURE__ */ new Date()).toISOString();
|
|
1289
1313
|
return { chatResult: {
|
|
1290
|
-
chatMode:
|
|
1314
|
+
chatMode: b.Functional,
|
|
1291
1315
|
chat: {
|
|
1292
1316
|
id: j,
|
|
1293
1317
|
agent_id: e.id,
|
|
1294
1318
|
owner_id: e.owner_id ?? "",
|
|
1295
|
-
created:
|
|
1296
|
-
modified:
|
|
1297
|
-
agent_id__created_at:
|
|
1298
|
-
agent_id__modified_at:
|
|
1299
|
-
chat_mode:
|
|
1319
|
+
created: I,
|
|
1320
|
+
modified: I,
|
|
1321
|
+
agent_id__created_at: I,
|
|
1322
|
+
agent_id__modified_at: I,
|
|
1323
|
+
chat_mode: b.Functional,
|
|
1300
1324
|
messages: []
|
|
1301
1325
|
}
|
|
1302
1326
|
}, streamingManager: y };
|
|
1303
1327
|
} else {
|
|
1304
1328
|
const y = new AbortController(), j = y.signal;
|
|
1305
|
-
let
|
|
1329
|
+
let I;
|
|
1306
1330
|
try {
|
|
1307
1331
|
const _ = qe(
|
|
1308
1332
|
e,
|
|
@@ -1311,23 +1335,23 @@ async function mr(e, t, r, a, c) {
|
|
|
1311
1335
|
t.mode,
|
|
1312
1336
|
t.persistentChat,
|
|
1313
1337
|
c
|
|
1314
|
-
), L = $e(e, t, a, j).then((
|
|
1315
|
-
return { chatResult: E, streamingManager:
|
|
1338
|
+
), L = $e(e, t, a, j).then((O) => (I = O, O)), [E, Y] = await Promise.all([_, L]);
|
|
1339
|
+
return { chatResult: E, streamingManager: Y };
|
|
1316
1340
|
} catch (_) {
|
|
1317
|
-
throw y.abort(),
|
|
1341
|
+
throw y.abort(), I && await I.disconnect().catch(() => {
|
|
1318
1342
|
}), _;
|
|
1319
1343
|
}
|
|
1320
1344
|
}
|
|
1321
|
-
}, { chatResult: o, streamingManager: n } = await
|
|
1322
|
-
return d && t.mode !== void 0 && d !== t.mode && (t.mode = d, (
|
|
1345
|
+
}, { chatResult: o, streamingManager: n } = await i(), { chat: s, chatMode: d } = o;
|
|
1346
|
+
return d && t.mode !== void 0 && d !== t.mode && (t.mode = d, (m = (f = t.callbacks).onModeChange) == null || m.call(f, d), d !== b.Functional) ? ((p = (u = t.callbacks).onError) == null || p.call(u, new et(d)), n == null || n.disconnect(), { chat: s }) : { chat: s, streamingManager: n };
|
|
1323
1347
|
}
|
|
1324
|
-
async function
|
|
1325
|
-
var J, se,
|
|
1348
|
+
async function yr(e, t) {
|
|
1349
|
+
var J, se, oe, ee;
|
|
1326
1350
|
let r = !0;
|
|
1327
|
-
const a = t.mixpanelKey || wt, c = t.wsURL || pt,
|
|
1351
|
+
const a = t.mixpanelKey || wt, c = t.wsURL || pt, i = t.baseURL || le, o = t.mode || b.Functional, n = {
|
|
1328
1352
|
messages: [],
|
|
1329
1353
|
chatMode: o
|
|
1330
|
-
},
|
|
1354
|
+
}, s = Pt({
|
|
1331
1355
|
token: a,
|
|
1332
1356
|
agentId: e,
|
|
1333
1357
|
isEnabled: t.enableAnalitics,
|
|
@@ -1335,85 +1359,85 @@ async function vr(e, t) {
|
|
|
1335
1359
|
mixpanelAdditionalProperties: t.mixpanelAdditionalProperties
|
|
1336
1360
|
}), d = Date.now();
|
|
1337
1361
|
Te(() => {
|
|
1338
|
-
|
|
1362
|
+
s.track("agent-sdk", { event: "init" }, d);
|
|
1339
1363
|
});
|
|
1340
|
-
const
|
|
1341
|
-
t.callbacks.onError = (l,
|
|
1342
|
-
|
|
1364
|
+
const f = t.callbacks.onError;
|
|
1365
|
+
t.callbacks.onError = (l, w) => {
|
|
1366
|
+
s.track("agent-error", { error: be(l) }), f == null || f(l, w);
|
|
1343
1367
|
};
|
|
1344
|
-
const
|
|
1345
|
-
t.debug = t.debug || ((J =
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
const { onMessage: y, clearQueue: j } =
|
|
1349
|
-
var l,
|
|
1350
|
-
(l = n.socketManager) == null || l.disconnect(), (v = (
|
|
1368
|
+
const m = It(t.auth, i, t.callbacks.onError, t.externalId), u = await m.getById(e);
|
|
1369
|
+
t.debug = t.debug || ((J = u == null ? void 0 : u.advanced_settings) == null ? void 0 : J.ui_debug_mode);
|
|
1370
|
+
const p = we(u.presenter.type);
|
|
1371
|
+
s.enrich(_t(u));
|
|
1372
|
+
const { onMessage: y, clearQueue: j } = Vt(s, n, t, u, () => {
|
|
1373
|
+
var l, w, v;
|
|
1374
|
+
(l = n.socketManager) == null || l.disconnect(), (v = (w = t.callbacks).onConnectionStateChange) == null || v.call(w, A.Disconnected);
|
|
1351
1375
|
});
|
|
1352
|
-
n.messages =
|
|
1353
|
-
const
|
|
1376
|
+
n.messages = jt(t.initialMessages), (oe = (se = t.callbacks).onNewMessage) == null || oe.call(se, [...n.messages], "answer");
|
|
1377
|
+
const I = (l) => {
|
|
1354
1378
|
}, _ = ({ type: l }) => {
|
|
1355
1379
|
var v, C, k, R;
|
|
1356
1380
|
if (!((v = n.streamingManager) != null && v.interruptAvailable) || !((C = n.streamingManager) != null && C.isInterruptible)) return;
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1381
|
+
const w = n.messages[n.messages.length - 1];
|
|
1382
|
+
s.track("agent-video-interrupt", {
|
|
1359
1383
|
type: l || "click",
|
|
1360
1384
|
video_duration_to_interrupt: ge.get(!0),
|
|
1361
|
-
message_duration_to_interrupt:
|
|
1362
|
-
}),
|
|
1385
|
+
message_duration_to_interrupt: G.get(!0)
|
|
1386
|
+
}), w.interrupted = !0, (R = (k = t.callbacks).onNewMessage) == null || R.call(k, [...n.messages], "answer"), n.streamingManager.interrupt(l);
|
|
1363
1387
|
}, L = /* @__PURE__ */ new Map();
|
|
1364
1388
|
function E(l) {
|
|
1365
|
-
return async (
|
|
1389
|
+
return async (w) => {
|
|
1366
1390
|
const v = L.get(l);
|
|
1367
1391
|
if (!v)
|
|
1368
1392
|
throw new Error(`No handler registered for client tool: ${l}`);
|
|
1369
1393
|
try {
|
|
1370
|
-
const C = JSON.parse(
|
|
1394
|
+
const C = JSON.parse(w.payload);
|
|
1371
1395
|
return await v(C);
|
|
1372
1396
|
} catch (C) {
|
|
1373
1397
|
throw new Error(`Client tool "${l}" failed: ${C.message}`);
|
|
1374
1398
|
}
|
|
1375
1399
|
};
|
|
1376
1400
|
}
|
|
1377
|
-
function
|
|
1378
|
-
var l,
|
|
1401
|
+
function Y() {
|
|
1402
|
+
var l, w, v, C;
|
|
1379
1403
|
for (const [k] of L)
|
|
1380
|
-
(
|
|
1404
|
+
(w = (l = n.streamingManager) == null ? void 0 : l.unregisterRpcMethod) == null || w.call(l, k), (C = (v = n.streamingManager) == null ? void 0 : v.registerRpcMethod) == null || C.call(v, k, E(k));
|
|
1381
1405
|
}
|
|
1382
|
-
function
|
|
1406
|
+
function O(l, w) {
|
|
1383
1407
|
var C, k;
|
|
1384
1408
|
const v = !L.has(l);
|
|
1385
|
-
L.set(l,
|
|
1409
|
+
L.set(l, w), v && ((k = (C = n.streamingManager) == null ? void 0 : C.registerRpcMethod) == null || k.call(C, l, E(l)));
|
|
1386
1410
|
}
|
|
1387
1411
|
function V(l) {
|
|
1388
|
-
var
|
|
1389
|
-
L.delete(l), (v = (
|
|
1412
|
+
var w, v;
|
|
1413
|
+
L.delete(l), (v = (w = n.streamingManager) == null ? void 0 : w.unregisterRpcMethod) == null || v.call(w, l);
|
|
1390
1414
|
}
|
|
1391
|
-
const
|
|
1415
|
+
const ie = Date.now();
|
|
1392
1416
|
Te(() => {
|
|
1393
|
-
|
|
1417
|
+
s.track("agent-sdk", { event: "loaded", ...Et(u) }, ie);
|
|
1394
1418
|
});
|
|
1395
|
-
async function
|
|
1396
|
-
var P, N, F, g, h,
|
|
1397
|
-
ft(), (N = (P = t.callbacks).onConnectionStateChange) == null || N.call(P,
|
|
1398
|
-
const
|
|
1419
|
+
async function Q(l) {
|
|
1420
|
+
var P, N, F, g, h, D, B;
|
|
1421
|
+
ft(), (N = (P = t.callbacks).onConnectionStateChange) == null || N.call(P, A.Connecting), G.reset(), l && !r && (delete n.chat, (g = (F = t.callbacks).onNewMessage) == null || g.call(F, [...n.messages], "answer"));
|
|
1422
|
+
const w = o === b.DirectPlayback || p ? Promise.resolve(void 0) : zt(
|
|
1399
1423
|
t.auth,
|
|
1400
1424
|
c,
|
|
1401
1425
|
{ onMessage: y, onError: t.callbacks.onError },
|
|
1402
1426
|
t.externalId
|
|
1403
1427
|
), v = fe(
|
|
1404
|
-
() =>
|
|
1405
|
-
|
|
1428
|
+
() => fr(
|
|
1429
|
+
u,
|
|
1406
1430
|
{
|
|
1407
1431
|
...t,
|
|
1408
1432
|
mode: o,
|
|
1409
1433
|
callbacks: {
|
|
1410
1434
|
...t.callbacks,
|
|
1411
|
-
onVideoIdChange:
|
|
1435
|
+
onVideoIdChange: I,
|
|
1412
1436
|
onMessage: y
|
|
1413
1437
|
}
|
|
1414
1438
|
},
|
|
1415
|
-
|
|
1416
|
-
|
|
1439
|
+
m,
|
|
1440
|
+
s,
|
|
1417
1441
|
n.chat
|
|
1418
1442
|
),
|
|
1419
1443
|
{
|
|
@@ -1425,24 +1449,24 @@ async function vr(e, t) {
|
|
|
1425
1449
|
}
|
|
1426
1450
|
).catch((K) => {
|
|
1427
1451
|
var T, U;
|
|
1428
|
-
throw
|
|
1429
|
-
}), [C, { streamingManager: k, chat: R }] = await Promise.all([
|
|
1430
|
-
R && R.id !== ((h = n.chat) == null ? void 0 : h.id) && ((B = (
|
|
1452
|
+
throw q(b.Maintenance), (U = (T = t.callbacks).onConnectionStateChange) == null || U.call(T, A.Fail), K;
|
|
1453
|
+
}), [C, { streamingManager: k, chat: R }] = await Promise.all([w, v]);
|
|
1454
|
+
R && R.id !== ((h = n.chat) == null ? void 0 : h.id) && ((B = (D = t.callbacks).onNewChat) == null || B.call(D, R.id)), n.streamingManager = k, n.socketManager = C, n.chat = R, Y(), r = !1, s.enrich({
|
|
1431
1455
|
chatId: R == null ? void 0 : R.id,
|
|
1432
1456
|
streamId: k == null ? void 0 : k.streamId,
|
|
1433
1457
|
mode: n.chatMode
|
|
1434
|
-
}),
|
|
1458
|
+
}), q((R == null ? void 0 : R.chat_mode) ?? o);
|
|
1435
1459
|
}
|
|
1436
|
-
async function
|
|
1437
|
-
var l,
|
|
1438
|
-
(l = n.socketManager) == null || l.disconnect(), await ((
|
|
1460
|
+
async function M() {
|
|
1461
|
+
var l, w, v, C;
|
|
1462
|
+
(l = n.socketManager) == null || l.disconnect(), await ((w = n.streamingManager) == null ? void 0 : w.disconnect()), delete n.streamingManager, delete n.socketManager, (C = (v = t.callbacks).onConnectionStateChange) == null || C.call(v, A.Disconnected);
|
|
1439
1463
|
}
|
|
1440
|
-
async function
|
|
1441
|
-
var
|
|
1442
|
-
l !== n.chatMode && (
|
|
1464
|
+
async function q(l) {
|
|
1465
|
+
var w, v;
|
|
1466
|
+
l !== n.chatMode && (s.track("agent-mode-change", { mode: l }), n.chatMode = l, n.chatMode !== b.Functional && await M(), (v = (w = t.callbacks).onModeChange) == null || v.call(w, l));
|
|
1443
1467
|
}
|
|
1444
1468
|
return {
|
|
1445
|
-
agent:
|
|
1469
|
+
agent: u,
|
|
1446
1470
|
getStreamType: () => {
|
|
1447
1471
|
var l;
|
|
1448
1472
|
return (l = n.streamingManager) == null ? void 0 : l.streamType;
|
|
@@ -1451,55 +1475,55 @@ async function vr(e, t) {
|
|
|
1451
1475
|
var l;
|
|
1452
1476
|
return ((l = n.streamingManager) == null ? void 0 : l.interruptAvailable) ?? !1;
|
|
1453
1477
|
},
|
|
1454
|
-
starterMessages: ((
|
|
1455
|
-
getSTTToken: () =>
|
|
1456
|
-
changeMode:
|
|
1457
|
-
enrichAnalytics:
|
|
1478
|
+
starterMessages: ((ee = u.knowledge) == null ? void 0 : ee.starter_message) || [],
|
|
1479
|
+
getSTTToken: () => m.getSTTToken(u.id),
|
|
1480
|
+
changeMode: q,
|
|
1481
|
+
enrichAnalytics: s.enrich,
|
|
1458
1482
|
async connect() {
|
|
1459
|
-
await
|
|
1483
|
+
await Q(!0), s.track("agent-chat", {
|
|
1460
1484
|
event: "connect",
|
|
1461
1485
|
mode: n.chatMode
|
|
1462
1486
|
});
|
|
1463
1487
|
},
|
|
1464
1488
|
async reconnect() {
|
|
1465
1489
|
const l = n.streamingManager;
|
|
1466
|
-
if (
|
|
1490
|
+
if (p && (l != null && l.reconnect)) {
|
|
1467
1491
|
try {
|
|
1468
|
-
await l.reconnect(),
|
|
1492
|
+
await l.reconnect(), s.track("agent-chat", {
|
|
1469
1493
|
event: "reconnect",
|
|
1470
1494
|
mode: n.chatMode
|
|
1471
1495
|
});
|
|
1472
1496
|
} catch {
|
|
1473
|
-
await
|
|
1497
|
+
await M(), await Q(!1);
|
|
1474
1498
|
}
|
|
1475
1499
|
return;
|
|
1476
1500
|
}
|
|
1477
|
-
await
|
|
1501
|
+
await M(), await Q(!1), s.track("agent-chat", {
|
|
1478
1502
|
event: "reconnect",
|
|
1479
1503
|
mode: n.chatMode
|
|
1480
1504
|
});
|
|
1481
1505
|
},
|
|
1482
1506
|
async disconnect() {
|
|
1483
|
-
await
|
|
1507
|
+
await M(), s.track("agent-chat", {
|
|
1484
1508
|
event: "disconnect",
|
|
1485
1509
|
mode: n.chatMode
|
|
1486
1510
|
});
|
|
1487
1511
|
},
|
|
1488
1512
|
publishMicrophoneStream(l) {
|
|
1489
|
-
var
|
|
1490
|
-
return (
|
|
1513
|
+
var w;
|
|
1514
|
+
return (w = n.streamingManager) != null && w.publishMicrophoneStream ? n.streamingManager.publishMicrophoneStream(l) : Promise.reject(new Error("publishMicrophoneStream is not available for this streaming manager"));
|
|
1491
1515
|
},
|
|
1492
1516
|
unpublishMicrophoneStream() {
|
|
1493
1517
|
var l;
|
|
1494
1518
|
return (l = n.streamingManager) != null && l.unpublishMicrophoneStream ? n.streamingManager.unpublishMicrophoneStream() : Promise.resolve();
|
|
1495
1519
|
},
|
|
1496
1520
|
replaceMicrophoneTrack(l) {
|
|
1497
|
-
var
|
|
1498
|
-
return (
|
|
1521
|
+
var w;
|
|
1522
|
+
return (w = n.streamingManager) != null && w.replaceMicrophoneTrack ? n.streamingManager.replaceMicrophoneTrack(l) : Promise.reject(new Error("replaceMicrophoneTrack is not available for this streaming manager"));
|
|
1499
1523
|
},
|
|
1500
1524
|
publishCameraStream(l) {
|
|
1501
|
-
var
|
|
1502
|
-
return (
|
|
1525
|
+
var w;
|
|
1526
|
+
return (w = n.streamingManager) != null && w.publishCameraStream ? n.streamingManager.publishCameraStream(l) : Promise.reject(new Error("publishCameraStream is not available for this streaming manager"));
|
|
1503
1527
|
},
|
|
1504
1528
|
unpublishCameraStream() {
|
|
1505
1529
|
var l;
|
|
@@ -1507,16 +1531,16 @@ async function vr(e, t) {
|
|
|
1507
1531
|
},
|
|
1508
1532
|
async chat(l) {
|
|
1509
1533
|
var k, R, P, N, F;
|
|
1510
|
-
const
|
|
1534
|
+
const w = () => {
|
|
1511
1535
|
if (We(o))
|
|
1512
1536
|
throw new $(`${o} is enabled, chat is disabled`);
|
|
1513
1537
|
if (l.length >= ke)
|
|
1514
1538
|
throw new $(`Message cannot be more than ${ke} characters`);
|
|
1515
1539
|
if (l.length === 0)
|
|
1516
1540
|
throw new $("Message cannot be empty");
|
|
1517
|
-
if (n.chatMode ===
|
|
1541
|
+
if (n.chatMode === b.Maintenance)
|
|
1518
1542
|
throw new $("Chat is in maintenance mode");
|
|
1519
|
-
if (![
|
|
1543
|
+
if (![b.TextOnly, b.Playground].includes(n.chatMode)) {
|
|
1520
1544
|
if (!n.streamingManager)
|
|
1521
1545
|
throw new $("Streaming manager is not initialized");
|
|
1522
1546
|
if (!n.chat)
|
|
@@ -1525,33 +1549,33 @@ async function vr(e, t) {
|
|
|
1525
1549
|
}, v = async () => {
|
|
1526
1550
|
var g, h;
|
|
1527
1551
|
if (!n.chat) {
|
|
1528
|
-
const
|
|
1552
|
+
const D = await qe(
|
|
1553
|
+
u,
|
|
1529
1554
|
m,
|
|
1530
|
-
|
|
1531
|
-
i,
|
|
1555
|
+
s,
|
|
1532
1556
|
n.chatMode,
|
|
1533
1557
|
t.persistentChat
|
|
1534
1558
|
);
|
|
1535
|
-
if (!
|
|
1559
|
+
if (!D.chat)
|
|
1536
1560
|
throw new Ze(n.chatMode, !!t.persistentChat);
|
|
1537
|
-
n.chat =
|
|
1561
|
+
n.chat = D.chat, (h = (g = t.callbacks).onNewChat) == null || h.call(g, n.chat.id);
|
|
1538
1562
|
}
|
|
1539
1563
|
return n.chat.id;
|
|
1540
1564
|
}, C = async (g, h) => {
|
|
1541
|
-
const
|
|
1542
|
-
return fe(
|
|
1565
|
+
const D = n.chatMode === b.Playground;
|
|
1566
|
+
return fe(p && !D ? async () => {
|
|
1543
1567
|
var T, U;
|
|
1544
1568
|
return await ((U = (T = n.streamingManager) == null ? void 0 : T.sendTextMessage) == null ? void 0 : U.call(T, l)), Promise.resolve({});
|
|
1545
1569
|
} : async () => {
|
|
1546
1570
|
var T, U;
|
|
1547
|
-
return
|
|
1548
|
-
|
|
1571
|
+
return m.chat(
|
|
1572
|
+
u.id,
|
|
1549
1573
|
h,
|
|
1550
1574
|
{
|
|
1551
1575
|
chatMode: n.chatMode,
|
|
1552
1576
|
streamId: (T = n.streamingManager) == null ? void 0 : T.streamId,
|
|
1553
1577
|
sessionId: (U = n.streamingManager) == null ? void 0 : U.sessionId,
|
|
1554
|
-
messages: g.map(({ matches: Xe, ...
|
|
1578
|
+
messages: g.map(({ matches: Xe, ...ce }) => ce)
|
|
1555
1579
|
},
|
|
1556
1580
|
{
|
|
1557
1581
|
...Oe(n.chatMode),
|
|
@@ -1561,48 +1585,48 @@ async function vr(e, t) {
|
|
|
1561
1585
|
}, {
|
|
1562
1586
|
limit: 2,
|
|
1563
1587
|
shouldRetryFn: (T) => {
|
|
1564
|
-
var
|
|
1565
|
-
const U = (
|
|
1588
|
+
var ce, ye, Ce, Se;
|
|
1589
|
+
const U = (ce = T == null ? void 0 : T.message) == null ? void 0 : ce.includes("missing or invalid session_id");
|
|
1566
1590
|
return !((ye = T == null ? void 0 : T.message) == null ? void 0 : ye.includes("Stream Error")) && !U ? ((Se = (Ce = t.callbacks).onError) == null || Se.call(Ce, T), !1) : !0;
|
|
1567
1591
|
},
|
|
1568
1592
|
onRetry: async () => {
|
|
1569
|
-
await
|
|
1593
|
+
await M(), await Q(!1);
|
|
1570
1594
|
}
|
|
1571
1595
|
});
|
|
1572
1596
|
};
|
|
1573
1597
|
try {
|
|
1574
|
-
j(),
|
|
1575
|
-
id:
|
|
1598
|
+
j(), w(), n.messages.push({
|
|
1599
|
+
id: Z(),
|
|
1576
1600
|
role: "user",
|
|
1577
1601
|
content: l,
|
|
1578
|
-
parts:
|
|
1579
|
-
created_at: new Date(
|
|
1602
|
+
parts: ne(l),
|
|
1603
|
+
created_at: new Date(G.update()).toISOString()
|
|
1580
1604
|
}), (R = (k = t.callbacks).onNewMessage) == null || R.call(k, [...n.messages], "user");
|
|
1581
1605
|
const g = await v(), h = await C([...n.messages], g);
|
|
1582
1606
|
return h.result && n.messages.push({
|
|
1583
|
-
id:
|
|
1607
|
+
id: Z(),
|
|
1584
1608
|
role: "assistant",
|
|
1585
1609
|
content: h.result,
|
|
1586
|
-
parts:
|
|
1610
|
+
parts: ne(h.result),
|
|
1587
1611
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1588
1612
|
context: h.context,
|
|
1589
1613
|
matches: h.matches
|
|
1590
|
-
}),
|
|
1614
|
+
}), s.track("agent-message-send", {
|
|
1591
1615
|
event: "success",
|
|
1592
1616
|
messages: n.messages.length + 1
|
|
1593
|
-
}), h.result && ((N = (P = t.callbacks).onNewMessage) == null || N.call(P, [...n.messages], "answer"),
|
|
1594
|
-
latency:
|
|
1617
|
+
}), h.result && ((N = (P = t.callbacks).onNewMessage) == null || N.call(P, [...n.messages], "answer"), s.track("agent-message-received", {
|
|
1618
|
+
latency: G.get(!0),
|
|
1595
1619
|
messages: n.messages.length
|
|
1596
1620
|
})), h;
|
|
1597
1621
|
} catch (g) {
|
|
1598
|
-
throw ((F = n.messages[n.messages.length - 1]) == null ? void 0 : F.role) === "assistant" && n.messages.pop(),
|
|
1622
|
+
throw ((F = n.messages[n.messages.length - 1]) == null ? void 0 : F.role) === "assistant" && n.messages.pop(), s.track("agent-message-send", {
|
|
1599
1623
|
event: "error",
|
|
1600
1624
|
messages: n.messages.length,
|
|
1601
|
-
error:
|
|
1625
|
+
error: be(g)
|
|
1602
1626
|
}), g;
|
|
1603
1627
|
}
|
|
1604
1628
|
},
|
|
1605
|
-
rate(l,
|
|
1629
|
+
rate(l, w, v) {
|
|
1606
1630
|
var R, P, N, F;
|
|
1607
1631
|
const C = n.messages.find((g) => g.id === l);
|
|
1608
1632
|
if (n.chat) {
|
|
@@ -1610,60 +1634,60 @@ async function vr(e, t) {
|
|
|
1610
1634
|
throw new $("Message not found");
|
|
1611
1635
|
} else throw new $("Chat is not initialized");
|
|
1612
1636
|
const k = ((R = C.matches) == null ? void 0 : R.map((g) => [g.document_id, g.id])) ?? [];
|
|
1613
|
-
return
|
|
1637
|
+
return s.track("agent-rate", {
|
|
1614
1638
|
event: v ? "update" : "create",
|
|
1615
|
-
thumb:
|
|
1616
|
-
knowledge_id: ((P =
|
|
1639
|
+
thumb: w === 1 ? "up" : "down",
|
|
1640
|
+
knowledge_id: ((P = u.knowledge) == null ? void 0 : P.id) ?? "",
|
|
1617
1641
|
matches: k,
|
|
1618
|
-
score:
|
|
1619
|
-
}), v ?
|
|
1620
|
-
knowledge_id: ((N =
|
|
1642
|
+
score: w
|
|
1643
|
+
}), v ? m.updateRating(u.id, n.chat.id, v, {
|
|
1644
|
+
knowledge_id: ((N = u.knowledge) == null ? void 0 : N.id) ?? "",
|
|
1621
1645
|
message_id: l,
|
|
1622
1646
|
matches: k,
|
|
1623
|
-
score:
|
|
1624
|
-
}) :
|
|
1625
|
-
knowledge_id: ((F =
|
|
1647
|
+
score: w
|
|
1648
|
+
}) : m.createRating(u.id, n.chat.id, {
|
|
1649
|
+
knowledge_id: ((F = u.knowledge) == null ? void 0 : F.id) ?? "",
|
|
1626
1650
|
message_id: l,
|
|
1627
1651
|
matches: k,
|
|
1628
|
-
score:
|
|
1652
|
+
score: w
|
|
1629
1653
|
});
|
|
1630
1654
|
},
|
|
1631
1655
|
deleteRate(l) {
|
|
1632
1656
|
if (!n.chat)
|
|
1633
1657
|
throw new $("Chat is not initialized");
|
|
1634
|
-
return
|
|
1658
|
+
return s.track("agent-rate-delete", { type: "text" }), m.deleteRating(u.id, n.chat.id, l);
|
|
1635
1659
|
},
|
|
1636
1660
|
async speak(l) {
|
|
1637
1661
|
var k, R, P;
|
|
1638
|
-
function
|
|
1662
|
+
function w() {
|
|
1639
1663
|
if (typeof l == "string") {
|
|
1640
|
-
if (!
|
|
1664
|
+
if (!u.presenter.voice)
|
|
1641
1665
|
throw new $("Presenter voice is not initialized");
|
|
1642
1666
|
return {
|
|
1643
1667
|
type: "text",
|
|
1644
|
-
provider:
|
|
1668
|
+
provider: u.presenter.voice,
|
|
1645
1669
|
input: l,
|
|
1646
1670
|
ssml: !1
|
|
1647
1671
|
};
|
|
1648
1672
|
}
|
|
1649
1673
|
if (l.type === "text" && !l.provider) {
|
|
1650
|
-
if (!
|
|
1674
|
+
if (!u.presenter.voice)
|
|
1651
1675
|
throw new $("Presenter voice is not initialized");
|
|
1652
1676
|
return {
|
|
1653
1677
|
type: "text",
|
|
1654
|
-
provider:
|
|
1678
|
+
provider: u.presenter.voice,
|
|
1655
1679
|
input: l.input,
|
|
1656
1680
|
ssml: l.ssml
|
|
1657
1681
|
};
|
|
1658
1682
|
}
|
|
1659
1683
|
return l;
|
|
1660
1684
|
}
|
|
1661
|
-
const v =
|
|
1662
|
-
if (
|
|
1663
|
-
id:
|
|
1685
|
+
const v = w();
|
|
1686
|
+
if (s.track("agent-speak", v), G.update(), n.messages && v.type === "text" && (n.messages.push({
|
|
1687
|
+
id: Z(),
|
|
1664
1688
|
role: "assistant",
|
|
1665
1689
|
content: v.input,
|
|
1666
|
-
parts:
|
|
1690
|
+
parts: ne(v.input),
|
|
1667
1691
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1668
1692
|
}), (R = (k = t.callbacks).onNewMessage) == null || R.call(k, [...n.messages], "answer")), Ct(n.chatMode))
|
|
1669
1693
|
return {
|
|
@@ -1675,52 +1699,53 @@ async function vr(e, t) {
|
|
|
1675
1699
|
throw new $("Please connect to the agent first");
|
|
1676
1700
|
return n.streamingManager.speak({
|
|
1677
1701
|
script: v,
|
|
1678
|
-
metadata: { chat_id: (P = n.chat) == null ? void 0 : P.id, agent_id:
|
|
1702
|
+
metadata: { chat_id: (P = n.chat) == null ? void 0 : P.id, agent_id: u.id }
|
|
1679
1703
|
});
|
|
1680
1704
|
},
|
|
1681
1705
|
interrupt: _,
|
|
1682
|
-
registerClientTool:
|
|
1706
|
+
registerClientTool: O,
|
|
1683
1707
|
unregisterClientTool: V
|
|
1684
1708
|
};
|
|
1685
1709
|
}
|
|
1686
1710
|
export {
|
|
1687
|
-
|
|
1688
|
-
|
|
1711
|
+
ae as A,
|
|
1712
|
+
X as B,
|
|
1689
1713
|
z as C,
|
|
1690
1714
|
lt as D,
|
|
1691
1715
|
ze as H,
|
|
1692
1716
|
dt as K,
|
|
1693
1717
|
rt as N,
|
|
1694
|
-
|
|
1718
|
+
it as P,
|
|
1695
1719
|
ot as R,
|
|
1696
1720
|
x as S,
|
|
1697
1721
|
pe as T,
|
|
1698
1722
|
at as U,
|
|
1699
1723
|
$ as V,
|
|
1700
1724
|
nt as W,
|
|
1701
|
-
|
|
1702
|
-
|
|
1725
|
+
Ut as a,
|
|
1726
|
+
H as b,
|
|
1703
1727
|
He as c,
|
|
1704
1728
|
le as d,
|
|
1705
1729
|
Ne as e,
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1730
|
+
A as f,
|
|
1731
|
+
re as g,
|
|
1732
|
+
Yt as h,
|
|
1733
|
+
vr as i,
|
|
1710
1734
|
S as j,
|
|
1711
|
-
|
|
1712
|
-
|
|
1735
|
+
st as k,
|
|
1736
|
+
G as l,
|
|
1713
1737
|
Ze as m,
|
|
1714
|
-
|
|
1715
|
-
|
|
1738
|
+
wr as n,
|
|
1739
|
+
b as o,
|
|
1716
1740
|
et as p,
|
|
1717
1741
|
ut as q,
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1742
|
+
xt as r,
|
|
1743
|
+
ct as s,
|
|
1744
|
+
be as t,
|
|
1745
|
+
Fe as u,
|
|
1746
|
+
mt as v,
|
|
1747
|
+
yr as w,
|
|
1724
1748
|
hr as x,
|
|
1725
|
-
|
|
1749
|
+
pr as y,
|
|
1750
|
+
Rt as z
|
|
1726
1751
|
};
|