@d-id/client-sdk 1.1.68 → 1.1.69
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-BPiQZpON.js → index-WcVCCl5y.js} +428 -408
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +6 -6
- package/dist/{livekit-client.esm-RGXA_gNu.js → livekit-client.esm-DypJ_fOm.js} +97 -72
- package/dist/{livekit-manager-BtTtY9lx.js → livekit-manager-vNfdN45F.js} +2 -2
- package/dist/src/auth/get-auth-header.d.ts +1 -0
- package/dist/src/services/socket-manager/message-queue.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Z = (e, t, r) =>
|
|
1
|
+
var Oe = Object.defineProperty;
|
|
2
|
+
var He = (e, t, r) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var Z = (e, t, r) => He(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
class ce extends Error {
|
|
5
5
|
constructor({ kind: r, description: a, error: c }) {
|
|
6
6
|
super(JSON.stringify({ kind: r, description: a }));
|
|
@@ -10,7 +10,7 @@ class ce extends Error {
|
|
|
10
10
|
this.kind = r, this.description = a, this.error = c;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
class
|
|
13
|
+
class qe extends ce {
|
|
14
14
|
constructor(t, r) {
|
|
15
15
|
super({
|
|
16
16
|
kind: "ChatCreationFailed",
|
|
@@ -18,25 +18,25 @@ class Oe extends ce {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class
|
|
21
|
+
class Xe extends ce {
|
|
22
22
|
constructor(t) {
|
|
23
23
|
super({ kind: "ChatModeDowngraded", description: `Chat mode downgraded to ${t}` });
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class Q extends ce {
|
|
27
27
|
constructor(r, a) {
|
|
28
28
|
super({ kind: "ValidationError", description: r });
|
|
29
29
|
Z(this, "key");
|
|
30
30
|
this.key = a;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class Ye extends ce {
|
|
34
34
|
constructor(t) {
|
|
35
35
|
super({ kind: "WSError", description: t });
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
var
|
|
39
|
-
const
|
|
38
|
+
var Ge = /* @__PURE__ */ ((e) => (e.TRIAL = "trial", e.BASIC = "basic", e.ENTERPRISE = "enterprise", e.LITE = "lite", e.ADVANCED = "advanced", e))(Ge || {}), Qe = /* @__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))(Qe || {}), Ze = /* @__PURE__ */ ((e) => (e.Created = "created", e.Started = "started", e.Done = "done", e.Error = "error", e.Rejected = "rejected", e.Ready = "ready", e))(Ze || {}), et = /* @__PURE__ */ ((e) => (e.Unrated = "Unrated", e.Positive = "Positive", e.Negative = "Negative", e))(et || {}), x = /* @__PURE__ */ ((e) => (e.Functional = "Functional", e.TextOnly = "TextOnly", e.Maintenance = "Maintenance", e.Playground = "Playground", e.DirectPlayback = "DirectPlayback", e.Off = "Off", e))(x || {}), z = /* @__PURE__ */ ((e) => (e.Embed = "embed", e.Query = "query", e.Partial = "partial", e.Answer = "answer", e.Transcribe = "transcribe", e.Complete = "done", e))(z || {}), tt = /* @__PURE__ */ ((e) => (e.KnowledgeProcessing = "knowledge/processing", e.KnowledgeIndexing = "knowledge/indexing", e.KnowledgeFailed = "knowledge/error", e.KnowledgeDone = "knowledge/done", e))(tt || {}), rt = /* @__PURE__ */ ((e) => (e.Knowledge = "knowledge", e.Document = "document", e.Record = "record", e))(rt || {}), nt = /* @__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))(nt || {}), je = /* @__PURE__ */ ((e) => (e.Clip = "clip", e.Talk = "talk", e.Expressive = "expressive", e))(je || {});
|
|
39
|
+
const or = (e) => {
|
|
40
40
|
switch (e) {
|
|
41
41
|
case "clip":
|
|
42
42
|
return "clip";
|
|
@@ -48,12 +48,36 @@ const sr = (e) => {
|
|
|
48
48
|
throw new Error(`Unknown video type: ${e}`);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
var
|
|
52
|
-
const
|
|
53
|
-
},
|
|
51
|
+
var k = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(k || {}), te = /* @__PURE__ */ ((e) => (e.Strong = "STRONG", e.Weak = "WEAK", e.Unknown = "UNKNOWN", e))(te || {}), ne = /* @__PURE__ */ ((e) => (e.Idle = "IDLE", e.Loading = "LOADING", e.Talking = "TALKING", e.ToolActive = "TOOL_ACTIVE", e))(ne || {}), P = /* @__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))(P || {}), L = /* @__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))(L || {}), W = /* @__PURE__ */ ((e) => (e.Legacy = "legacy", e.Fluent = "fluent", e))(W || {}), pe = /* @__PURE__ */ ((e) => (e.Livekit = "livekit", e))(pe || {}), at = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.AzureOpenAi = "azure-openai", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(at || {}), it = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(it || {});
|
|
52
|
+
const cr = (...e) => {
|
|
53
|
+
}, Be = (e) => new Promise((t) => setTimeout(t, e)), G = (e = 16) => {
|
|
54
54
|
const t = new Uint8Array(e);
|
|
55
55
|
return window.crypto.getRandomValues(t), Array.from(t, (r) => r.toString(16).padStart(2, "0")).join("").slice(0, 13);
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
|
+
function ue(e) {
|
|
58
|
+
if (e !== void 0)
|
|
59
|
+
return window.localStorage.setItem("did_external_key_id", e), e;
|
|
60
|
+
let t = window.localStorage.getItem("did_external_key_id");
|
|
61
|
+
if (!t) {
|
|
62
|
+
let r = G();
|
|
63
|
+
window.localStorage.setItem("did_external_key_id", r), t = r;
|
|
64
|
+
}
|
|
65
|
+
return t;
|
|
66
|
+
}
|
|
67
|
+
let $e = G();
|
|
68
|
+
function st() {
|
|
69
|
+
$e = G();
|
|
70
|
+
}
|
|
71
|
+
function ze(e, t) {
|
|
72
|
+
if (e.type === "bearer")
|
|
73
|
+
return `Bearer ${e.token}`;
|
|
74
|
+
if (e.type === "basic")
|
|
75
|
+
return `Basic ${"token" in e ? e.token : btoa(`${e.username}:${e.password}`)}`;
|
|
76
|
+
if (e.type === "key")
|
|
77
|
+
return `Client-Key ${e.clientKey}.${ue(t)}_${$e}`;
|
|
78
|
+
throw new Error(`Unknown auth type: ${e}`);
|
|
79
|
+
}
|
|
80
|
+
const ot = 45 * 1e3, ct = "X-Playground-Chat", de = "https://api.d-id.com", dt = "wss://notifications.d-id.com", lt = "79f81a83a67430be2bc0fd61042b8faa", Fe = (e) => e.type === "clip" && e.presenter_id.startsWith("v2_") ? "clip_v2" : e.type, ut = (e) => {
|
|
57
81
|
switch (e.type) {
|
|
58
82
|
case "expressive":
|
|
59
83
|
return "v4";
|
|
@@ -62,13 +86,13 @@ const at = 45 * 1e3, it = "X-Playground-Chat", de = "https://api.d-id.com", st =
|
|
|
62
86
|
case "talk":
|
|
63
87
|
return "v2";
|
|
64
88
|
}
|
|
65
|
-
},
|
|
66
|
-
function
|
|
89
|
+
}, mt = (e) => e.type === "talk" ? e.source_url : e.presenter_id, he = (e) => e === je.Expressive, ft = (e) => [x.TextOnly, x.Playground, x.Maintenance].includes(e), Ne = (e) => e && [x.DirectPlayback, x.Off].includes(e), Se = /\[!\[([^\[\]]*)\]\(([^)\s]+)\)\]\(([^)\s]+)\)/g, ke = /!\[([^\[\]]*)\]\(([^)\s]+)\)/g, gt = [".mp4", ".webm", ".mkv", ".mov", ".m4v", ".ogv"];
|
|
90
|
+
function pt(e) {
|
|
67
91
|
const t = e.split("?")[0].split("#")[0].toLowerCase();
|
|
68
|
-
return
|
|
92
|
+
return gt.some((r) => t.endsWith(r));
|
|
69
93
|
}
|
|
70
|
-
const Re = new RegExp("(?<!!)\\[([^\\[\\]]+)\\]\\(([^)\\s]+)\\)", "g"),
|
|
71
|
-
function
|
|
94
|
+
const Re = new RegExp("(?<!!)\\[([^\\[\\]]+)\\]\\(([^)\\s]+)\\)", "g"), Ie = /<a\s+href="([^"]*)"[^>]*?>([^<]*)<\/a>/gi;
|
|
95
|
+
function ht(e) {
|
|
72
96
|
if (e.length === 0)
|
|
73
97
|
return [];
|
|
74
98
|
const t = [];
|
|
@@ -83,7 +107,7 @@ function ft(e) {
|
|
|
83
107
|
if (!t.some((o) => r.index >= o.index && r.index < o.index + o.length)) {
|
|
84
108
|
const o = r[2], n = r[1];
|
|
85
109
|
let i;
|
|
86
|
-
|
|
110
|
+
pt(o) ? i = { type: "video", src: o, alt: n } : (i = { type: "image", src: o, alt: n }, o.toLowerCase().endsWith(".gif") && (i.mimeType = "image/gif")), t.push({ index: r.index, length: r[0].length, part: i });
|
|
87
111
|
}
|
|
88
112
|
for (Re.lastIndex = 0; (r = Re.exec(e)) !== null; )
|
|
89
113
|
t.some((o) => r.index >= o.index && r.index < o.index + o.length) || t.push({
|
|
@@ -91,7 +115,7 @@ function ft(e) {
|
|
|
91
115
|
length: r[0].length,
|
|
92
116
|
part: { type: "link", href: r[2], label: r[1] }
|
|
93
117
|
});
|
|
94
|
-
for (
|
|
118
|
+
for (Ie.lastIndex = 0; (r = Ie.exec(e)) !== null; )
|
|
95
119
|
t.some((o) => r.index >= o.index && r.index < o.index + o.length) || t.push({
|
|
96
120
|
index: r.index,
|
|
97
121
|
length: r[0].length,
|
|
@@ -106,11 +130,11 @@ function ft(e) {
|
|
|
106
130
|
s.index > c && a.push({ type: "text", text: e.slice(c, s.index) }), a.push(s.part), c = s.index + s.length;
|
|
107
131
|
return c < e.length && a.push({ type: "text", text: e.slice(c) }), a;
|
|
108
132
|
}
|
|
109
|
-
let
|
|
133
|
+
let De = "", le = [];
|
|
110
134
|
function re(e) {
|
|
111
|
-
return e ===
|
|
135
|
+
return e === De || (De = e, le = ht(e)), le;
|
|
112
136
|
}
|
|
113
|
-
function
|
|
137
|
+
function wt(e, t) {
|
|
114
138
|
let r;
|
|
115
139
|
return {
|
|
116
140
|
promise: new Promise((c, s) => {
|
|
@@ -119,7 +143,7 @@ function gt(e, t) {
|
|
|
119
143
|
clear: () => clearTimeout(r)
|
|
120
144
|
};
|
|
121
145
|
}
|
|
122
|
-
async function
|
|
146
|
+
async function me(e, t) {
|
|
123
147
|
const r = {
|
|
124
148
|
limit: (t == null ? void 0 : t.limit) ?? 3,
|
|
125
149
|
delayMs: (t == null ? void 0 : t.delayMs) ?? 0,
|
|
@@ -134,47 +158,27 @@ async function ue(e, t) {
|
|
|
134
158
|
try {
|
|
135
159
|
if (!r.timeout)
|
|
136
160
|
return await e();
|
|
137
|
-
const { promise: s, clear: o } =
|
|
161
|
+
const { promise: s, clear: o } = wt(r.timeout, r.timeoutErrorMessage), n = e().finally(o);
|
|
138
162
|
return await Promise.race([n, s]);
|
|
139
163
|
} catch (s) {
|
|
140
164
|
if (a = s, !r.shouldRetryFn(s) || c >= r.limit)
|
|
141
165
|
throw s;
|
|
142
|
-
await
|
|
166
|
+
await Be(r.delayMs), r.onRetry(s);
|
|
143
167
|
}
|
|
144
168
|
throw a;
|
|
145
169
|
}
|
|
146
|
-
|
|
147
|
-
if (e !== void 0)
|
|
148
|
-
return window.localStorage.setItem("did_external_key_id", e), e;
|
|
149
|
-
let t = window.localStorage.getItem("did_external_key_id");
|
|
150
|
-
if (!t) {
|
|
151
|
-
let r = Q();
|
|
152
|
-
window.localStorage.setItem("did_external_key_id", r), t = r;
|
|
153
|
-
}
|
|
154
|
-
return t;
|
|
155
|
-
}
|
|
156
|
-
let ht = Q();
|
|
157
|
-
function ze(e, t) {
|
|
158
|
-
if (e.type === "bearer")
|
|
159
|
-
return `Bearer ${e.token}`;
|
|
160
|
-
if (e.type === "basic")
|
|
161
|
-
return `Basic ${"token" in e ? e.token : btoa(`${e.username}:${e.password}`)}`;
|
|
162
|
-
if (e.type === "key")
|
|
163
|
-
return `Client-Key ${e.clientKey}.${me(t)}_${ht}`;
|
|
164
|
-
throw new Error(`Unknown auth type: ${e}`);
|
|
165
|
-
}
|
|
166
|
-
const pt = (e) => ue(e, {
|
|
170
|
+
const vt = (e) => me(e, {
|
|
167
171
|
limit: 3,
|
|
168
172
|
delayMs: 1e3,
|
|
169
173
|
timeout: 0,
|
|
170
174
|
shouldRetryFn: (t) => t.status === 429
|
|
171
175
|
});
|
|
172
|
-
function
|
|
176
|
+
function Ve(e, t = de, r, a) {
|
|
173
177
|
const c = async (s, o) => {
|
|
174
178
|
const { skipErrorHandler: n, ...i } = o || {};
|
|
175
179
|
let d;
|
|
176
180
|
try {
|
|
177
|
-
d = await
|
|
181
|
+
d = await vt(
|
|
178
182
|
() => fetch(t + (s != null && s.startsWith("/") ? s : `/${s}`), {
|
|
179
183
|
...i,
|
|
180
184
|
headers: {
|
|
@@ -209,8 +213,8 @@ function Fe(e, t = de, r, a) {
|
|
|
209
213
|
}
|
|
210
214
|
};
|
|
211
215
|
}
|
|
212
|
-
function
|
|
213
|
-
const c =
|
|
216
|
+
function yt(e, t = de, r, a) {
|
|
217
|
+
const c = Ve(e, `${t}/agents`, r, a);
|
|
214
218
|
return {
|
|
215
219
|
create(s, o) {
|
|
216
220
|
return c.post("/", s, o);
|
|
@@ -247,7 +251,7 @@ function wt(e, t = de, r, a) {
|
|
|
247
251
|
}
|
|
248
252
|
};
|
|
249
253
|
}
|
|
250
|
-
function
|
|
254
|
+
function Ct(e) {
|
|
251
255
|
var c, s, o, n;
|
|
252
256
|
const t = () => /Mobi|Android/i.test(navigator.userAgent) ? "Mobile" : "Desktop", r = () => {
|
|
253
257
|
const i = navigator.platform;
|
|
@@ -258,20 +262,20 @@ function vt(e) {
|
|
|
258
262
|
isMobile: `${t() == "Mobile"}`,
|
|
259
263
|
browser: navigator.userAgent,
|
|
260
264
|
origin: window.location.origin,
|
|
261
|
-
agentType:
|
|
265
|
+
agentType: Fe(a),
|
|
262
266
|
agentVoice: {
|
|
263
267
|
voiceId: (s = (c = e.presenter) == null ? void 0 : c.voice) == null ? void 0 : s.voice_id,
|
|
264
268
|
provider: (n = (o = e.presenter) == null ? void 0 : o.voice) == null ? void 0 : n.type
|
|
265
269
|
}
|
|
266
270
|
};
|
|
267
271
|
}
|
|
268
|
-
function
|
|
272
|
+
function St(e) {
|
|
269
273
|
var r, a, c, s, o, n;
|
|
270
274
|
const t = (r = e.llm) == null ? void 0 : r.prompt_customization;
|
|
271
275
|
return {
|
|
272
|
-
agentType:
|
|
273
|
-
presenterType:
|
|
274
|
-
presenter:
|
|
276
|
+
agentType: Fe(e.presenter),
|
|
277
|
+
presenterType: ut(e.presenter),
|
|
278
|
+
presenter: mt(e.presenter),
|
|
275
279
|
owner_id: e.owner_id ?? "",
|
|
276
280
|
promptVersion: (a = e.llm) == null ? void 0 : a.prompt_version,
|
|
277
281
|
behavior: {
|
|
@@ -290,8 +294,8 @@ function yt(e) {
|
|
|
290
294
|
...e.access === "public" ? { from: "agent-template" } : {}
|
|
291
295
|
};
|
|
292
296
|
}
|
|
293
|
-
const
|
|
294
|
-
function
|
|
297
|
+
const kt = (e) => e.reduce((t, r) => t + r, 0), Me = (e) => kt(e) / e.length;
|
|
298
|
+
function Rt(e, t, r) {
|
|
295
299
|
var i, d, m;
|
|
296
300
|
const { event: a, ...c } = e, { template: s } = (t == null ? void 0 : t.llm) || {}, { language: o } = ((i = t == null ? void 0 : t.presenter) == null ? void 0 : i.voice) || {};
|
|
297
301
|
return {
|
|
@@ -305,19 +309,19 @@ function St(e, t, r) {
|
|
|
305
309
|
function Ee(e) {
|
|
306
310
|
"requestIdleCallback" in window ? requestIdleCallback(e, { timeout: 2e3 }) : setTimeout(e, 0);
|
|
307
311
|
}
|
|
308
|
-
const
|
|
309
|
-
function
|
|
312
|
+
const It = "https://api-js.mixpanel.com/track/?verbose=1&ip=1";
|
|
313
|
+
function Dt(e) {
|
|
310
314
|
const t = window != null && window.hasOwnProperty("DID_AGENTS_API") ? "agents-ui" : "agents-sdk", r = {};
|
|
311
315
|
return {
|
|
312
316
|
token: e.token || "testKey",
|
|
313
|
-
distinct_id:
|
|
317
|
+
distinct_id: ue(e.externalId),
|
|
314
318
|
agentId: e.agentId,
|
|
315
319
|
additionalProperties: {
|
|
316
|
-
id:
|
|
320
|
+
id: ue(e.externalId),
|
|
317
321
|
...e.mixpanelAdditionalProperties || {}
|
|
318
322
|
},
|
|
319
323
|
isEnabled: e.isEnabled ?? !0,
|
|
320
|
-
getRandom:
|
|
324
|
+
getRandom: G,
|
|
321
325
|
enrich(a) {
|
|
322
326
|
this.additionalProperties = { ...this.additionalProperties, ...a };
|
|
323
327
|
},
|
|
@@ -350,7 +354,7 @@ function Rt(e) {
|
|
|
350
354
|
])
|
|
351
355
|
})
|
|
352
356
|
};
|
|
353
|
-
return fetch(
|
|
357
|
+
return fetch(It, d).catch((m) => console.error("Analytics tracking error:", m)), Promise.resolve();
|
|
354
358
|
},
|
|
355
359
|
linkTrack(a, c, s, o) {
|
|
356
360
|
r[a] || (r[a] = { events: {}, resolvedDependencies: [] }), o.includes(s) || o.push(s);
|
|
@@ -376,22 +380,22 @@ function we() {
|
|
|
376
380
|
get: (t = !1) => t ? Date.now() - e : e
|
|
377
381
|
};
|
|
378
382
|
}
|
|
379
|
-
const H = we(), fe = we(),
|
|
380
|
-
function
|
|
381
|
-
return e === x.Playground ? { headers: { [
|
|
383
|
+
const H = we(), fe = we(), _e = we();
|
|
384
|
+
function Ke(e) {
|
|
385
|
+
return e === x.Playground ? { headers: { [ct]: "true" } } : {};
|
|
382
386
|
}
|
|
383
|
-
async function
|
|
387
|
+
async function Ue(e, t, r, a, c = !1, s) {
|
|
384
388
|
try {
|
|
385
|
-
return !s &&
|
|
389
|
+
return !s && !Ne(a) && (s = await t.newChat(e.id, { persist: c }, Ke(a)), r.track("agent-chat", {
|
|
386
390
|
event: "created",
|
|
387
391
|
chatId: s.id,
|
|
388
392
|
mode: a
|
|
389
393
|
})), { chat: s, chatMode: (s == null ? void 0 : s.chat_mode) ?? a };
|
|
390
394
|
} catch (o) {
|
|
391
|
-
throw
|
|
395
|
+
throw Mt(o) === "InsufficientCreditsError" ? new Error("InsufficientCreditsError") : new Error("Cannot create new chat");
|
|
392
396
|
}
|
|
393
397
|
}
|
|
394
|
-
const
|
|
398
|
+
const Mt = (e) => {
|
|
395
399
|
try {
|
|
396
400
|
const t = JSON.parse(e.message);
|
|
397
401
|
return t == null ? void 0 : t.kind;
|
|
@@ -399,10 +403,10 @@ const Dt = (e) => {
|
|
|
399
403
|
return "UnknownError";
|
|
400
404
|
}
|
|
401
405
|
};
|
|
402
|
-
function
|
|
406
|
+
function Et(e) {
|
|
403
407
|
return e && e.length > 0 ? e : [];
|
|
404
408
|
}
|
|
405
|
-
function
|
|
409
|
+
function _t(e) {
|
|
406
410
|
return new Promise((t, r) => {
|
|
407
411
|
const { callbacks: a, host: c, auth: s, externalId: o } = e, { onMessage: n = null, onOpen: i = null, onClose: d = null, onError: m = null } = a || {}, l = new WebSocket(`${c}?authorization=${encodeURIComponent(ze(s, o))}`);
|
|
408
412
|
l.onmessage = n, l.onclose = d, l.onerror = (w) => {
|
|
@@ -412,28 +416,28 @@ function Mt(e) {
|
|
|
412
416
|
};
|
|
413
417
|
});
|
|
414
418
|
}
|
|
415
|
-
async function
|
|
419
|
+
async function Tt(e) {
|
|
416
420
|
const { retries: t = 1 } = e;
|
|
417
421
|
let r = null;
|
|
418
422
|
for (let a = 0; (r == null ? void 0 : r.readyState) !== WebSocket.OPEN; a++)
|
|
419
423
|
try {
|
|
420
|
-
r = await
|
|
424
|
+
r = await _t(e);
|
|
421
425
|
} catch (c) {
|
|
422
426
|
if (a === t)
|
|
423
427
|
throw c;
|
|
424
|
-
await
|
|
428
|
+
await Be(a * 500);
|
|
425
429
|
}
|
|
426
430
|
return r;
|
|
427
431
|
}
|
|
428
|
-
async function
|
|
429
|
-
const c = r != null && r.onMessage ? [r.onMessage] : [], s = await
|
|
432
|
+
async function At(e, t, r, a) {
|
|
433
|
+
const c = r != null && r.onMessage ? [r.onMessage] : [], s = await Tt({
|
|
430
434
|
auth: e,
|
|
431
435
|
host: t,
|
|
432
436
|
externalId: a,
|
|
433
437
|
callbacks: {
|
|
434
438
|
onError: (o) => {
|
|
435
439
|
var n;
|
|
436
|
-
return (n = r.onError) == null ? void 0 : n.call(r, new
|
|
440
|
+
return (n = r.onError) == null ? void 0 : n.call(r, new Ye(o));
|
|
437
441
|
},
|
|
438
442
|
onMessage(o) {
|
|
439
443
|
const n = JSON.parse(o.data);
|
|
@@ -447,7 +451,7 @@ async function Tt(e, t, r, a) {
|
|
|
447
451
|
subscribeToEvents: (o) => c.push(o)
|
|
448
452
|
};
|
|
449
453
|
}
|
|
450
|
-
function
|
|
454
|
+
function Te(e) {
|
|
451
455
|
if (e.answer !== void 0)
|
|
452
456
|
return e.answer;
|
|
453
457
|
let t = 0, r = "";
|
|
@@ -458,9 +462,7 @@ function _t(e) {
|
|
|
458
462
|
function bt(e, t, r) {
|
|
459
463
|
if (!e.content)
|
|
460
464
|
return;
|
|
461
|
-
const a =
|
|
462
|
-
(a == null ? void 0 : a.role) === "assistant" && !a.interrupted && (a.interrupted = !0);
|
|
463
|
-
const c = {
|
|
465
|
+
const a = {
|
|
464
466
|
id: e.id || `user-${Date.now()}`,
|
|
465
467
|
role: e.role,
|
|
466
468
|
content: e.content,
|
|
@@ -468,73 +470,91 @@ function bt(e, t, r) {
|
|
|
468
470
|
created_at: e.created_at || (/* @__PURE__ */ new Date()).toISOString(),
|
|
469
471
|
transcribed: !0
|
|
470
472
|
};
|
|
471
|
-
t.messages.push(
|
|
473
|
+
t.messages.push(a), r == null || r([...t.messages], "user");
|
|
472
474
|
}
|
|
473
|
-
function
|
|
474
|
-
if (e ===
|
|
475
|
+
function xt(e, t, r, a, c, s, o) {
|
|
476
|
+
if (e === z.Transcribe && t.content) {
|
|
475
477
|
bt(t, a, c);
|
|
476
478
|
return;
|
|
477
479
|
}
|
|
478
|
-
if (!(e ===
|
|
480
|
+
if (!(e === z.Partial || e === z.Answer))
|
|
481
|
+
return;
|
|
482
|
+
const n = a.messages[a.messages.length - 1];
|
|
483
|
+
if (e === z.Answer && (n == null ? void 0 : n.role) === "user" && o === "partial")
|
|
479
484
|
return;
|
|
480
|
-
const
|
|
481
|
-
let
|
|
482
|
-
if ((
|
|
483
|
-
|
|
484
|
-
else if (!
|
|
485
|
-
|
|
485
|
+
const d = o === "answer";
|
|
486
|
+
let m;
|
|
487
|
+
if ((n == null ? void 0 : n.role) === "assistant" && !d)
|
|
488
|
+
m = n;
|
|
489
|
+
else if (!n || n.role === "user" || d)
|
|
490
|
+
d && s(), m = {
|
|
486
491
|
id: t.id || `assistant-${Date.now()}`,
|
|
487
492
|
role: t.role || "assistant",
|
|
488
493
|
content: t.content || "",
|
|
489
494
|
parts: [],
|
|
490
495
|
created_at: t.created_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
491
|
-
}, a.messages.push(
|
|
496
|
+
}, a.messages.push(m);
|
|
492
497
|
else
|
|
493
498
|
return;
|
|
494
|
-
const { content:
|
|
495
|
-
e ===
|
|
496
|
-
|
|
497
|
-
|
|
499
|
+
const { content: l, sequence: w } = t;
|
|
500
|
+
if (e === z.Partial)
|
|
501
|
+
r[w] = l;
|
|
502
|
+
else {
|
|
503
|
+
const y = Te(r);
|
|
504
|
+
!!(l && l.length < y.length) && (m.interrupted = !0), r.answer = l;
|
|
505
|
+
}
|
|
506
|
+
const p = Te(r);
|
|
507
|
+
(m.content !== p || e === z.Answer) && (m.content = p, m.parts = re(p), c == null || c([...a.messages], e));
|
|
498
508
|
}
|
|
499
|
-
function
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
509
|
+
function Lt(e, t, r, a, c) {
|
|
510
|
+
const s = {}, o = () => {
|
|
511
|
+
for (const d of Object.keys(s))
|
|
512
|
+
delete s[d];
|
|
513
|
+
};
|
|
514
|
+
let n = null;
|
|
503
515
|
const i = (d, m) => {
|
|
504
516
|
var l, w;
|
|
505
|
-
m === "user" && o(),
|
|
517
|
+
m === "user" && o(), (w = (l = r.callbacks).onNewMessage) == null || w.call(l, d, m);
|
|
506
518
|
};
|
|
507
519
|
return {
|
|
508
520
|
clearQueue: o,
|
|
509
521
|
onMessage: (d, m) => {
|
|
510
522
|
var l, w;
|
|
511
523
|
if ("content" in m) {
|
|
512
|
-
const
|
|
513
|
-
|
|
524
|
+
const p = d === P.ChatAnswer ? z.Answer : d === P.ChatAudioTranscribed ? z.Transcribe : d;
|
|
525
|
+
xt(
|
|
526
|
+
p,
|
|
527
|
+
m,
|
|
528
|
+
s,
|
|
529
|
+
t,
|
|
530
|
+
i,
|
|
531
|
+
o,
|
|
532
|
+
n
|
|
533
|
+
), p === z.Partial ? n = "partial" : p === z.Answer && (n = "answer", o()), p === z.Answer && e.track("agent-message-received", {
|
|
514
534
|
content: m.content,
|
|
515
535
|
messages: t.messages.length,
|
|
516
536
|
mode: t.chatMode
|
|
517
537
|
});
|
|
518
538
|
} else {
|
|
519
|
-
const
|
|
520
|
-
if (d = d, d ===
|
|
521
|
-
const
|
|
522
|
-
if ((
|
|
523
|
-
const $ = { ...
|
|
524
|
-
t.messages[t.messages.length - 1] = $, i == null || i([...t.messages], n);
|
|
539
|
+
const p = P, y = [p.StreamVideoDone, p.StreamVideoError, p.StreamVideoRejected], B = [p.StreamFailed, p.StreamVideoError, p.StreamVideoRejected], M = Rt(m, a, { mode: t.chatMode });
|
|
540
|
+
if (d = d, d === p.StreamVideoCreated && (e.linkTrack("agent-video", M, p.StreamVideoCreated, ["start"]), m.sentiment)) {
|
|
541
|
+
const I = t.messages[t.messages.length - 1];
|
|
542
|
+
if ((I == null ? void 0 : I.role) === "assistant") {
|
|
543
|
+
const $ = { ...I, sentiment: m.sentiment };
|
|
544
|
+
t.messages[t.messages.length - 1] = $, i == null || i([...t.messages], n ?? "answer");
|
|
525
545
|
}
|
|
526
546
|
}
|
|
527
|
-
if (
|
|
528
|
-
const
|
|
529
|
-
B.includes(d) ? e.track("agent-video", { ...M, event:
|
|
547
|
+
if (y.includes(d)) {
|
|
548
|
+
const I = d.split("/")[1];
|
|
549
|
+
B.includes(d) ? e.track("agent-video", { ...M, event: I }) : e.linkTrack("agent-video", { ...M, event: I }, d, ["done"]);
|
|
530
550
|
}
|
|
531
|
-
B.includes(d) && ((w = (l = r.callbacks).onError) == null || w.call(l, new Error(`Stream failed with event ${d}`), { data: m })), m.event ===
|
|
551
|
+
B.includes(d) && ((w = (l = r.callbacks).onError) == null || w.call(l, new Error(`Stream failed with event ${d}`), { data: m })), m.event === p.StreamDone && c();
|
|
532
552
|
}
|
|
533
553
|
}
|
|
534
554
|
};
|
|
535
555
|
}
|
|
536
|
-
function
|
|
537
|
-
const c =
|
|
556
|
+
function Pt(e, t, r, a) {
|
|
557
|
+
const c = Ve(e, `${t}/agents/${r}`, a);
|
|
538
558
|
return {
|
|
539
559
|
createStream(s, o) {
|
|
540
560
|
return c.post("/streams", s, { signal: o });
|
|
@@ -570,8 +590,8 @@ function Lt(e, t, r, a) {
|
|
|
570
590
|
}
|
|
571
591
|
};
|
|
572
592
|
}
|
|
573
|
-
const
|
|
574
|
-
function
|
|
593
|
+
const jt = (e, t) => (r, a) => e && console.log(`[${t}] ${r}`, a ?? "");
|
|
594
|
+
function Bt(e, t, r) {
|
|
575
595
|
const a = (t.timestamp - e.timestamp) / 1e3;
|
|
576
596
|
return {
|
|
577
597
|
duration: a,
|
|
@@ -591,7 +611,7 @@ function jt(e, t, r) {
|
|
|
591
611
|
lowFpsCount: r
|
|
592
612
|
};
|
|
593
613
|
}
|
|
594
|
-
function
|
|
614
|
+
function $t(e) {
|
|
595
615
|
return e.filter(
|
|
596
616
|
(t) => t.freezeCount > 0 || t.framesPerSecond < 21 || t.framesDropped > 0 || t.packetsLost > 0
|
|
597
617
|
).map((t) => {
|
|
@@ -602,7 +622,7 @@ function Bt(e) {
|
|
|
602
622
|
};
|
|
603
623
|
});
|
|
604
624
|
}
|
|
605
|
-
function
|
|
625
|
+
function zt(e) {
|
|
606
626
|
var o;
|
|
607
627
|
let t = "", r = 0, a = null;
|
|
608
628
|
const c = /* @__PURE__ */ new Map();
|
|
@@ -637,7 +657,7 @@ function $t(e) {
|
|
|
637
657
|
freezeDuration: s.totalFreezesDuration
|
|
638
658
|
};
|
|
639
659
|
}
|
|
640
|
-
function
|
|
660
|
+
function Ae(e, t, r) {
|
|
641
661
|
const a = e.map((i, d) => d === 0 ? r ? {
|
|
642
662
|
timestamp: i.timestamp,
|
|
643
663
|
duration: 0,
|
|
@@ -689,14 +709,14 @@ function _e(e, t, r) {
|
|
|
689
709
|
framesPerSecond: i.framesPerSecond,
|
|
690
710
|
freezeCount: i.freezeCount - e[d - 1].freezeCount,
|
|
691
711
|
freezeDuration: i.freezeDuration - e[d - 1].freezeDuration
|
|
692
|
-
}), c =
|
|
712
|
+
}), c = $t(a), s = c.reduce((i, d) => i + (d.causes.includes("low fps") ? 1 : 0), 0), o = a.filter((i) => !!i.avgJitterDelayInInterval).map((i) => i.avgJitterDelayInInterval), n = a.filter((i) => !!i.rtt).map((i) => i.rtt);
|
|
693
713
|
return {
|
|
694
714
|
webRTCStats: {
|
|
695
715
|
anomalies: c,
|
|
696
716
|
minRtt: Math.min(...n),
|
|
697
717
|
avgRtt: Me(n),
|
|
698
718
|
maxRtt: Math.max(...n),
|
|
699
|
-
aggregateReport:
|
|
719
|
+
aggregateReport: Bt(e[0], e[e.length - 1], s),
|
|
700
720
|
minJitterDelayInInterval: Math.min(...o),
|
|
701
721
|
maxJitterDelayInInterval: Math.max(...o),
|
|
702
722
|
avgJitterDelayInInterval: Me(o)
|
|
@@ -705,14 +725,14 @@ function _e(e, t, r) {
|
|
|
705
725
|
resolution: `${e[0].frameWidth}x${e[0].frameHeight}`
|
|
706
726
|
};
|
|
707
727
|
}
|
|
708
|
-
function
|
|
728
|
+
function We(e, t) {
|
|
709
729
|
for (const r of e.values())
|
|
710
730
|
if ((r == null ? void 0 : r.type) === "inbound-rtp" && r.kind === t)
|
|
711
731
|
return r;
|
|
712
732
|
return null;
|
|
713
733
|
}
|
|
714
734
|
const ee = 10;
|
|
715
|
-
function
|
|
735
|
+
function dr(e, t) {
|
|
716
736
|
let r = !1, a = !1, c = null, s = 0, o = 0, n = {};
|
|
717
737
|
async function i() {
|
|
718
738
|
if (r) {
|
|
@@ -722,7 +742,7 @@ function cr(e, t) {
|
|
|
722
742
|
c = setTimeout(i, ee);
|
|
723
743
|
return;
|
|
724
744
|
}
|
|
725
|
-
const m =
|
|
745
|
+
const m = We(d, "audio");
|
|
726
746
|
if (!m) {
|
|
727
747
|
c = setTimeout(i, ee);
|
|
728
748
|
return;
|
|
@@ -732,8 +752,8 @@ function cr(e, t) {
|
|
|
732
752
|
s = l, o = w, a = !0, c = setTimeout(i, ee);
|
|
733
753
|
return;
|
|
734
754
|
}
|
|
735
|
-
const
|
|
736
|
-
if (s = l, o = w,
|
|
755
|
+
const p = l - s, y = w - o;
|
|
756
|
+
if (s = l, o = w, y > 0 && p > 0) {
|
|
737
757
|
r = !1, t(n);
|
|
738
758
|
return;
|
|
739
759
|
}
|
|
@@ -751,11 +771,11 @@ function cr(e, t) {
|
|
|
751
771
|
}
|
|
752
772
|
};
|
|
753
773
|
}
|
|
754
|
-
const oe = 100,
|
|
755
|
-
function
|
|
774
|
+
const oe = 100, Ft = Math.max(Math.ceil(400 / oe), 1), Nt = 0.25, Vt = 0.28;
|
|
775
|
+
function Kt() {
|
|
756
776
|
let e = 0, t, r, a = 0;
|
|
757
777
|
return (c) => {
|
|
758
|
-
const s =
|
|
778
|
+
const s = We(c, "video");
|
|
759
779
|
if (!s)
|
|
760
780
|
return { isReceiving: !1, avgJitterDelayInInterval: a };
|
|
761
781
|
const o = s.jitterBufferDelay, n = s.jitterBufferEmittedCount;
|
|
@@ -768,19 +788,19 @@ function Vt() {
|
|
|
768
788
|
return e = i, { isReceiving: d, avgJitterDelayInInterval: a, freezeCount: s.freezeCount };
|
|
769
789
|
};
|
|
770
790
|
}
|
|
771
|
-
function
|
|
772
|
-
let s = null, o = [], n, i = 0, d = !1, m = te.Unknown, l = te.Unknown, w = 0,
|
|
773
|
-
const
|
|
791
|
+
function Ut(e, t, r, a, c) {
|
|
792
|
+
let s = null, o = [], n, i = 0, d = !1, m = te.Unknown, l = te.Unknown, w = 0, p = 0;
|
|
793
|
+
const y = Kt();
|
|
774
794
|
async function B() {
|
|
775
795
|
const M = await e();
|
|
776
796
|
if (!M)
|
|
777
797
|
return;
|
|
778
|
-
const { isReceiving:
|
|
779
|
-
if (
|
|
780
|
-
i = 0, w =
|
|
781
|
-
else if (d && (i++, i >=
|
|
782
|
-
const J =
|
|
783
|
-
a == null || a(
|
|
798
|
+
const { isReceiving: I, avgJitterDelayInInterval: $, freezeCount: T } = y(M), q = zt(M);
|
|
799
|
+
if (I)
|
|
800
|
+
i = 0, w = T - p, l = $ < Nt ? te.Strong : $ > Vt && w > 1 ? te.Weak : m, l !== m && (c == null || c(l), m = l, p += w, w = 0), d || (a == null || a(k.Start), n = o[o.length - 1], o = [], d = !0), o.push(q);
|
|
801
|
+
else if (d && (i++, i >= Ft)) {
|
|
802
|
+
const J = Ae(o, oe, n);
|
|
803
|
+
a == null || a(k.Stop, J), t() || r(), p = T, d = !1;
|
|
784
804
|
}
|
|
785
805
|
}
|
|
786
806
|
return {
|
|
@@ -790,10 +810,10 @@ function Kt(e, t, r, a, c) {
|
|
|
790
810
|
stop: () => {
|
|
791
811
|
s && (clearInterval(s), s = null);
|
|
792
812
|
},
|
|
793
|
-
getReport: () =>
|
|
813
|
+
getReport: () => Ae(o, oe, n)
|
|
794
814
|
};
|
|
795
815
|
}
|
|
796
|
-
const
|
|
816
|
+
const Wt = (window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection).bind(window);
|
|
797
817
|
function be(e) {
|
|
798
818
|
switch (e) {
|
|
799
819
|
case "connected":
|
|
@@ -814,7 +834,7 @@ function be(e) {
|
|
|
814
834
|
return L.New;
|
|
815
835
|
}
|
|
816
836
|
}
|
|
817
|
-
const
|
|
837
|
+
const Jt = (e) => (t) => {
|
|
818
838
|
const [r, a = ""] = t.split(/:(.+)/);
|
|
819
839
|
try {
|
|
820
840
|
const c = JSON.parse(a);
|
|
@@ -823,16 +843,16 @@ const Wt = (e) => (t) => {
|
|
|
823
843
|
return e("Failed to parse data channel message, returning data as string", { subject: r, rawData: a, error: c }), { subject: r, data: a };
|
|
824
844
|
}
|
|
825
845
|
};
|
|
826
|
-
function
|
|
846
|
+
function Ot({
|
|
827
847
|
statsSignal: e,
|
|
828
848
|
dataChannelSignal: t,
|
|
829
849
|
onVideoStateChange: r,
|
|
830
850
|
report: a,
|
|
831
851
|
log: c
|
|
832
852
|
}) {
|
|
833
|
-
e ===
|
|
853
|
+
e === k.Start && t === k.Start ? (c("CALLBACK: onVideoStateChange(Start)"), r == null || r(k.Start)) : e === k.Stop && t === k.Stop && (c("CALLBACK: onVideoStateChange(Stop)"), r == null || r(k.Stop, a));
|
|
834
854
|
}
|
|
835
|
-
function
|
|
855
|
+
function Ht({
|
|
836
856
|
statsSignal: e,
|
|
837
857
|
dataChannelSignal: t,
|
|
838
858
|
onVideoStateChange: r,
|
|
@@ -840,9 +860,9 @@ function Ot({
|
|
|
840
860
|
report: c,
|
|
841
861
|
log: s
|
|
842
862
|
}) {
|
|
843
|
-
e ===
|
|
863
|
+
e === k.Start ? (s("CALLBACK: onVideoStateChange(Start)"), r == null || r(k.Start)) : e === k.Stop && (s("CALLBACK: onVideoStateChange(Stop)"), r == null || r(k.Stop, c)), t === k.Start ? a == null || a(ne.Talking) : t === k.Stop && (a == null || a(ne.Idle));
|
|
844
864
|
}
|
|
845
|
-
function
|
|
865
|
+
function xe({
|
|
846
866
|
statsSignal: e,
|
|
847
867
|
dataChannelSignal: t,
|
|
848
868
|
onVideoStateChange: r,
|
|
@@ -851,7 +871,7 @@ function Ae({
|
|
|
851
871
|
report: s,
|
|
852
872
|
log: o
|
|
853
873
|
}) {
|
|
854
|
-
c === W.Legacy ?
|
|
874
|
+
c === W.Legacy ? Ot({ statsSignal: e, dataChannelSignal: t, onVideoStateChange: r, report: s, log: o }) : c === W.Fluent && Ht({
|
|
855
875
|
statsSignal: e,
|
|
856
876
|
dataChannelSignal: t,
|
|
857
877
|
onVideoStateChange: r,
|
|
@@ -860,45 +880,45 @@ function Ae({
|
|
|
860
880
|
log: o
|
|
861
881
|
});
|
|
862
882
|
}
|
|
863
|
-
async function
|
|
883
|
+
async function qt(e, t, { debug: r = !1, callbacks: a, auth: c, baseURL: s = de, analytics: o }, n) {
|
|
864
884
|
var E;
|
|
865
|
-
const i =
|
|
866
|
-
let m = !1, l = !1, w =
|
|
867
|
-
const { startConnection:
|
|
885
|
+
const i = jt(r, "WebRTCStreamingManager"), d = Jt(i);
|
|
886
|
+
let m = !1, l = !1, w = k.Stop, p = k.Stop;
|
|
887
|
+
const { startConnection: y, sendStreamRequest: B, close: M, createStream: I, addIceCandidate: $ } = Pt(
|
|
868
888
|
c,
|
|
869
889
|
s,
|
|
870
890
|
e,
|
|
871
891
|
a.onError
|
|
872
892
|
), {
|
|
873
|
-
id:
|
|
893
|
+
id: T,
|
|
874
894
|
offer: q,
|
|
875
895
|
ice_servers: J,
|
|
876
|
-
session_id:
|
|
896
|
+
session_id: V,
|
|
877
897
|
fluent: X,
|
|
878
898
|
interrupt_enabled: O
|
|
879
|
-
} = await
|
|
880
|
-
(E = a.onStreamCreated) == null || E.call(a, { stream_id:
|
|
881
|
-
const
|
|
882
|
-
if (!
|
|
899
|
+
} = await I(t, n);
|
|
900
|
+
(E = a.onStreamCreated) == null || E.call(a, { stream_id: T, session_id: V, agent_id: e });
|
|
901
|
+
const D = new Wt({ iceServers: J }), Y = D.createDataChannel("JanusDataChannel");
|
|
902
|
+
if (!V)
|
|
883
903
|
throw new Error("Could not create session_id");
|
|
884
|
-
const
|
|
904
|
+
const K = X ? W.Fluent : W.Legacy;
|
|
885
905
|
o.enrich({
|
|
886
|
-
"stream-type":
|
|
906
|
+
"stream-type": K
|
|
887
907
|
});
|
|
888
908
|
const ae = t.stream_warmup && !X, ie = () => m, u = () => {
|
|
889
909
|
var f;
|
|
890
910
|
m = !0, l && (i("CALLBACK: onConnectionStateChange(Connected)"), (f = a.onConnectionStateChange) == null || f.call(a, L.Connected));
|
|
891
|
-
}, g =
|
|
892
|
-
() =>
|
|
911
|
+
}, g = Ut(
|
|
912
|
+
() => D.getStats(),
|
|
893
913
|
ie,
|
|
894
914
|
u,
|
|
895
|
-
(f, h) =>
|
|
896
|
-
statsSignal:
|
|
897
|
-
dataChannelSignal:
|
|
915
|
+
(f, h) => xe({
|
|
916
|
+
statsSignal: p = f,
|
|
917
|
+
dataChannelSignal: K === W.Legacy ? w : void 0,
|
|
898
918
|
onVideoStateChange: a.onVideoStateChange,
|
|
899
919
|
onAgentActivityStateChange: a.onAgentActivityStateChange,
|
|
900
920
|
report: h,
|
|
901
|
-
streamType:
|
|
921
|
+
streamType: K,
|
|
902
922
|
log: i
|
|
903
923
|
}),
|
|
904
924
|
(f) => {
|
|
@@ -906,82 +926,82 @@ async function Ht(e, t, { debug: r = !1, callbacks: a, auth: c, baseURL: s = de,
|
|
|
906
926
|
return (h = a.onConnectivityStateChange) == null ? void 0 : h.call(a, f);
|
|
907
927
|
}
|
|
908
928
|
);
|
|
909
|
-
g.start(),
|
|
929
|
+
g.start(), D.onicecandidate = (f) => {
|
|
910
930
|
var h;
|
|
911
931
|
i("peerConnection.onicecandidate", f);
|
|
912
932
|
try {
|
|
913
933
|
f.candidate && f.candidate.sdpMid && f.candidate.sdpMLineIndex !== null ? $(
|
|
914
|
-
|
|
934
|
+
T,
|
|
915
935
|
{
|
|
916
936
|
candidate: f.candidate.candidate,
|
|
917
937
|
sdpMid: f.candidate.sdpMid,
|
|
918
938
|
sdpMLineIndex: f.candidate.sdpMLineIndex
|
|
919
939
|
},
|
|
920
|
-
|
|
940
|
+
V,
|
|
921
941
|
n
|
|
922
|
-
) : $(
|
|
923
|
-
} catch (
|
|
924
|
-
(h = a.onError) == null || h.call(a,
|
|
942
|
+
) : $(T, { candidate: null }, V, n);
|
|
943
|
+
} catch (A) {
|
|
944
|
+
(h = a.onError) == null || h.call(a, A, { streamId: T });
|
|
925
945
|
}
|
|
926
946
|
}, Y.onopen = () => {
|
|
927
947
|
l = !0, (!ae || m) && u();
|
|
928
948
|
};
|
|
929
|
-
let
|
|
930
|
-
const
|
|
949
|
+
let v = null;
|
|
950
|
+
const C = (f) => {
|
|
931
951
|
var h;
|
|
932
|
-
|
|
952
|
+
v = f, (h = a.onVideoIdChange) == null || h.call(a, f);
|
|
933
953
|
};
|
|
934
|
-
function
|
|
954
|
+
function S(f, h) {
|
|
935
955
|
if (f === P.StreamStarted && typeof h == "object" && "metadata" in h) {
|
|
936
|
-
const
|
|
937
|
-
|
|
956
|
+
const A = h.metadata;
|
|
957
|
+
C(A.videoId);
|
|
938
958
|
}
|
|
939
|
-
f === P.StreamDone &&
|
|
940
|
-
statsSignal:
|
|
959
|
+
f === P.StreamDone && C(null), w = f === P.StreamStarted ? k.Start : k.Stop, xe({
|
|
960
|
+
statsSignal: K === W.Legacy ? p : void 0,
|
|
941
961
|
dataChannelSignal: w,
|
|
942
962
|
onVideoStateChange: a.onVideoStateChange,
|
|
943
963
|
onAgentActivityStateChange: a.onAgentActivityStateChange,
|
|
944
|
-
streamType:
|
|
964
|
+
streamType: K,
|
|
945
965
|
log: i
|
|
946
966
|
});
|
|
947
967
|
}
|
|
948
968
|
function R(f, h) {
|
|
949
|
-
var
|
|
950
|
-
const
|
|
951
|
-
|
|
969
|
+
var _;
|
|
970
|
+
const A = typeof h == "string" ? h : h == null ? void 0 : h.metadata;
|
|
971
|
+
A && o.enrich({ streamMetadata: A }), (_ = a.onStreamReady) == null || _.call(a);
|
|
952
972
|
}
|
|
953
973
|
const j = {
|
|
954
|
-
[P.StreamStarted]:
|
|
955
|
-
[P.StreamDone]:
|
|
974
|
+
[P.StreamStarted]: S,
|
|
975
|
+
[P.StreamDone]: S,
|
|
956
976
|
[P.StreamReady]: R
|
|
957
977
|
};
|
|
958
978
|
Y.onmessage = (f) => {
|
|
959
|
-
var
|
|
960
|
-
const { subject: h, data:
|
|
961
|
-
(
|
|
962
|
-
},
|
|
979
|
+
var _;
|
|
980
|
+
const { subject: h, data: A } = d(f.data);
|
|
981
|
+
(_ = j[h]) == null || _.call(j, h, A);
|
|
982
|
+
}, D.oniceconnectionstatechange = () => {
|
|
963
983
|
var h;
|
|
964
|
-
i("peerConnection.oniceconnectionstatechange => " +
|
|
965
|
-
const f = be(
|
|
984
|
+
i("peerConnection.oniceconnectionstatechange => " + D.iceConnectionState);
|
|
985
|
+
const f = be(D.iceConnectionState);
|
|
966
986
|
f !== L.Connected && ((h = a.onConnectionStateChange) == null || h.call(a, f));
|
|
967
|
-
},
|
|
987
|
+
}, D.ontrack = (f) => {
|
|
968
988
|
var h;
|
|
969
989
|
i("peerConnection.ontrack", f), i("CALLBACK: onSrcObjectReady"), (h = a.onSrcObjectReady) == null || h.call(a, f.streams[0]);
|
|
970
|
-
}, await
|
|
971
|
-
const
|
|
972
|
-
i("create answer OK"), await
|
|
973
|
-
function
|
|
974
|
-
var h,
|
|
990
|
+
}, await D.setRemoteDescription(q), i("set remote description OK");
|
|
991
|
+
const F = await D.createAnswer();
|
|
992
|
+
i("create answer OK"), await D.setLocalDescription(F), i("set local description OK"), await y(T, F, V, n), i("start connection OK");
|
|
993
|
+
function N(f) {
|
|
994
|
+
var h, A;
|
|
975
995
|
if (!m || Y.readyState !== "open") {
|
|
976
996
|
i("Data channel is not ready for sending messages"), (h = a.onError) == null || h.call(a, new Error("Data channel is not ready for sending messages"), {
|
|
977
|
-
streamId:
|
|
997
|
+
streamId: T
|
|
978
998
|
});
|
|
979
999
|
return;
|
|
980
1000
|
}
|
|
981
1001
|
try {
|
|
982
1002
|
Y.send(f);
|
|
983
|
-
} catch (
|
|
984
|
-
i("Error sending data channel message",
|
|
1003
|
+
} catch (_) {
|
|
1004
|
+
i("Error sending data channel message", _), (A = a.onError) == null || A.call(a, _, { streamId: T });
|
|
985
1005
|
}
|
|
986
1006
|
}
|
|
987
1007
|
return {
|
|
@@ -990,72 +1010,72 @@ async function Ht(e, t, { debug: r = !1, callbacks: a, auth: c, baseURL: s = de,
|
|
|
990
1010
|
* @param payload
|
|
991
1011
|
*/
|
|
992
1012
|
speak(f) {
|
|
993
|
-
return B(
|
|
1013
|
+
return B(T, V, f);
|
|
994
1014
|
},
|
|
995
1015
|
/**
|
|
996
1016
|
* Method to close RTC connection
|
|
997
1017
|
*/
|
|
998
1018
|
async disconnect() {
|
|
999
1019
|
var f;
|
|
1000
|
-
if (
|
|
1001
|
-
const h = be(
|
|
1002
|
-
if (
|
|
1020
|
+
if (T) {
|
|
1021
|
+
const h = be(D.iceConnectionState);
|
|
1022
|
+
if (D) {
|
|
1003
1023
|
if (h === L.New) {
|
|
1004
1024
|
g.stop();
|
|
1005
1025
|
return;
|
|
1006
1026
|
}
|
|
1007
|
-
|
|
1027
|
+
D.close(), D.oniceconnectionstatechange = null, D.onnegotiationneeded = null, D.onicecandidate = null, D.ontrack = null;
|
|
1008
1028
|
}
|
|
1009
1029
|
try {
|
|
1010
|
-
h === L.Connected && await M(
|
|
1030
|
+
h === L.Connected && await M(T, V).catch((A) => {
|
|
1011
1031
|
});
|
|
1012
|
-
} catch (
|
|
1013
|
-
i("Error on close stream connection",
|
|
1032
|
+
} catch (A) {
|
|
1033
|
+
i("Error on close stream connection", A);
|
|
1014
1034
|
}
|
|
1015
1035
|
(f = a.onAgentActivityStateChange) == null || f.call(a, ne.Idle), g.stop();
|
|
1016
1036
|
}
|
|
1017
1037
|
},
|
|
1018
|
-
sendDataChannelMessage:
|
|
1038
|
+
sendDataChannelMessage: N,
|
|
1019
1039
|
/**
|
|
1020
1040
|
* Session identifier information, should be returned in the body of all streaming requests
|
|
1021
1041
|
*/
|
|
1022
|
-
sessionId:
|
|
1042
|
+
sessionId: V,
|
|
1023
1043
|
/**
|
|
1024
1044
|
* Id of current RTC stream
|
|
1025
1045
|
*/
|
|
1026
|
-
streamId:
|
|
1027
|
-
streamType:
|
|
1046
|
+
streamId: T,
|
|
1047
|
+
streamType: K,
|
|
1028
1048
|
interruptAvailable: O ?? !1,
|
|
1029
1049
|
isInterruptible: !0,
|
|
1030
1050
|
interrupt(f) {
|
|
1031
1051
|
if (!O)
|
|
1032
1052
|
throw new Error("Interrupt is not enabled for this stream");
|
|
1033
|
-
if (
|
|
1053
|
+
if (K !== W.Fluent)
|
|
1034
1054
|
throw new Error("Interrupt only available for Fluent streams");
|
|
1035
|
-
if (!
|
|
1055
|
+
if (!v)
|
|
1036
1056
|
throw new Error("No active video to interrupt");
|
|
1037
1057
|
const h = {
|
|
1038
1058
|
type: P.StreamInterrupt,
|
|
1039
|
-
videoId:
|
|
1059
|
+
videoId: v,
|
|
1040
1060
|
timestamp: Date.now()
|
|
1041
1061
|
};
|
|
1042
|
-
|
|
1062
|
+
N(JSON.stringify(h));
|
|
1043
1063
|
}
|
|
1044
1064
|
};
|
|
1045
1065
|
}
|
|
1046
1066
|
var ge = /* @__PURE__ */ ((e) => (e.V1 = "v1", e.V2 = "v2", e))(ge || {});
|
|
1047
|
-
async function
|
|
1067
|
+
async function Xt(e, t, r, a) {
|
|
1048
1068
|
const c = e.id;
|
|
1049
1069
|
switch (t.version) {
|
|
1050
1070
|
case "v1": {
|
|
1051
1071
|
const { version: s, ...o } = t;
|
|
1052
|
-
return
|
|
1072
|
+
return qt(c, o, r, a);
|
|
1053
1073
|
}
|
|
1054
1074
|
case "v2": {
|
|
1055
1075
|
const { version: s, ...o } = t;
|
|
1056
1076
|
switch (o.transport.provider) {
|
|
1057
|
-
case
|
|
1058
|
-
const { createLiveKitStreamingManager: n } = await import("./livekit-manager-
|
|
1077
|
+
case pe.Livekit:
|
|
1078
|
+
const { createLiveKitStreamingManager: n } = await import("./livekit-manager-vNfdN45F.js");
|
|
1059
1079
|
return n(c, o, r);
|
|
1060
1080
|
default:
|
|
1061
1081
|
throw new Error(`Unsupported transport provider: ${o.transport.provider}`);
|
|
@@ -1065,15 +1085,15 @@ async function qt(e, t, r, a) {
|
|
|
1065
1085
|
throw new Error(`Invalid stream version: ${t.version}`);
|
|
1066
1086
|
}
|
|
1067
1087
|
}
|
|
1068
|
-
const
|
|
1069
|
-
function
|
|
1088
|
+
const Yt = "cht";
|
|
1089
|
+
function Gt() {
|
|
1070
1090
|
return {
|
|
1071
1091
|
transport: {
|
|
1072
|
-
provider:
|
|
1092
|
+
provider: pe.Livekit
|
|
1073
1093
|
}
|
|
1074
1094
|
};
|
|
1075
1095
|
}
|
|
1076
|
-
function
|
|
1096
|
+
function Qt(e) {
|
|
1077
1097
|
var c, s;
|
|
1078
1098
|
const { streamOptions: t } = e ?? {}, r = ((c = e == null ? void 0 : e.mixpanelAdditionalProperties) == null ? void 0 : c.plan) !== void 0 ? {
|
|
1079
1099
|
plan: (s = e.mixpanelAdditionalProperties) == null ? void 0 : s.plan
|
|
@@ -1086,17 +1106,17 @@ function Gt(e) {
|
|
|
1086
1106
|
fluent: t == null ? void 0 : t.fluent
|
|
1087
1107
|
}, ...r && { end_user_data: r } };
|
|
1088
1108
|
}
|
|
1089
|
-
function
|
|
1090
|
-
return
|
|
1109
|
+
function Zt(e, t) {
|
|
1110
|
+
return he(e.presenter.type) ? { version: ge.V2, ...Gt() } : { version: ge.V1, ...Qt(t) };
|
|
1091
1111
|
}
|
|
1092
|
-
function
|
|
1112
|
+
function er(e, t, r) {
|
|
1093
1113
|
r.track("agent-connection-state-change", { state: e, ...t && { reason: t } });
|
|
1094
1114
|
}
|
|
1095
|
-
function er(e, t, r, a, c) {
|
|
1096
|
-
c === W.Fluent ? tr(e, t, r, a, c) : rr(e, t, r, a, c);
|
|
1097
|
-
}
|
|
1098
1115
|
function tr(e, t, r, a, c) {
|
|
1099
|
-
|
|
1116
|
+
c === W.Fluent ? rr(e, t, r, a, c) : nr(e, t, r, a, c);
|
|
1117
|
+
}
|
|
1118
|
+
function rr(e, t, r, a, c) {
|
|
1119
|
+
e === k.Start ? a.track("stream-session", { event: "start", "stream-type": c }) : e === k.Stop && a.track("stream-session", {
|
|
1100
1120
|
event: "stop",
|
|
1101
1121
|
is_greenscreen: t.presenter.type === "clip" && t.presenter.is_greenscreen,
|
|
1102
1122
|
background: t.presenter.type === "clip" && t.presenter.background,
|
|
@@ -1104,10 +1124,10 @@ function tr(e, t, r, a, c) {
|
|
|
1104
1124
|
...r
|
|
1105
1125
|
});
|
|
1106
1126
|
}
|
|
1107
|
-
function
|
|
1108
|
-
e ===
|
|
1127
|
+
function Le(e, t, r, a, c) {
|
|
1128
|
+
e === k.Start ? r.linkTrack("agent-video", { event: "start", ...c, "stream-type": a }, "start", [
|
|
1109
1129
|
P.StreamVideoCreated
|
|
1110
|
-
]) : e ===
|
|
1130
|
+
]) : e === k.Stop && r.linkTrack(
|
|
1111
1131
|
"agent-video",
|
|
1112
1132
|
{
|
|
1113
1133
|
event: "stop",
|
|
@@ -1119,13 +1139,13 @@ function xe(e, t, r, a, c) {
|
|
|
1119
1139
|
[P.StreamVideoDone]
|
|
1120
1140
|
);
|
|
1121
1141
|
}
|
|
1122
|
-
function
|
|
1123
|
-
e ===
|
|
1142
|
+
function nr(e, t, r, a, c) {
|
|
1143
|
+
e === k.Start ? a.linkTrack(
|
|
1124
1144
|
"agent-video",
|
|
1125
1145
|
{ event: "start", latency: H.get(!0), "stream-type": c },
|
|
1126
1146
|
"start",
|
|
1127
1147
|
[P.StreamVideoCreated]
|
|
1128
|
-
) : e ===
|
|
1148
|
+
) : e === k.Stop && a.linkTrack(
|
|
1129
1149
|
"agent-video",
|
|
1130
1150
|
{
|
|
1131
1151
|
event: "stop",
|
|
@@ -1138,7 +1158,7 @@ function rr(e, t, r, a, c) {
|
|
|
1138
1158
|
[P.StreamVideoDone]
|
|
1139
1159
|
);
|
|
1140
1160
|
}
|
|
1141
|
-
function
|
|
1161
|
+
function ar(e, t, r) {
|
|
1142
1162
|
const a = {
|
|
1143
1163
|
call_id: t.call_id,
|
|
1144
1164
|
name: t.name
|
|
@@ -1155,17 +1175,17 @@ function nr(e, t, r) {
|
|
|
1155
1175
|
extra_keys: c.extra ? Object.keys(c.extra).length : 0
|
|
1156
1176
|
});
|
|
1157
1177
|
}
|
|
1158
|
-
function
|
|
1159
|
-
return H.reset(),
|
|
1178
|
+
function Pe(e, t, r, a) {
|
|
1179
|
+
return H.reset(), _e.update(), new Promise(async (c, s) => {
|
|
1160
1180
|
try {
|
|
1161
1181
|
let o, n = !1;
|
|
1162
|
-
const i =
|
|
1182
|
+
const i = Zt(e, t);
|
|
1163
1183
|
r.enrich({
|
|
1164
1184
|
"stream-version": i.version.toString()
|
|
1165
1185
|
});
|
|
1166
1186
|
let d = null;
|
|
1167
1187
|
const m = e.presenter.type === "expressive";
|
|
1168
|
-
o = await
|
|
1188
|
+
o = await Xt(
|
|
1169
1189
|
e,
|
|
1170
1190
|
i,
|
|
1171
1191
|
{
|
|
@@ -1174,12 +1194,12 @@ function Le(e, t, r, a) {
|
|
|
1174
1194
|
callbacks: {
|
|
1175
1195
|
...t.callbacks,
|
|
1176
1196
|
onConnectionStateChange: (l, w) => {
|
|
1177
|
-
var
|
|
1178
|
-
(
|
|
1197
|
+
var p, y;
|
|
1198
|
+
(y = (p = t.callbacks).onConnectionStateChange) == null || y.call(p, l), er(l, w, r), l === L.Connected && (o ? c(o) : n = !0);
|
|
1179
1199
|
},
|
|
1180
1200
|
onVideoStateChange: (l, w) => {
|
|
1181
|
-
var
|
|
1182
|
-
(
|
|
1201
|
+
var p, y;
|
|
1202
|
+
(y = (p = t.callbacks).onVideoStateChange) == null || y.call(p, l), tr(
|
|
1183
1203
|
l,
|
|
1184
1204
|
e,
|
|
1185
1205
|
w,
|
|
@@ -1188,17 +1208,17 @@ function Le(e, t, r, a) {
|
|
|
1188
1208
|
);
|
|
1189
1209
|
},
|
|
1190
1210
|
onAgentActivityStateChange: (l) => {
|
|
1191
|
-
var w,
|
|
1192
|
-
(
|
|
1193
|
-
|
|
1194
|
-
|
|
1211
|
+
var w, p;
|
|
1212
|
+
(p = (w = t.callbacks).onAgentActivityStateChange) == null || p.call(w, l), l === ne.Talking ? (fe.update(), d = (y) => {
|
|
1213
|
+
Le(
|
|
1214
|
+
k.Start,
|
|
1195
1215
|
e,
|
|
1196
1216
|
r,
|
|
1197
1217
|
o.streamType,
|
|
1198
|
-
|
|
1218
|
+
y
|
|
1199
1219
|
), d = null;
|
|
1200
|
-
}, m || d({ latency: H.get(!0) })) : (fe.reset(), d = null,
|
|
1201
|
-
|
|
1220
|
+
}, m || d({ latency: H.get(!0) })) : (fe.reset(), d = null, Le(
|
|
1221
|
+
k.Stop,
|
|
1202
1222
|
e,
|
|
1203
1223
|
r,
|
|
1204
1224
|
o.streamType
|
|
@@ -1208,13 +1228,13 @@ function Le(e, t, r, a) {
|
|
|
1208
1228
|
d == null || d(l);
|
|
1209
1229
|
},
|
|
1210
1230
|
onStreamReady: () => {
|
|
1211
|
-
const l =
|
|
1231
|
+
const l = _e.get(!0);
|
|
1212
1232
|
r.track("agent-chat", { event: "ready", latency: l });
|
|
1213
1233
|
},
|
|
1214
|
-
onToolEvent: (l, w) => {
|
|
1215
|
-
var
|
|
1216
|
-
(
|
|
1217
|
-
}
|
|
1234
|
+
onToolEvent: ((l, w) => {
|
|
1235
|
+
var p, y;
|
|
1236
|
+
(y = (p = t.callbacks).onToolEvent) == null || y.call(p, l, w), ar(l, w, r);
|
|
1237
|
+
})
|
|
1218
1238
|
}
|
|
1219
1239
|
},
|
|
1220
1240
|
a
|
|
@@ -1224,11 +1244,11 @@ function Le(e, t, r, a) {
|
|
|
1224
1244
|
}
|
|
1225
1245
|
});
|
|
1226
1246
|
}
|
|
1227
|
-
async function
|
|
1228
|
-
var m, l, w,
|
|
1247
|
+
async function ir(e, t, r, a, c) {
|
|
1248
|
+
var m, l, w, p;
|
|
1229
1249
|
const s = async () => {
|
|
1230
|
-
if (
|
|
1231
|
-
const
|
|
1250
|
+
if (he(e.presenter.type)) {
|
|
1251
|
+
const y = await Pe(e, t, a), B = `${Yt}_${y.sessionId}`, M = (/* @__PURE__ */ new Date()).toISOString();
|
|
1232
1252
|
return { chatResult: {
|
|
1233
1253
|
chatMode: x.Functional,
|
|
1234
1254
|
chat: {
|
|
@@ -1242,35 +1262,35 @@ async function ar(e, t, r, a, c) {
|
|
|
1242
1262
|
chat_mode: x.Functional,
|
|
1243
1263
|
messages: []
|
|
1244
1264
|
}
|
|
1245
|
-
}, streamingManager:
|
|
1265
|
+
}, streamingManager: y };
|
|
1246
1266
|
} else {
|
|
1247
|
-
const
|
|
1267
|
+
const y = new AbortController(), B = y.signal;
|
|
1248
1268
|
let M;
|
|
1249
1269
|
try {
|
|
1250
|
-
const
|
|
1270
|
+
const I = Ue(
|
|
1251
1271
|
e,
|
|
1252
1272
|
r,
|
|
1253
1273
|
a,
|
|
1254
1274
|
t.mode,
|
|
1255
1275
|
t.persistentChat,
|
|
1256
1276
|
c
|
|
1257
|
-
), $ =
|
|
1258
|
-
return { chatResult:
|
|
1259
|
-
} catch (
|
|
1260
|
-
throw
|
|
1261
|
-
}),
|
|
1277
|
+
), $ = Pe(e, t, a, B).then((J) => (M = J, J)), [T, q] = await Promise.all([I, $]);
|
|
1278
|
+
return { chatResult: T, streamingManager: q };
|
|
1279
|
+
} catch (I) {
|
|
1280
|
+
throw y.abort(), M && await M.disconnect().catch(() => {
|
|
1281
|
+
}), I;
|
|
1262
1282
|
}
|
|
1263
1283
|
}
|
|
1264
1284
|
}, { chatResult: o, streamingManager: n } = await s(), { chat: i, chatMode: d } = o;
|
|
1265
|
-
return d && t.mode !== void 0 && d !== t.mode && (t.mode = d, (l = (m = t.callbacks).onModeChange) == null || l.call(m, d), d !== x.Functional) ? ((
|
|
1285
|
+
return d && t.mode !== void 0 && d !== t.mode && (t.mode = d, (l = (m = t.callbacks).onModeChange) == null || l.call(m, d), d !== x.Functional) ? ((p = (w = t.callbacks).onError) == null || p.call(w, new Xe(d)), n == null || n.disconnect(), { chat: i }) : { chat: i, streamingManager: n };
|
|
1266
1286
|
}
|
|
1267
|
-
async function
|
|
1268
|
-
var Y,
|
|
1287
|
+
async function lr(e, t) {
|
|
1288
|
+
var Y, K, ae, ie;
|
|
1269
1289
|
let r = !0;
|
|
1270
|
-
const a = t.mixpanelKey ||
|
|
1290
|
+
const a = t.mixpanelKey || lt, c = t.wsURL || dt, s = t.baseURL || de, o = t.mode || x.Functional, n = {
|
|
1271
1291
|
messages: [],
|
|
1272
1292
|
chatMode: o
|
|
1273
|
-
}, i =
|
|
1293
|
+
}, i = Dt({
|
|
1274
1294
|
token: a,
|
|
1275
1295
|
agentId: e,
|
|
1276
1296
|
isEnabled: t.enableAnalitics,
|
|
@@ -1280,67 +1300,67 @@ async function dr(e, t) {
|
|
|
1280
1300
|
Ee(() => {
|
|
1281
1301
|
i.track("agent-sdk", { event: "init" }, d);
|
|
1282
1302
|
});
|
|
1283
|
-
const m =
|
|
1303
|
+
const m = yt(t.auth, s, t.callbacks.onError, t.externalId), l = await m.getById(e);
|
|
1284
1304
|
t.debug = t.debug || ((Y = l == null ? void 0 : l.advanced_settings) == null ? void 0 : Y.ui_debug_mode);
|
|
1285
|
-
const w =
|
|
1286
|
-
i.enrich(
|
|
1287
|
-
const { onMessage:
|
|
1288
|
-
var u, g,
|
|
1289
|
-
(u = n.socketManager) == null || u.disconnect(), (
|
|
1305
|
+
const w = he(l.presenter.type);
|
|
1306
|
+
i.enrich(St(l));
|
|
1307
|
+
const { onMessage: p, clearQueue: y } = Lt(i, n, t, l, () => {
|
|
1308
|
+
var u, g, v;
|
|
1309
|
+
(u = n.socketManager) == null || u.disconnect(), (v = (g = t.callbacks).onConnectionStateChange) == null || v.call(g, L.Disconnected);
|
|
1290
1310
|
});
|
|
1291
|
-
n.messages =
|
|
1311
|
+
n.messages = Et(t.initialMessages), (ae = (K = t.callbacks).onNewMessage) == null || ae.call(K, [...n.messages], "answer");
|
|
1292
1312
|
const B = (u) => {
|
|
1293
1313
|
}, M = ({ type: u }) => {
|
|
1294
|
-
var
|
|
1295
|
-
if (!((
|
|
1314
|
+
var v, C, S, R;
|
|
1315
|
+
if (!((v = n.streamingManager) != null && v.interruptAvailable) || !((C = n.streamingManager) != null && C.isInterruptible)) return;
|
|
1296
1316
|
const g = n.messages[n.messages.length - 1];
|
|
1297
1317
|
i.track("agent-video-interrupt", {
|
|
1298
1318
|
type: u || "click",
|
|
1299
1319
|
video_duration_to_interrupt: fe.get(!0),
|
|
1300
1320
|
message_duration_to_interrupt: H.get(!0)
|
|
1301
|
-
}), g.interrupted = !0, (R = (
|
|
1302
|
-
},
|
|
1321
|
+
}), g.interrupted = !0, (R = (S = t.callbacks).onNewMessage) == null || R.call(S, [...n.messages], "answer"), n.streamingManager.interrupt(u);
|
|
1322
|
+
}, I = /* @__PURE__ */ new Map();
|
|
1303
1323
|
function $(u) {
|
|
1304
1324
|
return async (g) => {
|
|
1305
|
-
const
|
|
1306
|
-
if (!
|
|
1325
|
+
const v = I.get(u);
|
|
1326
|
+
if (!v)
|
|
1307
1327
|
throw new Error(`No handler registered for client tool: ${u}`);
|
|
1308
1328
|
try {
|
|
1309
|
-
const
|
|
1310
|
-
return await
|
|
1311
|
-
} catch (
|
|
1312
|
-
throw new Error(`Client tool "${u}" failed: ${
|
|
1329
|
+
const C = JSON.parse(g.payload);
|
|
1330
|
+
return await v(C);
|
|
1331
|
+
} catch (C) {
|
|
1332
|
+
throw new Error(`Client tool "${u}" failed: ${C.message}`);
|
|
1313
1333
|
}
|
|
1314
1334
|
};
|
|
1315
1335
|
}
|
|
1316
|
-
function
|
|
1317
|
-
var u, g,
|
|
1318
|
-
for (const [
|
|
1319
|
-
(g = (u = n.streamingManager) == null ? void 0 : u.unregisterRpcMethod) == null || g.call(u,
|
|
1336
|
+
function T() {
|
|
1337
|
+
var u, g, v, C;
|
|
1338
|
+
for (const [S] of I)
|
|
1339
|
+
(g = (u = n.streamingManager) == null ? void 0 : u.unregisterRpcMethod) == null || g.call(u, S), (C = (v = n.streamingManager) == null ? void 0 : v.registerRpcMethod) == null || C.call(v, S, $(S));
|
|
1320
1340
|
}
|
|
1321
1341
|
function q(u, g) {
|
|
1322
|
-
var
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1342
|
+
var C, S;
|
|
1343
|
+
const v = !I.has(u);
|
|
1344
|
+
I.set(u, g), v && ((S = (C = n.streamingManager) == null ? void 0 : C.registerRpcMethod) == null || S.call(C, u, $(u)));
|
|
1325
1345
|
}
|
|
1326
1346
|
function J(u) {
|
|
1327
|
-
var g,
|
|
1328
|
-
|
|
1347
|
+
var g, v;
|
|
1348
|
+
I.delete(u), (v = (g = n.streamingManager) == null ? void 0 : g.unregisterRpcMethod) == null || v.call(g, u);
|
|
1329
1349
|
}
|
|
1330
|
-
const
|
|
1350
|
+
const V = Date.now();
|
|
1331
1351
|
Ee(() => {
|
|
1332
|
-
i.track("agent-sdk", { event: "loaded", ...
|
|
1352
|
+
i.track("agent-sdk", { event: "loaded", ...Ct(l) }, V);
|
|
1333
1353
|
});
|
|
1334
1354
|
async function X(u) {
|
|
1335
|
-
var j,
|
|
1336
|
-
(
|
|
1337
|
-
const g = o === x.DirectPlayback || w ? Promise.resolve(void 0) :
|
|
1355
|
+
var j, F, N, E, f, h, A;
|
|
1356
|
+
st(), (F = (j = t.callbacks).onConnectionStateChange) == null || F.call(j, L.Connecting), H.reset(), u && !r && (delete n.chat, (E = (N = t.callbacks).onNewMessage) == null || E.call(N, [...n.messages], "answer"));
|
|
1357
|
+
const g = o === x.DirectPlayback || w ? Promise.resolve(void 0) : At(
|
|
1338
1358
|
t.auth,
|
|
1339
1359
|
c,
|
|
1340
|
-
{ onMessage:
|
|
1360
|
+
{ onMessage: p, onError: t.callbacks.onError },
|
|
1341
1361
|
t.externalId
|
|
1342
|
-
),
|
|
1343
|
-
() =>
|
|
1362
|
+
), v = me(
|
|
1363
|
+
() => ir(
|
|
1344
1364
|
l,
|
|
1345
1365
|
{
|
|
1346
1366
|
...t,
|
|
@@ -1348,7 +1368,7 @@ async function dr(e, t) {
|
|
|
1348
1368
|
callbacks: {
|
|
1349
1369
|
...t.callbacks,
|
|
1350
1370
|
onVideoIdChange: B,
|
|
1351
|
-
onMessage:
|
|
1371
|
+
onMessage: p
|
|
1352
1372
|
}
|
|
1353
1373
|
},
|
|
1354
1374
|
m,
|
|
@@ -1357,28 +1377,28 @@ async function dr(e, t) {
|
|
|
1357
1377
|
),
|
|
1358
1378
|
{
|
|
1359
1379
|
limit: 3,
|
|
1360
|
-
timeout:
|
|
1380
|
+
timeout: ot,
|
|
1361
1381
|
timeoutErrorMessage: "Timeout initializing the stream",
|
|
1362
|
-
shouldRetryFn: (
|
|
1382
|
+
shouldRetryFn: (_) => (_ == null ? void 0 : _.message) !== "Could not connect" && _.status !== 429 && (_ == null ? void 0 : _.message) !== "InsufficientCreditsError",
|
|
1363
1383
|
delayMs: 1e3
|
|
1364
1384
|
}
|
|
1365
|
-
).catch((
|
|
1366
|
-
var
|
|
1367
|
-
throw
|
|
1368
|
-
}), [
|
|
1369
|
-
R && R.id !== ((f = n.chat) == null ? void 0 : f.id) && ((
|
|
1385
|
+
).catch((_) => {
|
|
1386
|
+
var b, U;
|
|
1387
|
+
throw D(x.Maintenance), (U = (b = t.callbacks).onConnectionStateChange) == null || U.call(b, L.Fail), _;
|
|
1388
|
+
}), [C, { streamingManager: S, chat: R }] = await Promise.all([g, v]);
|
|
1389
|
+
R && R.id !== ((f = n.chat) == null ? void 0 : f.id) && ((A = (h = t.callbacks).onNewChat) == null || A.call(h, R.id)), n.streamingManager = S, n.socketManager = C, n.chat = R, T(), r = !1, i.enrich({
|
|
1370
1390
|
chatId: R == null ? void 0 : R.id,
|
|
1371
|
-
streamId:
|
|
1391
|
+
streamId: S == null ? void 0 : S.streamId,
|
|
1372
1392
|
mode: n.chatMode
|
|
1373
|
-
}),
|
|
1393
|
+
}), D((R == null ? void 0 : R.chat_mode) ?? o);
|
|
1374
1394
|
}
|
|
1375
1395
|
async function O() {
|
|
1376
|
-
var u, g,
|
|
1377
|
-
(u = n.socketManager) == null || u.disconnect(), await ((g = n.streamingManager) == null ? void 0 : g.disconnect()), delete n.streamingManager, delete n.socketManager, (
|
|
1396
|
+
var u, g, v, C;
|
|
1397
|
+
(u = n.socketManager) == null || u.disconnect(), await ((g = n.streamingManager) == null ? void 0 : g.disconnect()), delete n.streamingManager, delete n.socketManager, (C = (v = t.callbacks).onConnectionStateChange) == null || C.call(v, L.Disconnected);
|
|
1378
1398
|
}
|
|
1379
|
-
async function
|
|
1380
|
-
var g,
|
|
1381
|
-
u !== n.chatMode && (i.track("agent-mode-change", { mode: u }), n.chatMode = u, n.chatMode !== x.Functional && await O(), (
|
|
1399
|
+
async function D(u) {
|
|
1400
|
+
var g, v;
|
|
1401
|
+
u !== n.chatMode && (i.track("agent-mode-change", { mode: u }), n.chatMode = u, n.chatMode !== x.Functional && await O(), (v = (g = t.callbacks).onModeChange) == null || v.call(g, u));
|
|
1382
1402
|
}
|
|
1383
1403
|
return {
|
|
1384
1404
|
agent: l,
|
|
@@ -1392,7 +1412,7 @@ async function dr(e, t) {
|
|
|
1392
1412
|
},
|
|
1393
1413
|
starterMessages: ((ie = l.knowledge) == null ? void 0 : ie.starter_message) || [],
|
|
1394
1414
|
getSTTToken: () => m.getSTTToken(l.id),
|
|
1395
|
-
changeMode:
|
|
1415
|
+
changeMode: D,
|
|
1396
1416
|
enrichAnalytics: i.enrich,
|
|
1397
1417
|
async connect() {
|
|
1398
1418
|
await X(!0), i.track("agent-chat", {
|
|
@@ -1445,26 +1465,26 @@ async function dr(e, t) {
|
|
|
1445
1465
|
return (u = n.streamingManager) != null && u.unpublishCameraStream ? n.streamingManager.unpublishCameraStream() : Promise.resolve();
|
|
1446
1466
|
},
|
|
1447
1467
|
async chat(u) {
|
|
1448
|
-
var
|
|
1468
|
+
var S, R, j, F, N;
|
|
1449
1469
|
const g = () => {
|
|
1450
|
-
if (
|
|
1451
|
-
throw new
|
|
1470
|
+
if (Ne(o))
|
|
1471
|
+
throw new Q(`${o} is enabled, chat is disabled`);
|
|
1452
1472
|
if (u.length >= 800)
|
|
1453
|
-
throw new
|
|
1473
|
+
throw new Q("Message cannot be more than 800 characters");
|
|
1454
1474
|
if (u.length === 0)
|
|
1455
|
-
throw new
|
|
1475
|
+
throw new Q("Message cannot be empty");
|
|
1456
1476
|
if (n.chatMode === x.Maintenance)
|
|
1457
|
-
throw new
|
|
1477
|
+
throw new Q("Chat is in maintenance mode");
|
|
1458
1478
|
if (![x.TextOnly, x.Playground].includes(n.chatMode)) {
|
|
1459
1479
|
if (!n.streamingManager)
|
|
1460
|
-
throw new
|
|
1480
|
+
throw new Q("Streaming manager is not initialized");
|
|
1461
1481
|
if (!n.chat)
|
|
1462
|
-
throw new
|
|
1482
|
+
throw new Q("Chat is not initialized");
|
|
1463
1483
|
}
|
|
1464
|
-
},
|
|
1484
|
+
}, v = async () => {
|
|
1465
1485
|
var E, f;
|
|
1466
1486
|
if (!n.chat) {
|
|
1467
|
-
const h = await
|
|
1487
|
+
const h = await Ue(
|
|
1468
1488
|
l,
|
|
1469
1489
|
m,
|
|
1470
1490
|
i,
|
|
@@ -1472,37 +1492,37 @@ async function dr(e, t) {
|
|
|
1472
1492
|
t.persistentChat
|
|
1473
1493
|
);
|
|
1474
1494
|
if (!h.chat)
|
|
1475
|
-
throw new
|
|
1495
|
+
throw new qe(n.chatMode, !!t.persistentChat);
|
|
1476
1496
|
n.chat = h.chat, (f = (E = t.callbacks).onNewChat) == null || f.call(E, n.chat.id);
|
|
1477
1497
|
}
|
|
1478
1498
|
return n.chat.id;
|
|
1479
|
-
},
|
|
1499
|
+
}, C = async (E, f) => {
|
|
1480
1500
|
const h = n.chatMode === x.Playground;
|
|
1481
|
-
return
|
|
1482
|
-
var
|
|
1483
|
-
return await ((
|
|
1501
|
+
return me(w && !h ? async () => {
|
|
1502
|
+
var b, U;
|
|
1503
|
+
return await ((U = (b = n.streamingManager) == null ? void 0 : b.sendTextMessage) == null ? void 0 : U.call(b, u)), Promise.resolve({});
|
|
1484
1504
|
} : async () => {
|
|
1485
|
-
var
|
|
1505
|
+
var b, U;
|
|
1486
1506
|
return m.chat(
|
|
1487
1507
|
l.id,
|
|
1488
1508
|
f,
|
|
1489
1509
|
{
|
|
1490
1510
|
chatMode: n.chatMode,
|
|
1491
|
-
streamId: (
|
|
1492
|
-
sessionId: (
|
|
1493
|
-
messages: E.map(({ matches:
|
|
1511
|
+
streamId: (b = n.streamingManager) == null ? void 0 : b.streamId,
|
|
1512
|
+
sessionId: (U = n.streamingManager) == null ? void 0 : U.sessionId,
|
|
1513
|
+
messages: E.map(({ matches: Je, ...se }) => se)
|
|
1494
1514
|
},
|
|
1495
1515
|
{
|
|
1496
|
-
...
|
|
1516
|
+
...Ke(n.chatMode),
|
|
1497
1517
|
skipErrorHandler: !0
|
|
1498
1518
|
}
|
|
1499
1519
|
);
|
|
1500
1520
|
}, {
|
|
1501
1521
|
limit: 2,
|
|
1502
|
-
shouldRetryFn: (
|
|
1522
|
+
shouldRetryFn: (b) => {
|
|
1503
1523
|
var se, ve, ye, Ce;
|
|
1504
|
-
const
|
|
1505
|
-
return !((ve =
|
|
1524
|
+
const U = (se = b == null ? void 0 : b.message) == null ? void 0 : se.includes("missing or invalid session_id");
|
|
1525
|
+
return !((ve = b == null ? void 0 : b.message) == null ? void 0 : ve.includes("Stream Error")) && !U ? ((Ce = (ye = t.callbacks).onError) == null || Ce.call(ye, b), !1) : !0;
|
|
1506
1526
|
},
|
|
1507
1527
|
onRetry: async () => {
|
|
1508
1528
|
await O(), await X(!1);
|
|
@@ -1510,59 +1530,59 @@ async function dr(e, t) {
|
|
|
1510
1530
|
});
|
|
1511
1531
|
};
|
|
1512
1532
|
try {
|
|
1513
|
-
|
|
1514
|
-
id:
|
|
1533
|
+
y(), g(), n.messages.push({
|
|
1534
|
+
id: G(),
|
|
1515
1535
|
role: "user",
|
|
1516
1536
|
content: u,
|
|
1517
1537
|
parts: re(u),
|
|
1518
1538
|
created_at: new Date(H.update()).toISOString()
|
|
1519
|
-
}), (R = (
|
|
1520
|
-
const E = await
|
|
1521
|
-
return n.messages.push({
|
|
1522
|
-
id:
|
|
1539
|
+
}), (R = (S = t.callbacks).onNewMessage) == null || R.call(S, [...n.messages], "user");
|
|
1540
|
+
const E = await v(), f = await C([...n.messages], E);
|
|
1541
|
+
return f.result && n.messages.push({
|
|
1542
|
+
id: G(),
|
|
1523
1543
|
role: "assistant",
|
|
1524
|
-
content: f.result
|
|
1525
|
-
parts: re(f.result
|
|
1544
|
+
content: f.result,
|
|
1545
|
+
parts: re(f.result),
|
|
1526
1546
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1527
1547
|
context: f.context,
|
|
1528
1548
|
matches: f.matches
|
|
1529
1549
|
}), i.track("agent-message-send", {
|
|
1530
1550
|
event: "success",
|
|
1531
1551
|
messages: n.messages.length + 1
|
|
1532
|
-
}), f.result && ((
|
|
1552
|
+
}), f.result && ((F = (j = t.callbacks).onNewMessage) == null || F.call(j, [...n.messages], "answer"), i.track("agent-message-received", {
|
|
1533
1553
|
latency: H.get(!0),
|
|
1534
1554
|
messages: n.messages.length
|
|
1535
1555
|
})), f;
|
|
1536
1556
|
} catch (E) {
|
|
1537
|
-
throw ((
|
|
1557
|
+
throw ((N = n.messages[n.messages.length - 1]) == null ? void 0 : N.role) === "assistant" && n.messages.pop(), i.track("agent-message-send", {
|
|
1538
1558
|
event: "error",
|
|
1539
1559
|
messages: n.messages.length
|
|
1540
1560
|
}), E;
|
|
1541
1561
|
}
|
|
1542
1562
|
},
|
|
1543
|
-
rate(u, g,
|
|
1544
|
-
var R, j,
|
|
1545
|
-
const
|
|
1563
|
+
rate(u, g, v) {
|
|
1564
|
+
var R, j, F, N;
|
|
1565
|
+
const C = n.messages.find((E) => E.id === u);
|
|
1546
1566
|
if (n.chat) {
|
|
1547
|
-
if (!
|
|
1567
|
+
if (!C)
|
|
1548
1568
|
throw new Error("Message not found");
|
|
1549
1569
|
} else throw new Error("Chat is not initialized");
|
|
1550
|
-
const
|
|
1570
|
+
const S = ((R = C.matches) == null ? void 0 : R.map((E) => [E.document_id, E.id])) ?? [];
|
|
1551
1571
|
return i.track("agent-rate", {
|
|
1552
|
-
event:
|
|
1572
|
+
event: v ? "update" : "create",
|
|
1553
1573
|
thumb: g === 1 ? "up" : "down",
|
|
1554
1574
|
knowledge_id: ((j = l.knowledge) == null ? void 0 : j.id) ?? "",
|
|
1555
|
-
matches:
|
|
1575
|
+
matches: S,
|
|
1556
1576
|
score: g
|
|
1557
|
-
}),
|
|
1558
|
-
knowledge_id: ((
|
|
1577
|
+
}), v ? m.updateRating(l.id, n.chat.id, v, {
|
|
1578
|
+
knowledge_id: ((F = l.knowledge) == null ? void 0 : F.id) ?? "",
|
|
1559
1579
|
message_id: u,
|
|
1560
|
-
matches:
|
|
1580
|
+
matches: S,
|
|
1561
1581
|
score: g
|
|
1562
1582
|
}) : m.createRating(l.id, n.chat.id, {
|
|
1563
|
-
knowledge_id: ((
|
|
1583
|
+
knowledge_id: ((N = l.knowledge) == null ? void 0 : N.id) ?? "",
|
|
1564
1584
|
message_id: u,
|
|
1565
|
-
matches:
|
|
1585
|
+
matches: S,
|
|
1566
1586
|
score: g
|
|
1567
1587
|
});
|
|
1568
1588
|
},
|
|
@@ -1572,7 +1592,7 @@ async function dr(e, t) {
|
|
|
1572
1592
|
return i.track("agent-rate-delete", { type: "text" }), m.deleteRating(l.id, n.chat.id, u);
|
|
1573
1593
|
},
|
|
1574
1594
|
async speak(u) {
|
|
1575
|
-
var
|
|
1595
|
+
var S, R, j;
|
|
1576
1596
|
function g() {
|
|
1577
1597
|
if (typeof u == "string") {
|
|
1578
1598
|
if (!l.presenter.voice)
|
|
@@ -1596,14 +1616,14 @@ async function dr(e, t) {
|
|
|
1596
1616
|
}
|
|
1597
1617
|
return u;
|
|
1598
1618
|
}
|
|
1599
|
-
const
|
|
1600
|
-
if (i.track("agent-speak",
|
|
1601
|
-
id:
|
|
1619
|
+
const v = g();
|
|
1620
|
+
if (i.track("agent-speak", v), H.update(), n.messages && v.type === "text" && (n.messages.push({
|
|
1621
|
+
id: G(),
|
|
1602
1622
|
role: "assistant",
|
|
1603
|
-
content:
|
|
1604
|
-
parts: re(
|
|
1623
|
+
content: v.input,
|
|
1624
|
+
parts: re(v.input),
|
|
1605
1625
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1606
|
-
}), (R = (
|
|
1626
|
+
}), (R = (S = t.callbacks).onNewMessage) == null || R.call(S, [...n.messages], "answer")), ft(n.chatMode))
|
|
1607
1627
|
return {
|
|
1608
1628
|
duration: 0,
|
|
1609
1629
|
video_id: "",
|
|
@@ -1612,7 +1632,7 @@ async function dr(e, t) {
|
|
|
1612
1632
|
if (!n.streamingManager)
|
|
1613
1633
|
throw new Error("Please connect to the agent first");
|
|
1614
1634
|
return n.streamingManager.speak({
|
|
1615
|
-
script:
|
|
1635
|
+
script: v,
|
|
1616
1636
|
metadata: { chat_id: (j = n.chat) == null ? void 0 : j.id, agent_id: l.id }
|
|
1617
1637
|
});
|
|
1618
1638
|
},
|
|
@@ -1623,36 +1643,36 @@ async function dr(e, t) {
|
|
|
1623
1643
|
}
|
|
1624
1644
|
export {
|
|
1625
1645
|
ne as A,
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1646
|
+
z as C,
|
|
1647
|
+
nt as D,
|
|
1648
|
+
rt as K,
|
|
1649
|
+
Qe as P,
|
|
1650
|
+
et as R,
|
|
1631
1651
|
P as S,
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1652
|
+
pe as T,
|
|
1653
|
+
Ge as U,
|
|
1654
|
+
Q as V,
|
|
1655
|
+
Ye as W,
|
|
1656
|
+
jt as a,
|
|
1637
1657
|
W as b,
|
|
1638
|
-
|
|
1658
|
+
Ve as c,
|
|
1639
1659
|
de as d,
|
|
1640
1660
|
L as e,
|
|
1641
1661
|
te as f,
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1662
|
+
Ut as g,
|
|
1663
|
+
dr as h,
|
|
1664
|
+
k as i,
|
|
1665
|
+
Ze as j,
|
|
1666
|
+
qe as k,
|
|
1647
1667
|
H as l,
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1668
|
+
x as m,
|
|
1669
|
+
cr as n,
|
|
1670
|
+
Xe as o,
|
|
1671
|
+
at as p,
|
|
1672
|
+
tt as q,
|
|
1673
|
+
je as r,
|
|
1674
|
+
it as s,
|
|
1675
|
+
lr as t,
|
|
1676
|
+
or as u,
|
|
1677
|
+
ht as v
|
|
1658
1678
|
};
|