@asgard-js/core 0.1.1 → 0.1.2-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +415 -400
- package/dist/index.mjs.map +1 -1
- package/dist/lib/channel.d.ts +1 -0
- package/dist/lib/channel.d.ts.map +1 -1
- package/dist/lib/conversation.d.ts.map +1 -1
- package/dist/lib/create-sse-observable.d.ts.map +1 -1
- package/dist/types/channel.d.ts +3 -0
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/sse-response.d.ts +1 -0
- package/dist/types/sse-response.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (r, t, e) =>
|
|
4
|
-
var B = /* @__PURE__ */ ((r) => (r.RESET_CHANNEL = "RESET_CHANNEL", r.NONE = "NONE", r))(B || {}),
|
|
5
|
-
return
|
|
1
|
+
var Ue = Object.defineProperty;
|
|
2
|
+
var je = (r, t, e) => t in r ? Ue(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var m = (r, t, e) => je(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
var B = /* @__PURE__ */ ((r) => (r.RESET_CHANNEL = "RESET_CHANNEL", r.NONE = "NONE", r))(B || {}), y = /* @__PURE__ */ ((r) => (r.INIT = "asgard.run.init", r.PROCESS = "asgard.process", r.PROCESS_START = "asgard.process.start", r.PROCESS_COMPLETE = "asgard.process.complete", r.MESSAGE = "asgard.message", r.MESSAGE_START = "asgard.message.start", r.MESSAGE_DELTA = "asgard.message.delta", r.MESSAGE_COMPLETE = "asgard.message.complete", r.TOOL_CALL = "asgard.tool_call", r.TOOL_CALL_START = "asgard.tool_call.start", r.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", r.DONE = "asgard.run.done", r.ERROR = "asgard.run.error", r))(y || {}), $e = /* @__PURE__ */ ((r) => (r.TEXT = "TEXT", r.HINT = "HINT", r.BUTTON = "BUTTON", r.IMAGE = "IMAGE", r.VIDEO = "VIDEO", r.AUDIO = "AUDIO", r.LOCATION = "LOCATION", r.CAROUSEL = "CAROUSEL", r.CHART = "CHART", r))($e || {}), q = function(r, t) {
|
|
5
|
+
return q = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
|
|
6
6
|
e.__proto__ = n;
|
|
7
7
|
} || function(e, n) {
|
|
8
8
|
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
|
|
9
|
-
},
|
|
9
|
+
}, q(r, t);
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function I(r, t) {
|
|
12
12
|
if (typeof t != "function" && t !== null)
|
|
13
13
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
14
|
-
|
|
14
|
+
q(r, t);
|
|
15
15
|
function e() {
|
|
16
16
|
this.constructor = r;
|
|
17
17
|
}
|
|
@@ -24,84 +24,84 @@ function De(r, t, e, n) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
return new (e || (e = Promise))(function(o, s) {
|
|
27
|
-
function
|
|
27
|
+
function a(l) {
|
|
28
28
|
try {
|
|
29
|
-
|
|
30
|
-
} catch (
|
|
31
|
-
s(
|
|
29
|
+
u(n.next(l));
|
|
30
|
+
} catch (d) {
|
|
31
|
+
s(d);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function c(l) {
|
|
35
35
|
try {
|
|
36
|
-
|
|
37
|
-
} catch (
|
|
38
|
-
s(
|
|
36
|
+
u(n.throw(l));
|
|
37
|
+
} catch (d) {
|
|
38
|
+
s(d);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
l.done ? o(l.value) : i(l.value).then(
|
|
41
|
+
function u(l) {
|
|
42
|
+
l.done ? o(l.value) : i(l.value).then(a, c);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
u((n = n.apply(r, t || [])).next());
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function ue(r, t) {
|
|
48
48
|
var e = { label: 0, sent: function() {
|
|
49
49
|
if (o[0] & 1) throw o[1];
|
|
50
50
|
return o[1];
|
|
51
51
|
}, trys: [], ops: [] }, n, i, o, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
52
|
-
return s.next =
|
|
52
|
+
return s.next = a(0), s.throw = a(1), s.return = a(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
53
53
|
return this;
|
|
54
54
|
}), s;
|
|
55
|
-
function
|
|
55
|
+
function a(u) {
|
|
56
56
|
return function(l) {
|
|
57
|
-
return
|
|
57
|
+
return c([u, l]);
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function u
|
|
60
|
+
function c(u) {
|
|
61
61
|
if (n) throw new TypeError("Generator is already executing.");
|
|
62
|
-
for (; s && (s = 0,
|
|
63
|
-
if (n = 1, i && (o =
|
|
64
|
-
switch (i = 0, o && (
|
|
62
|
+
for (; s && (s = 0, u[0] && (e = 0)), e; ) try {
|
|
63
|
+
if (n = 1, i && (o = u[0] & 2 ? i.return : u[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, u[1])).done) return o;
|
|
64
|
+
switch (i = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
|
|
65
65
|
case 0:
|
|
66
66
|
case 1:
|
|
67
|
-
o =
|
|
67
|
+
o = u;
|
|
68
68
|
break;
|
|
69
69
|
case 4:
|
|
70
|
-
return e.label++, { value:
|
|
70
|
+
return e.label++, { value: u[1], done: !1 };
|
|
71
71
|
case 5:
|
|
72
|
-
e.label++, i =
|
|
72
|
+
e.label++, i = u[1], u = [0];
|
|
73
73
|
continue;
|
|
74
74
|
case 7:
|
|
75
|
-
|
|
75
|
+
u = e.ops.pop(), e.trys.pop();
|
|
76
76
|
continue;
|
|
77
77
|
default:
|
|
78
|
-
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (
|
|
78
|
+
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
|
|
79
79
|
e = 0;
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
|
-
if (
|
|
83
|
-
e.label =
|
|
82
|
+
if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
|
|
83
|
+
e.label = u[1];
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
|
-
if (
|
|
87
|
-
e.label = o[1], o =
|
|
86
|
+
if (u[0] === 6 && e.label < o[1]) {
|
|
87
|
+
e.label = o[1], o = u;
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
90
|
if (o && e.label < o[2]) {
|
|
91
|
-
e.label = o[2], e.ops.push(
|
|
91
|
+
e.label = o[2], e.ops.push(u);
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
o[2] && e.ops.pop(), e.trys.pop();
|
|
95
95
|
continue;
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
u = t.call(r, e);
|
|
98
98
|
} catch (l) {
|
|
99
|
-
|
|
99
|
+
u = [6, l], i = 0;
|
|
100
100
|
} finally {
|
|
101
101
|
n = o = 0;
|
|
102
102
|
}
|
|
103
|
-
if (
|
|
104
|
-
return { value:
|
|
103
|
+
if (u[0] & 5) throw u[1];
|
|
104
|
+
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
function M(r) {
|
|
@@ -120,8 +120,8 @@ function L(r, t) {
|
|
|
120
120
|
var n = e.call(r), i, o = [], s;
|
|
121
121
|
try {
|
|
122
122
|
for (; (t === void 0 || t-- > 0) && !(i = n.next()).done; ) o.push(i.value);
|
|
123
|
-
} catch (
|
|
124
|
-
s = { error:
|
|
123
|
+
} catch (a) {
|
|
124
|
+
s = { error: a };
|
|
125
125
|
} finally {
|
|
126
126
|
try {
|
|
127
127
|
i && !i.done && (e = n.return) && e.call(n);
|
|
@@ -142,39 +142,39 @@ function C(r) {
|
|
|
142
142
|
function Ne(r, t, e) {
|
|
143
143
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
144
144
|
var n = e.apply(r, t || []), i, o = [];
|
|
145
|
-
return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype),
|
|
145
|
+
return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", s), i[Symbol.asyncIterator] = function() {
|
|
146
146
|
return this;
|
|
147
147
|
}, i;
|
|
148
148
|
function s(f) {
|
|
149
|
-
return function(
|
|
150
|
-
return Promise.resolve(
|
|
149
|
+
return function(p) {
|
|
150
|
+
return Promise.resolve(p).then(f, d);
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function a(f, p) {
|
|
154
154
|
n[f] && (i[f] = function(h) {
|
|
155
155
|
return new Promise(function(S, w) {
|
|
156
|
-
o.push([f, h, S, w]) > 1 ||
|
|
156
|
+
o.push([f, h, S, w]) > 1 || c(f, h);
|
|
157
157
|
});
|
|
158
|
-
},
|
|
158
|
+
}, p && (i[f] = p(i[f])));
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function c(f, p) {
|
|
161
161
|
try {
|
|
162
|
-
|
|
162
|
+
u(n[f](p));
|
|
163
163
|
} catch (h) {
|
|
164
|
-
|
|
164
|
+
v(o[0][3], h);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
f.value instanceof C ? Promise.resolve(f.value.v).then(l,
|
|
167
|
+
function u(f) {
|
|
168
|
+
f.value instanceof C ? Promise.resolve(f.value.v).then(l, d) : v(o[0][2], f);
|
|
169
169
|
}
|
|
170
170
|
function l(f) {
|
|
171
|
-
|
|
171
|
+
c("next", f);
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
173
|
+
function d(f) {
|
|
174
|
+
c("throw", f);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
f(
|
|
176
|
+
function v(f, p) {
|
|
177
|
+
f(p), o.shift(), o.length && c(o[0][0], o[0][1]);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
function Ge(r) {
|
|
@@ -185,18 +185,18 @@ function Ge(r) {
|
|
|
185
185
|
}, e);
|
|
186
186
|
function n(o) {
|
|
187
187
|
e[o] = r[o] && function(s) {
|
|
188
|
-
return new Promise(function(
|
|
189
|
-
s = r[o](s), i(
|
|
188
|
+
return new Promise(function(a, c) {
|
|
189
|
+
s = r[o](s), i(a, c, s.done, s.value);
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function i(o, s,
|
|
194
|
-
Promise.resolve(
|
|
195
|
-
o({ value:
|
|
193
|
+
function i(o, s, a, c) {
|
|
194
|
+
Promise.resolve(c).then(function(u) {
|
|
195
|
+
o({ value: u, done: a });
|
|
196
196
|
}, s);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function b(r) {
|
|
200
200
|
return typeof r == "function";
|
|
201
201
|
}
|
|
202
202
|
function le(r) {
|
|
@@ -232,15 +232,15 @@ var k = (function() {
|
|
|
232
232
|
if (s)
|
|
233
233
|
if (this._parentage = null, Array.isArray(s))
|
|
234
234
|
try {
|
|
235
|
-
for (var
|
|
236
|
-
var
|
|
237
|
-
|
|
235
|
+
for (var a = M(s), c = a.next(); !c.done; c = a.next()) {
|
|
236
|
+
var u = c.value;
|
|
237
|
+
u.remove(this);
|
|
238
238
|
}
|
|
239
239
|
} catch (h) {
|
|
240
240
|
t = { error: h };
|
|
241
241
|
} finally {
|
|
242
242
|
try {
|
|
243
|
-
|
|
243
|
+
c && !c.done && (e = a.return) && e.call(a);
|
|
244
244
|
} finally {
|
|
245
245
|
if (t) throw t.error;
|
|
246
246
|
}
|
|
@@ -248,20 +248,20 @@ var k = (function() {
|
|
|
248
248
|
else
|
|
249
249
|
s.remove(this);
|
|
250
250
|
var l = this.initialTeardown;
|
|
251
|
-
if (
|
|
251
|
+
if (b(l))
|
|
252
252
|
try {
|
|
253
253
|
l();
|
|
254
254
|
} catch (h) {
|
|
255
255
|
o = h instanceof K ? h.errors : [h];
|
|
256
256
|
}
|
|
257
|
-
var
|
|
258
|
-
if (
|
|
257
|
+
var d = this._finalizers;
|
|
258
|
+
if (d) {
|
|
259
259
|
this._finalizers = null;
|
|
260
260
|
try {
|
|
261
|
-
for (var
|
|
262
|
-
var
|
|
261
|
+
for (var v = M(d), f = v.next(); !f.done; f = v.next()) {
|
|
262
|
+
var p = f.value;
|
|
263
263
|
try {
|
|
264
|
-
ee(
|
|
264
|
+
ee(p);
|
|
265
265
|
} catch (h) {
|
|
266
266
|
o = o ?? [], h instanceof K ? o = R(R([], L(o)), L(h.errors)) : o.push(h);
|
|
267
267
|
}
|
|
@@ -270,7 +270,7 @@ var k = (function() {
|
|
|
270
270
|
n = { error: h };
|
|
271
271
|
} finally {
|
|
272
272
|
try {
|
|
273
|
-
f && !f.done && (i =
|
|
273
|
+
f && !f.done && (i = v.return) && i.call(v);
|
|
274
274
|
} finally {
|
|
275
275
|
if (n) throw n.error;
|
|
276
276
|
}
|
|
@@ -309,11 +309,11 @@ var k = (function() {
|
|
|
309
309
|
return t.closed = !0, t;
|
|
310
310
|
})(), r;
|
|
311
311
|
})(), fe = k.EMPTY;
|
|
312
|
-
function
|
|
313
|
-
return r instanceof k || r && "closed" in r &&
|
|
312
|
+
function de(r) {
|
|
313
|
+
return r instanceof k || r && "closed" in r && b(r.remove) && b(r.add) && b(r.unsubscribe);
|
|
314
314
|
}
|
|
315
315
|
function ee(r) {
|
|
316
|
-
|
|
316
|
+
b(r) ? r() : r.unsubscribe();
|
|
317
317
|
}
|
|
318
318
|
var Fe = {
|
|
319
319
|
Promise: void 0
|
|
@@ -328,21 +328,21 @@ var Fe = {
|
|
|
328
328
|
},
|
|
329
329
|
delegate: void 0
|
|
330
330
|
};
|
|
331
|
-
function
|
|
331
|
+
function he(r) {
|
|
332
332
|
He.setTimeout(function() {
|
|
333
333
|
throw r;
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function Y() {
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function $(r) {
|
|
339
339
|
r();
|
|
340
340
|
}
|
|
341
341
|
var J = (function(r) {
|
|
342
|
-
|
|
342
|
+
I(t, r);
|
|
343
343
|
function t(e) {
|
|
344
344
|
var n = r.call(this) || this;
|
|
345
|
-
return n.isStopped = !1, e ? (n.destination = e,
|
|
345
|
+
return n.isStopped = !1, e ? (n.destination = e, de(e) && e.add(n)) : n.destination = Be, n;
|
|
346
346
|
}
|
|
347
347
|
return t.create = function(e, n, i) {
|
|
348
348
|
return new W(e, n, i);
|
|
@@ -379,7 +379,7 @@ var J = (function(r) {
|
|
|
379
379
|
try {
|
|
380
380
|
e.next(t);
|
|
381
381
|
} catch (n) {
|
|
382
|
-
|
|
382
|
+
j(n);
|
|
383
383
|
}
|
|
384
384
|
}, r.prototype.error = function(t) {
|
|
385
385
|
var e = this.partialObserver;
|
|
@@ -387,24 +387,24 @@ var J = (function(r) {
|
|
|
387
387
|
try {
|
|
388
388
|
e.error(t);
|
|
389
389
|
} catch (n) {
|
|
390
|
-
|
|
390
|
+
j(n);
|
|
391
391
|
}
|
|
392
392
|
else
|
|
393
|
-
|
|
393
|
+
j(t);
|
|
394
394
|
}, r.prototype.complete = function() {
|
|
395
395
|
var t = this.partialObserver;
|
|
396
396
|
if (t.complete)
|
|
397
397
|
try {
|
|
398
398
|
t.complete();
|
|
399
399
|
} catch (e) {
|
|
400
|
-
|
|
400
|
+
j(e);
|
|
401
401
|
}
|
|
402
402
|
}, r;
|
|
403
403
|
})(), W = (function(r) {
|
|
404
|
-
|
|
404
|
+
I(t, r);
|
|
405
405
|
function t(e, n, i) {
|
|
406
406
|
var o = r.call(this) || this, s;
|
|
407
|
-
return
|
|
407
|
+
return b(e) || !e ? s = {
|
|
408
408
|
next: e ?? void 0,
|
|
409
409
|
error: n ?? void 0,
|
|
410
410
|
complete: i ?? void 0
|
|
@@ -412,24 +412,24 @@ var J = (function(r) {
|
|
|
412
412
|
}
|
|
413
413
|
return t;
|
|
414
414
|
})(J);
|
|
415
|
-
function
|
|
416
|
-
|
|
415
|
+
function j(r) {
|
|
416
|
+
he(r);
|
|
417
417
|
}
|
|
418
418
|
function Ke(r) {
|
|
419
419
|
throw r;
|
|
420
420
|
}
|
|
421
421
|
var Be = {
|
|
422
422
|
closed: !0,
|
|
423
|
-
next:
|
|
423
|
+
next: Y,
|
|
424
424
|
error: Ke,
|
|
425
|
-
complete:
|
|
425
|
+
complete: Y
|
|
426
426
|
}, z = (function() {
|
|
427
427
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
428
428
|
})();
|
|
429
429
|
function G(r) {
|
|
430
430
|
return r;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function qe(r) {
|
|
433
433
|
return r.length === 0 ? G : r.length === 1 ? r[0] : function(e) {
|
|
434
434
|
return r.reduce(function(n, i) {
|
|
435
435
|
return i(n);
|
|
@@ -445,9 +445,9 @@ var g = (function() {
|
|
|
445
445
|
return e.source = this, e.operator = t, e;
|
|
446
446
|
}, r.prototype.subscribe = function(t, e, n) {
|
|
447
447
|
var i = this, o = We(t) ? t : new W(t, e, n);
|
|
448
|
-
return
|
|
449
|
-
var s = i,
|
|
450
|
-
o.add(
|
|
448
|
+
return $(function() {
|
|
449
|
+
var s = i, a = s.operator, c = s.source;
|
|
450
|
+
o.add(a ? a.call(o, c) : c ? i._subscribe(o) : i._trySubscribe(o));
|
|
451
451
|
}), o;
|
|
452
452
|
}, r.prototype._trySubscribe = function(t) {
|
|
453
453
|
try {
|
|
@@ -459,11 +459,11 @@ var g = (function() {
|
|
|
459
459
|
var n = this;
|
|
460
460
|
return e = te(e), new e(function(i, o) {
|
|
461
461
|
var s = new W({
|
|
462
|
-
next: function(
|
|
462
|
+
next: function(a) {
|
|
463
463
|
try {
|
|
464
|
-
t(
|
|
465
|
-
} catch (
|
|
466
|
-
o(
|
|
464
|
+
t(a);
|
|
465
|
+
} catch (c) {
|
|
466
|
+
o(c), s.unsubscribe();
|
|
467
467
|
}
|
|
468
468
|
},
|
|
469
469
|
error: o,
|
|
@@ -479,7 +479,7 @@ var g = (function() {
|
|
|
479
479
|
}, r.prototype.pipe = function() {
|
|
480
480
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
481
481
|
t[e] = arguments[e];
|
|
482
|
-
return
|
|
482
|
+
return qe(t)(this);
|
|
483
483
|
}, r.prototype.toPromise = function(t) {
|
|
484
484
|
var e = this;
|
|
485
485
|
return t = te(t), new t(function(n, i) {
|
|
@@ -500,16 +500,16 @@ function te(r) {
|
|
|
500
500
|
var t;
|
|
501
501
|
return (t = r ?? Fe.Promise) !== null && t !== void 0 ? t : Promise;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
return r &&
|
|
503
|
+
function Ye(r) {
|
|
504
|
+
return r && b(r.next) && b(r.error) && b(r.complete);
|
|
505
505
|
}
|
|
506
506
|
function We(r) {
|
|
507
|
-
return r && r instanceof J ||
|
|
507
|
+
return r && r instanceof J || Ye(r) && de(r);
|
|
508
508
|
}
|
|
509
509
|
function Xe(r) {
|
|
510
|
-
return
|
|
510
|
+
return b(r == null ? void 0 : r.lift);
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function T(r) {
|
|
513
513
|
return function(t) {
|
|
514
514
|
if (Xe(t))
|
|
515
515
|
return t.lift(function(e) {
|
|
@@ -526,32 +526,32 @@ function E(r, t, e, n, i) {
|
|
|
526
526
|
return new Je(r, t, e, n, i);
|
|
527
527
|
}
|
|
528
528
|
var Je = (function(r) {
|
|
529
|
-
|
|
530
|
-
function t(e, n, i, o, s,
|
|
531
|
-
var
|
|
532
|
-
return
|
|
529
|
+
I(t, r);
|
|
530
|
+
function t(e, n, i, o, s, a) {
|
|
531
|
+
var c = r.call(this, e) || this;
|
|
532
|
+
return c.onFinalize = s, c.shouldUnsubscribe = a, c._next = n ? function(u) {
|
|
533
533
|
try {
|
|
534
|
-
n(
|
|
534
|
+
n(u);
|
|
535
535
|
} catch (l) {
|
|
536
536
|
e.error(l);
|
|
537
537
|
}
|
|
538
|
-
} : r.prototype._next,
|
|
538
|
+
} : r.prototype._next, c._error = o ? function(u) {
|
|
539
539
|
try {
|
|
540
|
-
o(
|
|
540
|
+
o(u);
|
|
541
541
|
} catch (l) {
|
|
542
542
|
e.error(l);
|
|
543
543
|
} finally {
|
|
544
544
|
this.unsubscribe();
|
|
545
545
|
}
|
|
546
|
-
} : r.prototype._error,
|
|
546
|
+
} : r.prototype._error, c._complete = i ? function() {
|
|
547
547
|
try {
|
|
548
548
|
i();
|
|
549
|
-
} catch (
|
|
550
|
-
e.error(
|
|
549
|
+
} catch (u) {
|
|
550
|
+
e.error(u);
|
|
551
551
|
} finally {
|
|
552
552
|
this.unsubscribe();
|
|
553
553
|
}
|
|
554
|
-
} : r.prototype._complete,
|
|
554
|
+
} : r.prototype._complete, c;
|
|
555
555
|
}
|
|
556
556
|
return t.prototype.unsubscribe = function() {
|
|
557
557
|
var e;
|
|
@@ -565,7 +565,7 @@ var Je = (function(r) {
|
|
|
565
565
|
r(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
566
566
|
};
|
|
567
567
|
}), Q = (function(r) {
|
|
568
|
-
|
|
568
|
+
I(t, r);
|
|
569
569
|
function t() {
|
|
570
570
|
var e = r.call(this) || this;
|
|
571
571
|
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
@@ -578,20 +578,20 @@ var Je = (function(r) {
|
|
|
578
578
|
throw new ze();
|
|
579
579
|
}, t.prototype.next = function(e) {
|
|
580
580
|
var n = this;
|
|
581
|
-
|
|
581
|
+
$(function() {
|
|
582
582
|
var i, o;
|
|
583
583
|
if (n._throwIfClosed(), !n.isStopped) {
|
|
584
584
|
n.currentObservers || (n.currentObservers = Array.from(n.observers));
|
|
585
585
|
try {
|
|
586
|
-
for (var s = M(n.currentObservers),
|
|
587
|
-
var
|
|
588
|
-
|
|
586
|
+
for (var s = M(n.currentObservers), a = s.next(); !a.done; a = s.next()) {
|
|
587
|
+
var c = a.value;
|
|
588
|
+
c.next(e);
|
|
589
589
|
}
|
|
590
|
-
} catch (
|
|
591
|
-
i = { error:
|
|
590
|
+
} catch (u) {
|
|
591
|
+
i = { error: u };
|
|
592
592
|
} finally {
|
|
593
593
|
try {
|
|
594
|
-
|
|
594
|
+
a && !a.done && (o = s.return) && o.call(s);
|
|
595
595
|
} finally {
|
|
596
596
|
if (i) throw i.error;
|
|
597
597
|
}
|
|
@@ -600,7 +600,7 @@ var Je = (function(r) {
|
|
|
600
600
|
});
|
|
601
601
|
}, t.prototype.error = function(e) {
|
|
602
602
|
var n = this;
|
|
603
|
-
|
|
603
|
+
$(function() {
|
|
604
604
|
if (n._throwIfClosed(), !n.isStopped) {
|
|
605
605
|
n.hasError = n.isStopped = !0, n.thrownError = e;
|
|
606
606
|
for (var i = n.observers; i.length; )
|
|
@@ -609,7 +609,7 @@ var Je = (function(r) {
|
|
|
609
609
|
});
|
|
610
610
|
}, t.prototype.complete = function() {
|
|
611
611
|
var e = this;
|
|
612
|
-
|
|
612
|
+
$(function() {
|
|
613
613
|
if (e._throwIfClosed(), !e.isStopped) {
|
|
614
614
|
e.isStopped = !0;
|
|
615
615
|
for (var n = e.observers; n.length; )
|
|
@@ -630,9 +630,9 @@ var Je = (function(r) {
|
|
|
630
630
|
}, t.prototype._subscribe = function(e) {
|
|
631
631
|
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
|
632
632
|
}, t.prototype._innerSubscribe = function(e) {
|
|
633
|
-
var n = this, i = this, o = i.hasError, s = i.isStopped,
|
|
634
|
-
return o || s ? fe : (this.currentObservers = null,
|
|
635
|
-
n.currentObservers = null, D(
|
|
633
|
+
var n = this, i = this, o = i.hasError, s = i.isStopped, a = i.observers;
|
|
634
|
+
return o || s ? fe : (this.currentObservers = null, a.push(e), new k(function() {
|
|
635
|
+
n.currentObservers = null, D(a, e);
|
|
636
636
|
}));
|
|
637
637
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
638
638
|
var n = this, i = n.hasError, o = n.thrownError, s = n.isStopped;
|
|
@@ -644,7 +644,7 @@ var Je = (function(r) {
|
|
|
644
644
|
return new re(e, n);
|
|
645
645
|
}, t;
|
|
646
646
|
})(g), re = (function(r) {
|
|
647
|
-
|
|
647
|
+
I(t, r);
|
|
648
648
|
function t(e, n) {
|
|
649
649
|
var i = r.call(this) || this;
|
|
650
650
|
return i.destination = e, i.source = n, i;
|
|
@@ -663,7 +663,7 @@ var Je = (function(r) {
|
|
|
663
663
|
return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(e)) !== null && i !== void 0 ? i : fe;
|
|
664
664
|
}, t;
|
|
665
665
|
})(Q), ne = (function(r) {
|
|
666
|
-
|
|
666
|
+
I(t, r);
|
|
667
667
|
function t(e) {
|
|
668
668
|
var n = r.call(this) || this;
|
|
669
669
|
return n._value = e, n;
|
|
@@ -690,7 +690,7 @@ var Je = (function(r) {
|
|
|
690
690
|
return Date.now();
|
|
691
691
|
}
|
|
692
692
|
}, Ze = (function(r) {
|
|
693
|
-
|
|
693
|
+
I(t, r);
|
|
694
694
|
function t(e, n) {
|
|
695
695
|
return r.call(this) || this;
|
|
696
696
|
}
|
|
@@ -708,7 +708,7 @@ var Je = (function(r) {
|
|
|
708
708
|
},
|
|
709
709
|
delegate: void 0
|
|
710
710
|
}, et = (function(r) {
|
|
711
|
-
|
|
711
|
+
I(t, r);
|
|
712
712
|
function t(e, n) {
|
|
713
713
|
var i = r.call(this, e, n) || this;
|
|
714
714
|
return i.scheduler = e, i.work = n, i.pending = !1, i;
|
|
@@ -757,7 +757,7 @@ var Je = (function(r) {
|
|
|
757
757
|
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(n, e);
|
|
758
758
|
}, r.now = Qe.now, r;
|
|
759
759
|
})(), tt = (function(r) {
|
|
760
|
-
|
|
760
|
+
I(t, r);
|
|
761
761
|
function t(e, n) {
|
|
762
762
|
n === void 0 && (n = oe.now);
|
|
763
763
|
var i = r.call(this, e, n) || this;
|
|
@@ -785,13 +785,13 @@ var Je = (function(r) {
|
|
|
785
785
|
return r.complete();
|
|
786
786
|
});
|
|
787
787
|
function ye(r) {
|
|
788
|
-
return r &&
|
|
788
|
+
return r && b(r.schedule);
|
|
789
789
|
}
|
|
790
790
|
function pe(r) {
|
|
791
791
|
return r[r.length - 1];
|
|
792
792
|
}
|
|
793
793
|
function it(r) {
|
|
794
|
-
return
|
|
794
|
+
return b(pe(r)) ? r.pop() : void 0;
|
|
795
795
|
}
|
|
796
796
|
function be(r) {
|
|
797
797
|
return ye(pe(r)) ? r.pop() : void 0;
|
|
@@ -800,13 +800,13 @@ var me = (function(r) {
|
|
|
800
800
|
return r && typeof r.length == "number" && typeof r != "function";
|
|
801
801
|
});
|
|
802
802
|
function ge(r) {
|
|
803
|
-
return
|
|
803
|
+
return b(r == null ? void 0 : r.then);
|
|
804
804
|
}
|
|
805
805
|
function Se(r) {
|
|
806
|
-
return
|
|
806
|
+
return b(r[z]);
|
|
807
807
|
}
|
|
808
808
|
function we(r) {
|
|
809
|
-
return Symbol.asyncIterator &&
|
|
809
|
+
return Symbol.asyncIterator && b(r == null ? void 0 : r[Symbol.asyncIterator]);
|
|
810
810
|
}
|
|
811
811
|
function Ee(r) {
|
|
812
812
|
return new TypeError("You provided " + (r !== null && typeof r == "object" ? "an invalid object" : "'" + r + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
@@ -814,14 +814,14 @@ function Ee(r) {
|
|
|
814
814
|
function ot() {
|
|
815
815
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
816
816
|
}
|
|
817
|
-
var
|
|
818
|
-
function
|
|
819
|
-
return
|
|
817
|
+
var Ie = ot();
|
|
818
|
+
function Oe(r) {
|
|
819
|
+
return b(r == null ? void 0 : r[Ie]);
|
|
820
820
|
}
|
|
821
821
|
function Ae(r) {
|
|
822
822
|
return Ne(this, arguments, function() {
|
|
823
823
|
var e, n, i, o;
|
|
824
|
-
return
|
|
824
|
+
return ue(this, function(s) {
|
|
825
825
|
switch (s.label) {
|
|
826
826
|
case 0:
|
|
827
827
|
e = r.getReader(), s.label = 1;
|
|
@@ -849,10 +849,10 @@ function Ae(r) {
|
|
|
849
849
|
});
|
|
850
850
|
});
|
|
851
851
|
}
|
|
852
|
-
function
|
|
853
|
-
return
|
|
852
|
+
function xe(r) {
|
|
853
|
+
return b(r == null ? void 0 : r.getReader);
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function x(r) {
|
|
856
856
|
if (r instanceof g)
|
|
857
857
|
return r;
|
|
858
858
|
if (r != null) {
|
|
@@ -861,12 +861,12 @@ function _(r) {
|
|
|
861
861
|
if (me(r))
|
|
862
862
|
return at(r);
|
|
863
863
|
if (ge(r))
|
|
864
|
-
return ut(r);
|
|
865
|
-
if (we(r))
|
|
866
|
-
return xe(r);
|
|
867
|
-
if (Ie(r))
|
|
868
864
|
return ct(r);
|
|
869
|
-
if (
|
|
865
|
+
if (we(r))
|
|
866
|
+
return _e(r);
|
|
867
|
+
if (Oe(r))
|
|
868
|
+
return ut(r);
|
|
869
|
+
if (xe(r))
|
|
870
870
|
return lt(r);
|
|
871
871
|
}
|
|
872
872
|
throw Ee(r);
|
|
@@ -874,7 +874,7 @@ function _(r) {
|
|
|
874
874
|
function st(r) {
|
|
875
875
|
return new g(function(t) {
|
|
876
876
|
var e = r[z]();
|
|
877
|
-
if (
|
|
877
|
+
if (b(e.subscribe))
|
|
878
878
|
return e.subscribe(t);
|
|
879
879
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
880
880
|
});
|
|
@@ -886,16 +886,16 @@ function at(r) {
|
|
|
886
886
|
t.complete();
|
|
887
887
|
});
|
|
888
888
|
}
|
|
889
|
-
function
|
|
889
|
+
function ct(r) {
|
|
890
890
|
return new g(function(t) {
|
|
891
891
|
r.then(function(e) {
|
|
892
892
|
t.closed || (t.next(e), t.complete());
|
|
893
893
|
}, function(e) {
|
|
894
894
|
return t.error(e);
|
|
895
|
-
}).then(null,
|
|
895
|
+
}).then(null, he);
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
|
-
function
|
|
898
|
+
function ut(r) {
|
|
899
899
|
return new g(function(t) {
|
|
900
900
|
var e, n;
|
|
901
901
|
try {
|
|
@@ -904,8 +904,8 @@ function ct(r) {
|
|
|
904
904
|
if (t.next(s), t.closed)
|
|
905
905
|
return;
|
|
906
906
|
}
|
|
907
|
-
} catch (
|
|
908
|
-
e = { error:
|
|
907
|
+
} catch (a) {
|
|
908
|
+
e = { error: a };
|
|
909
909
|
} finally {
|
|
910
910
|
try {
|
|
911
911
|
o && !o.done && (n = i.return) && n.call(i);
|
|
@@ -916,7 +916,7 @@ function ct(r) {
|
|
|
916
916
|
t.complete();
|
|
917
917
|
});
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function _e(r) {
|
|
920
920
|
return new g(function(t) {
|
|
921
921
|
ft(r, t).catch(function(e) {
|
|
922
922
|
return t.error(e);
|
|
@@ -924,33 +924,33 @@ function xe(r) {
|
|
|
924
924
|
});
|
|
925
925
|
}
|
|
926
926
|
function lt(r) {
|
|
927
|
-
return
|
|
927
|
+
return _e(Ae(r));
|
|
928
928
|
}
|
|
929
929
|
function ft(r, t) {
|
|
930
930
|
var e, n, i, o;
|
|
931
931
|
return De(this, void 0, void 0, function() {
|
|
932
|
-
var s,
|
|
933
|
-
return
|
|
934
|
-
switch (
|
|
932
|
+
var s, a;
|
|
933
|
+
return ue(this, function(c) {
|
|
934
|
+
switch (c.label) {
|
|
935
935
|
case 0:
|
|
936
|
-
|
|
936
|
+
c.trys.push([0, 5, 6, 11]), e = Ge(r), c.label = 1;
|
|
937
937
|
case 1:
|
|
938
938
|
return [4, e.next()];
|
|
939
939
|
case 2:
|
|
940
|
-
if (n =
|
|
940
|
+
if (n = c.sent(), !!n.done) return [3, 4];
|
|
941
941
|
if (s = n.value, t.next(s), t.closed)
|
|
942
942
|
return [2];
|
|
943
|
-
|
|
943
|
+
c.label = 3;
|
|
944
944
|
case 3:
|
|
945
945
|
return [3, 1];
|
|
946
946
|
case 4:
|
|
947
947
|
return [3, 11];
|
|
948
948
|
case 5:
|
|
949
|
-
return
|
|
949
|
+
return a = c.sent(), i = { error: a }, [3, 11];
|
|
950
950
|
case 6:
|
|
951
|
-
return
|
|
951
|
+
return c.trys.push([6, , 9, 10]), n && !n.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
|
|
952
952
|
case 7:
|
|
953
|
-
|
|
953
|
+
c.sent(), c.label = 8;
|
|
954
954
|
case 8:
|
|
955
955
|
return [3, 10];
|
|
956
956
|
case 9:
|
|
@@ -973,7 +973,7 @@ function A(r, t, e, n, i) {
|
|
|
973
973
|
return o;
|
|
974
974
|
}
|
|
975
975
|
function Pe(r, t) {
|
|
976
|
-
return t === void 0 && (t = 0),
|
|
976
|
+
return t === void 0 && (t = 0), T(function(e, n) {
|
|
977
977
|
e.subscribe(E(n, function(i) {
|
|
978
978
|
return A(n, r, function() {
|
|
979
979
|
return n.next(i);
|
|
@@ -990,17 +990,17 @@ function Pe(r, t) {
|
|
|
990
990
|
});
|
|
991
991
|
}
|
|
992
992
|
function Te(r, t) {
|
|
993
|
-
return t === void 0 && (t = 0),
|
|
993
|
+
return t === void 0 && (t = 0), T(function(e, n) {
|
|
994
994
|
n.add(r.schedule(function() {
|
|
995
995
|
return e.subscribe(n);
|
|
996
996
|
}, t));
|
|
997
997
|
});
|
|
998
998
|
}
|
|
999
|
-
function ht(r, t) {
|
|
1000
|
-
return _(r).pipe(Te(t), Pe(t));
|
|
1001
|
-
}
|
|
1002
999
|
function dt(r, t) {
|
|
1003
|
-
return
|
|
1000
|
+
return x(r).pipe(Te(t), Pe(t));
|
|
1001
|
+
}
|
|
1002
|
+
function ht(r, t) {
|
|
1003
|
+
return x(r).pipe(Te(t), Pe(t));
|
|
1004
1004
|
}
|
|
1005
1005
|
function vt(r, t) {
|
|
1006
1006
|
return new g(function(e) {
|
|
@@ -1014,18 +1014,18 @@ function yt(r, t) {
|
|
|
1014
1014
|
return new g(function(e) {
|
|
1015
1015
|
var n;
|
|
1016
1016
|
return A(e, t, function() {
|
|
1017
|
-
n = r[
|
|
1017
|
+
n = r[Ie](), A(e, t, function() {
|
|
1018
1018
|
var i, o, s;
|
|
1019
1019
|
try {
|
|
1020
1020
|
i = n.next(), o = i.value, s = i.done;
|
|
1021
|
-
} catch (
|
|
1022
|
-
e.error(
|
|
1021
|
+
} catch (a) {
|
|
1022
|
+
e.error(a);
|
|
1023
1023
|
return;
|
|
1024
1024
|
}
|
|
1025
1025
|
s ? e.complete() : e.next(o);
|
|
1026
1026
|
}, 0, !0);
|
|
1027
1027
|
}), function() {
|
|
1028
|
-
return
|
|
1028
|
+
return b(n == null ? void 0 : n.return) && n.return();
|
|
1029
1029
|
};
|
|
1030
1030
|
});
|
|
1031
1031
|
}
|
|
@@ -1049,22 +1049,22 @@ function pt(r, t) {
|
|
|
1049
1049
|
function bt(r, t) {
|
|
1050
1050
|
if (r != null) {
|
|
1051
1051
|
if (Se(r))
|
|
1052
|
-
return
|
|
1052
|
+
return dt(r, t);
|
|
1053
1053
|
if (me(r))
|
|
1054
1054
|
return vt(r, t);
|
|
1055
1055
|
if (ge(r))
|
|
1056
|
-
return
|
|
1056
|
+
return ht(r, t);
|
|
1057
1057
|
if (we(r))
|
|
1058
1058
|
return Ce(r, t);
|
|
1059
|
-
if (
|
|
1059
|
+
if (Oe(r))
|
|
1060
1060
|
return yt(r, t);
|
|
1061
|
-
if (
|
|
1061
|
+
if (xe(r))
|
|
1062
1062
|
return pt(r, t);
|
|
1063
1063
|
}
|
|
1064
1064
|
throw Ee(r);
|
|
1065
1065
|
}
|
|
1066
1066
|
function Z(r, t) {
|
|
1067
|
-
return t ? bt(r, t) :
|
|
1067
|
+
return t ? bt(r, t) : x(r);
|
|
1068
1068
|
}
|
|
1069
1069
|
function mt() {
|
|
1070
1070
|
for (var r = [], t = 0; t < arguments.length; t++)
|
|
@@ -1076,7 +1076,7 @@ function gt(r) {
|
|
|
1076
1076
|
return r instanceof Date && !isNaN(r);
|
|
1077
1077
|
}
|
|
1078
1078
|
function F(r, t) {
|
|
1079
|
-
return
|
|
1079
|
+
return T(function(e, n) {
|
|
1080
1080
|
var i = 0;
|
|
1081
1081
|
e.subscribe(E(n, function(o) {
|
|
1082
1082
|
n.next(r.call(t, o, i++));
|
|
@@ -1092,14 +1092,14 @@ function Et(r) {
|
|
|
1092
1092
|
return wt(r, t);
|
|
1093
1093
|
});
|
|
1094
1094
|
}
|
|
1095
|
-
var
|
|
1096
|
-
function
|
|
1095
|
+
var It = Array.isArray, Ot = Object.getPrototypeOf, At = Object.prototype, xt = Object.keys;
|
|
1096
|
+
function _t(r) {
|
|
1097
1097
|
if (r.length === 1) {
|
|
1098
1098
|
var t = r[0];
|
|
1099
|
-
if (
|
|
1099
|
+
if (It(t))
|
|
1100
1100
|
return { args: t, keys: null };
|
|
1101
1101
|
if (Pt(t)) {
|
|
1102
|
-
var e =
|
|
1102
|
+
var e = xt(t);
|
|
1103
1103
|
return {
|
|
1104
1104
|
args: e.map(function(n) {
|
|
1105
1105
|
return t[n];
|
|
@@ -1111,7 +1111,7 @@ function xt(r) {
|
|
|
1111
1111
|
return { args: r, keys: null };
|
|
1112
1112
|
}
|
|
1113
1113
|
function Pt(r) {
|
|
1114
|
-
return r && typeof r == "object" &&
|
|
1114
|
+
return r && typeof r == "object" && Ot(r) === At;
|
|
1115
1115
|
}
|
|
1116
1116
|
function Tt(r, t) {
|
|
1117
1117
|
return r.reduce(function(e, n, i) {
|
|
@@ -1121,72 +1121,72 @@ function Tt(r, t) {
|
|
|
1121
1121
|
function Ct() {
|
|
1122
1122
|
for (var r = [], t = 0; t < arguments.length; t++)
|
|
1123
1123
|
r[t] = arguments[t];
|
|
1124
|
-
var e = be(r), n = it(r), i =
|
|
1124
|
+
var e = be(r), n = it(r), i = _t(r), o = i.args, s = i.keys;
|
|
1125
1125
|
if (o.length === 0)
|
|
1126
1126
|
return Z([], e);
|
|
1127
|
-
var
|
|
1128
|
-
return Tt(s,
|
|
1127
|
+
var a = new g(Mt(o, e, s ? function(c) {
|
|
1128
|
+
return Tt(s, c);
|
|
1129
1129
|
} : G));
|
|
1130
|
-
return n ?
|
|
1130
|
+
return n ? a.pipe(Et(n)) : a;
|
|
1131
1131
|
}
|
|
1132
1132
|
function Mt(r, t, e) {
|
|
1133
1133
|
return e === void 0 && (e = G), function(n) {
|
|
1134
1134
|
se(t, function() {
|
|
1135
|
-
for (var i = r.length, o = new Array(i), s = i,
|
|
1135
|
+
for (var i = r.length, o = new Array(i), s = i, a = i, c = function(l) {
|
|
1136
1136
|
se(t, function() {
|
|
1137
|
-
var
|
|
1138
|
-
|
|
1139
|
-
o[l] = f,
|
|
1137
|
+
var d = Z(r[l], t), v = !1;
|
|
1138
|
+
d.subscribe(E(n, function(f) {
|
|
1139
|
+
o[l] = f, v || (v = !0, a--), a || n.next(e(o.slice()));
|
|
1140
1140
|
}, function() {
|
|
1141
1141
|
--s || n.complete();
|
|
1142
1142
|
}));
|
|
1143
1143
|
}, n);
|
|
1144
|
-
},
|
|
1145
|
-
u
|
|
1144
|
+
}, u = 0; u < i; u++)
|
|
1145
|
+
c(u);
|
|
1146
1146
|
}, n);
|
|
1147
1147
|
};
|
|
1148
1148
|
}
|
|
1149
1149
|
function se(r, t, e) {
|
|
1150
1150
|
r ? A(e, r, t) : t();
|
|
1151
1151
|
}
|
|
1152
|
-
function Lt(r, t, e, n, i, o, s,
|
|
1153
|
-
var
|
|
1154
|
-
|
|
1152
|
+
function Lt(r, t, e, n, i, o, s, a) {
|
|
1153
|
+
var c = [], u = 0, l = 0, d = !1, v = function() {
|
|
1154
|
+
d && !c.length && !u && t.complete();
|
|
1155
1155
|
}, f = function(h) {
|
|
1156
|
-
return
|
|
1157
|
-
},
|
|
1158
|
-
|
|
1156
|
+
return u < n ? p(h) : c.push(h);
|
|
1157
|
+
}, p = function(h) {
|
|
1158
|
+
u++;
|
|
1159
1159
|
var S = !1;
|
|
1160
|
-
|
|
1160
|
+
x(e(h, l++)).subscribe(E(t, function(w) {
|
|
1161
1161
|
t.next(w);
|
|
1162
1162
|
}, function() {
|
|
1163
1163
|
S = !0;
|
|
1164
1164
|
}, void 0, function() {
|
|
1165
1165
|
if (S)
|
|
1166
1166
|
try {
|
|
1167
|
-
|
|
1167
|
+
u--;
|
|
1168
1168
|
for (var w = function() {
|
|
1169
|
-
var
|
|
1170
|
-
s ||
|
|
1171
|
-
};
|
|
1169
|
+
var _ = c.shift();
|
|
1170
|
+
s || p(_);
|
|
1171
|
+
}; c.length && u < n; )
|
|
1172
1172
|
w();
|
|
1173
|
-
|
|
1174
|
-
} catch (
|
|
1175
|
-
t.error(
|
|
1173
|
+
v();
|
|
1174
|
+
} catch (_) {
|
|
1175
|
+
t.error(_);
|
|
1176
1176
|
}
|
|
1177
1177
|
}));
|
|
1178
1178
|
};
|
|
1179
1179
|
return r.subscribe(E(t, f, function() {
|
|
1180
|
-
|
|
1180
|
+
d = !0, v();
|
|
1181
1181
|
})), function() {
|
|
1182
1182
|
};
|
|
1183
1183
|
}
|
|
1184
1184
|
function N(r, t, e) {
|
|
1185
|
-
return e === void 0 && (e = 1 / 0),
|
|
1185
|
+
return e === void 0 && (e = 1 / 0), b(t) ? N(function(n, i) {
|
|
1186
1186
|
return F(function(o, s) {
|
|
1187
1187
|
return t(n, o, i, s);
|
|
1188
|
-
})(
|
|
1189
|
-
}, e) : (typeof t == "number" && (e = t),
|
|
1188
|
+
})(x(r(n, i)));
|
|
1189
|
+
}, e) : (typeof t == "number" && (e = t), T(function(n, i) {
|
|
1190
1190
|
return Lt(n, i, r, e);
|
|
1191
1191
|
}));
|
|
1192
1192
|
}
|
|
@@ -1203,32 +1203,32 @@ function Me(r, t, e) {
|
|
|
1203
1203
|
});
|
|
1204
1204
|
}
|
|
1205
1205
|
function Rt(r, t) {
|
|
1206
|
-
return
|
|
1206
|
+
return b(t) ? N(r, t, 1) : N(r, 1);
|
|
1207
1207
|
}
|
|
1208
1208
|
function kt(r) {
|
|
1209
1209
|
return r <= 0 ? function() {
|
|
1210
1210
|
return nt;
|
|
1211
|
-
} :
|
|
1211
|
+
} : T(function(t, e) {
|
|
1212
1212
|
var n = 0;
|
|
1213
1213
|
t.subscribe(E(e, function(i) {
|
|
1214
1214
|
++n <= r && (e.next(i), r <= n && e.complete());
|
|
1215
1215
|
}));
|
|
1216
1216
|
});
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function Ut(r) {
|
|
1219
1219
|
return F(function() {
|
|
1220
1220
|
return r;
|
|
1221
1221
|
});
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1223
|
+
function jt(r, t) {
|
|
1224
1224
|
return N(function(e, n) {
|
|
1225
|
-
return
|
|
1225
|
+
return x(r(e, n)).pipe(kt(1), Ut(e));
|
|
1226
1226
|
});
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1228
|
+
function $t(r, t) {
|
|
1229
1229
|
t === void 0 && (t = ve);
|
|
1230
1230
|
var e = Me(r, t);
|
|
1231
|
-
return
|
|
1231
|
+
return jt(function() {
|
|
1232
1232
|
return e;
|
|
1233
1233
|
});
|
|
1234
1234
|
}
|
|
@@ -1238,37 +1238,37 @@ function Dt(r) {
|
|
|
1238
1238
|
count: r
|
|
1239
1239
|
};
|
|
1240
1240
|
var e = t.count, n = e === void 0 ? 1 / 0 : e, i = t.delay, o = t.resetOnSuccess, s = o === void 0 ? !1 : o;
|
|
1241
|
-
return n <= 0 ? G :
|
|
1242
|
-
var
|
|
1243
|
-
var
|
|
1244
|
-
l =
|
|
1245
|
-
s && (
|
|
1241
|
+
return n <= 0 ? G : T(function(a, c) {
|
|
1242
|
+
var u = 0, l, d = function() {
|
|
1243
|
+
var v = !1;
|
|
1244
|
+
l = a.subscribe(E(c, function(f) {
|
|
1245
|
+
s && (u = 0), c.next(f);
|
|
1246
1246
|
}, void 0, function(f) {
|
|
1247
|
-
if (
|
|
1248
|
-
var
|
|
1249
|
-
l ? (l.unsubscribe(), l = null,
|
|
1247
|
+
if (u++ < n) {
|
|
1248
|
+
var p = function() {
|
|
1249
|
+
l ? (l.unsubscribe(), l = null, d()) : v = !0;
|
|
1250
1250
|
};
|
|
1251
1251
|
if (i != null) {
|
|
1252
|
-
var h = typeof i == "number" ? Me(i) :
|
|
1253
|
-
S.unsubscribe(),
|
|
1252
|
+
var h = typeof i == "number" ? Me(i) : x(i(f, u)), S = E(c, function() {
|
|
1253
|
+
S.unsubscribe(), p();
|
|
1254
1254
|
}, function() {
|
|
1255
|
-
|
|
1255
|
+
c.complete();
|
|
1256
1256
|
});
|
|
1257
1257
|
h.subscribe(S);
|
|
1258
1258
|
} else
|
|
1259
|
-
|
|
1259
|
+
p();
|
|
1260
1260
|
} else
|
|
1261
|
-
|
|
1262
|
-
})),
|
|
1261
|
+
c.error(f);
|
|
1262
|
+
})), v && (l.unsubscribe(), l = null, d());
|
|
1263
1263
|
};
|
|
1264
|
-
|
|
1264
|
+
d();
|
|
1265
1265
|
});
|
|
1266
1266
|
}
|
|
1267
1267
|
function Nt(r) {
|
|
1268
|
-
return
|
|
1269
|
-
|
|
1268
|
+
return T(function(t, e) {
|
|
1269
|
+
x(r).subscribe(E(e, function() {
|
|
1270
1270
|
return e.complete();
|
|
1271
|
-
},
|
|
1271
|
+
}, Y)), !e.closed && t.subscribe(e);
|
|
1272
1272
|
});
|
|
1273
1273
|
}
|
|
1274
1274
|
async function Gt(r, t) {
|
|
@@ -1281,38 +1281,38 @@ function Ft(r) {
|
|
|
1281
1281
|
let t, e, n, i = !1;
|
|
1282
1282
|
return function(s) {
|
|
1283
1283
|
t === void 0 ? (t = s, e = 0, n = -1) : t = Vt(t, s);
|
|
1284
|
-
const
|
|
1285
|
-
let
|
|
1286
|
-
for (; e <
|
|
1287
|
-
i && (t[e] === 10 && (
|
|
1288
|
-
let
|
|
1289
|
-
for (; e <
|
|
1284
|
+
const a = t.length;
|
|
1285
|
+
let c = 0;
|
|
1286
|
+
for (; e < a; ) {
|
|
1287
|
+
i && (t[e] === 10 && (c = ++e), i = !1);
|
|
1288
|
+
let u = -1;
|
|
1289
|
+
for (; e < a && u === -1; ++e)
|
|
1290
1290
|
switch (t[e]) {
|
|
1291
1291
|
case 58:
|
|
1292
|
-
n === -1 && (n = e -
|
|
1292
|
+
n === -1 && (n = e - c);
|
|
1293
1293
|
break;
|
|
1294
1294
|
case 13:
|
|
1295
1295
|
i = !0;
|
|
1296
1296
|
case 10:
|
|
1297
|
-
|
|
1297
|
+
u = e;
|
|
1298
1298
|
break;
|
|
1299
1299
|
}
|
|
1300
|
-
if (
|
|
1300
|
+
if (u === -1)
|
|
1301
1301
|
break;
|
|
1302
|
-
r(t.subarray(
|
|
1302
|
+
r(t.subarray(c, u), n), c = e, n = -1;
|
|
1303
1303
|
}
|
|
1304
|
-
|
|
1304
|
+
c === a ? t = void 0 : c !== 0 && (t = t.subarray(c), e -= c);
|
|
1305
1305
|
};
|
|
1306
1306
|
}
|
|
1307
1307
|
function Ht(r, t, e) {
|
|
1308
1308
|
let n = ae();
|
|
1309
1309
|
const i = new TextDecoder();
|
|
1310
|
-
return function(s,
|
|
1310
|
+
return function(s, a) {
|
|
1311
1311
|
if (s.length === 0)
|
|
1312
1312
|
e == null || e(n), n = ae();
|
|
1313
|
-
else if (
|
|
1314
|
-
const
|
|
1315
|
-
switch (
|
|
1313
|
+
else if (a > 0) {
|
|
1314
|
+
const c = i.decode(s.subarray(0, a)), u = a + (s[a + 1] === 32 ? 2 : 1), l = i.decode(s.subarray(u));
|
|
1315
|
+
switch (c) {
|
|
1316
1316
|
case "data":
|
|
1317
1317
|
n.data = n.data ? n.data + `
|
|
1318
1318
|
` + l : l;
|
|
@@ -1324,8 +1324,8 @@ function Ht(r, t, e) {
|
|
|
1324
1324
|
r(n.id = l);
|
|
1325
1325
|
break;
|
|
1326
1326
|
case "retry":
|
|
1327
|
-
const
|
|
1328
|
-
isNaN(
|
|
1327
|
+
const d = parseInt(l, 10);
|
|
1328
|
+
isNaN(d) || t(n.retry = d);
|
|
1329
1329
|
break;
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
@@ -1351,49 +1351,49 @@ var Kt = function(r, t) {
|
|
|
1351
1351
|
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[i]) && (e[n[i]] = r[n[i]]);
|
|
1352
1352
|
return e;
|
|
1353
1353
|
};
|
|
1354
|
-
const X = "text/event-stream", Bt = 1e3,
|
|
1355
|
-
function
|
|
1356
|
-
var { signal: e, headers: n, onopen: i, onmessage: o, onclose: s, onerror:
|
|
1357
|
-
return new Promise((
|
|
1354
|
+
const X = "text/event-stream", Bt = 1e3, ce = "last-event-id";
|
|
1355
|
+
function qt(r, t) {
|
|
1356
|
+
var { signal: e, headers: n, onopen: i, onmessage: o, onclose: s, onerror: a, openWhenHidden: c, fetch: u } = t, l = Kt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
1357
|
+
return new Promise((d, v) => {
|
|
1358
1358
|
const f = Object.assign({}, n);
|
|
1359
1359
|
f.accept || (f.accept = X);
|
|
1360
|
-
let
|
|
1360
|
+
let p;
|
|
1361
1361
|
function h() {
|
|
1362
|
-
|
|
1362
|
+
p.abort(), document.hidden || H();
|
|
1363
1363
|
}
|
|
1364
|
-
|
|
1364
|
+
c || document.addEventListener("visibilitychange", h);
|
|
1365
1365
|
let S = Bt, w = 0;
|
|
1366
|
-
function
|
|
1367
|
-
document.removeEventListener("visibilitychange", h), window.clearTimeout(w),
|
|
1366
|
+
function _() {
|
|
1367
|
+
document.removeEventListener("visibilitychange", h), window.clearTimeout(w), p.abort();
|
|
1368
1368
|
}
|
|
1369
1369
|
e == null || e.addEventListener("abort", () => {
|
|
1370
|
-
|
|
1370
|
+
_(), d();
|
|
1371
1371
|
});
|
|
1372
|
-
const Re =
|
|
1372
|
+
const Re = u ?? window.fetch, ke = i ?? Yt;
|
|
1373
1373
|
async function H() {
|
|
1374
1374
|
var V;
|
|
1375
|
-
|
|
1375
|
+
p = new AbortController();
|
|
1376
1376
|
try {
|
|
1377
|
-
const
|
|
1378
|
-
await ke(
|
|
1379
|
-
|
|
1380
|
-
}, (
|
|
1381
|
-
S =
|
|
1382
|
-
}, o))), s == null || s(),
|
|
1383
|
-
} catch (
|
|
1384
|
-
if (!
|
|
1377
|
+
const U = await Re(r, Object.assign(Object.assign({}, l), { headers: f, signal: p.signal }));
|
|
1378
|
+
await ke(U), await Gt(U.body, Ft(Ht((O) => {
|
|
1379
|
+
O ? f[ce] = O : delete f[ce];
|
|
1380
|
+
}, (O) => {
|
|
1381
|
+
S = O;
|
|
1382
|
+
}, o))), s == null || s(), _(), d();
|
|
1383
|
+
} catch (U) {
|
|
1384
|
+
if (!p.signal.aborted)
|
|
1385
1385
|
try {
|
|
1386
|
-
const
|
|
1387
|
-
window.clearTimeout(w), w = window.setTimeout(H,
|
|
1388
|
-
} catch (
|
|
1389
|
-
|
|
1386
|
+
const O = (V = a == null ? void 0 : a(U)) !== null && V !== void 0 ? V : S;
|
|
1387
|
+
window.clearTimeout(w), w = window.setTimeout(H, O);
|
|
1388
|
+
} catch (O) {
|
|
1389
|
+
_(), v(O);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
1393
|
H();
|
|
1394
1394
|
});
|
|
1395
1395
|
}
|
|
1396
|
-
function
|
|
1396
|
+
function Yt(r) {
|
|
1397
1397
|
const t = r.headers.get("content-type");
|
|
1398
1398
|
if (!(t != null && t.startsWith(X)))
|
|
1399
1399
|
throw new Error(`Expected content-type to be ${X}, Actual: ${t}`);
|
|
@@ -1401,14 +1401,16 @@ function qt(r) {
|
|
|
1401
1401
|
function Wt(r) {
|
|
1402
1402
|
const { endpoint: t, apiKey: e, payload: n, debugMode: i } = r;
|
|
1403
1403
|
return new g((o) => {
|
|
1404
|
-
const s = new AbortController()
|
|
1404
|
+
const s = new AbortController();
|
|
1405
|
+
let a;
|
|
1406
|
+
const c = {
|
|
1405
1407
|
"Content-Type": "application/json"
|
|
1406
1408
|
};
|
|
1407
1409
|
e && (c["X-API-KEY"] = e);
|
|
1408
1410
|
const u = new URLSearchParams();
|
|
1409
1411
|
i && u.set("is_debug", "true");
|
|
1410
|
-
const
|
|
1411
|
-
return u.toString() && (
|
|
1412
|
+
const l = new URL(t);
|
|
1413
|
+
return u.toString() && (l.search = u.toString()), qt(l.toString(), {
|
|
1412
1414
|
method: "POST",
|
|
1413
1415
|
headers: c,
|
|
1414
1416
|
body: n ? JSON.stringify(n) : void 0,
|
|
@@ -1418,17 +1420,18 @@ function Wt(r) {
|
|
|
1418
1420
|
* https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
|
|
1419
1421
|
*/
|
|
1420
1422
|
openWhenHidden: !0,
|
|
1421
|
-
onopen: async (
|
|
1422
|
-
|
|
1423
|
+
onopen: async (d) => {
|
|
1424
|
+
d.ok ? a = d.headers.get("X-Trace-Id") ?? void 0 : (o.error(d), s.abort());
|
|
1423
1425
|
},
|
|
1424
|
-
onmessage: (
|
|
1425
|
-
|
|
1426
|
+
onmessage: (d) => {
|
|
1427
|
+
const v = JSON.parse(d.data);
|
|
1428
|
+
a ? v.traceId = a : v.requestId && (v.traceId = v.requestId, a || (a = v.requestId)), o.next(v);
|
|
1426
1429
|
},
|
|
1427
1430
|
onclose: () => {
|
|
1428
1431
|
o.complete();
|
|
1429
1432
|
},
|
|
1430
|
-
onerror: (
|
|
1431
|
-
throw o.error(
|
|
1433
|
+
onerror: (d) => {
|
|
1434
|
+
throw o.error(d), s.abort(), d;
|
|
1432
1435
|
}
|
|
1433
1436
|
}), () => {
|
|
1434
1437
|
s.abort();
|
|
@@ -1479,43 +1482,43 @@ class zt {
|
|
|
1479
1482
|
}
|
|
1480
1483
|
handleEvent(t) {
|
|
1481
1484
|
switch (t.eventType) {
|
|
1482
|
-
case
|
|
1485
|
+
case y.INIT:
|
|
1483
1486
|
this.sseEmitter.emit(
|
|
1484
|
-
|
|
1487
|
+
y.INIT,
|
|
1485
1488
|
t
|
|
1486
1489
|
);
|
|
1487
1490
|
break;
|
|
1488
|
-
case
|
|
1489
|
-
case
|
|
1491
|
+
case y.PROCESS_START:
|
|
1492
|
+
case y.PROCESS_COMPLETE:
|
|
1490
1493
|
this.sseEmitter.emit(
|
|
1491
|
-
|
|
1494
|
+
y.PROCESS,
|
|
1492
1495
|
t
|
|
1493
1496
|
);
|
|
1494
1497
|
break;
|
|
1495
|
-
case
|
|
1496
|
-
case
|
|
1497
|
-
case
|
|
1498
|
+
case y.MESSAGE_START:
|
|
1499
|
+
case y.MESSAGE_DELTA:
|
|
1500
|
+
case y.MESSAGE_COMPLETE:
|
|
1498
1501
|
this.sseEmitter.emit(
|
|
1499
|
-
|
|
1502
|
+
y.MESSAGE,
|
|
1500
1503
|
t
|
|
1501
1504
|
);
|
|
1502
1505
|
break;
|
|
1503
|
-
case
|
|
1504
|
-
case
|
|
1506
|
+
case y.TOOL_CALL_START:
|
|
1507
|
+
case y.TOOL_CALL_COMPLETE:
|
|
1505
1508
|
this.sseEmitter.emit(
|
|
1506
|
-
|
|
1509
|
+
y.TOOL_CALL,
|
|
1507
1510
|
t
|
|
1508
1511
|
);
|
|
1509
1512
|
break;
|
|
1510
|
-
case
|
|
1513
|
+
case y.DONE:
|
|
1511
1514
|
this.sseEmitter.emit(
|
|
1512
|
-
|
|
1515
|
+
y.DONE,
|
|
1513
1516
|
t
|
|
1514
1517
|
);
|
|
1515
1518
|
break;
|
|
1516
|
-
case
|
|
1519
|
+
case y.ERROR:
|
|
1517
1520
|
this.sseEmitter.emit(
|
|
1518
|
-
|
|
1521
|
+
y.ERROR,
|
|
1519
1522
|
t
|
|
1520
1523
|
);
|
|
1521
1524
|
break;
|
|
@@ -1529,7 +1532,7 @@ class zt {
|
|
|
1529
1532
|
debugMode: this.debugMode,
|
|
1530
1533
|
payload: ((i = this.transformSsePayload) == null ? void 0 : i.call(this, t)) ?? t
|
|
1531
1534
|
}).pipe(
|
|
1532
|
-
Rt((o) => mt(o).pipe(
|
|
1535
|
+
Rt((o) => mt(o).pipe($t((e == null ? void 0 : e.delayTime) ?? 50))),
|
|
1533
1536
|
Nt(this.destroy$),
|
|
1534
1537
|
Dt(3)
|
|
1535
1538
|
).subscribe({
|
|
@@ -1570,8 +1573,8 @@ class zt {
|
|
|
1570
1573
|
});
|
|
1571
1574
|
if (!s.ok)
|
|
1572
1575
|
throw new Error(`Upload failed: ${s.status} ${s.statusText}`);
|
|
1573
|
-
const
|
|
1574
|
-
return this.debugMode && console.log("[AsgardServiceClient] File upload response:",
|
|
1576
|
+
const a = await s.json();
|
|
1577
|
+
return this.debugMode && console.log("[AsgardServiceClient] File upload response:", a), a;
|
|
1575
1578
|
} catch (s) {
|
|
1576
1579
|
throw console.error("[AsgardServiceClient] File upload error:", s), s;
|
|
1577
1580
|
}
|
|
@@ -1595,6 +1598,88 @@ class zt {
|
|
|
1595
1598
|
return `${t}/blob`;
|
|
1596
1599
|
}
|
|
1597
1600
|
}
|
|
1601
|
+
class P {
|
|
1602
|
+
constructor({ messages: t }) {
|
|
1603
|
+
m(this, "messages", null);
|
|
1604
|
+
this.messages = t;
|
|
1605
|
+
}
|
|
1606
|
+
pushMessage(t) {
|
|
1607
|
+
const e = new Map(this.messages);
|
|
1608
|
+
return e.set(t.messageId, t), new P({ messages: e });
|
|
1609
|
+
}
|
|
1610
|
+
onMessage(t) {
|
|
1611
|
+
switch (t.eventType) {
|
|
1612
|
+
case y.MESSAGE_START:
|
|
1613
|
+
return this.onMessageStart(
|
|
1614
|
+
t
|
|
1615
|
+
);
|
|
1616
|
+
case y.MESSAGE_DELTA:
|
|
1617
|
+
return this.onMessageDelta(
|
|
1618
|
+
t
|
|
1619
|
+
);
|
|
1620
|
+
case y.MESSAGE_COMPLETE:
|
|
1621
|
+
return this.onMessageComplete(
|
|
1622
|
+
t
|
|
1623
|
+
);
|
|
1624
|
+
case y.ERROR:
|
|
1625
|
+
return this.onMessageError(t);
|
|
1626
|
+
default:
|
|
1627
|
+
return this;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
onMessageStart(t) {
|
|
1631
|
+
const e = t.fact.messageStart.message, n = new Map(this.messages);
|
|
1632
|
+
return n.set(e.messageId, {
|
|
1633
|
+
type: "bot",
|
|
1634
|
+
eventType: y.MESSAGE_START,
|
|
1635
|
+
isTyping: !0,
|
|
1636
|
+
typingText: "",
|
|
1637
|
+
messageId: e.messageId,
|
|
1638
|
+
message: e,
|
|
1639
|
+
time: /* @__PURE__ */ new Date(),
|
|
1640
|
+
traceId: t.traceId
|
|
1641
|
+
}), new P({ messages: n });
|
|
1642
|
+
}
|
|
1643
|
+
onMessageDelta(t) {
|
|
1644
|
+
const e = t.fact.messageDelta.message, n = new Map(this.messages), i = n.get(e.messageId);
|
|
1645
|
+
if ((i == null ? void 0 : i.type) !== "bot") return this;
|
|
1646
|
+
const o = `${(i == null ? void 0 : i.typingText) ?? ""}${e.text}`;
|
|
1647
|
+
return n.set(e.messageId, {
|
|
1648
|
+
type: "bot",
|
|
1649
|
+
eventType: y.MESSAGE_DELTA,
|
|
1650
|
+
isTyping: !0,
|
|
1651
|
+
typingText: o,
|
|
1652
|
+
messageId: e.messageId,
|
|
1653
|
+
message: e,
|
|
1654
|
+
time: /* @__PURE__ */ new Date(),
|
|
1655
|
+
traceId: t.traceId ?? i.traceId
|
|
1656
|
+
}), new P({ messages: n });
|
|
1657
|
+
}
|
|
1658
|
+
onMessageComplete(t) {
|
|
1659
|
+
const e = t.fact.messageComplete.message, n = new Map(this.messages), i = n.get(e.messageId);
|
|
1660
|
+
return n.set(e.messageId, {
|
|
1661
|
+
type: "bot",
|
|
1662
|
+
eventType: y.MESSAGE_COMPLETE,
|
|
1663
|
+
isTyping: !1,
|
|
1664
|
+
typingText: null,
|
|
1665
|
+
messageId: e.messageId,
|
|
1666
|
+
message: e,
|
|
1667
|
+
time: /* @__PURE__ */ new Date(),
|
|
1668
|
+
traceId: t.traceId ?? ((i == null ? void 0 : i.type) === "bot" ? i.traceId : void 0)
|
|
1669
|
+
}), new P({ messages: n });
|
|
1670
|
+
}
|
|
1671
|
+
onMessageError(t) {
|
|
1672
|
+
const e = crypto.randomUUID(), n = t.fact.runError.error, i = new Map(this.messages);
|
|
1673
|
+
return i.set(e, {
|
|
1674
|
+
type: "error",
|
|
1675
|
+
eventType: y.ERROR,
|
|
1676
|
+
messageId: e,
|
|
1677
|
+
error: n,
|
|
1678
|
+
time: /* @__PURE__ */ new Date(),
|
|
1679
|
+
traceId: t.traceId
|
|
1680
|
+
}), new P({ messages: i });
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1598
1683
|
class Le {
|
|
1599
1684
|
constructor(t) {
|
|
1600
1685
|
m(this, "client");
|
|
@@ -1604,6 +1689,7 @@ class Le {
|
|
|
1604
1689
|
m(this, "conversation$");
|
|
1605
1690
|
m(this, "statesObserver");
|
|
1606
1691
|
m(this, "statesSubscription");
|
|
1692
|
+
m(this, "currentUserMessageId");
|
|
1607
1693
|
if (!t.client)
|
|
1608
1694
|
throw new Error("client must be required");
|
|
1609
1695
|
if (!t.customChannelId)
|
|
@@ -1635,15 +1721,22 @@ class Le {
|
|
|
1635
1721
|
onSseStart: e == null ? void 0 : e.onSseStart,
|
|
1636
1722
|
onSseMessage: (o) => {
|
|
1637
1723
|
var s;
|
|
1638
|
-
(s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, o), this.
|
|
1724
|
+
if ((s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, o), this.currentUserMessageId && o.traceId) {
|
|
1725
|
+
const a = new Map(this.conversation$.value.messages), c = a.get(this.currentUserMessageId);
|
|
1726
|
+
c && c.type === "user" && (a.set(this.currentUserMessageId, {
|
|
1727
|
+
...c,
|
|
1728
|
+
traceId: o.traceId
|
|
1729
|
+
}), this.conversation$.next(new P({ messages: a }))), this.currentUserMessageId = void 0;
|
|
1730
|
+
}
|
|
1731
|
+
this.conversation$.next(this.conversation$.value.onMessage(o));
|
|
1639
1732
|
},
|
|
1640
1733
|
onSseError: (o) => {
|
|
1641
1734
|
var s;
|
|
1642
|
-
(s = e == null ? void 0 : e.onSseError) == null || s.call(e, o), this.isConnecting$.next(!1), i(o);
|
|
1735
|
+
(s = e == null ? void 0 : e.onSseError) == null || s.call(e, o), this.isConnecting$.next(!1), this.currentUserMessageId = void 0, i(o);
|
|
1643
1736
|
},
|
|
1644
1737
|
onSseCompleted: () => {
|
|
1645
1738
|
var o;
|
|
1646
|
-
(o = e == null ? void 0 : e.onSseCompleted) == null || o.call(e), this.isConnecting$.next(!1), n();
|
|
1739
|
+
(o = e == null ? void 0 : e.onSseCompleted) == null || o.call(e), this.isConnecting$.next(!1), this.currentUserMessageId = void 0, n();
|
|
1647
1740
|
}
|
|
1648
1741
|
});
|
|
1649
1742
|
});
|
|
@@ -1662,7 +1755,7 @@ class Le {
|
|
|
1662
1755
|
}
|
|
1663
1756
|
sendMessage(t, e) {
|
|
1664
1757
|
const n = t.text.trim(), i = t.customMessageId ?? crypto.randomUUID();
|
|
1665
|
-
return this.conversation$.next(
|
|
1758
|
+
return this.currentUserMessageId = i, this.conversation$.next(
|
|
1666
1759
|
this.conversation$.value.pushMessage({
|
|
1667
1760
|
type: "user",
|
|
1668
1761
|
messageId: i,
|
|
@@ -1688,90 +1781,12 @@ class Le {
|
|
|
1688
1781
|
this.isConnecting$.complete(), this.conversation$.complete(), (t = this.statesSubscription) == null || t.unsubscribe();
|
|
1689
1782
|
}
|
|
1690
1783
|
}
|
|
1691
|
-
class T {
|
|
1692
|
-
constructor({ messages: t }) {
|
|
1693
|
-
m(this, "messages", null);
|
|
1694
|
-
this.messages = t;
|
|
1695
|
-
}
|
|
1696
|
-
pushMessage(t) {
|
|
1697
|
-
const e = new Map(this.messages);
|
|
1698
|
-
return e.set(t.messageId, t), new T({ messages: e });
|
|
1699
|
-
}
|
|
1700
|
-
onMessage(t) {
|
|
1701
|
-
switch (t.eventType) {
|
|
1702
|
-
case d.MESSAGE_START:
|
|
1703
|
-
return this.onMessageStart(
|
|
1704
|
-
t
|
|
1705
|
-
);
|
|
1706
|
-
case d.MESSAGE_DELTA:
|
|
1707
|
-
return this.onMessageDelta(
|
|
1708
|
-
t
|
|
1709
|
-
);
|
|
1710
|
-
case d.MESSAGE_COMPLETE:
|
|
1711
|
-
return this.onMessageComplete(
|
|
1712
|
-
t
|
|
1713
|
-
);
|
|
1714
|
-
case d.ERROR:
|
|
1715
|
-
return this.onMessageError(t);
|
|
1716
|
-
default:
|
|
1717
|
-
return this;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
onMessageStart(t) {
|
|
1721
|
-
const e = t.fact.messageStart.message, n = new Map(this.messages);
|
|
1722
|
-
return n.set(e.messageId, {
|
|
1723
|
-
type: "bot",
|
|
1724
|
-
eventType: d.MESSAGE_START,
|
|
1725
|
-
isTyping: !0,
|
|
1726
|
-
typingText: "",
|
|
1727
|
-
messageId: e.messageId,
|
|
1728
|
-
message: e,
|
|
1729
|
-
time: /* @__PURE__ */ new Date()
|
|
1730
|
-
}), new T({ messages: n });
|
|
1731
|
-
}
|
|
1732
|
-
onMessageDelta(t) {
|
|
1733
|
-
const e = t.fact.messageDelta.message, n = new Map(this.messages), i = n.get(e.messageId);
|
|
1734
|
-
if ((i == null ? void 0 : i.type) !== "bot") return this;
|
|
1735
|
-
const o = `${(i == null ? void 0 : i.typingText) ?? ""}${e.text}`;
|
|
1736
|
-
return n.set(e.messageId, {
|
|
1737
|
-
type: "bot",
|
|
1738
|
-
eventType: d.MESSAGE_DELTA,
|
|
1739
|
-
isTyping: !0,
|
|
1740
|
-
typingText: o,
|
|
1741
|
-
messageId: e.messageId,
|
|
1742
|
-
message: e,
|
|
1743
|
-
time: /* @__PURE__ */ new Date()
|
|
1744
|
-
}), new T({ messages: n });
|
|
1745
|
-
}
|
|
1746
|
-
onMessageComplete(t) {
|
|
1747
|
-
const e = t.fact.messageComplete.message, n = new Map(this.messages);
|
|
1748
|
-
return n.set(e.messageId, {
|
|
1749
|
-
type: "bot",
|
|
1750
|
-
eventType: d.MESSAGE_COMPLETE,
|
|
1751
|
-
isTyping: !1,
|
|
1752
|
-
typingText: null,
|
|
1753
|
-
messageId: e.messageId,
|
|
1754
|
-
message: e,
|
|
1755
|
-
time: /* @__PURE__ */ new Date()
|
|
1756
|
-
}), new T({ messages: n });
|
|
1757
|
-
}
|
|
1758
|
-
onMessageError(t) {
|
|
1759
|
-
const e = crypto.randomUUID(), n = t.fact.runError.error, i = new Map(this.messages);
|
|
1760
|
-
return i.set(e, {
|
|
1761
|
-
type: "error",
|
|
1762
|
-
eventType: d.ERROR,
|
|
1763
|
-
messageId: e,
|
|
1764
|
-
error: n,
|
|
1765
|
-
time: /* @__PURE__ */ new Date()
|
|
1766
|
-
}), new T({ messages: i });
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
1784
|
export {
|
|
1770
1785
|
zt as AsgardServiceClient,
|
|
1771
1786
|
Le as Channel,
|
|
1772
|
-
|
|
1773
|
-
|
|
1787
|
+
P as Conversation,
|
|
1788
|
+
y as EventType,
|
|
1774
1789
|
B as FetchSseAction,
|
|
1775
|
-
|
|
1790
|
+
$e as MessageTemplateType
|
|
1776
1791
|
};
|
|
1777
1792
|
//# sourceMappingURL=index.mjs.map
|