@asgard-js/core 0.1.18-canary.2 → 0.1.18
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 +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +841 -807
- package/dist/index.mjs.map +1 -1
- package/dist/lib/conversation.d.ts +2 -0
- package/dist/lib/conversation.d.ts.map +1 -1
- package/dist/types/channel.d.ts +15 -1
- package/dist/types/channel.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
1
|
var Ne = Object.defineProperty;
|
|
2
|
-
var Ge = (r,
|
|
3
|
-
var
|
|
4
|
-
var Y = /* @__PURE__ */ ((r) => (r.RESET_CHANNEL = "RESET_CHANNEL", r.NONE = "NONE", r))(Y || {}),
|
|
5
|
-
return W = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
6
|
-
|
|
7
|
-
} || function(
|
|
8
|
-
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (
|
|
9
|
-
}, W(r,
|
|
2
|
+
var Ge = (r, t, e) => t in r ? Ne(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var b = (r, t, e) => Ge(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
var Y = /* @__PURE__ */ ((r) => (r.RESET_CHANNEL = "RESET_CHANNEL", r.NONE = "NONE", r))(Y || {}), h = /* @__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))(h || {}), Fe = /* @__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))(Fe || {}), W = function(r, t) {
|
|
5
|
+
return W = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
|
|
6
|
+
e.__proto__ = n;
|
|
7
|
+
} || function(e, n) {
|
|
8
|
+
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
|
|
9
|
+
}, W(r, t);
|
|
10
10
|
};
|
|
11
|
-
function
|
|
12
|
-
if (typeof
|
|
13
|
-
throw new TypeError("Class extends value " + String(
|
|
14
|
-
W(r,
|
|
15
|
-
function
|
|
11
|
+
function A(r, t) {
|
|
12
|
+
if (typeof t != "function" && t !== null)
|
|
13
|
+
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
14
|
+
W(r, t);
|
|
15
|
+
function e() {
|
|
16
16
|
this.constructor = r;
|
|
17
17
|
}
|
|
18
|
-
r.prototype =
|
|
18
|
+
r.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
19
19
|
}
|
|
20
|
-
function Ve(r,
|
|
20
|
+
function Ve(r, t, e, n) {
|
|
21
21
|
function i(o) {
|
|
22
|
-
return o instanceof
|
|
22
|
+
return o instanceof e ? o : new e(function(s) {
|
|
23
23
|
s(o);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
return new (
|
|
26
|
+
return new (e || (e = Promise))(function(o, s) {
|
|
27
27
|
function a(l) {
|
|
28
28
|
try {
|
|
29
|
-
|
|
29
|
+
u(n.next(l));
|
|
30
30
|
} catch (d) {
|
|
31
31
|
s(d);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function c(l) {
|
|
35
35
|
try {
|
|
36
|
-
|
|
36
|
+
u(n.throw(l));
|
|
37
37
|
} catch (d) {
|
|
38
38
|
s(d);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
l.done ? o(l.value) : i(l.value).then(a,
|
|
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 de(r,
|
|
48
|
-
var
|
|
47
|
+
function de(r, t) {
|
|
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
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 a(
|
|
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
|
|
70
|
+
return e.label++, { value: u[1], done: !1 };
|
|
71
71
|
case 5:
|
|
72
|
-
|
|
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 =
|
|
79
|
-
|
|
78
|
+
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
|
|
79
|
+
e = 0;
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
|
-
if (
|
|
83
|
-
|
|
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
|
-
|
|
86
|
+
if (u[0] === 6 && e.label < o[1]) {
|
|
87
|
+
e.label = o[1], o = u;
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
|
-
if (o &&
|
|
91
|
-
|
|
90
|
+
if (o && e.label < o[2]) {
|
|
91
|
+
e.label = o[2], e.ops.push(u);
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
|
-
o[2] &&
|
|
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
|
-
function
|
|
108
|
-
var
|
|
109
|
-
if (
|
|
107
|
+
function L(r) {
|
|
108
|
+
var t = typeof Symbol == "function" && Symbol.iterator, e = t && r[t], n = 0;
|
|
109
|
+
if (e) return e.call(r);
|
|
110
110
|
if (r && typeof r.length == "number") return {
|
|
111
111
|
next: function() {
|
|
112
112
|
return r && n >= r.length && (r = void 0), { value: r && r[n++], done: !r };
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
throw new TypeError(
|
|
115
|
+
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
var
|
|
119
|
-
if (!
|
|
120
|
-
var n =
|
|
117
|
+
function R(r, t) {
|
|
118
|
+
var e = typeof Symbol == "function" && r[Symbol.iterator];
|
|
119
|
+
if (!e) return r;
|
|
120
|
+
var n = e.call(r), i, o = [], s;
|
|
121
121
|
try {
|
|
122
|
-
for (; (
|
|
122
|
+
for (; (t === void 0 || t-- > 0) && !(i = n.next()).done; ) o.push(i.value);
|
|
123
123
|
} catch (a) {
|
|
124
124
|
s = { error: a };
|
|
125
125
|
} finally {
|
|
126
126
|
try {
|
|
127
|
-
i && !i.done && (
|
|
127
|
+
i && !i.done && (e = n.return) && e.call(n);
|
|
128
128
|
} finally {
|
|
129
129
|
if (s) throw s.error;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
return o;
|
|
133
133
|
}
|
|
134
|
-
function U(r,
|
|
135
|
-
if (
|
|
136
|
-
(o || !(n in
|
|
137
|
-
return r.concat(o || Array.prototype.slice.call(
|
|
134
|
+
function U(r, t, e) {
|
|
135
|
+
if (e || arguments.length === 2) for (var n = 0, i = t.length, o; n < i; n++)
|
|
136
|
+
(o || !(n in t)) && (o || (o = Array.prototype.slice.call(t, 0, n)), o[n] = t[n]);
|
|
137
|
+
return r.concat(o || Array.prototype.slice.call(t));
|
|
138
138
|
}
|
|
139
139
|
function M(r) {
|
|
140
140
|
return this instanceof M ? (this.v = r, this) : new M(r);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function qe(r, t, e) {
|
|
143
143
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
144
|
-
var n =
|
|
144
|
+
var n = e.apply(r, t || []), i, o = [];
|
|
145
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;
|
|
@@ -151,177 +151,177 @@ function He(r, e, t) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function a(f, p) {
|
|
154
|
-
n[f] && (i[f] = function(
|
|
154
|
+
n[f] && (i[f] = function(v) {
|
|
155
155
|
return new Promise(function(w, E) {
|
|
156
|
-
o.push([f,
|
|
156
|
+
o.push([f, v, w, E]) > 1 || c(f, v);
|
|
157
157
|
});
|
|
158
158
|
}, p && (i[f] = p(i[f])));
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function c(f, p) {
|
|
161
161
|
try {
|
|
162
|
-
|
|
163
|
-
} catch (
|
|
164
|
-
|
|
162
|
+
u(n[f](p));
|
|
163
|
+
} catch (v) {
|
|
164
|
+
y(o[0][3], v);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
f.value instanceof M ? Promise.resolve(f.value.v).then(l, d) :
|
|
167
|
+
function u(f) {
|
|
168
|
+
f.value instanceof M ? Promise.resolve(f.value.v).then(l, d) : y(o[0][2], f);
|
|
169
169
|
}
|
|
170
170
|
function l(f) {
|
|
171
|
-
|
|
171
|
+
c("next", f);
|
|
172
172
|
}
|
|
173
173
|
function d(f) {
|
|
174
|
-
|
|
174
|
+
c("throw", f);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
f(p), o.shift(), o.length &&
|
|
176
|
+
function y(f, p) {
|
|
177
|
+
f(p), o.shift(), o.length && c(o[0][0], o[0][1]);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function He(r) {
|
|
181
181
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
182
|
-
var
|
|
183
|
-
return
|
|
182
|
+
var t = r[Symbol.asyncIterator], e;
|
|
183
|
+
return t ? t.call(r) : (r = typeof L == "function" ? L(r) : r[Symbol.iterator](), e = {}, n("next"), n("throw"), n("return"), e[Symbol.asyncIterator] = function() {
|
|
184
184
|
return this;
|
|
185
|
-
},
|
|
185
|
+
}, e);
|
|
186
186
|
function n(o) {
|
|
187
|
-
|
|
188
|
-
return new Promise(function(a,
|
|
189
|
-
s = r[o](s), i(a,
|
|
187
|
+
e[o] = r[o] && function(s) {
|
|
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, a,
|
|
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 m(r) {
|
|
200
200
|
return typeof r == "function";
|
|
201
201
|
}
|
|
202
202
|
function he(r) {
|
|
203
|
-
var
|
|
203
|
+
var t = function(n) {
|
|
204
204
|
Error.call(n), n.stack = new Error().stack;
|
|
205
|
-
},
|
|
206
|
-
return
|
|
205
|
+
}, e = r(t);
|
|
206
|
+
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
|
207
207
|
}
|
|
208
|
-
var
|
|
209
|
-
return function(
|
|
210
|
-
r(this), this.message =
|
|
211
|
-
` +
|
|
208
|
+
var K = he(function(r) {
|
|
209
|
+
return function(e) {
|
|
210
|
+
r(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
211
|
+
` + e.map(function(n, i) {
|
|
212
212
|
return i + 1 + ") " + n.toString();
|
|
213
213
|
}).join(`
|
|
214
|
-
`) : "", this.name = "UnsubscriptionError", this.errors =
|
|
214
|
+
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
215
215
|
};
|
|
216
216
|
});
|
|
217
|
-
function N(r,
|
|
217
|
+
function N(r, t) {
|
|
218
218
|
if (r) {
|
|
219
|
-
var
|
|
220
|
-
0 <=
|
|
219
|
+
var e = r.indexOf(t);
|
|
220
|
+
0 <= e && r.splice(e, 1);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
var k = (function() {
|
|
224
|
-
function r(
|
|
225
|
-
this.initialTeardown =
|
|
224
|
+
function r(t) {
|
|
225
|
+
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
226
226
|
}
|
|
227
227
|
return r.prototype.unsubscribe = function() {
|
|
228
|
-
var
|
|
228
|
+
var t, e, n, i, o;
|
|
229
229
|
if (!this.closed) {
|
|
230
230
|
this.closed = !0;
|
|
231
231
|
var s = this._parentage;
|
|
232
232
|
if (s)
|
|
233
233
|
if (this._parentage = null, Array.isArray(s))
|
|
234
234
|
try {
|
|
235
|
-
for (var a =
|
|
236
|
-
var
|
|
237
|
-
|
|
235
|
+
for (var a = L(s), c = a.next(); !c.done; c = a.next()) {
|
|
236
|
+
var u = c.value;
|
|
237
|
+
u.remove(this);
|
|
238
238
|
}
|
|
239
|
-
} catch (
|
|
240
|
-
|
|
239
|
+
} catch (v) {
|
|
240
|
+
t = { error: v };
|
|
241
241
|
} finally {
|
|
242
242
|
try {
|
|
243
|
-
|
|
243
|
+
c && !c.done && (e = a.return) && e.call(a);
|
|
244
244
|
} finally {
|
|
245
|
-
if (
|
|
245
|
+
if (t) throw t.error;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
else
|
|
249
249
|
s.remove(this);
|
|
250
250
|
var l = this.initialTeardown;
|
|
251
|
-
if (
|
|
251
|
+
if (m(l))
|
|
252
252
|
try {
|
|
253
253
|
l();
|
|
254
|
-
} catch (
|
|
255
|
-
o =
|
|
254
|
+
} catch (v) {
|
|
255
|
+
o = v instanceof K ? v.errors : [v];
|
|
256
256
|
}
|
|
257
257
|
var d = this._finalizers;
|
|
258
258
|
if (d) {
|
|
259
259
|
this._finalizers = null;
|
|
260
260
|
try {
|
|
261
|
-
for (var
|
|
261
|
+
for (var y = L(d), f = y.next(); !f.done; f = y.next()) {
|
|
262
262
|
var p = f.value;
|
|
263
263
|
try {
|
|
264
264
|
re(p);
|
|
265
|
-
} catch (
|
|
266
|
-
o = o ?? [],
|
|
265
|
+
} catch (v) {
|
|
266
|
+
o = o ?? [], v instanceof K ? o = U(U([], R(o)), R(v.errors)) : o.push(v);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
} catch (
|
|
270
|
-
n = { error:
|
|
269
|
+
} catch (v) {
|
|
270
|
+
n = { error: v };
|
|
271
271
|
} finally {
|
|
272
272
|
try {
|
|
273
|
-
f && !f.done && (i =
|
|
273
|
+
f && !f.done && (i = y.return) && i.call(y);
|
|
274
274
|
} finally {
|
|
275
275
|
if (n) throw n.error;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
if (o)
|
|
280
|
-
throw new
|
|
280
|
+
throw new K(o);
|
|
281
281
|
}
|
|
282
|
-
}, r.prototype.add = function(
|
|
283
|
-
var
|
|
284
|
-
if (
|
|
282
|
+
}, r.prototype.add = function(t) {
|
|
283
|
+
var e;
|
|
284
|
+
if (t && t !== this)
|
|
285
285
|
if (this.closed)
|
|
286
|
-
re(
|
|
286
|
+
re(t);
|
|
287
287
|
else {
|
|
288
|
-
if (
|
|
289
|
-
if (
|
|
288
|
+
if (t instanceof r) {
|
|
289
|
+
if (t.closed || t._hasParent(this))
|
|
290
290
|
return;
|
|
291
|
-
|
|
291
|
+
t._addParent(this);
|
|
292
292
|
}
|
|
293
|
-
(this._finalizers = (
|
|
293
|
+
(this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(t);
|
|
294
294
|
}
|
|
295
|
-
}, r.prototype._hasParent = function(
|
|
296
|
-
var
|
|
297
|
-
return
|
|
298
|
-
}, r.prototype._addParent = function(
|
|
299
|
-
var
|
|
300
|
-
this._parentage = Array.isArray(
|
|
301
|
-
}, r.prototype._removeParent = function(
|
|
302
|
-
var
|
|
303
|
-
|
|
304
|
-
}, r.prototype.remove = function(
|
|
305
|
-
var
|
|
306
|
-
|
|
295
|
+
}, r.prototype._hasParent = function(t) {
|
|
296
|
+
var e = this._parentage;
|
|
297
|
+
return e === t || Array.isArray(e) && e.includes(t);
|
|
298
|
+
}, r.prototype._addParent = function(t) {
|
|
299
|
+
var e = this._parentage;
|
|
300
|
+
this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
|
|
301
|
+
}, r.prototype._removeParent = function(t) {
|
|
302
|
+
var e = this._parentage;
|
|
303
|
+
e === t ? this._parentage = null : Array.isArray(e) && N(e, t);
|
|
304
|
+
}, r.prototype.remove = function(t) {
|
|
305
|
+
var e = this._finalizers;
|
|
306
|
+
e && N(e, t), t instanceof r && t._removeParent(this);
|
|
307
307
|
}, r.EMPTY = (function() {
|
|
308
|
-
var
|
|
309
|
-
return
|
|
308
|
+
var t = new r();
|
|
309
|
+
return t.closed = !0, t;
|
|
310
310
|
})(), r;
|
|
311
311
|
})(), ve = k.EMPTY;
|
|
312
312
|
function ye(r) {
|
|
313
|
-
return r instanceof k || r && "closed" in r &&
|
|
313
|
+
return r instanceof k || r && "closed" in r && m(r.remove) && m(r.add) && m(r.unsubscribe);
|
|
314
314
|
}
|
|
315
315
|
function re(r) {
|
|
316
|
-
|
|
316
|
+
m(r) ? r() : r.unsubscribe();
|
|
317
317
|
}
|
|
318
|
-
var
|
|
318
|
+
var Ke = {
|
|
319
319
|
Promise: void 0
|
|
320
|
-
},
|
|
321
|
-
setTimeout: function(r,
|
|
322
|
-
for (var
|
|
323
|
-
|
|
324
|
-
return setTimeout.apply(void 0, U([r,
|
|
320
|
+
}, Be = {
|
|
321
|
+
setTimeout: function(r, t) {
|
|
322
|
+
for (var e = [], n = 2; n < arguments.length; n++)
|
|
323
|
+
e[n - 2] = arguments[n];
|
|
324
|
+
return setTimeout.apply(void 0, U([r, t], R(e)));
|
|
325
325
|
},
|
|
326
326
|
clearTimeout: function(r) {
|
|
327
327
|
return clearTimeout(r);
|
|
@@ -329,7 +329,7 @@ var Be = {
|
|
|
329
329
|
delegate: void 0
|
|
330
330
|
};
|
|
331
331
|
function pe(r) {
|
|
332
|
-
|
|
332
|
+
Be.setTimeout(function() {
|
|
333
333
|
throw r;
|
|
334
334
|
});
|
|
335
335
|
}
|
|
@@ -339,80 +339,80 @@ function D(r) {
|
|
|
339
339
|
r();
|
|
340
340
|
}
|
|
341
341
|
var Q = (function(r) {
|
|
342
|
-
|
|
343
|
-
function e
|
|
342
|
+
A(t, r);
|
|
343
|
+
function t(e) {
|
|
344
344
|
var n = r.call(this) || this;
|
|
345
|
-
return n.isStopped = !1,
|
|
345
|
+
return n.isStopped = !1, e ? (n.destination = e, ye(e) && e.add(n)) : n.destination = Xe, n;
|
|
346
346
|
}
|
|
347
|
-
return
|
|
348
|
-
return new J(
|
|
349
|
-
},
|
|
350
|
-
this.isStopped || this._next(
|
|
351
|
-
},
|
|
352
|
-
this.isStopped || (this.isStopped = !0, this._error(
|
|
353
|
-
},
|
|
347
|
+
return t.create = function(e, n, i) {
|
|
348
|
+
return new J(e, n, i);
|
|
349
|
+
}, t.prototype.next = function(e) {
|
|
350
|
+
this.isStopped || this._next(e);
|
|
351
|
+
}, t.prototype.error = function(e) {
|
|
352
|
+
this.isStopped || (this.isStopped = !0, this._error(e));
|
|
353
|
+
}, t.prototype.complete = function() {
|
|
354
354
|
this.isStopped || (this.isStopped = !0, this._complete());
|
|
355
|
-
},
|
|
355
|
+
}, t.prototype.unsubscribe = function() {
|
|
356
356
|
this.closed || (this.isStopped = !0, r.prototype.unsubscribe.call(this), this.destination = null);
|
|
357
|
-
},
|
|
358
|
-
this.destination.next(
|
|
359
|
-
},
|
|
357
|
+
}, t.prototype._next = function(e) {
|
|
358
|
+
this.destination.next(e);
|
|
359
|
+
}, t.prototype._error = function(e) {
|
|
360
360
|
try {
|
|
361
|
-
this.destination.error(
|
|
361
|
+
this.destination.error(e);
|
|
362
362
|
} finally {
|
|
363
363
|
this.unsubscribe();
|
|
364
364
|
}
|
|
365
|
-
},
|
|
365
|
+
}, t.prototype._complete = function() {
|
|
366
366
|
try {
|
|
367
367
|
this.destination.complete();
|
|
368
368
|
} finally {
|
|
369
369
|
this.unsubscribe();
|
|
370
370
|
}
|
|
371
|
-
},
|
|
371
|
+
}, t;
|
|
372
372
|
})(k), Ye = (function() {
|
|
373
|
-
function r(
|
|
374
|
-
this.partialObserver =
|
|
373
|
+
function r(t) {
|
|
374
|
+
this.partialObserver = t;
|
|
375
375
|
}
|
|
376
|
-
return r.prototype.next = function(
|
|
377
|
-
var
|
|
378
|
-
if (
|
|
376
|
+
return r.prototype.next = function(t) {
|
|
377
|
+
var e = this.partialObserver;
|
|
378
|
+
if (e.next)
|
|
379
379
|
try {
|
|
380
|
-
|
|
380
|
+
e.next(t);
|
|
381
381
|
} catch (n) {
|
|
382
|
-
|
|
382
|
+
j(n);
|
|
383
383
|
}
|
|
384
|
-
}, r.prototype.error = function(
|
|
385
|
-
var
|
|
386
|
-
if (
|
|
384
|
+
}, r.prototype.error = function(t) {
|
|
385
|
+
var e = this.partialObserver;
|
|
386
|
+
if (e.error)
|
|
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
|
-
var
|
|
396
|
-
if (
|
|
395
|
+
var t = this.partialObserver;
|
|
396
|
+
if (t.complete)
|
|
397
397
|
try {
|
|
398
|
-
|
|
399
|
-
} catch (
|
|
400
|
-
|
|
398
|
+
t.complete();
|
|
399
|
+
} catch (e) {
|
|
400
|
+
j(e);
|
|
401
401
|
}
|
|
402
402
|
}, r;
|
|
403
403
|
})(), J = (function(r) {
|
|
404
|
-
|
|
405
|
-
function e
|
|
404
|
+
A(t, r);
|
|
405
|
+
function t(e, n, i) {
|
|
406
406
|
var o = r.call(this) || this, s;
|
|
407
|
-
return
|
|
408
|
-
next:
|
|
407
|
+
return m(e) || !e ? s = {
|
|
408
|
+
next: e ?? void 0,
|
|
409
409
|
error: n ?? void 0,
|
|
410
410
|
complete: i ?? void 0
|
|
411
|
-
} : s =
|
|
411
|
+
} : s = e, o.destination = new Ye(s), o;
|
|
412
412
|
}
|
|
413
|
-
return
|
|
413
|
+
return t;
|
|
414
414
|
})(Q);
|
|
415
|
-
function
|
|
415
|
+
function j(r) {
|
|
416
416
|
pe(r);
|
|
417
417
|
}
|
|
418
418
|
function We(r) {
|
|
@@ -430,40 +430,40 @@ function F(r) {
|
|
|
430
430
|
return r;
|
|
431
431
|
}
|
|
432
432
|
function Je(r) {
|
|
433
|
-
return r.length === 0 ? F : r.length === 1 ? r[0] : function(
|
|
433
|
+
return r.length === 0 ? F : r.length === 1 ? r[0] : function(e) {
|
|
434
434
|
return r.reduce(function(n, i) {
|
|
435
435
|
return i(n);
|
|
436
|
-
},
|
|
436
|
+
}, e);
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
439
|
var S = (function() {
|
|
440
|
-
function r(
|
|
441
|
-
|
|
440
|
+
function r(t) {
|
|
441
|
+
t && (this._subscribe = t);
|
|
442
442
|
}
|
|
443
|
-
return r.prototype.lift = function(
|
|
444
|
-
var
|
|
445
|
-
return
|
|
446
|
-
}, r.prototype.subscribe = function(
|
|
447
|
-
var i = this, o = Qe(
|
|
443
|
+
return r.prototype.lift = function(t) {
|
|
444
|
+
var e = new r();
|
|
445
|
+
return e.source = this, e.operator = t, e;
|
|
446
|
+
}, r.prototype.subscribe = function(t, e, n) {
|
|
447
|
+
var i = this, o = Qe(t) ? t : new J(t, e, n);
|
|
448
448
|
return D(function() {
|
|
449
|
-
var s = i, a = s.operator,
|
|
450
|
-
o.add(a ? a.call(o,
|
|
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
|
-
}, r.prototype._trySubscribe = function(
|
|
452
|
+
}, r.prototype._trySubscribe = function(t) {
|
|
453
453
|
try {
|
|
454
|
-
return this._subscribe(
|
|
455
|
-
} catch (
|
|
456
|
-
|
|
454
|
+
return this._subscribe(t);
|
|
455
|
+
} catch (e) {
|
|
456
|
+
t.error(e);
|
|
457
457
|
}
|
|
458
|
-
}, r.prototype.forEach = function(
|
|
458
|
+
}, r.prototype.forEach = function(t, e) {
|
|
459
459
|
var n = this;
|
|
460
|
-
return
|
|
460
|
+
return e = ne(e), new e(function(i, o) {
|
|
461
461
|
var s = new J({
|
|
462
462
|
next: function(a) {
|
|
463
463
|
try {
|
|
464
|
-
|
|
465
|
-
} catch (
|
|
466
|
-
o(
|
|
464
|
+
t(a);
|
|
465
|
+
} catch (c) {
|
|
466
|
+
o(c), s.unsubscribe();
|
|
467
467
|
}
|
|
468
468
|
},
|
|
469
469
|
error: o,
|
|
@@ -471,20 +471,20 @@ var S = (function() {
|
|
|
471
471
|
});
|
|
472
472
|
n.subscribe(s);
|
|
473
473
|
});
|
|
474
|
-
}, r.prototype._subscribe = function(
|
|
475
|
-
var
|
|
476
|
-
return (
|
|
474
|
+
}, r.prototype._subscribe = function(t) {
|
|
475
|
+
var e;
|
|
476
|
+
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
|
|
477
477
|
}, r.prototype[Z] = function() {
|
|
478
478
|
return this;
|
|
479
479
|
}, r.prototype.pipe = function() {
|
|
480
|
-
for (var
|
|
481
|
-
e
|
|
482
|
-
return Je(
|
|
483
|
-
}, r.prototype.toPromise = function(
|
|
484
|
-
var
|
|
485
|
-
return
|
|
480
|
+
for (var t = [], e = 0; e < arguments.length; e++)
|
|
481
|
+
t[e] = arguments[e];
|
|
482
|
+
return Je(t)(this);
|
|
483
|
+
}, r.prototype.toPromise = function(t) {
|
|
484
|
+
var e = this;
|
|
485
|
+
return t = ne(t), new t(function(n, i) {
|
|
486
486
|
var o;
|
|
487
|
-
|
|
487
|
+
e.subscribe(function(s) {
|
|
488
488
|
return o = s;
|
|
489
489
|
}, function(s) {
|
|
490
490
|
return i(s);
|
|
@@ -492,29 +492,29 @@ var S = (function() {
|
|
|
492
492
|
return n(o);
|
|
493
493
|
});
|
|
494
494
|
});
|
|
495
|
-
}, r.create = function(
|
|
496
|
-
return new r(
|
|
495
|
+
}, r.create = function(t) {
|
|
496
|
+
return new r(t);
|
|
497
497
|
}, r;
|
|
498
498
|
})();
|
|
499
499
|
function ne(r) {
|
|
500
|
-
var
|
|
501
|
-
return (
|
|
500
|
+
var t;
|
|
501
|
+
return (t = r ?? Ke.Promise) !== null && t !== void 0 ? t : Promise;
|
|
502
502
|
}
|
|
503
503
|
function ze(r) {
|
|
504
|
-
return r &&
|
|
504
|
+
return r && m(r.next) && m(r.error) && m(r.complete);
|
|
505
505
|
}
|
|
506
506
|
function Qe(r) {
|
|
507
507
|
return r && r instanceof Q || ze(r) && ye(r);
|
|
508
508
|
}
|
|
509
509
|
function Ze(r) {
|
|
510
|
-
return
|
|
510
|
+
return m(r == null ? void 0 : r.lift);
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
return function(
|
|
514
|
-
if (Ze(
|
|
515
|
-
return
|
|
512
|
+
function P(r) {
|
|
513
|
+
return function(t) {
|
|
514
|
+
if (Ze(t))
|
|
515
|
+
return t.lift(function(e) {
|
|
516
516
|
try {
|
|
517
|
-
return r(
|
|
517
|
+
return r(e, this);
|
|
518
518
|
} catch (n) {
|
|
519
519
|
this.error(n);
|
|
520
520
|
}
|
|
@@ -522,73 +522,73 @@ function C(r) {
|
|
|
522
522
|
throw new TypeError("Unable to lift unknown Observable type");
|
|
523
523
|
};
|
|
524
524
|
}
|
|
525
|
-
function
|
|
526
|
-
return new et(r,
|
|
525
|
+
function O(r, t, e, n, i) {
|
|
526
|
+
return new et(r, t, e, n, i);
|
|
527
527
|
}
|
|
528
528
|
var et = (function(r) {
|
|
529
|
-
|
|
530
|
-
function e
|
|
531
|
-
var
|
|
532
|
-
return
|
|
529
|
+
A(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
|
-
|
|
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
|
-
return
|
|
557
|
-
var
|
|
556
|
+
return t.prototype.unsubscribe = function() {
|
|
557
|
+
var e;
|
|
558
558
|
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
559
559
|
var n = this.closed;
|
|
560
|
-
r.prototype.unsubscribe.call(this), !n && ((
|
|
560
|
+
r.prototype.unsubscribe.call(this), !n && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
561
561
|
}
|
|
562
|
-
},
|
|
562
|
+
}, t;
|
|
563
563
|
})(Q), tt = he(function(r) {
|
|
564
564
|
return function() {
|
|
565
565
|
r(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
566
566
|
};
|
|
567
567
|
}), ee = (function(r) {
|
|
568
|
-
|
|
569
|
-
function
|
|
570
|
-
var
|
|
571
|
-
return
|
|
568
|
+
A(t, r);
|
|
569
|
+
function t() {
|
|
570
|
+
var e = r.call(this) || this;
|
|
571
|
+
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
572
572
|
}
|
|
573
|
-
return
|
|
573
|
+
return t.prototype.lift = function(e) {
|
|
574
574
|
var n = new ie(this, this);
|
|
575
|
-
return n.operator =
|
|
576
|
-
},
|
|
575
|
+
return n.operator = e, n;
|
|
576
|
+
}, t.prototype._throwIfClosed = function() {
|
|
577
577
|
if (this.closed)
|
|
578
578
|
throw new tt();
|
|
579
|
-
},
|
|
579
|
+
}, t.prototype.next = function(e) {
|
|
580
580
|
var n = this;
|
|
581
581
|
D(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 =
|
|
587
|
-
var
|
|
588
|
-
|
|
586
|
+
for (var s = L(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);
|
|
@@ -598,237 +598,237 @@ var et = (function(r) {
|
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
});
|
|
601
|
-
},
|
|
601
|
+
}, t.prototype.error = function(e) {
|
|
602
602
|
var n = this;
|
|
603
603
|
D(function() {
|
|
604
604
|
if (n._throwIfClosed(), !n.isStopped) {
|
|
605
|
-
n.hasError = n.isStopped = !0, n.thrownError =
|
|
605
|
+
n.hasError = n.isStopped = !0, n.thrownError = e;
|
|
606
606
|
for (var i = n.observers; i.length; )
|
|
607
|
-
i.shift().error(
|
|
607
|
+
i.shift().error(e);
|
|
608
608
|
}
|
|
609
609
|
});
|
|
610
|
-
},
|
|
611
|
-
var
|
|
610
|
+
}, t.prototype.complete = function() {
|
|
611
|
+
var e = this;
|
|
612
612
|
D(function() {
|
|
613
|
-
if (
|
|
614
|
-
|
|
615
|
-
for (var n =
|
|
613
|
+
if (e._throwIfClosed(), !e.isStopped) {
|
|
614
|
+
e.isStopped = !0;
|
|
615
|
+
for (var n = e.observers; n.length; )
|
|
616
616
|
n.shift().complete();
|
|
617
617
|
}
|
|
618
618
|
});
|
|
619
|
-
},
|
|
619
|
+
}, t.prototype.unsubscribe = function() {
|
|
620
620
|
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
|
|
621
|
-
}, Object.defineProperty(
|
|
621
|
+
}, Object.defineProperty(t.prototype, "observed", {
|
|
622
622
|
get: function() {
|
|
623
|
-
var
|
|
624
|
-
return ((
|
|
623
|
+
var e;
|
|
624
|
+
return ((e = this.observers) === null || e === void 0 ? void 0 : e.length) > 0;
|
|
625
625
|
},
|
|
626
626
|
enumerable: !1,
|
|
627
627
|
configurable: !0
|
|
628
|
-
}),
|
|
629
|
-
return this._throwIfClosed(), r.prototype._trySubscribe.call(this,
|
|
630
|
-
},
|
|
631
|
-
return this._throwIfClosed(), this._checkFinalizedStatuses(
|
|
632
|
-
},
|
|
628
|
+
}), t.prototype._trySubscribe = function(e) {
|
|
629
|
+
return this._throwIfClosed(), r.prototype._trySubscribe.call(this, e);
|
|
630
|
+
}, t.prototype._subscribe = function(e) {
|
|
631
|
+
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
|
632
|
+
}, t.prototype._innerSubscribe = function(e) {
|
|
633
633
|
var n = this, i = this, o = i.hasError, s = i.isStopped, a = i.observers;
|
|
634
|
-
return o || s ? ve : (this.currentObservers = null, a.push(
|
|
635
|
-
n.currentObservers = null, N(a,
|
|
634
|
+
return o || s ? ve : (this.currentObservers = null, a.push(e), new k(function() {
|
|
635
|
+
n.currentObservers = null, N(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;
|
|
639
|
-
i ?
|
|
640
|
-
},
|
|
641
|
-
var
|
|
642
|
-
return
|
|
643
|
-
},
|
|
644
|
-
return new ie(
|
|
645
|
-
},
|
|
639
|
+
i ? e.error(o) : s && e.complete();
|
|
640
|
+
}, t.prototype.asObservable = function() {
|
|
641
|
+
var e = new S();
|
|
642
|
+
return e.source = this, e;
|
|
643
|
+
}, t.create = function(e, n) {
|
|
644
|
+
return new ie(e, n);
|
|
645
|
+
}, t;
|
|
646
646
|
})(S), ie = (function(r) {
|
|
647
|
-
|
|
648
|
-
function e
|
|
647
|
+
A(t, r);
|
|
648
|
+
function t(e, n) {
|
|
649
649
|
var i = r.call(this) || this;
|
|
650
|
-
return i.destination =
|
|
650
|
+
return i.destination = e, i.source = n, i;
|
|
651
651
|
}
|
|
652
|
-
return
|
|
652
|
+
return t.prototype.next = function(e) {
|
|
653
653
|
var n, i;
|
|
654
|
-
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.next) === null || i === void 0 || i.call(n,
|
|
655
|
-
},
|
|
654
|
+
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.next) === null || i === void 0 || i.call(n, e);
|
|
655
|
+
}, t.prototype.error = function(e) {
|
|
656
656
|
var n, i;
|
|
657
|
-
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.error) === null || i === void 0 || i.call(n,
|
|
658
|
-
},
|
|
659
|
-
var
|
|
660
|
-
(n = (
|
|
661
|
-
},
|
|
657
|
+
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.error) === null || i === void 0 || i.call(n, e);
|
|
658
|
+
}, t.prototype.complete = function() {
|
|
659
|
+
var e, n;
|
|
660
|
+
(n = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || n === void 0 || n.call(e);
|
|
661
|
+
}, t.prototype._subscribe = function(e) {
|
|
662
662
|
var n, i;
|
|
663
|
-
return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(
|
|
664
|
-
},
|
|
663
|
+
return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(e)) !== null && i !== void 0 ? i : ve;
|
|
664
|
+
}, t;
|
|
665
665
|
})(ee), oe = (function(r) {
|
|
666
|
-
|
|
667
|
-
function e
|
|
666
|
+
A(t, r);
|
|
667
|
+
function t(e) {
|
|
668
668
|
var n = r.call(this) || this;
|
|
669
|
-
return n._value =
|
|
669
|
+
return n._value = e, n;
|
|
670
670
|
}
|
|
671
|
-
return Object.defineProperty(
|
|
671
|
+
return Object.defineProperty(t.prototype, "value", {
|
|
672
672
|
get: function() {
|
|
673
673
|
return this.getValue();
|
|
674
674
|
},
|
|
675
675
|
enumerable: !1,
|
|
676
676
|
configurable: !0
|
|
677
|
-
}),
|
|
678
|
-
var n = r.prototype._subscribe.call(this,
|
|
679
|
-
return !n.closed &&
|
|
680
|
-
},
|
|
681
|
-
var
|
|
677
|
+
}), t.prototype._subscribe = function(e) {
|
|
678
|
+
var n = r.prototype._subscribe.call(this, e);
|
|
679
|
+
return !n.closed && e.next(this._value), n;
|
|
680
|
+
}, t.prototype.getValue = function() {
|
|
681
|
+
var e = this, n = e.hasError, i = e.thrownError, o = e._value;
|
|
682
682
|
if (n)
|
|
683
683
|
throw i;
|
|
684
684
|
return this._throwIfClosed(), o;
|
|
685
|
-
},
|
|
686
|
-
r.prototype.next.call(this, this._value =
|
|
687
|
-
},
|
|
685
|
+
}, t.prototype.next = function(e) {
|
|
686
|
+
r.prototype.next.call(this, this._value = e);
|
|
687
|
+
}, t;
|
|
688
688
|
})(ee), rt = {
|
|
689
689
|
now: function() {
|
|
690
690
|
return Date.now();
|
|
691
691
|
}
|
|
692
692
|
}, nt = (function(r) {
|
|
693
|
-
|
|
694
|
-
function e
|
|
693
|
+
A(t, r);
|
|
694
|
+
function t(e, n) {
|
|
695
695
|
return r.call(this) || this;
|
|
696
696
|
}
|
|
697
|
-
return
|
|
697
|
+
return t.prototype.schedule = function(e, n) {
|
|
698
698
|
return this;
|
|
699
|
-
},
|
|
699
|
+
}, t;
|
|
700
700
|
})(k), se = {
|
|
701
|
-
setInterval: function(r,
|
|
702
|
-
for (var
|
|
703
|
-
|
|
704
|
-
return setInterval.apply(void 0, U([r,
|
|
701
|
+
setInterval: function(r, t) {
|
|
702
|
+
for (var e = [], n = 2; n < arguments.length; n++)
|
|
703
|
+
e[n - 2] = arguments[n];
|
|
704
|
+
return setInterval.apply(void 0, U([r, t], R(e)));
|
|
705
705
|
},
|
|
706
706
|
clearInterval: function(r) {
|
|
707
707
|
return clearInterval(r);
|
|
708
708
|
},
|
|
709
709
|
delegate: void 0
|
|
710
710
|
}, it = (function(r) {
|
|
711
|
-
|
|
712
|
-
function e
|
|
713
|
-
var i = r.call(this,
|
|
714
|
-
return i.scheduler =
|
|
711
|
+
A(t, r);
|
|
712
|
+
function t(e, n) {
|
|
713
|
+
var i = r.call(this, e, n) || this;
|
|
714
|
+
return i.scheduler = e, i.work = n, i.pending = !1, i;
|
|
715
715
|
}
|
|
716
|
-
return
|
|
716
|
+
return t.prototype.schedule = function(e, n) {
|
|
717
717
|
var i;
|
|
718
718
|
if (n === void 0 && (n = 0), this.closed)
|
|
719
719
|
return this;
|
|
720
|
-
this.state =
|
|
720
|
+
this.state = e;
|
|
721
721
|
var o = this.id, s = this.scheduler;
|
|
722
722
|
return o != null && (this.id = this.recycleAsyncId(s, o, n)), this.pending = !0, this.delay = n, this.id = (i = this.id) !== null && i !== void 0 ? i : this.requestAsyncId(s, this.id, n), this;
|
|
723
|
-
},
|
|
724
|
-
return i === void 0 && (i = 0), se.setInterval(
|
|
725
|
-
},
|
|
723
|
+
}, t.prototype.requestAsyncId = function(e, n, i) {
|
|
724
|
+
return i === void 0 && (i = 0), se.setInterval(e.flush.bind(e, this), i);
|
|
725
|
+
}, t.prototype.recycleAsyncId = function(e, n, i) {
|
|
726
726
|
if (i === void 0 && (i = 0), i != null && this.delay === i && this.pending === !1)
|
|
727
727
|
return n;
|
|
728
728
|
n != null && se.clearInterval(n);
|
|
729
|
-
},
|
|
729
|
+
}, t.prototype.execute = function(e, n) {
|
|
730
730
|
if (this.closed)
|
|
731
731
|
return new Error("executing a cancelled action");
|
|
732
732
|
this.pending = !1;
|
|
733
|
-
var i = this._execute(
|
|
733
|
+
var i = this._execute(e, n);
|
|
734
734
|
if (i)
|
|
735
735
|
return i;
|
|
736
736
|
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
|
|
737
|
-
},
|
|
737
|
+
}, t.prototype._execute = function(e, n) {
|
|
738
738
|
var i = !1, o;
|
|
739
739
|
try {
|
|
740
|
-
this.work(
|
|
740
|
+
this.work(e);
|
|
741
741
|
} catch (s) {
|
|
742
742
|
i = !0, o = s || new Error("Scheduled action threw falsy error");
|
|
743
743
|
}
|
|
744
744
|
if (i)
|
|
745
745
|
return this.unsubscribe(), o;
|
|
746
|
-
},
|
|
746
|
+
}, t.prototype.unsubscribe = function() {
|
|
747
747
|
if (!this.closed) {
|
|
748
|
-
var
|
|
748
|
+
var e = this, n = e.id, i = e.scheduler, o = i.actions;
|
|
749
749
|
this.work = this.state = this.scheduler = null, this.pending = !1, N(o, this), n != null && (this.id = this.recycleAsyncId(i, n, null)), this.delay = null, r.prototype.unsubscribe.call(this);
|
|
750
750
|
}
|
|
751
|
-
},
|
|
751
|
+
}, t;
|
|
752
752
|
})(nt), ae = (function() {
|
|
753
|
-
function r(
|
|
754
|
-
|
|
753
|
+
function r(t, e) {
|
|
754
|
+
e === void 0 && (e = r.now), this.schedulerActionCtor = t, this.now = e;
|
|
755
755
|
}
|
|
756
|
-
return r.prototype.schedule = function(
|
|
757
|
-
return
|
|
756
|
+
return r.prototype.schedule = function(t, e, n) {
|
|
757
|
+
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(n, e);
|
|
758
758
|
}, r.now = rt.now, r;
|
|
759
759
|
})(), ot = (function(r) {
|
|
760
|
-
|
|
761
|
-
function e
|
|
760
|
+
A(t, r);
|
|
761
|
+
function t(e, n) {
|
|
762
762
|
n === void 0 && (n = ae.now);
|
|
763
|
-
var i = r.call(this,
|
|
763
|
+
var i = r.call(this, e, n) || this;
|
|
764
764
|
return i.actions = [], i._active = !1, i;
|
|
765
765
|
}
|
|
766
|
-
return
|
|
766
|
+
return t.prototype.flush = function(e) {
|
|
767
767
|
var n = this.actions;
|
|
768
768
|
if (this._active) {
|
|
769
|
-
n.push(
|
|
769
|
+
n.push(e);
|
|
770
770
|
return;
|
|
771
771
|
}
|
|
772
772
|
var i;
|
|
773
773
|
this._active = !0;
|
|
774
774
|
do
|
|
775
|
-
if (i =
|
|
775
|
+
if (i = e.execute(e.state, e.delay))
|
|
776
776
|
break;
|
|
777
|
-
while (
|
|
777
|
+
while (e = n.shift());
|
|
778
778
|
if (this._active = !1, i) {
|
|
779
|
-
for (;
|
|
780
|
-
|
|
779
|
+
for (; e = n.shift(); )
|
|
780
|
+
e.unsubscribe();
|
|
781
781
|
throw i;
|
|
782
782
|
}
|
|
783
|
-
},
|
|
784
|
-
})(ae),
|
|
783
|
+
}, t;
|
|
784
|
+
})(ae), me = new ot(it), st = me, at = new S(function(r) {
|
|
785
785
|
return r.complete();
|
|
786
786
|
});
|
|
787
|
-
function
|
|
788
|
-
return r &&
|
|
787
|
+
function be(r) {
|
|
788
|
+
return r && m(r.schedule);
|
|
789
789
|
}
|
|
790
790
|
function ge(r) {
|
|
791
791
|
return r[r.length - 1];
|
|
792
792
|
}
|
|
793
|
-
function
|
|
794
|
-
return
|
|
793
|
+
function ct(r) {
|
|
794
|
+
return m(ge(r)) ? r.pop() : void 0;
|
|
795
795
|
}
|
|
796
796
|
function Se(r) {
|
|
797
|
-
return
|
|
797
|
+
return be(ge(r)) ? r.pop() : void 0;
|
|
798
798
|
}
|
|
799
799
|
var we = (function(r) {
|
|
800
800
|
return r && typeof r.length == "number" && typeof r != "function";
|
|
801
801
|
});
|
|
802
802
|
function Ee(r) {
|
|
803
|
-
return
|
|
803
|
+
return m(r == null ? void 0 : r.then);
|
|
804
804
|
}
|
|
805
805
|
function Ie(r) {
|
|
806
|
-
return
|
|
806
|
+
return m(r[Z]);
|
|
807
807
|
}
|
|
808
808
|
function Oe(r) {
|
|
809
|
-
return Symbol.asyncIterator &&
|
|
809
|
+
return Symbol.asyncIterator && m(r == null ? void 0 : r[Symbol.asyncIterator]);
|
|
810
810
|
}
|
|
811
811
|
function Ae(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.");
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function ut() {
|
|
815
815
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
816
816
|
}
|
|
817
|
-
var
|
|
817
|
+
var Ce = ut();
|
|
818
818
|
function _e(r) {
|
|
819
|
-
return
|
|
819
|
+
return m(r == null ? void 0 : r[Ce]);
|
|
820
820
|
}
|
|
821
|
-
function
|
|
822
|
-
return
|
|
823
|
-
var
|
|
821
|
+
function Te(r) {
|
|
822
|
+
return qe(this, arguments, function() {
|
|
823
|
+
var e, n, i, o;
|
|
824
824
|
return de(this, function(s) {
|
|
825
825
|
switch (s.label) {
|
|
826
826
|
case 0:
|
|
827
|
-
|
|
827
|
+
e = r.getReader(), s.label = 1;
|
|
828
828
|
case 1:
|
|
829
829
|
s.trys.push([1, , 9, 10]), s.label = 2;
|
|
830
830
|
case 2:
|
|
831
|
-
return [4, M(
|
|
831
|
+
return [4, M(e.read())];
|
|
832
832
|
case 3:
|
|
833
833
|
return n = s.sent(), i = n.value, o = n.done, o ? [4, M(void 0)] : [3, 5];
|
|
834
834
|
case 4:
|
|
@@ -842,17 +842,17 @@ function Pe(r) {
|
|
|
842
842
|
case 8:
|
|
843
843
|
return [3, 10];
|
|
844
844
|
case 9:
|
|
845
|
-
return
|
|
845
|
+
return e.releaseLock(), [7];
|
|
846
846
|
case 10:
|
|
847
847
|
return [2];
|
|
848
848
|
}
|
|
849
849
|
});
|
|
850
850
|
});
|
|
851
851
|
}
|
|
852
|
-
function
|
|
853
|
-
return
|
|
852
|
+
function xe(r) {
|
|
853
|
+
return m(r == null ? void 0 : r.getReader);
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function T(r) {
|
|
856
856
|
if (r instanceof S)
|
|
857
857
|
return r;
|
|
858
858
|
if (r != null) {
|
|
@@ -863,94 +863,94 @@ function _(r) {
|
|
|
863
863
|
if (Ee(r))
|
|
864
864
|
return dt(r);
|
|
865
865
|
if (Oe(r))
|
|
866
|
-
return
|
|
866
|
+
return Pe(r);
|
|
867
867
|
if (_e(r))
|
|
868
868
|
return ht(r);
|
|
869
|
-
if (
|
|
869
|
+
if (xe(r))
|
|
870
870
|
return vt(r);
|
|
871
871
|
}
|
|
872
872
|
throw Ae(r);
|
|
873
873
|
}
|
|
874
874
|
function lt(r) {
|
|
875
|
-
return new S(function(
|
|
876
|
-
var
|
|
877
|
-
if (
|
|
878
|
-
return
|
|
875
|
+
return new S(function(t) {
|
|
876
|
+
var e = r[Z]();
|
|
877
|
+
if (m(e.subscribe))
|
|
878
|
+
return e.subscribe(t);
|
|
879
879
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
880
880
|
});
|
|
881
881
|
}
|
|
882
882
|
function ft(r) {
|
|
883
|
-
return new S(function(
|
|
884
|
-
for (var
|
|
885
|
-
|
|
886
|
-
|
|
883
|
+
return new S(function(t) {
|
|
884
|
+
for (var e = 0; e < r.length && !t.closed; e++)
|
|
885
|
+
t.next(r[e]);
|
|
886
|
+
t.complete();
|
|
887
887
|
});
|
|
888
888
|
}
|
|
889
889
|
function dt(r) {
|
|
890
|
-
return new S(function(
|
|
891
|
-
r.then(function(
|
|
892
|
-
|
|
893
|
-
}, function(
|
|
894
|
-
return
|
|
890
|
+
return new S(function(t) {
|
|
891
|
+
r.then(function(e) {
|
|
892
|
+
t.closed || (t.next(e), t.complete());
|
|
893
|
+
}, function(e) {
|
|
894
|
+
return t.error(e);
|
|
895
895
|
}).then(null, pe);
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
898
|
function ht(r) {
|
|
899
|
-
return new S(function(
|
|
900
|
-
var
|
|
899
|
+
return new S(function(t) {
|
|
900
|
+
var e, n;
|
|
901
901
|
try {
|
|
902
|
-
for (var i =
|
|
902
|
+
for (var i = L(r), o = i.next(); !o.done; o = i.next()) {
|
|
903
903
|
var s = o.value;
|
|
904
|
-
if (
|
|
904
|
+
if (t.next(s), t.closed)
|
|
905
905
|
return;
|
|
906
906
|
}
|
|
907
907
|
} catch (a) {
|
|
908
|
-
|
|
908
|
+
e = { error: a };
|
|
909
909
|
} finally {
|
|
910
910
|
try {
|
|
911
911
|
o && !o.done && (n = i.return) && n.call(i);
|
|
912
912
|
} finally {
|
|
913
|
-
if (
|
|
913
|
+
if (e) throw e.error;
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
|
-
|
|
916
|
+
t.complete();
|
|
917
917
|
});
|
|
918
918
|
}
|
|
919
|
-
function
|
|
920
|
-
return new S(function(
|
|
921
|
-
yt(r,
|
|
922
|
-
return
|
|
919
|
+
function Pe(r) {
|
|
920
|
+
return new S(function(t) {
|
|
921
|
+
yt(r, t).catch(function(e) {
|
|
922
|
+
return t.error(e);
|
|
923
923
|
});
|
|
924
924
|
});
|
|
925
925
|
}
|
|
926
926
|
function vt(r) {
|
|
927
|
-
return
|
|
927
|
+
return Pe(Te(r));
|
|
928
928
|
}
|
|
929
|
-
function yt(r,
|
|
930
|
-
var
|
|
929
|
+
function yt(r, t) {
|
|
930
|
+
var e, n, i, o;
|
|
931
931
|
return Ve(this, void 0, void 0, function() {
|
|
932
932
|
var s, a;
|
|
933
|
-
return de(this, function(
|
|
934
|
-
switch (
|
|
933
|
+
return de(this, function(c) {
|
|
934
|
+
switch (c.label) {
|
|
935
935
|
case 0:
|
|
936
|
-
|
|
936
|
+
c.trys.push([0, 5, 6, 11]), e = He(r), c.label = 1;
|
|
937
937
|
case 1:
|
|
938
|
-
return [4,
|
|
938
|
+
return [4, e.next()];
|
|
939
939
|
case 2:
|
|
940
|
-
if (n =
|
|
941
|
-
if (s = n.value,
|
|
940
|
+
if (n = c.sent(), !!n.done) return [3, 4];
|
|
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 a =
|
|
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:
|
|
@@ -959,259 +959,259 @@ function yt(r, e) {
|
|
|
959
959
|
case 10:
|
|
960
960
|
return [7];
|
|
961
961
|
case 11:
|
|
962
|
-
return
|
|
962
|
+
return t.complete(), [2];
|
|
963
963
|
}
|
|
964
964
|
});
|
|
965
965
|
});
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function _(r, t, e, n, i) {
|
|
968
968
|
n === void 0 && (n = 0), i === void 0 && (i = !1);
|
|
969
|
-
var o =
|
|
970
|
-
|
|
969
|
+
var o = t.schedule(function() {
|
|
970
|
+
e(), i ? r.add(this.schedule(null, n)) : this.unsubscribe();
|
|
971
971
|
}, n);
|
|
972
972
|
if (r.add(o), !i)
|
|
973
973
|
return o;
|
|
974
974
|
}
|
|
975
|
-
function Me(r,
|
|
976
|
-
return
|
|
977
|
-
|
|
978
|
-
return
|
|
975
|
+
function Me(r, t) {
|
|
976
|
+
return t === void 0 && (t = 0), P(function(e, n) {
|
|
977
|
+
e.subscribe(O(n, function(i) {
|
|
978
|
+
return _(n, r, function() {
|
|
979
979
|
return n.next(i);
|
|
980
|
-
},
|
|
980
|
+
}, t);
|
|
981
981
|
}, function() {
|
|
982
|
-
return
|
|
982
|
+
return _(n, r, function() {
|
|
983
983
|
return n.complete();
|
|
984
|
-
},
|
|
984
|
+
}, t);
|
|
985
985
|
}, function(i) {
|
|
986
|
-
return
|
|
986
|
+
return _(n, r, function() {
|
|
987
987
|
return n.error(i);
|
|
988
|
-
},
|
|
988
|
+
}, t);
|
|
989
989
|
}));
|
|
990
990
|
});
|
|
991
991
|
}
|
|
992
|
-
function
|
|
993
|
-
return
|
|
992
|
+
function Le(r, t) {
|
|
993
|
+
return t === void 0 && (t = 0), P(function(e, n) {
|
|
994
994
|
n.add(r.schedule(function() {
|
|
995
|
-
return
|
|
996
|
-
},
|
|
995
|
+
return e.subscribe(n);
|
|
996
|
+
}, t));
|
|
997
997
|
});
|
|
998
998
|
}
|
|
999
|
-
function pt(r,
|
|
1000
|
-
return
|
|
999
|
+
function pt(r, t) {
|
|
1000
|
+
return T(r).pipe(Le(t), Me(t));
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1003
|
-
return
|
|
1002
|
+
function mt(r, t) {
|
|
1003
|
+
return T(r).pipe(Le(t), Me(t));
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1006
|
-
return new S(function(
|
|
1005
|
+
function bt(r, t) {
|
|
1006
|
+
return new S(function(e) {
|
|
1007
1007
|
var n = 0;
|
|
1008
|
-
return
|
|
1009
|
-
n === r.length ?
|
|
1008
|
+
return t.schedule(function() {
|
|
1009
|
+
n === r.length ? e.complete() : (e.next(r[n++]), e.closed || this.schedule());
|
|
1010
1010
|
});
|
|
1011
1011
|
});
|
|
1012
1012
|
}
|
|
1013
|
-
function gt(r,
|
|
1014
|
-
return new S(function(
|
|
1013
|
+
function gt(r, t) {
|
|
1014
|
+
return new S(function(e) {
|
|
1015
1015
|
var n;
|
|
1016
|
-
return
|
|
1017
|
-
n = r[
|
|
1016
|
+
return _(e, t, function() {
|
|
1017
|
+
n = r[Ce](), _(e, t, function() {
|
|
1018
1018
|
var i, o, s;
|
|
1019
1019
|
try {
|
|
1020
1020
|
i = n.next(), o = i.value, s = i.done;
|
|
1021
1021
|
} catch (a) {
|
|
1022
|
-
|
|
1022
|
+
e.error(a);
|
|
1023
1023
|
return;
|
|
1024
1024
|
}
|
|
1025
|
-
s ?
|
|
1025
|
+
s ? e.complete() : e.next(o);
|
|
1026
1026
|
}, 0, !0);
|
|
1027
1027
|
}), function() {
|
|
1028
|
-
return
|
|
1028
|
+
return m(n == null ? void 0 : n.return) && n.return();
|
|
1029
1029
|
};
|
|
1030
1030
|
});
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1032
|
+
function Re(r, t) {
|
|
1033
1033
|
if (!r)
|
|
1034
1034
|
throw new Error("Iterable cannot be null");
|
|
1035
|
-
return new S(function(
|
|
1036
|
-
|
|
1035
|
+
return new S(function(e) {
|
|
1036
|
+
_(e, t, function() {
|
|
1037
1037
|
var n = r[Symbol.asyncIterator]();
|
|
1038
|
-
|
|
1038
|
+
_(e, t, function() {
|
|
1039
1039
|
n.next().then(function(i) {
|
|
1040
|
-
i.done ?
|
|
1040
|
+
i.done ? e.complete() : e.next(i.value);
|
|
1041
1041
|
});
|
|
1042
1042
|
}, 0, !0);
|
|
1043
1043
|
});
|
|
1044
1044
|
});
|
|
1045
1045
|
}
|
|
1046
|
-
function St(r,
|
|
1047
|
-
return
|
|
1046
|
+
function St(r, t) {
|
|
1047
|
+
return Re(Te(r), t);
|
|
1048
1048
|
}
|
|
1049
|
-
function wt(r,
|
|
1049
|
+
function wt(r, t) {
|
|
1050
1050
|
if (r != null) {
|
|
1051
1051
|
if (Ie(r))
|
|
1052
|
-
return pt(r,
|
|
1052
|
+
return pt(r, t);
|
|
1053
1053
|
if (we(r))
|
|
1054
|
-
return
|
|
1054
|
+
return bt(r, t);
|
|
1055
1055
|
if (Ee(r))
|
|
1056
|
-
return
|
|
1056
|
+
return mt(r, t);
|
|
1057
1057
|
if (Oe(r))
|
|
1058
|
-
return
|
|
1058
|
+
return Re(r, t);
|
|
1059
1059
|
if (_e(r))
|
|
1060
|
-
return gt(r,
|
|
1061
|
-
if (
|
|
1062
|
-
return St(r,
|
|
1060
|
+
return gt(r, t);
|
|
1061
|
+
if (xe(r))
|
|
1062
|
+
return St(r, t);
|
|
1063
1063
|
}
|
|
1064
1064
|
throw Ae(r);
|
|
1065
1065
|
}
|
|
1066
|
-
function te(r,
|
|
1067
|
-
return
|
|
1066
|
+
function te(r, t) {
|
|
1067
|
+
return t ? wt(r, t) : T(r);
|
|
1068
1068
|
}
|
|
1069
1069
|
function Et() {
|
|
1070
|
-
for (var r = [],
|
|
1071
|
-
r[
|
|
1072
|
-
var
|
|
1073
|
-
return te(r,
|
|
1070
|
+
for (var r = [], t = 0; t < arguments.length; t++)
|
|
1071
|
+
r[t] = arguments[t];
|
|
1072
|
+
var e = Se(r);
|
|
1073
|
+
return te(r, e);
|
|
1074
1074
|
}
|
|
1075
1075
|
function It(r) {
|
|
1076
1076
|
return r instanceof Date && !isNaN(r);
|
|
1077
1077
|
}
|
|
1078
|
-
function V(r,
|
|
1079
|
-
return
|
|
1078
|
+
function V(r, t) {
|
|
1079
|
+
return P(function(e, n) {
|
|
1080
1080
|
var i = 0;
|
|
1081
|
-
|
|
1082
|
-
n.next(r.call(
|
|
1081
|
+
e.subscribe(O(n, function(o) {
|
|
1082
|
+
n.next(r.call(t, o, i++));
|
|
1083
1083
|
}));
|
|
1084
1084
|
});
|
|
1085
1085
|
}
|
|
1086
1086
|
var Ot = Array.isArray;
|
|
1087
|
-
function At(r,
|
|
1088
|
-
return Ot(
|
|
1087
|
+
function At(r, t) {
|
|
1088
|
+
return Ot(t) ? r.apply(void 0, U([], R(t))) : r(t);
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return V(function(
|
|
1092
|
-
return At(r,
|
|
1090
|
+
function Ct(r) {
|
|
1091
|
+
return V(function(t) {
|
|
1092
|
+
return At(r, t);
|
|
1093
1093
|
});
|
|
1094
1094
|
}
|
|
1095
|
-
var _t = Array.isArray,
|
|
1095
|
+
var _t = Array.isArray, Tt = Object.getPrototypeOf, xt = Object.prototype, Pt = Object.keys;
|
|
1096
1096
|
function Mt(r) {
|
|
1097
1097
|
if (r.length === 1) {
|
|
1098
|
-
var
|
|
1099
|
-
if (_t(
|
|
1100
|
-
return { args:
|
|
1101
|
-
if (
|
|
1102
|
-
var
|
|
1098
|
+
var t = r[0];
|
|
1099
|
+
if (_t(t))
|
|
1100
|
+
return { args: t, keys: null };
|
|
1101
|
+
if (Lt(t)) {
|
|
1102
|
+
var e = Pt(t);
|
|
1103
1103
|
return {
|
|
1104
|
-
args:
|
|
1105
|
-
return
|
|
1104
|
+
args: e.map(function(n) {
|
|
1105
|
+
return t[n];
|
|
1106
1106
|
}),
|
|
1107
|
-
keys:
|
|
1107
|
+
keys: e
|
|
1108
1108
|
};
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
1111
|
return { args: r, keys: null };
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1114
|
-
return r && typeof r == "object" &&
|
|
1113
|
+
function Lt(r) {
|
|
1114
|
+
return r && typeof r == "object" && Tt(r) === xt;
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
return r.reduce(function(
|
|
1118
|
-
return
|
|
1116
|
+
function Rt(r, t) {
|
|
1117
|
+
return r.reduce(function(e, n, i) {
|
|
1118
|
+
return e[n] = t[i], e;
|
|
1119
1119
|
}, {});
|
|
1120
1120
|
}
|
|
1121
1121
|
function Ut() {
|
|
1122
|
-
for (var r = [],
|
|
1123
|
-
r[
|
|
1124
|
-
var
|
|
1122
|
+
for (var r = [], t = 0; t < arguments.length; t++)
|
|
1123
|
+
r[t] = arguments[t];
|
|
1124
|
+
var e = Se(r), n = ct(r), i = Mt(r), o = i.args, s = i.keys;
|
|
1125
1125
|
if (o.length === 0)
|
|
1126
|
-
return te([],
|
|
1127
|
-
var a = new S(kt(o,
|
|
1128
|
-
return
|
|
1126
|
+
return te([], e);
|
|
1127
|
+
var a = new S(kt(o, e, s ? function(c) {
|
|
1128
|
+
return Rt(s, c);
|
|
1129
1129
|
} : F));
|
|
1130
|
-
return n ? a.pipe(
|
|
1131
|
-
}
|
|
1132
|
-
function kt(r,
|
|
1133
|
-
return
|
|
1134
|
-
|
|
1135
|
-
for (var i = r.length, o = new Array(i), s = i, a = i,
|
|
1136
|
-
|
|
1137
|
-
var d = te(r[l],
|
|
1138
|
-
d.subscribe(
|
|
1139
|
-
o[l] = f,
|
|
1130
|
+
return n ? a.pipe(Ct(n)) : a;
|
|
1131
|
+
}
|
|
1132
|
+
function kt(r, t, e) {
|
|
1133
|
+
return e === void 0 && (e = F), function(n) {
|
|
1134
|
+
ce(t, function() {
|
|
1135
|
+
for (var i = r.length, o = new Array(i), s = i, a = i, c = function(l) {
|
|
1136
|
+
ce(t, function() {
|
|
1137
|
+
var d = te(r[l], t), y = !1;
|
|
1138
|
+
d.subscribe(O(n, function(f) {
|
|
1139
|
+
o[l] = f, y || (y = !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
|
-
function
|
|
1150
|
-
r ?
|
|
1149
|
+
function ce(r, t, e) {
|
|
1150
|
+
r ? _(e, r, t) : t();
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1153
|
-
var
|
|
1154
|
-
d && !
|
|
1155
|
-
}, f = function(
|
|
1156
|
-
return
|
|
1157
|
-
}, p = function(
|
|
1158
|
-
|
|
1152
|
+
function $t(r, t, e, n, i, o, s, a) {
|
|
1153
|
+
var c = [], u = 0, l = 0, d = !1, y = function() {
|
|
1154
|
+
d && !c.length && !u && t.complete();
|
|
1155
|
+
}, f = function(v) {
|
|
1156
|
+
return u < n ? p(v) : c.push(v);
|
|
1157
|
+
}, p = function(v) {
|
|
1158
|
+
u++;
|
|
1159
1159
|
var w = !1;
|
|
1160
|
-
|
|
1161
|
-
|
|
1160
|
+
T(e(v, l++)).subscribe(O(t, function(E) {
|
|
1161
|
+
t.next(E);
|
|
1162
1162
|
}, function() {
|
|
1163
1163
|
w = !0;
|
|
1164
1164
|
}, void 0, function() {
|
|
1165
1165
|
if (w)
|
|
1166
1166
|
try {
|
|
1167
|
-
|
|
1167
|
+
u--;
|
|
1168
1168
|
for (var E = function() {
|
|
1169
|
-
var
|
|
1170
|
-
s || p(
|
|
1171
|
-
};
|
|
1169
|
+
var x = c.shift();
|
|
1170
|
+
s || p(x);
|
|
1171
|
+
}; c.length && u < n; )
|
|
1172
1172
|
E();
|
|
1173
|
-
|
|
1174
|
-
} catch (
|
|
1175
|
-
|
|
1173
|
+
y();
|
|
1174
|
+
} catch (x) {
|
|
1175
|
+
t.error(x);
|
|
1176
1176
|
}
|
|
1177
1177
|
}));
|
|
1178
1178
|
};
|
|
1179
|
-
return r.subscribe(
|
|
1180
|
-
d = !0,
|
|
1179
|
+
return r.subscribe(O(t, f, function() {
|
|
1180
|
+
d = !0, y();
|
|
1181
1181
|
})), function() {
|
|
1182
1182
|
};
|
|
1183
1183
|
}
|
|
1184
|
-
function G(r,
|
|
1185
|
-
return
|
|
1184
|
+
function G(r, t, e) {
|
|
1185
|
+
return e === void 0 && (e = 1 / 0), m(t) ? G(function(n, i) {
|
|
1186
1186
|
return V(function(o, s) {
|
|
1187
|
-
return
|
|
1188
|
-
})(
|
|
1189
|
-
},
|
|
1190
|
-
return
|
|
1187
|
+
return t(n, o, i, s);
|
|
1188
|
+
})(T(r(n, i)));
|
|
1189
|
+
}, e) : (typeof t == "number" && (e = t), P(function(n, i) {
|
|
1190
|
+
return $t(n, i, r, e);
|
|
1191
1191
|
}));
|
|
1192
1192
|
}
|
|
1193
|
-
function Ue(r,
|
|
1194
|
-
r === void 0 && (r = 0),
|
|
1193
|
+
function Ue(r, t, e) {
|
|
1194
|
+
r === void 0 && (r = 0), e === void 0 && (e = st);
|
|
1195
1195
|
var n = -1;
|
|
1196
|
-
return
|
|
1197
|
-
var o = It(r) ? +r -
|
|
1196
|
+
return t != null && (be(t) ? e = t : n = t), new S(function(i) {
|
|
1197
|
+
var o = It(r) ? +r - e.now() : r;
|
|
1198
1198
|
o < 0 && (o = 0);
|
|
1199
1199
|
var s = 0;
|
|
1200
|
-
return
|
|
1200
|
+
return e.schedule(function() {
|
|
1201
1201
|
i.closed || (i.next(s++), 0 <= n ? this.schedule(void 0, n) : i.complete());
|
|
1202
1202
|
}, o);
|
|
1203
1203
|
});
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1206
|
-
return
|
|
1205
|
+
function jt(r, t) {
|
|
1206
|
+
return m(t) ? G(r, t, 1) : G(r, 1);
|
|
1207
1207
|
}
|
|
1208
1208
|
function Dt(r) {
|
|
1209
1209
|
return r <= 0 ? function() {
|
|
1210
1210
|
return at;
|
|
1211
|
-
} :
|
|
1211
|
+
} : P(function(t, e) {
|
|
1212
1212
|
var n = 0;
|
|
1213
|
-
|
|
1214
|
-
++n <= r && (
|
|
1213
|
+
t.subscribe(O(e, function(i) {
|
|
1214
|
+
++n <= r && (e.next(i), r <= n && e.complete());
|
|
1215
1215
|
}));
|
|
1216
1216
|
});
|
|
1217
1217
|
}
|
|
@@ -1220,99 +1220,99 @@ function Nt(r) {
|
|
|
1220
1220
|
return r;
|
|
1221
1221
|
});
|
|
1222
1222
|
}
|
|
1223
|
-
function Gt(r,
|
|
1224
|
-
return G(function(
|
|
1225
|
-
return
|
|
1223
|
+
function Gt(r, t) {
|
|
1224
|
+
return G(function(e, n) {
|
|
1225
|
+
return T(r(e, n)).pipe(Dt(1), Nt(e));
|
|
1226
1226
|
});
|
|
1227
1227
|
}
|
|
1228
|
-
function Ft(r,
|
|
1229
|
-
|
|
1230
|
-
var
|
|
1228
|
+
function Ft(r, t) {
|
|
1229
|
+
t === void 0 && (t = me);
|
|
1230
|
+
var e = Ue(r, t);
|
|
1231
1231
|
return Gt(function() {
|
|
1232
|
-
return
|
|
1232
|
+
return e;
|
|
1233
1233
|
});
|
|
1234
1234
|
}
|
|
1235
1235
|
function Vt(r) {
|
|
1236
|
-
var
|
|
1237
|
-
|
|
1236
|
+
var t;
|
|
1237
|
+
t = {
|
|
1238
1238
|
count: r
|
|
1239
1239
|
};
|
|
1240
|
-
var
|
|
1241
|
-
return n <= 0 ? F :
|
|
1242
|
-
var
|
|
1243
|
-
var
|
|
1244
|
-
l = a.subscribe(
|
|
1245
|
-
s && (
|
|
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 ? F : P(function(a, c) {
|
|
1242
|
+
var u = 0, l, d = function() {
|
|
1243
|
+
var y = !1;
|
|
1244
|
+
l = a.subscribe(O(c, function(f) {
|
|
1245
|
+
s && (u = 0), c.next(f);
|
|
1246
1246
|
}, void 0, function(f) {
|
|
1247
|
-
if (
|
|
1247
|
+
if (u++ < n) {
|
|
1248
1248
|
var p = function() {
|
|
1249
|
-
l ? (l.unsubscribe(), l = null, d()) :
|
|
1249
|
+
l ? (l.unsubscribe(), l = null, d()) : y = !0;
|
|
1250
1250
|
};
|
|
1251
1251
|
if (i != null) {
|
|
1252
|
-
var
|
|
1252
|
+
var v = typeof i == "number" ? Ue(i) : T(i(f, u)), w = O(c, function() {
|
|
1253
1253
|
w.unsubscribe(), p();
|
|
1254
1254
|
}, function() {
|
|
1255
|
-
|
|
1255
|
+
c.complete();
|
|
1256
1256
|
});
|
|
1257
|
-
|
|
1257
|
+
v.subscribe(w);
|
|
1258
1258
|
} else
|
|
1259
1259
|
p();
|
|
1260
1260
|
} else
|
|
1261
|
-
|
|
1262
|
-
})),
|
|
1261
|
+
c.error(f);
|
|
1262
|
+
})), y && (l.unsubscribe(), l = null, d());
|
|
1263
1263
|
};
|
|
1264
1264
|
d();
|
|
1265
1265
|
});
|
|
1266
1266
|
}
|
|
1267
|
-
function
|
|
1268
|
-
return
|
|
1269
|
-
|
|
1270
|
-
return
|
|
1271
|
-
}, X)), !
|
|
1267
|
+
function qt(r) {
|
|
1268
|
+
return P(function(t, e) {
|
|
1269
|
+
T(r).subscribe(O(e, function() {
|
|
1270
|
+
return e.complete();
|
|
1271
|
+
}, X)), !e.closed && t.subscribe(e);
|
|
1272
1272
|
});
|
|
1273
1273
|
}
|
|
1274
|
-
async function
|
|
1275
|
-
const
|
|
1274
|
+
async function Ht(r, t) {
|
|
1275
|
+
const e = r.getReader();
|
|
1276
1276
|
let n;
|
|
1277
|
-
for (; !(n = await
|
|
1278
|
-
|
|
1277
|
+
for (; !(n = await e.read()).done; )
|
|
1278
|
+
t(n.value);
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1281
|
-
let
|
|
1280
|
+
function Kt(r) {
|
|
1281
|
+
let t, e, n, i = !1;
|
|
1282
1282
|
return function(s) {
|
|
1283
|
-
|
|
1284
|
-
const a =
|
|
1285
|
-
let
|
|
1286
|
-
for (;
|
|
1287
|
-
i && (e
|
|
1288
|
-
let
|
|
1289
|
-
for (;
|
|
1290
|
-
switch (e
|
|
1283
|
+
t === void 0 ? (t = s, e = 0, n = -1) : t = Yt(t, s);
|
|
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
|
+
switch (t[e]) {
|
|
1291
1291
|
case 58:
|
|
1292
|
-
n === -1 && (n =
|
|
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(
|
|
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
|
-
function
|
|
1308
|
-
let n =
|
|
1307
|
+
function Bt(r, t, e) {
|
|
1308
|
+
let n = ue();
|
|
1309
1309
|
const i = new TextDecoder();
|
|
1310
1310
|
return function(s, a) {
|
|
1311
1311
|
if (s.length === 0)
|
|
1312
|
-
|
|
1312
|
+
e == null || e(n), n = ue();
|
|
1313
1313
|
else if (a > 0) {
|
|
1314
|
-
const
|
|
1315
|
-
switch (
|
|
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;
|
|
@@ -1325,17 +1325,17 @@ function qt(r, e, t) {
|
|
|
1325
1325
|
break;
|
|
1326
1326
|
case "retry":
|
|
1327
1327
|
const d = parseInt(l, 10);
|
|
1328
|
-
isNaN(d) ||
|
|
1328
|
+
isNaN(d) || t(n.retry = d);
|
|
1329
1329
|
break;
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
1332
1332
|
};
|
|
1333
1333
|
}
|
|
1334
|
-
function Yt(r,
|
|
1335
|
-
const
|
|
1336
|
-
return
|
|
1334
|
+
function Yt(r, t) {
|
|
1335
|
+
const e = new Uint8Array(r.length + t.length);
|
|
1336
|
+
return e.set(r), e.set(t, r.length), e;
|
|
1337
1337
|
}
|
|
1338
|
-
function
|
|
1338
|
+
function ue() {
|
|
1339
1339
|
return {
|
|
1340
1340
|
data: "",
|
|
1341
1341
|
event: "",
|
|
@@ -1343,76 +1343,76 @@ function ce() {
|
|
|
1343
1343
|
retry: void 0
|
|
1344
1344
|
};
|
|
1345
1345
|
}
|
|
1346
|
-
var Wt = function(r,
|
|
1347
|
-
var
|
|
1348
|
-
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) &&
|
|
1346
|
+
var Wt = function(r, t) {
|
|
1347
|
+
var e = {};
|
|
1348
|
+
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && t.indexOf(n) < 0 && (e[n] = r[n]);
|
|
1349
1349
|
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1350
1350
|
for (var i = 0, n = Object.getOwnPropertySymbols(r); i < n.length; i++)
|
|
1351
|
-
|
|
1352
|
-
return
|
|
1351
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[i]) && (e[n[i]] = r[n[i]]);
|
|
1352
|
+
return e;
|
|
1353
1353
|
};
|
|
1354
1354
|
const z = "text/event-stream", Xt = 1e3, le = "last-event-id";
|
|
1355
|
-
function Jt(r,
|
|
1356
|
-
var { signal:
|
|
1357
|
-
return new Promise((d,
|
|
1355
|
+
function Jt(r, t) {
|
|
1356
|
+
var { signal: e, headers: n, onopen: i, onmessage: o, onclose: s, onerror: a, openWhenHidden: c, fetch: u } = t, l = Wt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
1357
|
+
return new Promise((d, y) => {
|
|
1358
1358
|
const f = Object.assign({}, n);
|
|
1359
1359
|
f.accept || (f.accept = z);
|
|
1360
1360
|
let p;
|
|
1361
|
-
function
|
|
1362
|
-
p.abort(), document.hidden ||
|
|
1361
|
+
function v() {
|
|
1362
|
+
p.abort(), document.hidden || q();
|
|
1363
1363
|
}
|
|
1364
|
-
|
|
1364
|
+
c || document.addEventListener("visibilitychange", v);
|
|
1365
1365
|
let w = Xt, E = 0;
|
|
1366
|
-
function
|
|
1367
|
-
document.removeEventListener("visibilitychange",
|
|
1366
|
+
function x() {
|
|
1367
|
+
document.removeEventListener("visibilitychange", v), window.clearTimeout(E), p.abort();
|
|
1368
1368
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1369
|
+
e == null || e.addEventListener("abort", () => {
|
|
1370
|
+
x(), d();
|
|
1371
1371
|
});
|
|
1372
|
-
const
|
|
1373
|
-
async function
|
|
1374
|
-
var
|
|
1372
|
+
const je = u ?? window.fetch, De = i ?? zt;
|
|
1373
|
+
async function q() {
|
|
1374
|
+
var H;
|
|
1375
1375
|
p = new AbortController();
|
|
1376
1376
|
try {
|
|
1377
|
-
const
|
|
1378
|
-
await De(
|
|
1379
|
-
|
|
1380
|
-
}, (
|
|
1381
|
-
w =
|
|
1382
|
-
}, o))), s == null || s(),
|
|
1383
|
-
} catch (
|
|
1377
|
+
const $ = await je(r, Object.assign(Object.assign({}, l), { headers: f, signal: p.signal }));
|
|
1378
|
+
await De($), await Ht($.body, Kt(Bt((C) => {
|
|
1379
|
+
C ? f[le] = C : delete f[le];
|
|
1380
|
+
}, (C) => {
|
|
1381
|
+
w = C;
|
|
1382
|
+
}, o))), s == null || s(), x(), d();
|
|
1383
|
+
} catch ($) {
|
|
1384
1384
|
if (!p.signal.aborted)
|
|
1385
1385
|
try {
|
|
1386
|
-
const
|
|
1387
|
-
window.clearTimeout(E), E = window.setTimeout(
|
|
1388
|
-
} catch (
|
|
1389
|
-
|
|
1386
|
+
const C = (H = a == null ? void 0 : a($)) !== null && H !== void 0 ? H : w;
|
|
1387
|
+
window.clearTimeout(E), E = window.setTimeout(q, C);
|
|
1388
|
+
} catch (C) {
|
|
1389
|
+
x(), y(C);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
|
-
|
|
1393
|
+
q();
|
|
1394
1394
|
});
|
|
1395
1395
|
}
|
|
1396
1396
|
function zt(r) {
|
|
1397
|
-
const
|
|
1398
|
-
if (!(
|
|
1399
|
-
throw new Error(`Expected content-type to be ${z}, Actual: ${
|
|
1397
|
+
const t = r.headers.get("content-type");
|
|
1398
|
+
if (!(t != null && t.startsWith(z)))
|
|
1399
|
+
throw new Error(`Expected content-type to be ${z}, Actual: ${t}`);
|
|
1400
1400
|
}
|
|
1401
1401
|
function Qt(r) {
|
|
1402
|
-
const { endpoint:
|
|
1402
|
+
const { endpoint: t, apiKey: e, payload: n, debugMode: i } = r;
|
|
1403
1403
|
return new S((o) => {
|
|
1404
1404
|
const s = new AbortController();
|
|
1405
1405
|
let a;
|
|
1406
|
-
const
|
|
1406
|
+
const c = {
|
|
1407
1407
|
"Content-Type": "application/json"
|
|
1408
1408
|
};
|
|
1409
|
-
|
|
1410
|
-
const
|
|
1411
|
-
i &&
|
|
1412
|
-
const l = new URL(
|
|
1413
|
-
return
|
|
1409
|
+
e && (c["X-API-KEY"] = e);
|
|
1410
|
+
const u = new URLSearchParams();
|
|
1411
|
+
i && u.set("is_debug", "true");
|
|
1412
|
+
const l = new URL(t);
|
|
1413
|
+
return u.toString() && (l.search = u.toString()), Jt(l.toString(), {
|
|
1414
1414
|
method: "POST",
|
|
1415
|
-
headers:
|
|
1415
|
+
headers: c,
|
|
1416
1416
|
body: n ? JSON.stringify(n) : void 0,
|
|
1417
1417
|
signal: s.signal,
|
|
1418
1418
|
/**
|
|
@@ -1424,8 +1424,8 @@ function Qt(r) {
|
|
|
1424
1424
|
d.ok ? a = d.headers.get("X-Trace-Id") ?? void 0 : (o.error(d), s.abort());
|
|
1425
1425
|
},
|
|
1426
1426
|
onmessage: (d) => {
|
|
1427
|
-
const
|
|
1428
|
-
a ?
|
|
1427
|
+
const y = JSON.parse(d.data);
|
|
1428
|
+
a ? y.traceId = a : y.requestId && (y.traceId = y.requestId, a || (a = y.requestId)), o.next(y);
|
|
1429
1429
|
},
|
|
1430
1430
|
onclose: () => {
|
|
1431
1431
|
o.complete();
|
|
@@ -1440,95 +1440,95 @@ function Qt(r) {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
class Zt {
|
|
1442
1442
|
constructor() {
|
|
1443
|
-
|
|
1443
|
+
b(this, "listeners", {});
|
|
1444
1444
|
}
|
|
1445
|
-
on(
|
|
1445
|
+
on(t, e) {
|
|
1446
1446
|
this.listeners = Object.assign({}, this.listeners, {
|
|
1447
|
-
[
|
|
1447
|
+
[t]: (this.listeners[t] ?? []).concat(e)
|
|
1448
1448
|
});
|
|
1449
1449
|
}
|
|
1450
|
-
off(
|
|
1451
|
-
this.listeners[
|
|
1452
|
-
[
|
|
1450
|
+
off(t, e) {
|
|
1451
|
+
this.listeners[t] && (this.listeners = Object.assign({}, this.listeners, {
|
|
1452
|
+
[t]: (this.listeners[t] ?? []).filter((n) => n !== e)
|
|
1453
1453
|
}));
|
|
1454
1454
|
}
|
|
1455
|
-
remove(
|
|
1456
|
-
delete this.listeners[
|
|
1455
|
+
remove(t) {
|
|
1456
|
+
delete this.listeners[t];
|
|
1457
1457
|
}
|
|
1458
|
-
emit(
|
|
1459
|
-
this.listeners[
|
|
1458
|
+
emit(t, ...e) {
|
|
1459
|
+
this.listeners[t] && this.listeners[t].forEach((n) => n(...e));
|
|
1460
1460
|
}
|
|
1461
1461
|
}
|
|
1462
1462
|
class sr {
|
|
1463
|
-
constructor(
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
if (!
|
|
1463
|
+
constructor(t) {
|
|
1464
|
+
b(this, "apiKey");
|
|
1465
|
+
b(this, "endpoint");
|
|
1466
|
+
b(this, "botProviderEndpoint");
|
|
1467
|
+
b(this, "debugMode");
|
|
1468
|
+
b(this, "destroy$", new ee());
|
|
1469
|
+
b(this, "sseEmitter", new Zt());
|
|
1470
|
+
b(this, "transformSsePayload");
|
|
1471
|
+
if (!t.endpoint && !t.botProviderEndpoint)
|
|
1472
1472
|
throw new Error("Either endpoint or botProviderEndpoint must be provided");
|
|
1473
|
-
if (this.apiKey =
|
|
1474
|
-
const
|
|
1475
|
-
this.endpoint = `${
|
|
1476
|
-
} else
|
|
1473
|
+
if (this.apiKey = t.apiKey, this.debugMode = t.debugMode, this.transformSsePayload = t.transformSsePayload, this.botProviderEndpoint = t.botProviderEndpoint, !t.endpoint && t.botProviderEndpoint) {
|
|
1474
|
+
const e = t.botProviderEndpoint.replace(/\/+$/, "");
|
|
1475
|
+
this.endpoint = `${e}/message/sse`;
|
|
1476
|
+
} else t.endpoint && (this.endpoint = t.endpoint, this.debugMode && console.warn(
|
|
1477
1477
|
'[AsgardServiceClient] The "endpoint" option is deprecated and will be removed in the next major version. Please use "botProviderEndpoint" instead. The SSE endpoint will be automatically derived as "${botProviderEndpoint}/message/sse".'
|
|
1478
1478
|
));
|
|
1479
1479
|
}
|
|
1480
|
-
on(
|
|
1481
|
-
this.sseEmitter.remove(
|
|
1480
|
+
on(t, e) {
|
|
1481
|
+
this.sseEmitter.remove(t), this.sseEmitter.on(t, e);
|
|
1482
1482
|
}
|
|
1483
|
-
handleEvent(
|
|
1484
|
-
switch (
|
|
1485
|
-
case
|
|
1486
|
-
this.sseEmitter.emit(
|
|
1483
|
+
handleEvent(t) {
|
|
1484
|
+
switch (t.eventType) {
|
|
1485
|
+
case h.INIT:
|
|
1486
|
+
this.sseEmitter.emit(h.INIT, t);
|
|
1487
1487
|
break;
|
|
1488
|
-
case
|
|
1489
|
-
case
|
|
1490
|
-
this.sseEmitter.emit(
|
|
1488
|
+
case h.PROCESS_START:
|
|
1489
|
+
case h.PROCESS_COMPLETE:
|
|
1490
|
+
this.sseEmitter.emit(h.PROCESS, t);
|
|
1491
1491
|
break;
|
|
1492
|
-
case
|
|
1493
|
-
case
|
|
1494
|
-
case
|
|
1495
|
-
this.sseEmitter.emit(
|
|
1492
|
+
case h.MESSAGE_START:
|
|
1493
|
+
case h.MESSAGE_DELTA:
|
|
1494
|
+
case h.MESSAGE_COMPLETE:
|
|
1495
|
+
this.sseEmitter.emit(h.MESSAGE, t);
|
|
1496
1496
|
break;
|
|
1497
|
-
case
|
|
1498
|
-
case
|
|
1499
|
-
this.sseEmitter.emit(
|
|
1497
|
+
case h.TOOL_CALL_START:
|
|
1498
|
+
case h.TOOL_CALL_COMPLETE:
|
|
1499
|
+
this.sseEmitter.emit(h.TOOL_CALL, t);
|
|
1500
1500
|
break;
|
|
1501
|
-
case
|
|
1502
|
-
this.sseEmitter.emit(
|
|
1501
|
+
case h.DONE:
|
|
1502
|
+
this.sseEmitter.emit(h.DONE, t);
|
|
1503
1503
|
break;
|
|
1504
|
-
case
|
|
1505
|
-
this.sseEmitter.emit(
|
|
1504
|
+
case h.ERROR:
|
|
1505
|
+
this.sseEmitter.emit(h.ERROR, t);
|
|
1506
1506
|
break;
|
|
1507
1507
|
}
|
|
1508
1508
|
}
|
|
1509
|
-
fetchSse(
|
|
1509
|
+
fetchSse(t, e) {
|
|
1510
1510
|
var n, i;
|
|
1511
|
-
(n =
|
|
1511
|
+
(n = e == null ? void 0 : e.onSseStart) == null || n.call(e), Qt({
|
|
1512
1512
|
apiKey: this.apiKey,
|
|
1513
1513
|
endpoint: this.endpoint,
|
|
1514
1514
|
debugMode: this.debugMode,
|
|
1515
|
-
payload: ((i = this.transformSsePayload) == null ? void 0 : i.call(this,
|
|
1515
|
+
payload: ((i = this.transformSsePayload) == null ? void 0 : i.call(this, t)) ?? t
|
|
1516
1516
|
}).pipe(
|
|
1517
|
-
|
|
1518
|
-
|
|
1517
|
+
jt((o) => Et(o).pipe(Ft((e == null ? void 0 : e.delayTime) ?? 50))),
|
|
1518
|
+
qt(this.destroy$),
|
|
1519
1519
|
Vt(3)
|
|
1520
1520
|
).subscribe({
|
|
1521
1521
|
next: (o) => {
|
|
1522
1522
|
var s;
|
|
1523
|
-
(s =
|
|
1523
|
+
(s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, o), this.handleEvent(o);
|
|
1524
1524
|
},
|
|
1525
1525
|
error: (o) => {
|
|
1526
1526
|
var s;
|
|
1527
|
-
(s =
|
|
1527
|
+
(s = e == null ? void 0 : e.onSseError) == null || s.call(e, o);
|
|
1528
1528
|
},
|
|
1529
1529
|
complete: () => {
|
|
1530
1530
|
var o;
|
|
1531
|
-
(o =
|
|
1531
|
+
(o = e == null ? void 0 : e.onSseCompleted) == null || o.call(e);
|
|
1532
1532
|
}
|
|
1533
1533
|
});
|
|
1534
1534
|
}
|
|
@@ -1539,12 +1539,12 @@ class sr {
|
|
|
1539
1539
|
* 上傳檔案到 Blob API
|
|
1540
1540
|
* 根據 API 文件:/generic/ns/{namespace}/bot-provider/{bot_provider_name}/blob
|
|
1541
1541
|
*/
|
|
1542
|
-
async uploadFile(
|
|
1542
|
+
async uploadFile(t, e) {
|
|
1543
1543
|
const n = this.deriveBlobEndpoint();
|
|
1544
1544
|
if (!n)
|
|
1545
1545
|
throw new Error("Unable to derive blob endpoint. Please provide botProviderEndpoint in config.");
|
|
1546
1546
|
const i = new FormData();
|
|
1547
|
-
i.append("file",
|
|
1547
|
+
i.append("file", t), i.append("customChannelId", e);
|
|
1548
1548
|
const o = {};
|
|
1549
1549
|
this.apiKey && (o["X-API-KEY"] = this.apiKey);
|
|
1550
1550
|
try {
|
|
@@ -1567,37 +1567,37 @@ class sr {
|
|
|
1567
1567
|
deriveBlobEndpoint() {
|
|
1568
1568
|
if (!this.botProviderEndpoint && !this.endpoint)
|
|
1569
1569
|
return null;
|
|
1570
|
-
let
|
|
1571
|
-
if (!
|
|
1570
|
+
let t = this.botProviderEndpoint;
|
|
1571
|
+
if (!t && this.endpoint && (t = this.endpoint.replace("/message/sse", "")), !t)
|
|
1572
1572
|
return null;
|
|
1573
|
-
if (
|
|
1574
|
-
const
|
|
1575
|
-
if (
|
|
1576
|
-
const [, n, i] =
|
|
1577
|
-
|
|
1573
|
+
if (t = t.replace(/\/+$/, ""), !t.includes("/generic/")) {
|
|
1574
|
+
const e = t.match(/^(https?:\/\/[^/]+)(\/.*)/);
|
|
1575
|
+
if (e) {
|
|
1576
|
+
const [, n, i] = e;
|
|
1577
|
+
t = `${n}/generic${i}`;
|
|
1578
1578
|
}
|
|
1579
1579
|
}
|
|
1580
|
-
return `${
|
|
1580
|
+
return `${t}/blob`;
|
|
1581
1581
|
}
|
|
1582
1582
|
}
|
|
1583
1583
|
const g = [];
|
|
1584
1584
|
for (let r = 0; r < 256; ++r)
|
|
1585
1585
|
g.push((r + 256).toString(16).slice(1));
|
|
1586
|
-
function er(r,
|
|
1587
|
-
return (g[r[
|
|
1586
|
+
function er(r, t = 0) {
|
|
1587
|
+
return (g[r[t + 0]] + g[r[t + 1]] + g[r[t + 2]] + g[r[t + 3]] + "-" + g[r[t + 4]] + g[r[t + 5]] + "-" + g[r[t + 6]] + g[r[t + 7]] + "-" + g[r[t + 8]] + g[r[t + 9]] + "-" + g[r[t + 10]] + g[r[t + 11]] + g[r[t + 12]] + g[r[t + 13]] + g[r[t + 14]] + g[r[t + 15]]).toLowerCase();
|
|
1588
1588
|
}
|
|
1589
|
-
let
|
|
1589
|
+
let B;
|
|
1590
1590
|
const tr = new Uint8Array(16);
|
|
1591
1591
|
function rr() {
|
|
1592
|
-
if (!
|
|
1592
|
+
if (!B) {
|
|
1593
1593
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1594
1594
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1595
|
-
|
|
1595
|
+
B = crypto.getRandomValues.bind(crypto);
|
|
1596
1596
|
}
|
|
1597
|
-
return
|
|
1597
|
+
return B(tr);
|
|
1598
1598
|
}
|
|
1599
1599
|
const nr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), fe = { randomUUID: nr };
|
|
1600
|
-
function ir(r,
|
|
1600
|
+
function ir(r, t, e) {
|
|
1601
1601
|
var i;
|
|
1602
1602
|
r = r || {};
|
|
1603
1603
|
const n = r.random ?? ((i = r.rng) == null ? void 0 : i.call(r)) ?? rr();
|
|
@@ -1605,165 +1605,199 @@ function ir(r, e, t) {
|
|
|
1605
1605
|
throw new Error("Random bytes length must be >= 16");
|
|
1606
1606
|
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, er(n);
|
|
1607
1607
|
}
|
|
1608
|
-
function ke(r,
|
|
1608
|
+
function ke(r, t, e) {
|
|
1609
1609
|
return fe.randomUUID && !r ? fe.randomUUID() : ir(r);
|
|
1610
1610
|
}
|
|
1611
|
-
class
|
|
1612
|
-
constructor({ messages:
|
|
1613
|
-
|
|
1614
|
-
this.messages =
|
|
1611
|
+
class I {
|
|
1612
|
+
constructor({ messages: t }) {
|
|
1613
|
+
b(this, "messages", null);
|
|
1614
|
+
this.messages = t;
|
|
1615
1615
|
}
|
|
1616
|
-
pushMessage(
|
|
1617
|
-
const
|
|
1618
|
-
return
|
|
1616
|
+
pushMessage(t) {
|
|
1617
|
+
const e = new Map(this.messages);
|
|
1618
|
+
return e.set(t.messageId, t), new I({ messages: e });
|
|
1619
1619
|
}
|
|
1620
|
-
onMessage(
|
|
1621
|
-
switch (
|
|
1622
|
-
case
|
|
1623
|
-
return this.onMessageStart(
|
|
1624
|
-
case
|
|
1625
|
-
return this.onMessageDelta(
|
|
1626
|
-
case
|
|
1627
|
-
return this.onMessageComplete(
|
|
1628
|
-
case
|
|
1629
|
-
return this.
|
|
1620
|
+
onMessage(t) {
|
|
1621
|
+
switch (t.eventType) {
|
|
1622
|
+
case h.MESSAGE_START:
|
|
1623
|
+
return this.onMessageStart(t);
|
|
1624
|
+
case h.MESSAGE_DELTA:
|
|
1625
|
+
return this.onMessageDelta(t);
|
|
1626
|
+
case h.MESSAGE_COMPLETE:
|
|
1627
|
+
return this.onMessageComplete(t);
|
|
1628
|
+
case h.TOOL_CALL_START:
|
|
1629
|
+
return this.onToolCallStart(t);
|
|
1630
|
+
case h.TOOL_CALL_COMPLETE:
|
|
1631
|
+
return this.onToolCallComplete(t);
|
|
1632
|
+
case h.ERROR:
|
|
1633
|
+
return this.onMessageError(t);
|
|
1630
1634
|
default:
|
|
1631
1635
|
return this;
|
|
1632
1636
|
}
|
|
1633
1637
|
}
|
|
1634
|
-
onMessageStart(
|
|
1635
|
-
const
|
|
1636
|
-
return n.set(
|
|
1638
|
+
onMessageStart(t) {
|
|
1639
|
+
const e = t.fact.messageStart.message, n = new Map(this.messages);
|
|
1640
|
+
return n.set(e.messageId, {
|
|
1637
1641
|
type: "bot",
|
|
1638
|
-
eventType:
|
|
1642
|
+
eventType: h.MESSAGE_START,
|
|
1639
1643
|
isTyping: !0,
|
|
1640
1644
|
typingText: "",
|
|
1641
|
-
messageId:
|
|
1642
|
-
message:
|
|
1645
|
+
messageId: e.messageId,
|
|
1646
|
+
message: e,
|
|
1643
1647
|
time: /* @__PURE__ */ new Date(),
|
|
1644
|
-
traceId:
|
|
1645
|
-
}), new
|
|
1648
|
+
traceId: t.traceId
|
|
1649
|
+
}), new I({ messages: n });
|
|
1646
1650
|
}
|
|
1647
|
-
onMessageDelta(
|
|
1648
|
-
const
|
|
1651
|
+
onMessageDelta(t) {
|
|
1652
|
+
const e = t.fact.messageDelta.message, n = new Map(this.messages), i = n.get(e.messageId);
|
|
1649
1653
|
if ((i == null ? void 0 : i.type) !== "bot") return this;
|
|
1650
|
-
const o = `${(i == null ? void 0 : i.typingText) ?? ""}${
|
|
1651
|
-
return n.set(
|
|
1654
|
+
const o = `${(i == null ? void 0 : i.typingText) ?? ""}${e.text}`;
|
|
1655
|
+
return n.set(e.messageId, {
|
|
1652
1656
|
type: "bot",
|
|
1653
|
-
eventType:
|
|
1657
|
+
eventType: h.MESSAGE_DELTA,
|
|
1654
1658
|
isTyping: !0,
|
|
1655
1659
|
typingText: o,
|
|
1656
|
-
messageId:
|
|
1657
|
-
message:
|
|
1660
|
+
messageId: e.messageId,
|
|
1661
|
+
message: e,
|
|
1658
1662
|
time: /* @__PURE__ */ new Date(),
|
|
1659
|
-
traceId:
|
|
1660
|
-
}), new
|
|
1663
|
+
traceId: t.traceId ?? i.traceId
|
|
1664
|
+
}), new I({ messages: n });
|
|
1661
1665
|
}
|
|
1662
|
-
onMessageComplete(
|
|
1663
|
-
const
|
|
1664
|
-
return n.set(
|
|
1666
|
+
onMessageComplete(t) {
|
|
1667
|
+
const e = t.fact.messageComplete.message, n = new Map(this.messages), i = n.get(e.messageId);
|
|
1668
|
+
return n.set(e.messageId, {
|
|
1665
1669
|
type: "bot",
|
|
1666
|
-
eventType:
|
|
1670
|
+
eventType: h.MESSAGE_COMPLETE,
|
|
1667
1671
|
isTyping: !1,
|
|
1668
1672
|
typingText: null,
|
|
1669
|
-
messageId:
|
|
1670
|
-
message:
|
|
1673
|
+
messageId: e.messageId,
|
|
1674
|
+
message: e,
|
|
1671
1675
|
time: /* @__PURE__ */ new Date(),
|
|
1672
|
-
traceId:
|
|
1673
|
-
}), new
|
|
1676
|
+
traceId: t.traceId ?? ((i == null ? void 0 : i.type) === "bot" ? i.traceId : void 0)
|
|
1677
|
+
}), new I({ messages: n });
|
|
1674
1678
|
}
|
|
1675
|
-
onMessageError(
|
|
1676
|
-
const
|
|
1677
|
-
return i.set(
|
|
1679
|
+
onMessageError(t) {
|
|
1680
|
+
const e = ke(), n = t.fact.runError.error, i = new Map(this.messages);
|
|
1681
|
+
return i.set(e, {
|
|
1678
1682
|
type: "error",
|
|
1679
|
-
eventType:
|
|
1680
|
-
messageId:
|
|
1683
|
+
eventType: h.ERROR,
|
|
1684
|
+
messageId: e,
|
|
1681
1685
|
error: n,
|
|
1682
1686
|
time: /* @__PURE__ */ new Date(),
|
|
1683
|
-
traceId:
|
|
1684
|
-
}), new
|
|
1687
|
+
traceId: t.traceId
|
|
1688
|
+
}), new I({ messages: i });
|
|
1689
|
+
}
|
|
1690
|
+
onToolCallStart(t) {
|
|
1691
|
+
const e = t.fact.toolCallStart, n = new Map(this.messages), i = `${e.processId}-${e.callSeq}`, o = {
|
|
1692
|
+
type: "tool-call",
|
|
1693
|
+
eventType: h.TOOL_CALL_START,
|
|
1694
|
+
messageId: i,
|
|
1695
|
+
processId: e.processId,
|
|
1696
|
+
callSeq: e.callSeq,
|
|
1697
|
+
toolName: e.toolCall.toolName,
|
|
1698
|
+
toolsetName: e.toolCall.toolsetName,
|
|
1699
|
+
parameter: e.toolCall.parameter,
|
|
1700
|
+
isComplete: !1,
|
|
1701
|
+
time: /* @__PURE__ */ new Date(),
|
|
1702
|
+
traceId: t.traceId
|
|
1703
|
+
};
|
|
1704
|
+
return n.set(i, o), new I({ messages: n });
|
|
1705
|
+
}
|
|
1706
|
+
onToolCallComplete(t) {
|
|
1707
|
+
const e = t.fact.toolCallComplete, n = new Map(this.messages), i = `${e.processId}-${e.callSeq}`, o = n.get(i);
|
|
1708
|
+
if ((o == null ? void 0 : o.type) === "tool-call") {
|
|
1709
|
+
const s = {
|
|
1710
|
+
...o,
|
|
1711
|
+
eventType: h.TOOL_CALL_COMPLETE,
|
|
1712
|
+
result: e.toolCallResult,
|
|
1713
|
+
isComplete: !0,
|
|
1714
|
+
traceId: t.traceId ?? o.traceId
|
|
1715
|
+
};
|
|
1716
|
+
n.set(i, s);
|
|
1717
|
+
}
|
|
1718
|
+
return new I({ messages: n });
|
|
1685
1719
|
}
|
|
1686
1720
|
}
|
|
1687
|
-
class
|
|
1688
|
-
constructor(
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
if (!
|
|
1721
|
+
class $e {
|
|
1722
|
+
constructor(t) {
|
|
1723
|
+
b(this, "client");
|
|
1724
|
+
b(this, "customChannelId");
|
|
1725
|
+
b(this, "customMessageId");
|
|
1726
|
+
b(this, "isConnecting$");
|
|
1727
|
+
b(this, "conversation$");
|
|
1728
|
+
b(this, "statesObserver");
|
|
1729
|
+
b(this, "statesSubscription");
|
|
1730
|
+
b(this, "currentUserMessageId");
|
|
1731
|
+
if (!t.client)
|
|
1698
1732
|
throw new Error("client must be required");
|
|
1699
|
-
if (!
|
|
1733
|
+
if (!t.customChannelId)
|
|
1700
1734
|
throw new Error("customChannelId must be required");
|
|
1701
|
-
this.client =
|
|
1735
|
+
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new oe(!1), this.conversation$ = new oe(t.conversation), this.statesObserver = t.statesObserver;
|
|
1702
1736
|
}
|
|
1703
|
-
static async reset(
|
|
1704
|
-
const i = new
|
|
1737
|
+
static async reset(t, e, n) {
|
|
1738
|
+
const i = new $e(t);
|
|
1705
1739
|
try {
|
|
1706
|
-
return i.subscribe(), await i.resetChannel(
|
|
1740
|
+
return i.subscribe(), await i.resetChannel(e, n), i;
|
|
1707
1741
|
} catch (o) {
|
|
1708
1742
|
throw i.close(), o;
|
|
1709
1743
|
}
|
|
1710
1744
|
}
|
|
1711
1745
|
subscribe() {
|
|
1712
1746
|
this.statesSubscription = Ut([this.isConnecting$, this.conversation$]).pipe(
|
|
1713
|
-
V(([
|
|
1714
|
-
isConnecting:
|
|
1715
|
-
conversation:
|
|
1747
|
+
V(([t, e]) => ({
|
|
1748
|
+
isConnecting: t,
|
|
1749
|
+
conversation: e
|
|
1716
1750
|
}))
|
|
1717
1751
|
).subscribe(this.statesObserver);
|
|
1718
1752
|
}
|
|
1719
|
-
fetchSse(
|
|
1753
|
+
fetchSse(t, e) {
|
|
1720
1754
|
return new Promise((n, i) => {
|
|
1721
|
-
this.isConnecting$.next(!0), this.client.fetchSse(
|
|
1722
|
-
onSseStart:
|
|
1755
|
+
this.isConnecting$.next(!0), this.client.fetchSse(t, {
|
|
1756
|
+
onSseStart: e == null ? void 0 : e.onSseStart,
|
|
1723
1757
|
onSseMessage: (o) => {
|
|
1724
1758
|
var s;
|
|
1725
|
-
if ((s =
|
|
1726
|
-
const a = new Map(this.conversation$.value.messages),
|
|
1727
|
-
|
|
1728
|
-
...
|
|
1759
|
+
if ((s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, o), this.currentUserMessageId && o.traceId) {
|
|
1760
|
+
const a = new Map(this.conversation$.value.messages), c = a.get(this.currentUserMessageId);
|
|
1761
|
+
c && c.type === "user" && (a.set(this.currentUserMessageId, {
|
|
1762
|
+
...c,
|
|
1729
1763
|
traceId: o.traceId
|
|
1730
|
-
}), this.conversation$.next(new
|
|
1764
|
+
}), this.conversation$.next(new I({ messages: a }))), this.currentUserMessageId = void 0;
|
|
1731
1765
|
}
|
|
1732
1766
|
this.conversation$.next(this.conversation$.value.onMessage(o));
|
|
1733
1767
|
},
|
|
1734
1768
|
onSseError: (o) => {
|
|
1735
1769
|
var s;
|
|
1736
|
-
(s =
|
|
1770
|
+
(s = e == null ? void 0 : e.onSseError) == null || s.call(e, o), this.isConnecting$.next(!1), this.currentUserMessageId = void 0, i(o);
|
|
1737
1771
|
},
|
|
1738
1772
|
onSseCompleted: () => {
|
|
1739
1773
|
var o;
|
|
1740
|
-
(o =
|
|
1774
|
+
(o = e == null ? void 0 : e.onSseCompleted) == null || o.call(e), this.isConnecting$.next(!1), this.currentUserMessageId = void 0, n();
|
|
1741
1775
|
}
|
|
1742
1776
|
});
|
|
1743
1777
|
});
|
|
1744
1778
|
}
|
|
1745
|
-
resetChannel(
|
|
1779
|
+
resetChannel(t, e) {
|
|
1746
1780
|
return this.fetchSse(
|
|
1747
1781
|
{
|
|
1748
1782
|
action: Y.RESET_CHANNEL,
|
|
1749
1783
|
customChannelId: this.customChannelId,
|
|
1750
1784
|
customMessageId: this.customMessageId,
|
|
1751
|
-
text: (
|
|
1752
|
-
payload:
|
|
1785
|
+
text: (t == null ? void 0 : t.text) || "",
|
|
1786
|
+
payload: t == null ? void 0 : t.payload
|
|
1753
1787
|
},
|
|
1754
|
-
|
|
1788
|
+
e
|
|
1755
1789
|
);
|
|
1756
1790
|
}
|
|
1757
|
-
sendMessage(
|
|
1758
|
-
const n =
|
|
1791
|
+
sendMessage(t, e) {
|
|
1792
|
+
const n = t.text.trim(), i = t.customMessageId ?? ke();
|
|
1759
1793
|
return this.currentUserMessageId = i, this.conversation$.next(
|
|
1760
1794
|
this.conversation$.value.pushMessage({
|
|
1761
1795
|
type: "user",
|
|
1762
1796
|
messageId: i,
|
|
1763
1797
|
text: n,
|
|
1764
|
-
blobIds:
|
|
1765
|
-
filePreviewUrls:
|
|
1766
|
-
documentNames:
|
|
1798
|
+
blobIds: t.blobIds,
|
|
1799
|
+
filePreviewUrls: t.filePreviewUrls,
|
|
1800
|
+
documentNames: t.documentNames,
|
|
1767
1801
|
time: /* @__PURE__ */ new Date()
|
|
1768
1802
|
})
|
|
1769
1803
|
), this.fetchSse(
|
|
@@ -1771,23 +1805,23 @@ class je {
|
|
|
1771
1805
|
action: Y.NONE,
|
|
1772
1806
|
customChannelId: this.customChannelId,
|
|
1773
1807
|
customMessageId: i,
|
|
1774
|
-
payload:
|
|
1808
|
+
payload: t == null ? void 0 : t.payload,
|
|
1775
1809
|
text: n,
|
|
1776
|
-
blobIds:
|
|
1810
|
+
blobIds: t == null ? void 0 : t.blobIds
|
|
1777
1811
|
},
|
|
1778
|
-
|
|
1812
|
+
e
|
|
1779
1813
|
);
|
|
1780
1814
|
}
|
|
1781
1815
|
close() {
|
|
1782
|
-
var
|
|
1783
|
-
this.isConnecting$.complete(), this.conversation$.complete(), (
|
|
1816
|
+
var t;
|
|
1817
|
+
this.isConnecting$.complete(), this.conversation$.complete(), (t = this.statesSubscription) == null || t.unsubscribe();
|
|
1784
1818
|
}
|
|
1785
1819
|
}
|
|
1786
1820
|
export {
|
|
1787
1821
|
sr as AsgardServiceClient,
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1822
|
+
$e as Channel,
|
|
1823
|
+
I as Conversation,
|
|
1824
|
+
h as EventType,
|
|
1791
1825
|
Y as FetchSseAction,
|
|
1792
1826
|
Fe as MessageTemplateType
|
|
1793
1827
|
};
|