@asgard-js/core 0.0.2 → 0.0.3-8.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/README.md +329 -6
- package/dist/constants/enum.d.ts +11 -2
- package/dist/constants/enum.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +876 -677
- package/dist/index.mjs.map +1 -1
- package/dist/lib/channel.d.ts +19 -0
- package/dist/lib/channel.d.ts.map +1 -0
- package/dist/lib/client.d.ts +10 -6
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/conversation.d.ts +8 -19
- package/dist/lib/conversation.d.ts.map +1 -1
- package/dist/lib/create-sse-observable.d.ts +2 -1
- package/dist/lib/create-sse-observable.d.ts.map +1 -1
- package/dist/lib/event-emitter.d.ts +8 -0
- package/dist/lib/event-emitter.d.ts.map +1 -0
- package/dist/types/channel.d.ts +42 -0
- package/dist/types/channel.d.ts.map +1 -0
- package/dist/types/client.d.ts +55 -27
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/event-emitter.d.ts +5 -0
- package/dist/types/event-emitter.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/sse-response.d.ts +56 -9
- package/dist/types/sse-response.d.ts.map +1 -1
- package/eslint.config.cjs +22 -0
- package/package.json +13 -1
- package/src/constants/enum.ts +32 -0
- package/src/index.ts +11 -0
- package/src/lib/channel.ts +153 -0
- package/src/lib/client.spec.ts +150 -0
- package/src/lib/client.ts +141 -0
- package/src/lib/conversation.ts +120 -0
- package/src/lib/create-sse-observable.ts +77 -0
- package/src/lib/event-emitter.ts +30 -0
- package/src/types/channel.ts +50 -0
- package/src/types/client.ts +89 -0
- package/src/types/event-emitter.ts +8 -0
- package/src/types/index.ts +4 -0
- package/src/types/sse-response.ts +176 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lib.json +28 -0
- package/tsconfig.spec.json +33 -0
- package/vite.config.ts +80 -0
package/dist/index.mjs
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
return
|
|
1
|
+
var De = Object.defineProperty;
|
|
2
|
+
var Ue = (n, t, e) => t in n ? De(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var m = (n, t, e) => Ue(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
var K = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n))(K || {}), h = /* @__PURE__ */ ((n) => (n.INIT = "asgard.run.init", n.PROCESS = "asgard.process", n.PROCESS_START = "asgard.process.start", n.PROCESS_COMPLETE = "asgard.process.complete", n.MESSAGE = "asgard.message", n.MESSAGE_START = "asgard.message.start", n.MESSAGE_DELTA = "asgard.message.delta", n.MESSAGE_COMPLETE = "asgard.message.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(h || {}), Ne = /* @__PURE__ */ ((n) => (n.TEXT = "TEXT", n.HINT = "HINT", n.BUTTON = "BUTTON", n.IMAGE = "IMAGE", n.VIDEO = "VIDEO", n.AUDIO = "AUDIO", n.LOCATION = "LOCATION", n.CAROUSEL = "CAROUSEL", n.CHART = "CHART", n))(Ne || {}), Y = function(n, t) {
|
|
5
|
+
return Y = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
6
6
|
e.__proto__ = r;
|
|
7
7
|
} || function(e, r) {
|
|
8
8
|
for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
|
|
9
|
-
},
|
|
9
|
+
}, Y(n, t);
|
|
10
10
|
};
|
|
11
11
|
function O(n, 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
|
+
Y(n, t);
|
|
15
15
|
function e() {
|
|
16
16
|
this.constructor = n;
|
|
17
17
|
}
|
|
18
18
|
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
function i(
|
|
22
|
-
return
|
|
23
|
-
o
|
|
20
|
+
function $e(n, t, e, r) {
|
|
21
|
+
function i(o) {
|
|
22
|
+
return o instanceof e ? o : new e(function(s) {
|
|
23
|
+
s(o);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
return new (e || (e = Promise))(function(
|
|
27
|
-
function c(
|
|
26
|
+
return new (e || (e = Promise))(function(o, s) {
|
|
27
|
+
function c(f) {
|
|
28
28
|
try {
|
|
29
|
-
|
|
30
|
-
} catch (
|
|
31
|
-
|
|
29
|
+
u(r.next(f));
|
|
30
|
+
} catch (y) {
|
|
31
|
+
s(y);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function a(f) {
|
|
35
35
|
try {
|
|
36
|
-
|
|
37
|
-
} catch (
|
|
38
|
-
|
|
36
|
+
u(r.throw(f));
|
|
37
|
+
} catch (y) {
|
|
38
|
+
s(y);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
41
|
+
function u(f) {
|
|
42
|
+
f.done ? o(f.value) : i(f.value).then(c, a);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
u((r = r.apply(n, t || [])).next());
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function ce(n, t) {
|
|
48
48
|
var e = { label: 0, sent: function() {
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
51
|
-
}, trys: [], ops: [] }, r, i,
|
|
52
|
-
return
|
|
49
|
+
if (o[0] & 1) throw o[1];
|
|
50
|
+
return o[1];
|
|
51
|
+
}, trys: [], ops: [] }, r, i, o, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
52
|
+
return s.next = c(0), s.throw = c(1), s.return = c(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
53
53
|
return this;
|
|
54
|
-
}),
|
|
55
|
-
function c(
|
|
56
|
-
return function(
|
|
57
|
-
return
|
|
54
|
+
}), s;
|
|
55
|
+
function c(u) {
|
|
56
|
+
return function(f) {
|
|
57
|
+
return a([u, f]);
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function u
|
|
60
|
+
function a(u) {
|
|
61
61
|
if (r) throw new TypeError("Generator is already executing.");
|
|
62
|
-
for (;
|
|
63
|
-
if (r = 1, i && (
|
|
64
|
-
switch (i = 0,
|
|
62
|
+
for (; s && (s = 0, u[0] && (e = 0)), e; ) try {
|
|
63
|
+
if (r = 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
|
-
|
|
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 (
|
|
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 =
|
|
86
|
+
if (u[0] === 6 && e.label < o[1]) {
|
|
87
|
+
e.label = o[1], o = u;
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
|
-
if (
|
|
91
|
-
e.label =
|
|
90
|
+
if (o && e.label < o[2]) {
|
|
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
|
-
|
|
98
|
-
} catch (
|
|
99
|
-
|
|
97
|
+
u = t.call(n, e);
|
|
98
|
+
} catch (f) {
|
|
99
|
+
u = [6, f], i = 0;
|
|
100
100
|
} finally {
|
|
101
|
-
r =
|
|
101
|
+
r = 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
|
|
107
|
+
function M(n) {
|
|
108
108
|
var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
|
|
109
109
|
if (e) return e.call(n);
|
|
110
110
|
if (n && typeof n.length == "number") return {
|
|
@@ -114,98 +114,98 @@ function P(n) {
|
|
|
114
114
|
};
|
|
115
115
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function L(n, t) {
|
|
118
118
|
var e = typeof Symbol == "function" && n[Symbol.iterator];
|
|
119
119
|
if (!e) return n;
|
|
120
|
-
var r = e.call(n), i,
|
|
120
|
+
var r = e.call(n), i, o = [], s;
|
|
121
121
|
try {
|
|
122
|
-
for (; (t === void 0 || t-- > 0) && !(i = r.next()).done; )
|
|
122
|
+
for (; (t === void 0 || t-- > 0) && !(i = r.next()).done; ) o.push(i.value);
|
|
123
123
|
} catch (c) {
|
|
124
|
-
|
|
124
|
+
s = { error: c };
|
|
125
125
|
} finally {
|
|
126
126
|
try {
|
|
127
127
|
i && !i.done && (e = r.return) && e.call(r);
|
|
128
128
|
} finally {
|
|
129
|
-
if (
|
|
129
|
+
if (s) throw s.error;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
return
|
|
132
|
+
return o;
|
|
133
133
|
}
|
|
134
134
|
function R(n, t, e) {
|
|
135
|
-
if (e || arguments.length === 2) for (var r = 0, i = t.length,
|
|
136
|
-
(
|
|
137
|
-
return n.concat(
|
|
135
|
+
if (e || arguments.length === 2) for (var r = 0, i = t.length, o; r < i; r++)
|
|
136
|
+
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
137
|
+
return n.concat(o || Array.prototype.slice.call(t));
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
return this instanceof
|
|
139
|
+
function P(n) {
|
|
140
|
+
return this instanceof P ? (this.v = n, this) : new P(n);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Ge(n, t, e) {
|
|
143
143
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
144
|
-
var r = e.apply(n, t || []), i,
|
|
145
|
-
return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), c("next"), c("throw"), c("return",
|
|
144
|
+
var r = e.apply(n, t || []), i, o = [];
|
|
145
|
+
return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), c("next"), c("throw"), c("return", s), i[Symbol.asyncIterator] = function() {
|
|
146
146
|
return this;
|
|
147
147
|
}, i;
|
|
148
|
-
function
|
|
149
|
-
return function(
|
|
150
|
-
return Promise.resolve(
|
|
148
|
+
function s(l) {
|
|
149
|
+
return function(v) {
|
|
150
|
+
return Promise.resolve(v).then(l, y);
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
function c(
|
|
154
|
-
r[
|
|
155
|
-
return new Promise(function(
|
|
156
|
-
|
|
153
|
+
function c(l, v) {
|
|
154
|
+
r[l] && (i[l] = function(d) {
|
|
155
|
+
return new Promise(function(g, w) {
|
|
156
|
+
o.push([l, d, g, w]) > 1 || a(l, d);
|
|
157
157
|
});
|
|
158
|
-
},
|
|
158
|
+
}, v && (i[l] = v(i[l])));
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function a(l, v) {
|
|
161
161
|
try {
|
|
162
|
-
|
|
162
|
+
u(r[l](v));
|
|
163
163
|
} catch (d) {
|
|
164
|
-
|
|
164
|
+
b(o[0][3], d);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
167
|
+
function u(l) {
|
|
168
|
+
l.value instanceof P ? Promise.resolve(l.value.v).then(f, y) : b(o[0][2], l);
|
|
169
169
|
}
|
|
170
|
-
function l
|
|
171
|
-
|
|
170
|
+
function f(l) {
|
|
171
|
+
a("next", l);
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
173
|
+
function y(l) {
|
|
174
|
+
a("throw", l);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
176
|
+
function b(l, v) {
|
|
177
|
+
l(v), o.shift(), o.length && a(o[0][0], o[0][1]);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function Fe(n) {
|
|
181
181
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
182
182
|
var t = n[Symbol.asyncIterator], e;
|
|
183
|
-
return t ? t.call(n) : (n = typeof
|
|
183
|
+
return t ? t.call(n) : (n = typeof M == "function" ? M(n) : n[Symbol.iterator](), e = {}, r("next"), r("throw"), r("return"), e[Symbol.asyncIterator] = function() {
|
|
184
184
|
return this;
|
|
185
185
|
}, e);
|
|
186
|
-
function r(
|
|
187
|
-
e[
|
|
188
|
-
return new Promise(function(c,
|
|
189
|
-
|
|
186
|
+
function r(o) {
|
|
187
|
+
e[o] = n[o] && function(s) {
|
|
188
|
+
return new Promise(function(c, a) {
|
|
189
|
+
s = n[o](s), i(c, a, s.done, s.value);
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function i(
|
|
194
|
-
Promise.resolve(
|
|
195
|
-
|
|
196
|
-
},
|
|
193
|
+
function i(o, s, c, a) {
|
|
194
|
+
Promise.resolve(a).then(function(u) {
|
|
195
|
+
o({ value: u, done: c });
|
|
196
|
+
}, s);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function p(n) {
|
|
200
200
|
return typeof n == "function";
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function fe(n) {
|
|
203
203
|
var t = function(r) {
|
|
204
204
|
Error.call(r), r.stack = new Error().stack;
|
|
205
205
|
}, e = n(t);
|
|
206
206
|
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
|
207
207
|
}
|
|
208
|
-
var
|
|
208
|
+
var B = fe(function(n) {
|
|
209
209
|
return function(e) {
|
|
210
210
|
n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
211
211
|
` + e.map(function(r, i) {
|
|
@@ -214,76 +214,76 @@ var H = ue(function(n) {
|
|
|
214
214
|
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
215
215
|
};
|
|
216
216
|
});
|
|
217
|
-
function
|
|
217
|
+
function N(n, t) {
|
|
218
218
|
if (n) {
|
|
219
219
|
var e = n.indexOf(t);
|
|
220
220
|
0 <= e && n.splice(e, 1);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var k = function() {
|
|
224
224
|
function n(t) {
|
|
225
225
|
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
226
226
|
}
|
|
227
227
|
return n.prototype.unsubscribe = function() {
|
|
228
|
-
var t, e, r, i,
|
|
228
|
+
var t, e, r, i, o;
|
|
229
229
|
if (!this.closed) {
|
|
230
230
|
this.closed = !0;
|
|
231
|
-
var
|
|
232
|
-
if (
|
|
233
|
-
if (this._parentage = null, Array.isArray(
|
|
231
|
+
var s = this._parentage;
|
|
232
|
+
if (s)
|
|
233
|
+
if (this._parentage = null, Array.isArray(s))
|
|
234
234
|
try {
|
|
235
|
-
for (var c =
|
|
236
|
-
var
|
|
237
|
-
|
|
235
|
+
for (var c = M(s), a = c.next(); !a.done; a = c.next()) {
|
|
236
|
+
var u = a.value;
|
|
237
|
+
u.remove(this);
|
|
238
238
|
}
|
|
239
239
|
} catch (d) {
|
|
240
240
|
t = { error: d };
|
|
241
241
|
} finally {
|
|
242
242
|
try {
|
|
243
|
-
|
|
243
|
+
a && !a.done && (e = c.return) && e.call(c);
|
|
244
244
|
} finally {
|
|
245
245
|
if (t) throw t.error;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
else
|
|
249
|
-
|
|
250
|
-
var
|
|
251
|
-
if (
|
|
249
|
+
s.remove(this);
|
|
250
|
+
var f = this.initialTeardown;
|
|
251
|
+
if (p(f))
|
|
252
252
|
try {
|
|
253
|
-
|
|
253
|
+
f();
|
|
254
254
|
} catch (d) {
|
|
255
|
-
|
|
255
|
+
o = d instanceof B ? d.errors : [d];
|
|
256
256
|
}
|
|
257
|
-
var
|
|
258
|
-
if (
|
|
257
|
+
var y = this._finalizers;
|
|
258
|
+
if (y) {
|
|
259
259
|
this._finalizers = null;
|
|
260
260
|
try {
|
|
261
|
-
for (var
|
|
262
|
-
var
|
|
261
|
+
for (var b = M(y), l = b.next(); !l.done; l = b.next()) {
|
|
262
|
+
var v = l.value;
|
|
263
263
|
try {
|
|
264
|
-
|
|
264
|
+
ee(v);
|
|
265
265
|
} catch (d) {
|
|
266
|
-
|
|
266
|
+
o = o ?? [], d instanceof B ? o = R(R([], L(o)), L(d.errors)) : o.push(d);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
} catch (d) {
|
|
270
270
|
r = { error: d };
|
|
271
271
|
} finally {
|
|
272
272
|
try {
|
|
273
|
-
|
|
273
|
+
l && !l.done && (i = b.return) && i.call(b);
|
|
274
274
|
} finally {
|
|
275
275
|
if (r) throw r.error;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
if (
|
|
280
|
-
throw new
|
|
279
|
+
if (o)
|
|
280
|
+
throw new B(o);
|
|
281
281
|
}
|
|
282
282
|
}, n.prototype.add = function(t) {
|
|
283
283
|
var e;
|
|
284
284
|
if (t && t !== this)
|
|
285
285
|
if (this.closed)
|
|
286
|
-
|
|
286
|
+
ee(t);
|
|
287
287
|
else {
|
|
288
288
|
if (t instanceof n) {
|
|
289
289
|
if (t.closed || t._hasParent(this))
|
|
@@ -300,57 +300,57 @@ var D = function() {
|
|
|
300
300
|
this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
|
|
301
301
|
}, n.prototype._removeParent = function(t) {
|
|
302
302
|
var e = this._parentage;
|
|
303
|
-
e === t ? this._parentage = null : Array.isArray(e) &&
|
|
303
|
+
e === t ? this._parentage = null : Array.isArray(e) && N(e, t);
|
|
304
304
|
}, n.prototype.remove = function(t) {
|
|
305
305
|
var e = this._finalizers;
|
|
306
|
-
e &&
|
|
306
|
+
e && N(e, t), t instanceof n && t._removeParent(this);
|
|
307
307
|
}, n.EMPTY = function() {
|
|
308
308
|
var t = new n();
|
|
309
309
|
return t.closed = !0, t;
|
|
310
310
|
}(), n;
|
|
311
|
-
}(),
|
|
312
|
-
function
|
|
313
|
-
return n instanceof
|
|
311
|
+
}(), le = k.EMPTY;
|
|
312
|
+
function de(n) {
|
|
313
|
+
return n instanceof k || n && "closed" in n && p(n.remove) && p(n.add) && p(n.unsubscribe);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
|
|
315
|
+
function ee(n) {
|
|
316
|
+
p(n) ? n() : n.unsubscribe();
|
|
317
317
|
}
|
|
318
|
-
var
|
|
318
|
+
var He = {
|
|
319
319
|
onUnhandledError: null,
|
|
320
320
|
onStoppedNotification: null,
|
|
321
321
|
Promise: void 0,
|
|
322
322
|
useDeprecatedSynchronousErrorHandling: !1,
|
|
323
323
|
useDeprecatedNextContext: !1
|
|
324
|
-
},
|
|
324
|
+
}, he = {
|
|
325
325
|
setTimeout: function(n, t) {
|
|
326
326
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
327
327
|
e[r - 2] = arguments[r];
|
|
328
|
-
return setTimeout.apply(void 0, R([n, t],
|
|
328
|
+
return setTimeout.apply(void 0, R([n, t], L(e)));
|
|
329
329
|
},
|
|
330
330
|
clearTimeout: function(n) {
|
|
331
|
-
var t =
|
|
331
|
+
var t = he.delegate;
|
|
332
332
|
return ((t == null ? void 0 : t.clearTimeout) || clearTimeout)(n);
|
|
333
333
|
},
|
|
334
334
|
delegate: void 0
|
|
335
335
|
};
|
|
336
|
-
function
|
|
337
|
-
|
|
336
|
+
function ye(n) {
|
|
337
|
+
he.setTimeout(function() {
|
|
338
338
|
throw n;
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function q() {
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function U(n) {
|
|
344
344
|
n();
|
|
345
345
|
}
|
|
346
|
-
var
|
|
346
|
+
var X = function(n) {
|
|
347
347
|
O(t, n);
|
|
348
348
|
function t(e) {
|
|
349
349
|
var r = n.call(this) || this;
|
|
350
|
-
return r.isStopped = !1, e ? (r.destination = e,
|
|
350
|
+
return r.isStopped = !1, e ? (r.destination = e, de(e) && e.add(r)) : r.destination = Ke, r;
|
|
351
351
|
}
|
|
352
352
|
return t.create = function(e, r, i) {
|
|
353
|
-
return new
|
|
353
|
+
return new W(e, r, i);
|
|
354
354
|
}, t.prototype.next = function(e) {
|
|
355
355
|
this.isStopped || this._next(e);
|
|
356
356
|
}, t.prototype.error = function(e) {
|
|
@@ -374,7 +374,7 @@ var W = function(n) {
|
|
|
374
374
|
this.unsubscribe();
|
|
375
375
|
}
|
|
376
376
|
}, t;
|
|
377
|
-
}(
|
|
377
|
+
}(k), Ve = function() {
|
|
378
378
|
function n(t) {
|
|
379
379
|
this.partialObserver = t;
|
|
380
380
|
}
|
|
@@ -384,7 +384,7 @@ var W = function(n) {
|
|
|
384
384
|
try {
|
|
385
385
|
e.next(t);
|
|
386
386
|
} catch (r) {
|
|
387
|
-
|
|
387
|
+
D(r);
|
|
388
388
|
}
|
|
389
389
|
}, n.prototype.error = function(t) {
|
|
390
390
|
var e = this.partialObserver;
|
|
@@ -392,56 +392,56 @@ var W = function(n) {
|
|
|
392
392
|
try {
|
|
393
393
|
e.error(t);
|
|
394
394
|
} catch (r) {
|
|
395
|
-
|
|
395
|
+
D(r);
|
|
396
396
|
}
|
|
397
397
|
else
|
|
398
|
-
|
|
398
|
+
D(t);
|
|
399
399
|
}, n.prototype.complete = function() {
|
|
400
400
|
var t = this.partialObserver;
|
|
401
401
|
if (t.complete)
|
|
402
402
|
try {
|
|
403
403
|
t.complete();
|
|
404
404
|
} catch (e) {
|
|
405
|
-
|
|
405
|
+
D(e);
|
|
406
406
|
}
|
|
407
407
|
}, n;
|
|
408
|
-
}(),
|
|
408
|
+
}(), W = function(n) {
|
|
409
409
|
O(t, n);
|
|
410
410
|
function t(e, r, i) {
|
|
411
|
-
var
|
|
412
|
-
return
|
|
411
|
+
var o = n.call(this) || this, s;
|
|
412
|
+
return p(e) || !e ? s = {
|
|
413
413
|
next: e ?? void 0,
|
|
414
414
|
error: r ?? void 0,
|
|
415
415
|
complete: i ?? void 0
|
|
416
|
-
} :
|
|
416
|
+
} : s = e, o.destination = new Ve(s), o;
|
|
417
417
|
}
|
|
418
418
|
return t;
|
|
419
|
-
}(
|
|
420
|
-
function
|
|
421
|
-
|
|
419
|
+
}(X);
|
|
420
|
+
function D(n) {
|
|
421
|
+
ye(n);
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function Be(n) {
|
|
424
424
|
throw n;
|
|
425
425
|
}
|
|
426
|
-
var
|
|
426
|
+
var Ke = {
|
|
427
427
|
closed: !0,
|
|
428
|
-
next:
|
|
429
|
-
error:
|
|
430
|
-
complete:
|
|
431
|
-
},
|
|
428
|
+
next: q,
|
|
429
|
+
error: Be,
|
|
430
|
+
complete: q
|
|
431
|
+
}, z = function() {
|
|
432
432
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
433
433
|
}();
|
|
434
|
-
function
|
|
434
|
+
function G(n) {
|
|
435
435
|
return n;
|
|
436
436
|
}
|
|
437
|
-
function
|
|
438
|
-
return n.length === 0 ?
|
|
437
|
+
function Ye(n) {
|
|
438
|
+
return n.length === 0 ? G : n.length === 1 ? n[0] : function(e) {
|
|
439
439
|
return n.reduce(function(r, i) {
|
|
440
440
|
return i(r);
|
|
441
441
|
}, e);
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
|
-
var
|
|
444
|
+
var S = function() {
|
|
445
445
|
function n(t) {
|
|
446
446
|
t && (this._subscribe = t);
|
|
447
447
|
}
|
|
@@ -449,11 +449,11 @@ var b = function() {
|
|
|
449
449
|
var e = new n();
|
|
450
450
|
return e.source = this, e.operator = t, e;
|
|
451
451
|
}, n.prototype.subscribe = function(t, e, r) {
|
|
452
|
-
var i = this,
|
|
453
|
-
return
|
|
454
|
-
var
|
|
455
|
-
|
|
456
|
-
}),
|
|
452
|
+
var i = this, o = We(t) ? t : new W(t, e, r);
|
|
453
|
+
return U(function() {
|
|
454
|
+
var s = i, c = s.operator, a = s.source;
|
|
455
|
+
o.add(c ? c.call(o, a) : a ? i._subscribe(o) : i._trySubscribe(o));
|
|
456
|
+
}), o;
|
|
457
457
|
}, n.prototype._trySubscribe = function(t) {
|
|
458
458
|
try {
|
|
459
459
|
return this._subscribe(t);
|
|
@@ -462,61 +462,61 @@ var b = function() {
|
|
|
462
462
|
}
|
|
463
463
|
}, n.prototype.forEach = function(t, e) {
|
|
464
464
|
var r = this;
|
|
465
|
-
return e =
|
|
466
|
-
var
|
|
465
|
+
return e = te(e), new e(function(i, o) {
|
|
466
|
+
var s = new W({
|
|
467
467
|
next: function(c) {
|
|
468
468
|
try {
|
|
469
469
|
t(c);
|
|
470
|
-
} catch (
|
|
471
|
-
|
|
470
|
+
} catch (a) {
|
|
471
|
+
o(a), s.unsubscribe();
|
|
472
472
|
}
|
|
473
473
|
},
|
|
474
|
-
error:
|
|
474
|
+
error: o,
|
|
475
475
|
complete: i
|
|
476
476
|
});
|
|
477
|
-
r.subscribe(
|
|
477
|
+
r.subscribe(s);
|
|
478
478
|
});
|
|
479
479
|
}, n.prototype._subscribe = function(t) {
|
|
480
480
|
var e;
|
|
481
481
|
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
|
|
482
|
-
}, n.prototype[
|
|
482
|
+
}, n.prototype[z] = function() {
|
|
483
483
|
return this;
|
|
484
484
|
}, n.prototype.pipe = function() {
|
|
485
485
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
486
486
|
t[e] = arguments[e];
|
|
487
|
-
return
|
|
487
|
+
return Ye(t)(this);
|
|
488
488
|
}, n.prototype.toPromise = function(t) {
|
|
489
489
|
var e = this;
|
|
490
|
-
return t =
|
|
491
|
-
var
|
|
492
|
-
e.subscribe(function(
|
|
493
|
-
return
|
|
494
|
-
}, function(
|
|
495
|
-
return i(
|
|
490
|
+
return t = te(t), new t(function(r, i) {
|
|
491
|
+
var o;
|
|
492
|
+
e.subscribe(function(s) {
|
|
493
|
+
return o = s;
|
|
494
|
+
}, function(s) {
|
|
495
|
+
return i(s);
|
|
496
496
|
}, function() {
|
|
497
|
-
return r(
|
|
497
|
+
return r(o);
|
|
498
498
|
});
|
|
499
499
|
});
|
|
500
500
|
}, n.create = function(t) {
|
|
501
501
|
return new n(t);
|
|
502
502
|
}, n;
|
|
503
503
|
}();
|
|
504
|
-
function
|
|
504
|
+
function te(n) {
|
|
505
505
|
var t;
|
|
506
|
-
return (t = n ??
|
|
506
|
+
return (t = n ?? He.Promise) !== null && t !== void 0 ? t : Promise;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
return n &&
|
|
508
|
+
function qe(n) {
|
|
509
|
+
return n && p(n.next) && p(n.error) && p(n.complete);
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
return n && n instanceof
|
|
511
|
+
function We(n) {
|
|
512
|
+
return n && n instanceof X || qe(n) && de(n);
|
|
513
513
|
}
|
|
514
|
-
function
|
|
515
|
-
return
|
|
514
|
+
function Je(n) {
|
|
515
|
+
return p(n == null ? void 0 : n.lift);
|
|
516
516
|
}
|
|
517
517
|
function T(n) {
|
|
518
518
|
return function(t) {
|
|
519
|
-
if (
|
|
519
|
+
if (Je(t))
|
|
520
520
|
return t.lift(function(e) {
|
|
521
521
|
try {
|
|
522
522
|
return n(e, this);
|
|
@@ -527,36 +527,36 @@ function T(n) {
|
|
|
527
527
|
throw new TypeError("Unable to lift unknown Observable type");
|
|
528
528
|
};
|
|
529
529
|
}
|
|
530
|
-
function
|
|
531
|
-
return new
|
|
530
|
+
function E(n, t, e, r, i) {
|
|
531
|
+
return new Xe(n, t, e, r, i);
|
|
532
532
|
}
|
|
533
|
-
var
|
|
533
|
+
var Xe = function(n) {
|
|
534
534
|
O(t, n);
|
|
535
|
-
function t(e, r, i,
|
|
536
|
-
var
|
|
537
|
-
return
|
|
535
|
+
function t(e, r, i, o, s, c) {
|
|
536
|
+
var a = n.call(this, e) || this;
|
|
537
|
+
return a.onFinalize = s, a.shouldUnsubscribe = c, a._next = r ? function(u) {
|
|
538
538
|
try {
|
|
539
|
-
r(
|
|
540
|
-
} catch (
|
|
541
|
-
e.error(
|
|
539
|
+
r(u);
|
|
540
|
+
} catch (f) {
|
|
541
|
+
e.error(f);
|
|
542
542
|
}
|
|
543
|
-
} : n.prototype._next,
|
|
543
|
+
} : n.prototype._next, a._error = o ? function(u) {
|
|
544
544
|
try {
|
|
545
|
-
|
|
546
|
-
} catch (
|
|
547
|
-
e.error(
|
|
545
|
+
o(u);
|
|
546
|
+
} catch (f) {
|
|
547
|
+
e.error(f);
|
|
548
548
|
} finally {
|
|
549
549
|
this.unsubscribe();
|
|
550
550
|
}
|
|
551
|
-
} : n.prototype._error,
|
|
551
|
+
} : n.prototype._error, a._complete = i ? function() {
|
|
552
552
|
try {
|
|
553
553
|
i();
|
|
554
|
-
} catch (
|
|
555
|
-
e.error(
|
|
554
|
+
} catch (u) {
|
|
555
|
+
e.error(u);
|
|
556
556
|
} finally {
|
|
557
557
|
this.unsubscribe();
|
|
558
558
|
}
|
|
559
|
-
} : n.prototype._complete,
|
|
559
|
+
} : n.prototype._complete, a;
|
|
560
560
|
}
|
|
561
561
|
return t.prototype.unsubscribe = function() {
|
|
562
562
|
var e;
|
|
@@ -565,38 +565,38 @@ var Be = function(n) {
|
|
|
565
565
|
n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
566
566
|
}
|
|
567
567
|
}, t;
|
|
568
|
-
}(
|
|
568
|
+
}(X), ze = fe(function(n) {
|
|
569
569
|
return function() {
|
|
570
570
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
571
571
|
};
|
|
572
|
-
}),
|
|
572
|
+
}), Q = function(n) {
|
|
573
573
|
O(t, n);
|
|
574
574
|
function t() {
|
|
575
575
|
var e = n.call(this) || this;
|
|
576
576
|
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
577
577
|
}
|
|
578
578
|
return t.prototype.lift = function(e) {
|
|
579
|
-
var r = new
|
|
579
|
+
var r = new ne(this, this);
|
|
580
580
|
return r.operator = e, r;
|
|
581
581
|
}, t.prototype._throwIfClosed = function() {
|
|
582
582
|
if (this.closed)
|
|
583
|
-
throw new
|
|
583
|
+
throw new ze();
|
|
584
584
|
}, t.prototype.next = function(e) {
|
|
585
585
|
var r = this;
|
|
586
|
-
|
|
587
|
-
var i,
|
|
586
|
+
U(function() {
|
|
587
|
+
var i, o;
|
|
588
588
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
589
589
|
r.currentObservers || (r.currentObservers = Array.from(r.observers));
|
|
590
590
|
try {
|
|
591
|
-
for (var
|
|
592
|
-
var
|
|
593
|
-
|
|
591
|
+
for (var s = M(r.currentObservers), c = s.next(); !c.done; c = s.next()) {
|
|
592
|
+
var a = c.value;
|
|
593
|
+
a.next(e);
|
|
594
594
|
}
|
|
595
|
-
} catch (
|
|
596
|
-
i = { error:
|
|
595
|
+
} catch (u) {
|
|
596
|
+
i = { error: u };
|
|
597
597
|
} finally {
|
|
598
598
|
try {
|
|
599
|
-
c && !c.done && (
|
|
599
|
+
c && !c.done && (o = s.return) && o.call(s);
|
|
600
600
|
} finally {
|
|
601
601
|
if (i) throw i.error;
|
|
602
602
|
}
|
|
@@ -605,7 +605,7 @@ var Be = function(n) {
|
|
|
605
605
|
});
|
|
606
606
|
}, t.prototype.error = function(e) {
|
|
607
607
|
var r = this;
|
|
608
|
-
|
|
608
|
+
U(function() {
|
|
609
609
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
610
610
|
r.hasError = r.isStopped = !0, r.thrownError = e;
|
|
611
611
|
for (var i = r.observers; i.length; )
|
|
@@ -614,7 +614,7 @@ var Be = function(n) {
|
|
|
614
614
|
});
|
|
615
615
|
}, t.prototype.complete = function() {
|
|
616
616
|
var e = this;
|
|
617
|
-
|
|
617
|
+
U(function() {
|
|
618
618
|
if (e._throwIfClosed(), !e.isStopped) {
|
|
619
619
|
e.isStopped = !0;
|
|
620
620
|
for (var r = e.observers; r.length; )
|
|
@@ -635,20 +635,20 @@ var Be = function(n) {
|
|
|
635
635
|
}, t.prototype._subscribe = function(e) {
|
|
636
636
|
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
|
637
637
|
}, t.prototype._innerSubscribe = function(e) {
|
|
638
|
-
var r = this, i = this,
|
|
639
|
-
return
|
|
640
|
-
r.currentObservers = null,
|
|
638
|
+
var r = this, i = this, o = i.hasError, s = i.isStopped, c = i.observers;
|
|
639
|
+
return o || s ? le : (this.currentObservers = null, c.push(e), new k(function() {
|
|
640
|
+
r.currentObservers = null, N(c, e);
|
|
641
641
|
}));
|
|
642
642
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
643
|
-
var r = this, i = r.hasError,
|
|
644
|
-
i ? e.error(
|
|
643
|
+
var r = this, i = r.hasError, o = r.thrownError, s = r.isStopped;
|
|
644
|
+
i ? e.error(o) : s && e.complete();
|
|
645
645
|
}, t.prototype.asObservable = function() {
|
|
646
|
-
var e = new
|
|
646
|
+
var e = new S();
|
|
647
647
|
return e.source = this, e;
|
|
648
648
|
}, t.create = function(e, r) {
|
|
649
|
-
return new
|
|
649
|
+
return new ne(e, r);
|
|
650
650
|
}, t;
|
|
651
|
-
}(
|
|
651
|
+
}(S), ne = function(n) {
|
|
652
652
|
O(t, n);
|
|
653
653
|
function t(e, r) {
|
|
654
654
|
var i = n.call(this) || this;
|
|
@@ -665,14 +665,37 @@ var Be = function(n) {
|
|
|
665
665
|
(r = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || r === void 0 || r.call(e);
|
|
666
666
|
}, t.prototype._subscribe = function(e) {
|
|
667
667
|
var r, i;
|
|
668
|
-
return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && i !== void 0 ? i :
|
|
668
|
+
return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && i !== void 0 ? i : le;
|
|
669
|
+
}, t;
|
|
670
|
+
}(Q), re = function(n) {
|
|
671
|
+
O(t, n);
|
|
672
|
+
function t(e) {
|
|
673
|
+
var r = n.call(this) || this;
|
|
674
|
+
return r._value = e, r;
|
|
675
|
+
}
|
|
676
|
+
return Object.defineProperty(t.prototype, "value", {
|
|
677
|
+
get: function() {
|
|
678
|
+
return this.getValue();
|
|
679
|
+
},
|
|
680
|
+
enumerable: !1,
|
|
681
|
+
configurable: !0
|
|
682
|
+
}), t.prototype._subscribe = function(e) {
|
|
683
|
+
var r = n.prototype._subscribe.call(this, e);
|
|
684
|
+
return !r.closed && e.next(this._value), r;
|
|
685
|
+
}, t.prototype.getValue = function() {
|
|
686
|
+
var e = this, r = e.hasError, i = e.thrownError, o = e._value;
|
|
687
|
+
if (r)
|
|
688
|
+
throw i;
|
|
689
|
+
return this._throwIfClosed(), o;
|
|
690
|
+
}, t.prototype.next = function(e) {
|
|
691
|
+
n.prototype.next.call(this, this._value = e);
|
|
669
692
|
}, t;
|
|
670
|
-
}(
|
|
693
|
+
}(Q), Qe = {
|
|
671
694
|
now: function() {
|
|
672
695
|
return Date.now();
|
|
673
696
|
},
|
|
674
697
|
delegate: void 0
|
|
675
|
-
},
|
|
698
|
+
}, Ze = function(n) {
|
|
676
699
|
O(t, n);
|
|
677
700
|
function t(e, r) {
|
|
678
701
|
return n.call(this) || this;
|
|
@@ -680,17 +703,17 @@ var Be = function(n) {
|
|
|
680
703
|
return t.prototype.schedule = function(e, r) {
|
|
681
704
|
return this;
|
|
682
705
|
}, t;
|
|
683
|
-
}(
|
|
706
|
+
}(k), ie = {
|
|
684
707
|
setInterval: function(n, t) {
|
|
685
708
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
686
709
|
e[r - 2] = arguments[r];
|
|
687
|
-
return setInterval.apply(void 0, R([n, t],
|
|
710
|
+
return setInterval.apply(void 0, R([n, t], L(e)));
|
|
688
711
|
},
|
|
689
712
|
clearInterval: function(n) {
|
|
690
713
|
return clearInterval(n);
|
|
691
714
|
},
|
|
692
715
|
delegate: void 0
|
|
693
|
-
},
|
|
716
|
+
}, et = function(n) {
|
|
694
717
|
O(t, n);
|
|
695
718
|
function t(e, r) {
|
|
696
719
|
var i = n.call(this, e, r) || this;
|
|
@@ -701,14 +724,14 @@ var Be = function(n) {
|
|
|
701
724
|
if (r === void 0 && (r = 0), this.closed)
|
|
702
725
|
return this;
|
|
703
726
|
this.state = e;
|
|
704
|
-
var
|
|
705
|
-
return
|
|
727
|
+
var o = this.id, s = this.scheduler;
|
|
728
|
+
return o != null && (this.id = this.recycleAsyncId(s, o, r)), this.pending = !0, this.delay = r, this.id = (i = this.id) !== null && i !== void 0 ? i : this.requestAsyncId(s, this.id, r), this;
|
|
706
729
|
}, t.prototype.requestAsyncId = function(e, r, i) {
|
|
707
|
-
return i === void 0 && (i = 0),
|
|
730
|
+
return i === void 0 && (i = 0), ie.setInterval(e.flush.bind(e, this), i);
|
|
708
731
|
}, t.prototype.recycleAsyncId = function(e, r, i) {
|
|
709
732
|
if (i === void 0 && (i = 0), i != null && this.delay === i && this.pending === !1)
|
|
710
733
|
return r;
|
|
711
|
-
r != null &&
|
|
734
|
+
r != null && ie.clearInterval(r);
|
|
712
735
|
}, t.prototype.execute = function(e, r) {
|
|
713
736
|
if (this.closed)
|
|
714
737
|
return new Error("executing a cancelled action");
|
|
@@ -718,31 +741,31 @@ var Be = function(n) {
|
|
|
718
741
|
return i;
|
|
719
742
|
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
|
|
720
743
|
}, t.prototype._execute = function(e, r) {
|
|
721
|
-
var i = !1,
|
|
744
|
+
var i = !1, o;
|
|
722
745
|
try {
|
|
723
746
|
this.work(e);
|
|
724
|
-
} catch (
|
|
725
|
-
i = !0,
|
|
747
|
+
} catch (s) {
|
|
748
|
+
i = !0, o = s || new Error("Scheduled action threw falsy error");
|
|
726
749
|
}
|
|
727
750
|
if (i)
|
|
728
|
-
return this.unsubscribe(),
|
|
751
|
+
return this.unsubscribe(), o;
|
|
729
752
|
}, t.prototype.unsubscribe = function() {
|
|
730
753
|
if (!this.closed) {
|
|
731
|
-
var e = this, r = e.id, i = e.scheduler,
|
|
732
|
-
this.work = this.state = this.scheduler = null, this.pending = !1,
|
|
754
|
+
var e = this, r = e.id, i = e.scheduler, o = i.actions;
|
|
755
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, N(o, this), r != null && (this.id = this.recycleAsyncId(i, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
|
|
733
756
|
}
|
|
734
757
|
}, t;
|
|
735
|
-
}(
|
|
758
|
+
}(Ze), oe = function() {
|
|
736
759
|
function n(t, e) {
|
|
737
760
|
e === void 0 && (e = n.now), this.schedulerActionCtor = t, this.now = e;
|
|
738
761
|
}
|
|
739
762
|
return n.prototype.schedule = function(t, e, r) {
|
|
740
763
|
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
|
|
741
|
-
}, n.now =
|
|
742
|
-
}(),
|
|
764
|
+
}, n.now = Qe.now, n;
|
|
765
|
+
}(), tt = function(n) {
|
|
743
766
|
O(t, n);
|
|
744
767
|
function t(e, r) {
|
|
745
|
-
r === void 0 && (r =
|
|
768
|
+
r === void 0 && (r = oe.now);
|
|
746
769
|
var i = n.call(this, e, r) || this;
|
|
747
770
|
return i.actions = [], i._active = !1, i;
|
|
748
771
|
}
|
|
@@ -764,61 +787,64 @@ var Be = function(n) {
|
|
|
764
787
|
throw i;
|
|
765
788
|
}
|
|
766
789
|
}, t;
|
|
767
|
-
}(
|
|
790
|
+
}(oe), ve = new tt(et), nt = ve, rt = new S(function(n) {
|
|
768
791
|
return n.complete();
|
|
769
792
|
});
|
|
770
|
-
function
|
|
771
|
-
return n &&
|
|
793
|
+
function pe(n) {
|
|
794
|
+
return n && p(n.schedule);
|
|
772
795
|
}
|
|
773
|
-
function
|
|
796
|
+
function be(n) {
|
|
774
797
|
return n[n.length - 1];
|
|
775
798
|
}
|
|
776
|
-
function
|
|
777
|
-
return
|
|
778
|
-
}
|
|
779
|
-
var pe = function(n) {
|
|
780
|
-
return n && typeof n.length == "number" && typeof n != "function";
|
|
781
|
-
};
|
|
782
|
-
function be(n) {
|
|
783
|
-
return v(n == null ? void 0 : n.then);
|
|
799
|
+
function it(n) {
|
|
800
|
+
return p(be(n)) ? n.pop() : void 0;
|
|
784
801
|
}
|
|
785
802
|
function me(n) {
|
|
786
|
-
return
|
|
803
|
+
return pe(be(n)) ? n.pop() : void 0;
|
|
787
804
|
}
|
|
805
|
+
var Se = function(n) {
|
|
806
|
+
return n && typeof n.length == "number" && typeof n != "function";
|
|
807
|
+
};
|
|
788
808
|
function ge(n) {
|
|
789
|
-
return
|
|
809
|
+
return p(n == null ? void 0 : n.then);
|
|
790
810
|
}
|
|
791
811
|
function we(n) {
|
|
812
|
+
return p(n[z]);
|
|
813
|
+
}
|
|
814
|
+
function Ee(n) {
|
|
815
|
+
return Symbol.asyncIterator && p(n == null ? void 0 : n[Symbol.asyncIterator]);
|
|
816
|
+
}
|
|
817
|
+
function Oe(n) {
|
|
792
818
|
return new TypeError("You provided " + (n !== null && typeof n == "object" ? "an invalid object" : "'" + n + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
793
819
|
}
|
|
794
|
-
function
|
|
820
|
+
function ot() {
|
|
795
821
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
796
822
|
}
|
|
797
|
-
var
|
|
798
|
-
function
|
|
799
|
-
return
|
|
823
|
+
var Ie = ot();
|
|
824
|
+
function Ae(n) {
|
|
825
|
+
return p(n == null ? void 0 : n[Ie]);
|
|
800
826
|
}
|
|
801
|
-
function
|
|
802
|
-
return
|
|
803
|
-
var e, r, i,
|
|
804
|
-
return
|
|
805
|
-
switch (
|
|
827
|
+
function xe(n) {
|
|
828
|
+
return Ge(this, arguments, function() {
|
|
829
|
+
var e, r, i, o;
|
|
830
|
+
return ce(this, function(s) {
|
|
831
|
+
switch (s.label) {
|
|
806
832
|
case 0:
|
|
807
|
-
e = n.getReader(),
|
|
833
|
+
e = n.getReader(), s.label = 1;
|
|
808
834
|
case 1:
|
|
809
|
-
|
|
835
|
+
s.trys.push([1, , 9, 10]), s.label = 2;
|
|
810
836
|
case 2:
|
|
811
|
-
return [4,
|
|
837
|
+
return [4, P(e.read())];
|
|
812
838
|
case 3:
|
|
813
|
-
return r =
|
|
839
|
+
return r = s.sent(), i = r.value, o = r.done, o ? [4, P(void 0)] : [3, 5];
|
|
814
840
|
case 4:
|
|
815
|
-
return [2,
|
|
841
|
+
return [2, s.sent()];
|
|
816
842
|
case 5:
|
|
817
|
-
return [4,
|
|
843
|
+
return [4, P(i)];
|
|
818
844
|
case 6:
|
|
819
|
-
return [4,
|
|
845
|
+
return [4, s.sent()];
|
|
820
846
|
case 7:
|
|
821
|
-
return
|
|
847
|
+
return s.sent(), [3, 2];
|
|
822
848
|
case 8:
|
|
823
849
|
return [3, 10];
|
|
824
850
|
case 9:
|
|
@@ -829,66 +855,66 @@ function Ie(n) {
|
|
|
829
855
|
});
|
|
830
856
|
});
|
|
831
857
|
}
|
|
832
|
-
function
|
|
833
|
-
return
|
|
858
|
+
function _e(n) {
|
|
859
|
+
return p(n == null ? void 0 : n.getReader);
|
|
834
860
|
}
|
|
835
861
|
function x(n) {
|
|
836
|
-
if (n instanceof
|
|
862
|
+
if (n instanceof S)
|
|
837
863
|
return n;
|
|
838
864
|
if (n != null) {
|
|
839
|
-
if (
|
|
840
|
-
return
|
|
841
|
-
if (
|
|
842
|
-
return
|
|
843
|
-
if (be(n))
|
|
844
|
-
return un(n);
|
|
865
|
+
if (we(n))
|
|
866
|
+
return st(n);
|
|
867
|
+
if (Se(n))
|
|
868
|
+
return ut(n);
|
|
845
869
|
if (ge(n))
|
|
846
|
-
return
|
|
870
|
+
return at(n);
|
|
847
871
|
if (Ee(n))
|
|
848
|
-
return
|
|
849
|
-
if (
|
|
850
|
-
return
|
|
872
|
+
return Te(n);
|
|
873
|
+
if (Ae(n))
|
|
874
|
+
return ct(n);
|
|
875
|
+
if (_e(n))
|
|
876
|
+
return ft(n);
|
|
851
877
|
}
|
|
852
|
-
throw
|
|
878
|
+
throw Oe(n);
|
|
853
879
|
}
|
|
854
|
-
function
|
|
855
|
-
return new
|
|
856
|
-
var e = n[
|
|
857
|
-
if (
|
|
880
|
+
function st(n) {
|
|
881
|
+
return new S(function(t) {
|
|
882
|
+
var e = n[z]();
|
|
883
|
+
if (p(e.subscribe))
|
|
858
884
|
return e.subscribe(t);
|
|
859
885
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
860
886
|
});
|
|
861
887
|
}
|
|
862
|
-
function
|
|
863
|
-
return new
|
|
888
|
+
function ut(n) {
|
|
889
|
+
return new S(function(t) {
|
|
864
890
|
for (var e = 0; e < n.length && !t.closed; e++)
|
|
865
891
|
t.next(n[e]);
|
|
866
892
|
t.complete();
|
|
867
893
|
});
|
|
868
894
|
}
|
|
869
|
-
function
|
|
870
|
-
return new
|
|
895
|
+
function at(n) {
|
|
896
|
+
return new S(function(t) {
|
|
871
897
|
n.then(function(e) {
|
|
872
898
|
t.closed || (t.next(e), t.complete());
|
|
873
899
|
}, function(e) {
|
|
874
900
|
return t.error(e);
|
|
875
|
-
}).then(null,
|
|
901
|
+
}).then(null, ye);
|
|
876
902
|
});
|
|
877
903
|
}
|
|
878
|
-
function
|
|
879
|
-
return new
|
|
904
|
+
function ct(n) {
|
|
905
|
+
return new S(function(t) {
|
|
880
906
|
var e, r;
|
|
881
907
|
try {
|
|
882
|
-
for (var i =
|
|
883
|
-
var
|
|
884
|
-
if (t.next(
|
|
908
|
+
for (var i = M(n), o = i.next(); !o.done; o = i.next()) {
|
|
909
|
+
var s = o.value;
|
|
910
|
+
if (t.next(s), t.closed)
|
|
885
911
|
return;
|
|
886
912
|
}
|
|
887
913
|
} catch (c) {
|
|
888
914
|
e = { error: c };
|
|
889
915
|
} finally {
|
|
890
916
|
try {
|
|
891
|
-
|
|
917
|
+
o && !o.done && (r = i.return) && r.call(i);
|
|
892
918
|
} finally {
|
|
893
919
|
if (e) throw e.error;
|
|
894
920
|
}
|
|
@@ -896,41 +922,41 @@ function an(n) {
|
|
|
896
922
|
t.complete();
|
|
897
923
|
});
|
|
898
924
|
}
|
|
899
|
-
function
|
|
900
|
-
return new
|
|
901
|
-
|
|
925
|
+
function Te(n) {
|
|
926
|
+
return new S(function(t) {
|
|
927
|
+
lt(n, t).catch(function(e) {
|
|
902
928
|
return t.error(e);
|
|
903
929
|
});
|
|
904
930
|
});
|
|
905
931
|
}
|
|
906
|
-
function
|
|
907
|
-
return xe(
|
|
932
|
+
function ft(n) {
|
|
933
|
+
return Te(xe(n));
|
|
908
934
|
}
|
|
909
|
-
function
|
|
910
|
-
var e, r, i,
|
|
911
|
-
return
|
|
912
|
-
var
|
|
913
|
-
return
|
|
914
|
-
switch (
|
|
935
|
+
function lt(n, t) {
|
|
936
|
+
var e, r, i, o;
|
|
937
|
+
return $e(this, void 0, void 0, function() {
|
|
938
|
+
var s, c;
|
|
939
|
+
return ce(this, function(a) {
|
|
940
|
+
switch (a.label) {
|
|
915
941
|
case 0:
|
|
916
|
-
|
|
942
|
+
a.trys.push([0, 5, 6, 11]), e = Fe(n), a.label = 1;
|
|
917
943
|
case 1:
|
|
918
944
|
return [4, e.next()];
|
|
919
945
|
case 2:
|
|
920
|
-
if (r =
|
|
921
|
-
if (
|
|
946
|
+
if (r = a.sent(), !!r.done) return [3, 4];
|
|
947
|
+
if (s = r.value, t.next(s), t.closed)
|
|
922
948
|
return [2];
|
|
923
|
-
|
|
949
|
+
a.label = 3;
|
|
924
950
|
case 3:
|
|
925
951
|
return [3, 1];
|
|
926
952
|
case 4:
|
|
927
953
|
return [3, 11];
|
|
928
954
|
case 5:
|
|
929
|
-
return c =
|
|
955
|
+
return c = a.sent(), i = { error: c }, [3, 11];
|
|
930
956
|
case 6:
|
|
931
|
-
return
|
|
957
|
+
return a.trys.push([6, , 9, 10]), r && !r.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
|
|
932
958
|
case 7:
|
|
933
|
-
|
|
959
|
+
a.sent(), a.label = 8;
|
|
934
960
|
case 8:
|
|
935
961
|
return [3, 10];
|
|
936
962
|
case 9:
|
|
@@ -944,78 +970,78 @@ function fn(n, t) {
|
|
|
944
970
|
});
|
|
945
971
|
});
|
|
946
972
|
}
|
|
947
|
-
function
|
|
973
|
+
function A(n, t, e, r, i) {
|
|
948
974
|
r === void 0 && (r = 0), i === void 0 && (i = !1);
|
|
949
|
-
var
|
|
975
|
+
var o = t.schedule(function() {
|
|
950
976
|
e(), i ? n.add(this.schedule(null, r)) : this.unsubscribe();
|
|
951
977
|
}, r);
|
|
952
|
-
if (n.add(
|
|
953
|
-
return
|
|
978
|
+
if (n.add(o), !i)
|
|
979
|
+
return o;
|
|
954
980
|
}
|
|
955
|
-
function
|
|
981
|
+
function Ce(n, t) {
|
|
956
982
|
return t === void 0 && (t = 0), T(function(e, r) {
|
|
957
|
-
e.subscribe(
|
|
958
|
-
return
|
|
983
|
+
e.subscribe(E(r, function(i) {
|
|
984
|
+
return A(r, n, function() {
|
|
959
985
|
return r.next(i);
|
|
960
986
|
}, t);
|
|
961
987
|
}, function() {
|
|
962
|
-
return
|
|
988
|
+
return A(r, n, function() {
|
|
963
989
|
return r.complete();
|
|
964
990
|
}, t);
|
|
965
991
|
}, function(i) {
|
|
966
|
-
return
|
|
992
|
+
return A(r, n, function() {
|
|
967
993
|
return r.error(i);
|
|
968
994
|
}, t);
|
|
969
995
|
}));
|
|
970
996
|
});
|
|
971
997
|
}
|
|
972
|
-
function
|
|
998
|
+
function Pe(n, t) {
|
|
973
999
|
return t === void 0 && (t = 0), T(function(e, r) {
|
|
974
1000
|
r.add(n.schedule(function() {
|
|
975
1001
|
return e.subscribe(r);
|
|
976
1002
|
}, t));
|
|
977
1003
|
});
|
|
978
1004
|
}
|
|
979
|
-
function
|
|
980
|
-
return x(n).pipe(
|
|
1005
|
+
function dt(n, t) {
|
|
1006
|
+
return x(n).pipe(Pe(t), Ce(t));
|
|
981
1007
|
}
|
|
982
|
-
function
|
|
983
|
-
return x(n).pipe(
|
|
1008
|
+
function ht(n, t) {
|
|
1009
|
+
return x(n).pipe(Pe(t), Ce(t));
|
|
984
1010
|
}
|
|
985
|
-
function
|
|
986
|
-
return new
|
|
1011
|
+
function yt(n, t) {
|
|
1012
|
+
return new S(function(e) {
|
|
987
1013
|
var r = 0;
|
|
988
1014
|
return t.schedule(function() {
|
|
989
1015
|
r === n.length ? e.complete() : (e.next(n[r++]), e.closed || this.schedule());
|
|
990
1016
|
});
|
|
991
1017
|
});
|
|
992
1018
|
}
|
|
993
|
-
function
|
|
994
|
-
return new
|
|
1019
|
+
function vt(n, t) {
|
|
1020
|
+
return new S(function(e) {
|
|
995
1021
|
var r;
|
|
996
|
-
return
|
|
997
|
-
r = n[
|
|
998
|
-
var i,
|
|
1022
|
+
return A(e, t, function() {
|
|
1023
|
+
r = n[Ie](), A(e, t, function() {
|
|
1024
|
+
var i, o, s;
|
|
999
1025
|
try {
|
|
1000
|
-
i = r.next(),
|
|
1026
|
+
i = r.next(), o = i.value, s = i.done;
|
|
1001
1027
|
} catch (c) {
|
|
1002
1028
|
e.error(c);
|
|
1003
1029
|
return;
|
|
1004
1030
|
}
|
|
1005
|
-
|
|
1031
|
+
s ? e.complete() : e.next(o);
|
|
1006
1032
|
}, 0, !0);
|
|
1007
1033
|
}), function() {
|
|
1008
|
-
return
|
|
1034
|
+
return p(r == null ? void 0 : r.return) && r.return();
|
|
1009
1035
|
};
|
|
1010
1036
|
});
|
|
1011
1037
|
}
|
|
1012
1038
|
function Me(n, t) {
|
|
1013
1039
|
if (!n)
|
|
1014
1040
|
throw new Error("Iterable cannot be null");
|
|
1015
|
-
return new
|
|
1016
|
-
|
|
1041
|
+
return new S(function(e) {
|
|
1042
|
+
A(e, t, function() {
|
|
1017
1043
|
var r = n[Symbol.asyncIterator]();
|
|
1018
|
-
|
|
1044
|
+
A(e, t, function() {
|
|
1019
1045
|
r.next().then(function(i) {
|
|
1020
1046
|
i.done ? e.complete() : e.next(i.value);
|
|
1021
1047
|
});
|
|
@@ -1023,233 +1049,299 @@ function Me(n, t) {
|
|
|
1023
1049
|
});
|
|
1024
1050
|
});
|
|
1025
1051
|
}
|
|
1026
|
-
function
|
|
1027
|
-
return Me(
|
|
1052
|
+
function pt(n, t) {
|
|
1053
|
+
return Me(xe(n), t);
|
|
1028
1054
|
}
|
|
1029
|
-
function
|
|
1055
|
+
function bt(n, t) {
|
|
1030
1056
|
if (n != null) {
|
|
1031
|
-
if (
|
|
1032
|
-
return
|
|
1033
|
-
if (
|
|
1034
|
-
return
|
|
1035
|
-
if (be(n))
|
|
1036
|
-
return dn(n, t);
|
|
1057
|
+
if (we(n))
|
|
1058
|
+
return dt(n, t);
|
|
1059
|
+
if (Se(n))
|
|
1060
|
+
return yt(n, t);
|
|
1037
1061
|
if (ge(n))
|
|
1038
|
-
return
|
|
1062
|
+
return ht(n, t);
|
|
1039
1063
|
if (Ee(n))
|
|
1040
|
-
return
|
|
1041
|
-
if (
|
|
1042
|
-
return
|
|
1064
|
+
return Me(n, t);
|
|
1065
|
+
if (Ae(n))
|
|
1066
|
+
return vt(n, t);
|
|
1067
|
+
if (_e(n))
|
|
1068
|
+
return pt(n, t);
|
|
1043
1069
|
}
|
|
1044
|
-
throw
|
|
1070
|
+
throw Oe(n);
|
|
1045
1071
|
}
|
|
1046
|
-
function
|
|
1047
|
-
return t ?
|
|
1072
|
+
function Z(n, t) {
|
|
1073
|
+
return t ? bt(n, t) : x(n);
|
|
1048
1074
|
}
|
|
1049
|
-
function
|
|
1075
|
+
function mt() {
|
|
1050
1076
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1051
1077
|
n[t] = arguments[t];
|
|
1052
|
-
var e =
|
|
1053
|
-
return
|
|
1078
|
+
var e = me(n);
|
|
1079
|
+
return Z(n, e);
|
|
1054
1080
|
}
|
|
1055
|
-
function
|
|
1081
|
+
function St(n) {
|
|
1056
1082
|
return n instanceof Date && !isNaN(n);
|
|
1057
1083
|
}
|
|
1058
|
-
function
|
|
1084
|
+
function F(n, t) {
|
|
1059
1085
|
return T(function(e, r) {
|
|
1060
1086
|
var i = 0;
|
|
1061
|
-
e.subscribe(
|
|
1062
|
-
r.next(n.call(t,
|
|
1087
|
+
e.subscribe(E(r, function(o) {
|
|
1088
|
+
r.next(n.call(t, o, i++));
|
|
1063
1089
|
}));
|
|
1064
1090
|
});
|
|
1065
1091
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1092
|
+
var gt = Array.isArray;
|
|
1093
|
+
function wt(n, t) {
|
|
1094
|
+
return gt(t) ? n.apply(void 0, R([], L(t))) : n(t);
|
|
1095
|
+
}
|
|
1096
|
+
function Et(n) {
|
|
1097
|
+
return F(function(t) {
|
|
1098
|
+
return wt(n, t);
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
var Ot = Array.isArray, It = Object.getPrototypeOf, At = Object.prototype, xt = Object.keys;
|
|
1102
|
+
function _t(n) {
|
|
1103
|
+
if (n.length === 1) {
|
|
1104
|
+
var t = n[0];
|
|
1105
|
+
if (Ot(t))
|
|
1106
|
+
return { args: t, keys: null };
|
|
1107
|
+
if (Tt(t)) {
|
|
1108
|
+
var e = xt(t);
|
|
1109
|
+
return {
|
|
1110
|
+
args: e.map(function(r) {
|
|
1111
|
+
return t[r];
|
|
1112
|
+
}),
|
|
1113
|
+
keys: e
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return { args: n, keys: null };
|
|
1118
|
+
}
|
|
1119
|
+
function Tt(n) {
|
|
1120
|
+
return n && typeof n == "object" && It(n) === At;
|
|
1121
|
+
}
|
|
1122
|
+
function Ct(n, t) {
|
|
1123
|
+
return n.reduce(function(e, r, i) {
|
|
1124
|
+
return e[r] = t[i], e;
|
|
1125
|
+
}, {});
|
|
1126
|
+
}
|
|
1127
|
+
function Pt() {
|
|
1128
|
+
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1129
|
+
n[t] = arguments[t];
|
|
1130
|
+
var e = me(n), r = it(n), i = _t(n), o = i.args, s = i.keys;
|
|
1131
|
+
if (o.length === 0)
|
|
1132
|
+
return Z([], e);
|
|
1133
|
+
var c = new S(Mt(o, e, s ? function(a) {
|
|
1134
|
+
return Ct(s, a);
|
|
1135
|
+
} : G));
|
|
1136
|
+
return r ? c.pipe(Et(r)) : c;
|
|
1137
|
+
}
|
|
1138
|
+
function Mt(n, t, e) {
|
|
1139
|
+
return e === void 0 && (e = G), function(r) {
|
|
1140
|
+
se(t, function() {
|
|
1141
|
+
for (var i = n.length, o = new Array(i), s = i, c = i, a = function(f) {
|
|
1142
|
+
se(t, function() {
|
|
1143
|
+
var y = Z(n[f], t), b = !1;
|
|
1144
|
+
y.subscribe(E(r, function(l) {
|
|
1145
|
+
o[f] = l, b || (b = !0, c--), c || r.next(e(o.slice()));
|
|
1146
|
+
}, function() {
|
|
1147
|
+
--s || r.complete();
|
|
1148
|
+
}));
|
|
1149
|
+
}, r);
|
|
1150
|
+
}, u = 0; u < i; u++)
|
|
1151
|
+
a(u);
|
|
1152
|
+
}, r);
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1155
|
+
function se(n, t, e) {
|
|
1156
|
+
n ? A(e, n, t) : t();
|
|
1157
|
+
}
|
|
1158
|
+
function Lt(n, t, e, r, i, o, s, c) {
|
|
1159
|
+
var a = [], u = 0, f = 0, y = !1, b = function() {
|
|
1160
|
+
y && !a.length && !u && t.complete();
|
|
1161
|
+
}, l = function(d) {
|
|
1162
|
+
return u < r ? v(d) : a.push(d);
|
|
1163
|
+
}, v = function(d) {
|
|
1164
|
+
u++;
|
|
1165
|
+
var g = !1;
|
|
1166
|
+
x(e(d, f++)).subscribe(E(t, function(w) {
|
|
1167
|
+
t.next(w);
|
|
1076
1168
|
}, function() {
|
|
1077
|
-
|
|
1169
|
+
g = !0;
|
|
1078
1170
|
}, void 0, function() {
|
|
1079
|
-
if (
|
|
1171
|
+
if (g)
|
|
1080
1172
|
try {
|
|
1081
|
-
|
|
1082
|
-
for (var
|
|
1083
|
-
var
|
|
1084
|
-
|
|
1085
|
-
};
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
} catch (
|
|
1089
|
-
t.error(
|
|
1173
|
+
u--;
|
|
1174
|
+
for (var w = function() {
|
|
1175
|
+
var _ = a.shift();
|
|
1176
|
+
s || v(_);
|
|
1177
|
+
}; a.length && u < r; )
|
|
1178
|
+
w();
|
|
1179
|
+
b();
|
|
1180
|
+
} catch (_) {
|
|
1181
|
+
t.error(_);
|
|
1090
1182
|
}
|
|
1091
1183
|
}));
|
|
1092
1184
|
};
|
|
1093
|
-
return n.subscribe(
|
|
1094
|
-
|
|
1185
|
+
return n.subscribe(E(t, l, function() {
|
|
1186
|
+
y = !0, b();
|
|
1095
1187
|
})), function() {
|
|
1096
1188
|
};
|
|
1097
1189
|
}
|
|
1098
|
-
function
|
|
1099
|
-
return e === void 0 && (e = 1 / 0),
|
|
1100
|
-
return
|
|
1101
|
-
return t(r,
|
|
1190
|
+
function $(n, t, e) {
|
|
1191
|
+
return e === void 0 && (e = 1 / 0), p(t) ? $(function(r, i) {
|
|
1192
|
+
return F(function(o, s) {
|
|
1193
|
+
return t(r, o, i, s);
|
|
1102
1194
|
})(x(n(r, i)));
|
|
1103
1195
|
}, e) : (typeof t == "number" && (e = t), T(function(r, i) {
|
|
1104
|
-
return
|
|
1196
|
+
return Lt(r, i, n, e);
|
|
1105
1197
|
}));
|
|
1106
1198
|
}
|
|
1107
|
-
function
|
|
1108
|
-
n === void 0 && (n = 0), e === void 0 && (e =
|
|
1199
|
+
function Le(n, t, e) {
|
|
1200
|
+
n === void 0 && (n = 0), e === void 0 && (e = nt);
|
|
1109
1201
|
var r = -1;
|
|
1110
|
-
return t != null && (
|
|
1111
|
-
var
|
|
1112
|
-
|
|
1113
|
-
var
|
|
1202
|
+
return t != null && (pe(t) ? e = t : r = t), new S(function(i) {
|
|
1203
|
+
var o = St(n) ? +n - e.now() : n;
|
|
1204
|
+
o < 0 && (o = 0);
|
|
1205
|
+
var s = 0;
|
|
1114
1206
|
return e.schedule(function() {
|
|
1115
|
-
i.closed || (i.next(
|
|
1116
|
-
},
|
|
1207
|
+
i.closed || (i.next(s++), 0 <= r ? this.schedule(void 0, r) : i.complete());
|
|
1208
|
+
}, o);
|
|
1117
1209
|
});
|
|
1118
1210
|
}
|
|
1119
|
-
function
|
|
1120
|
-
return
|
|
1211
|
+
function Rt(n, t) {
|
|
1212
|
+
return p(t) ? $(n, t, 1) : $(n, 1);
|
|
1121
1213
|
}
|
|
1122
|
-
function
|
|
1214
|
+
function kt(n) {
|
|
1123
1215
|
return n <= 0 ? function() {
|
|
1124
|
-
return
|
|
1216
|
+
return rt;
|
|
1125
1217
|
} : T(function(t, e) {
|
|
1126
1218
|
var r = 0;
|
|
1127
|
-
t.subscribe(
|
|
1219
|
+
t.subscribe(E(e, function(i) {
|
|
1128
1220
|
++r <= n && (e.next(i), n <= r && e.complete());
|
|
1129
1221
|
}));
|
|
1130
1222
|
});
|
|
1131
1223
|
}
|
|
1132
|
-
function
|
|
1133
|
-
return
|
|
1224
|
+
function jt(n) {
|
|
1225
|
+
return F(function() {
|
|
1134
1226
|
return n;
|
|
1135
1227
|
});
|
|
1136
1228
|
}
|
|
1137
|
-
function
|
|
1138
|
-
return
|
|
1139
|
-
return x(n(e, r)).pipe(
|
|
1229
|
+
function Dt(n, t) {
|
|
1230
|
+
return $(function(e, r) {
|
|
1231
|
+
return x(n(e, r)).pipe(kt(1), jt(e));
|
|
1140
1232
|
});
|
|
1141
1233
|
}
|
|
1142
|
-
function
|
|
1143
|
-
t === void 0 && (t =
|
|
1144
|
-
var e =
|
|
1145
|
-
return
|
|
1234
|
+
function Ut(n, t) {
|
|
1235
|
+
t === void 0 && (t = ve);
|
|
1236
|
+
var e = Le(n, t);
|
|
1237
|
+
return Dt(function() {
|
|
1146
1238
|
return e;
|
|
1147
1239
|
});
|
|
1148
1240
|
}
|
|
1149
|
-
function
|
|
1241
|
+
function Nt(n) {
|
|
1150
1242
|
var t;
|
|
1151
1243
|
t = {
|
|
1152
1244
|
count: n
|
|
1153
1245
|
};
|
|
1154
|
-
var e = t.count, r = e === void 0 ? 1 / 0 : e, i = t.delay,
|
|
1155
|
-
return r <= 0 ?
|
|
1156
|
-
var
|
|
1157
|
-
var
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
}, void 0, function(
|
|
1161
|
-
if (
|
|
1162
|
-
var
|
|
1163
|
-
|
|
1246
|
+
var e = t.count, r = e === void 0 ? 1 / 0 : e, i = t.delay, o = t.resetOnSuccess, s = o === void 0 ? !1 : o;
|
|
1247
|
+
return r <= 0 ? G : T(function(c, a) {
|
|
1248
|
+
var u = 0, f, y = function() {
|
|
1249
|
+
var b = !1;
|
|
1250
|
+
f = c.subscribe(E(a, function(l) {
|
|
1251
|
+
s && (u = 0), a.next(l);
|
|
1252
|
+
}, void 0, function(l) {
|
|
1253
|
+
if (u++ < r) {
|
|
1254
|
+
var v = function() {
|
|
1255
|
+
f ? (f.unsubscribe(), f = null, y()) : b = !0;
|
|
1164
1256
|
};
|
|
1165
1257
|
if (i != null) {
|
|
1166
|
-
var d = typeof i == "number" ?
|
|
1167
|
-
|
|
1258
|
+
var d = typeof i == "number" ? Le(i) : x(i(l, u)), g = E(a, function() {
|
|
1259
|
+
g.unsubscribe(), v();
|
|
1168
1260
|
}, function() {
|
|
1169
|
-
|
|
1261
|
+
a.complete();
|
|
1170
1262
|
});
|
|
1171
|
-
d.subscribe(
|
|
1263
|
+
d.subscribe(g);
|
|
1172
1264
|
} else
|
|
1173
|
-
|
|
1265
|
+
v();
|
|
1174
1266
|
} else
|
|
1175
|
-
|
|
1176
|
-
})),
|
|
1267
|
+
a.error(l);
|
|
1268
|
+
})), b && (f.unsubscribe(), f = null, y());
|
|
1177
1269
|
};
|
|
1178
|
-
|
|
1270
|
+
y();
|
|
1179
1271
|
});
|
|
1180
1272
|
}
|
|
1181
|
-
function
|
|
1273
|
+
function $t(n) {
|
|
1182
1274
|
return T(function(t, e) {
|
|
1183
|
-
x(n).subscribe(
|
|
1275
|
+
x(n).subscribe(E(e, function() {
|
|
1184
1276
|
return e.complete();
|
|
1185
|
-
},
|
|
1277
|
+
}, q)), !e.closed && t.subscribe(e);
|
|
1186
1278
|
});
|
|
1187
1279
|
}
|
|
1188
|
-
async function
|
|
1280
|
+
async function Gt(n, t) {
|
|
1189
1281
|
const e = n.getReader();
|
|
1190
1282
|
let r;
|
|
1191
1283
|
for (; !(r = await e.read()).done; )
|
|
1192
1284
|
t(r.value);
|
|
1193
1285
|
}
|
|
1194
|
-
function
|
|
1286
|
+
function Ft(n) {
|
|
1195
1287
|
let t, e, r, i = !1;
|
|
1196
|
-
return function(
|
|
1197
|
-
t === void 0 ? (t =
|
|
1288
|
+
return function(s) {
|
|
1289
|
+
t === void 0 ? (t = s, e = 0, r = -1) : t = Vt(t, s);
|
|
1198
1290
|
const c = t.length;
|
|
1199
|
-
let
|
|
1291
|
+
let a = 0;
|
|
1200
1292
|
for (; e < c; ) {
|
|
1201
|
-
i && (t[e] === 10 && (
|
|
1202
|
-
let
|
|
1203
|
-
for (; e < c &&
|
|
1293
|
+
i && (t[e] === 10 && (a = ++e), i = !1);
|
|
1294
|
+
let u = -1;
|
|
1295
|
+
for (; e < c && u === -1; ++e)
|
|
1204
1296
|
switch (t[e]) {
|
|
1205
1297
|
case 58:
|
|
1206
|
-
r === -1 && (r = e -
|
|
1298
|
+
r === -1 && (r = e - a);
|
|
1207
1299
|
break;
|
|
1208
1300
|
case 13:
|
|
1209
1301
|
i = !0;
|
|
1210
1302
|
case 10:
|
|
1211
|
-
|
|
1303
|
+
u = e;
|
|
1212
1304
|
break;
|
|
1213
1305
|
}
|
|
1214
|
-
if (
|
|
1306
|
+
if (u === -1)
|
|
1215
1307
|
break;
|
|
1216
|
-
n(t.subarray(
|
|
1308
|
+
n(t.subarray(a, u), r), a = e, r = -1;
|
|
1217
1309
|
}
|
|
1218
|
-
|
|
1310
|
+
a === c ? t = void 0 : a !== 0 && (t = t.subarray(a), e -= a);
|
|
1219
1311
|
};
|
|
1220
1312
|
}
|
|
1221
|
-
function
|
|
1222
|
-
let r =
|
|
1313
|
+
function Ht(n, t, e) {
|
|
1314
|
+
let r = ue();
|
|
1223
1315
|
const i = new TextDecoder();
|
|
1224
|
-
return function(
|
|
1225
|
-
if (
|
|
1226
|
-
e == null || e(r), r =
|
|
1316
|
+
return function(s, c) {
|
|
1317
|
+
if (s.length === 0)
|
|
1318
|
+
e == null || e(r), r = ue();
|
|
1227
1319
|
else if (c > 0) {
|
|
1228
|
-
const
|
|
1229
|
-
switch (
|
|
1320
|
+
const a = i.decode(s.subarray(0, c)), u = c + (s[c + 1] === 32 ? 2 : 1), f = i.decode(s.subarray(u));
|
|
1321
|
+
switch (a) {
|
|
1230
1322
|
case "data":
|
|
1231
1323
|
r.data = r.data ? r.data + `
|
|
1232
|
-
` +
|
|
1324
|
+
` + f : f;
|
|
1233
1325
|
break;
|
|
1234
1326
|
case "event":
|
|
1235
|
-
r.event =
|
|
1327
|
+
r.event = f;
|
|
1236
1328
|
break;
|
|
1237
1329
|
case "id":
|
|
1238
|
-
n(r.id =
|
|
1330
|
+
n(r.id = f);
|
|
1239
1331
|
break;
|
|
1240
1332
|
case "retry":
|
|
1241
|
-
const
|
|
1242
|
-
isNaN(
|
|
1333
|
+
const y = parseInt(f, 10);
|
|
1334
|
+
isNaN(y) || t(r.retry = y);
|
|
1243
1335
|
break;
|
|
1244
1336
|
}
|
|
1245
1337
|
}
|
|
1246
1338
|
};
|
|
1247
1339
|
}
|
|
1248
|
-
function
|
|
1340
|
+
function Vt(n, t) {
|
|
1249
1341
|
const e = new Uint8Array(n.length + t.length);
|
|
1250
1342
|
return e.set(n), e.set(t, n.length), e;
|
|
1251
1343
|
}
|
|
1252
|
-
function
|
|
1344
|
+
function ue() {
|
|
1253
1345
|
return {
|
|
1254
1346
|
data: "",
|
|
1255
1347
|
event: "",
|
|
@@ -1257,7 +1349,7 @@ function re() {
|
|
|
1257
1349
|
retry: void 0
|
|
1258
1350
|
};
|
|
1259
1351
|
}
|
|
1260
|
-
var
|
|
1352
|
+
var Bt = function(n, t) {
|
|
1261
1353
|
var e = {};
|
|
1262
1354
|
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && t.indexOf(r) < 0 && (e[r] = n[r]);
|
|
1263
1355
|
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -1265,272 +1357,379 @@ var Cn = function(n, t) {
|
|
|
1265
1357
|
t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[i]) && (e[r[i]] = n[r[i]]);
|
|
1266
1358
|
return e;
|
|
1267
1359
|
};
|
|
1268
|
-
const
|
|
1269
|
-
function
|
|
1270
|
-
var { signal: e, headers: r, onopen: i, onmessage:
|
|
1271
|
-
return new Promise((
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
let
|
|
1360
|
+
const J = "text/event-stream", Kt = 1e3, ae = "last-event-id";
|
|
1361
|
+
function Yt(n, t) {
|
|
1362
|
+
var { signal: e, headers: r, onopen: i, onmessage: o, onclose: s, onerror: c, openWhenHidden: a, fetch: u } = t, f = Bt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
1363
|
+
return new Promise((y, b) => {
|
|
1364
|
+
const l = Object.assign({}, r);
|
|
1365
|
+
l.accept || (l.accept = J);
|
|
1366
|
+
let v;
|
|
1275
1367
|
function d() {
|
|
1276
|
-
|
|
1368
|
+
v.abort(), document.hidden || H();
|
|
1277
1369
|
}
|
|
1278
|
-
|
|
1279
|
-
let
|
|
1280
|
-
function
|
|
1281
|
-
document.removeEventListener("visibilitychange", d), window.clearTimeout(
|
|
1370
|
+
a || document.addEventListener("visibilitychange", d);
|
|
1371
|
+
let g = Kt, w = 0;
|
|
1372
|
+
function _() {
|
|
1373
|
+
document.removeEventListener("visibilitychange", d), window.clearTimeout(w), v.abort();
|
|
1282
1374
|
}
|
|
1283
1375
|
e == null || e.addEventListener("abort", () => {
|
|
1284
|
-
|
|
1376
|
+
_(), y();
|
|
1285
1377
|
});
|
|
1286
|
-
const
|
|
1287
|
-
async function
|
|
1288
|
-
var
|
|
1289
|
-
|
|
1378
|
+
const ke = u ?? window.fetch, je = i ?? qt;
|
|
1379
|
+
async function H() {
|
|
1380
|
+
var V;
|
|
1381
|
+
v = new AbortController();
|
|
1290
1382
|
try {
|
|
1291
|
-
const
|
|
1292
|
-
await
|
|
1293
|
-
|
|
1294
|
-
}, (
|
|
1295
|
-
|
|
1296
|
-
},
|
|
1297
|
-
} catch (
|
|
1298
|
-
if (!
|
|
1383
|
+
const j = await ke(n, Object.assign(Object.assign({}, f), { headers: l, signal: v.signal }));
|
|
1384
|
+
await je(j), await Gt(j.body, Ft(Ht((I) => {
|
|
1385
|
+
I ? l[ae] = I : delete l[ae];
|
|
1386
|
+
}, (I) => {
|
|
1387
|
+
g = I;
|
|
1388
|
+
}, o))), s == null || s(), _(), y();
|
|
1389
|
+
} catch (j) {
|
|
1390
|
+
if (!v.signal.aborted)
|
|
1299
1391
|
try {
|
|
1300
|
-
const
|
|
1301
|
-
window.clearTimeout(
|
|
1302
|
-
} catch (
|
|
1303
|
-
|
|
1392
|
+
const I = (V = c == null ? void 0 : c(j)) !== null && V !== void 0 ? V : g;
|
|
1393
|
+
window.clearTimeout(w), w = window.setTimeout(H, I);
|
|
1394
|
+
} catch (I) {
|
|
1395
|
+
_(), b(I);
|
|
1304
1396
|
}
|
|
1305
1397
|
}
|
|
1306
1398
|
}
|
|
1307
|
-
|
|
1399
|
+
H();
|
|
1308
1400
|
});
|
|
1309
1401
|
}
|
|
1310
|
-
function
|
|
1402
|
+
function qt(n) {
|
|
1311
1403
|
const t = n.headers.get("content-type");
|
|
1312
|
-
if (!(t != null && t.startsWith(
|
|
1313
|
-
throw new Error(`Expected content-type to be ${
|
|
1314
|
-
}
|
|
1315
|
-
function
|
|
1316
|
-
const { endpoint: t, apiKey: e, payload: r } = n;
|
|
1317
|
-
return new
|
|
1318
|
-
const s = new AbortController()
|
|
1319
|
-
|
|
1404
|
+
if (!(t != null && t.startsWith(J)))
|
|
1405
|
+
throw new Error(`Expected content-type to be ${J}, Actual: ${t}`);
|
|
1406
|
+
}
|
|
1407
|
+
function Wt(n) {
|
|
1408
|
+
const { endpoint: t, apiKey: e, payload: r, debugMode: i } = n;
|
|
1409
|
+
return new S((o) => {
|
|
1410
|
+
const s = new AbortController(), c = {
|
|
1411
|
+
"Content-Type": "application/json"
|
|
1412
|
+
};
|
|
1413
|
+
e && (c["X-API-KEY"] = e);
|
|
1414
|
+
const a = new URLSearchParams();
|
|
1415
|
+
i && a.set("is_debug", "true");
|
|
1416
|
+
const u = new URL(t);
|
|
1417
|
+
return a.toString() && (u.search = a.toString()), Yt(u.toString(), {
|
|
1320
1418
|
method: "POST",
|
|
1321
|
-
headers:
|
|
1322
|
-
"X-API-KEY": e,
|
|
1323
|
-
"Content-Type": "application/json"
|
|
1324
|
-
},
|
|
1419
|
+
headers: c,
|
|
1325
1420
|
body: r ? JSON.stringify(r) : void 0,
|
|
1326
1421
|
signal: s.signal,
|
|
1327
|
-
|
|
1328
|
-
|
|
1422
|
+
/**
|
|
1423
|
+
* Allow SSE to work when the page is hidden.
|
|
1424
|
+
* https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
|
|
1425
|
+
*/
|
|
1426
|
+
openWhenHidden: !0,
|
|
1427
|
+
onopen: async (f) => {
|
|
1428
|
+
f.ok || (o.error(f), s.abort());
|
|
1329
1429
|
},
|
|
1330
|
-
onmessage: (
|
|
1331
|
-
|
|
1430
|
+
onmessage: (f) => {
|
|
1431
|
+
o.next(JSON.parse(f.data));
|
|
1332
1432
|
},
|
|
1333
1433
|
onclose: () => {
|
|
1334
|
-
|
|
1434
|
+
o.complete();
|
|
1335
1435
|
},
|
|
1336
|
-
onerror: (
|
|
1337
|
-
throw
|
|
1436
|
+
onerror: (f) => {
|
|
1437
|
+
throw o.error(f), s.abort(), f;
|
|
1338
1438
|
}
|
|
1339
1439
|
}), () => {
|
|
1340
1440
|
s.abort();
|
|
1341
1441
|
};
|
|
1342
1442
|
});
|
|
1343
1443
|
}
|
|
1344
|
-
class
|
|
1345
|
-
constructor(
|
|
1346
|
-
|
|
1347
|
-
_(this, "apiKey");
|
|
1348
|
-
_(this, "endpoint");
|
|
1349
|
-
_(this, "destroy$", new he());
|
|
1350
|
-
if (!t.apiKey)
|
|
1351
|
-
throw new Error("apiKey must be required");
|
|
1352
|
-
if (!t.endpoint)
|
|
1353
|
-
throw new Error("botProviderName must be required");
|
|
1354
|
-
this.apiKey = t.apiKey, this.endpoint = t.endpoint;
|
|
1444
|
+
class Jt {
|
|
1445
|
+
constructor() {
|
|
1446
|
+
m(this, "listeners", {});
|
|
1355
1447
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
apiKey: this.apiKey,
|
|
1360
|
-
endpoint: this.endpoint,
|
|
1361
|
-
payload: {
|
|
1362
|
-
action: $.RESET_CHANNEL,
|
|
1363
|
-
customChannelId: t.customChannelId,
|
|
1364
|
-
customMessageId: t == null ? void 0 : t.customMessageId,
|
|
1365
|
-
text: ""
|
|
1366
|
-
}
|
|
1367
|
-
}).pipe(te(this.destroy$), ne(3)).subscribe({
|
|
1368
|
-
next: (i) => {
|
|
1369
|
-
var s;
|
|
1370
|
-
(s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, i);
|
|
1371
|
-
},
|
|
1372
|
-
error: (i) => {
|
|
1373
|
-
var s;
|
|
1374
|
-
(s = e == null ? void 0 : e.onSseError) == null || s.call(e, i), this.isConnecting = !1;
|
|
1375
|
-
},
|
|
1376
|
-
complete: () => {
|
|
1377
|
-
var i;
|
|
1378
|
-
(i = e == null ? void 0 : e.onSseCompleted) == null || i.call(e), this.isConnecting = !1;
|
|
1379
|
-
}
|
|
1448
|
+
on(t, e) {
|
|
1449
|
+
this.listeners = Object.assign({}, this.listeners, {
|
|
1450
|
+
[t]: (this.listeners[t] ?? []).concat(e)
|
|
1380
1451
|
});
|
|
1381
1452
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1453
|
+
off(t, e) {
|
|
1454
|
+
this.listeners[t] && (this.listeners = Object.assign({}, this.listeners, {
|
|
1455
|
+
[t]: (this.listeners[t] ?? []).filter((r) => r !== e)
|
|
1456
|
+
}));
|
|
1457
|
+
}
|
|
1458
|
+
remove(t) {
|
|
1459
|
+
delete this.listeners[t];
|
|
1460
|
+
}
|
|
1461
|
+
emit(t, ...e) {
|
|
1462
|
+
this.listeners[t] && this.listeners[t].forEach((r) => r(...e));
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
class zt {
|
|
1466
|
+
constructor(t) {
|
|
1467
|
+
m(this, "apiKey");
|
|
1468
|
+
m(this, "endpoint");
|
|
1469
|
+
m(this, "debugMode");
|
|
1470
|
+
m(this, "destroy$", new Q());
|
|
1471
|
+
m(this, "sseEmitter", new Jt());
|
|
1472
|
+
m(this, "transformSsePayload");
|
|
1473
|
+
if (!t.endpoint && !t.botProviderEndpoint)
|
|
1474
|
+
throw new Error("Either endpoint or botProviderEndpoint must be provided");
|
|
1475
|
+
if (this.apiKey = t.apiKey, this.debugMode = t.debugMode, this.transformSsePayload = t.transformSsePayload, !t.endpoint && t.botProviderEndpoint) {
|
|
1476
|
+
const e = t.botProviderEndpoint.replace(/\/+$/, "");
|
|
1477
|
+
this.endpoint = `${e}/message/sse`;
|
|
1478
|
+
} else t.endpoint && (this.endpoint = t.endpoint, this.debugMode && console.warn(
|
|
1479
|
+
'[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".'
|
|
1480
|
+
));
|
|
1481
|
+
}
|
|
1482
|
+
on(t, e) {
|
|
1483
|
+
this.sseEmitter.remove(t), this.sseEmitter.on(t, e);
|
|
1484
|
+
}
|
|
1485
|
+
handleEvent(t) {
|
|
1486
|
+
switch (t.eventType) {
|
|
1487
|
+
case h.INIT:
|
|
1488
|
+
this.sseEmitter.emit(
|
|
1489
|
+
h.INIT,
|
|
1490
|
+
t
|
|
1491
|
+
);
|
|
1492
|
+
break;
|
|
1493
|
+
case h.PROCESS_START:
|
|
1494
|
+
case h.PROCESS_COMPLETE:
|
|
1495
|
+
this.sseEmitter.emit(
|
|
1496
|
+
h.PROCESS,
|
|
1497
|
+
t
|
|
1498
|
+
);
|
|
1499
|
+
break;
|
|
1500
|
+
case h.MESSAGE_START:
|
|
1501
|
+
case h.MESSAGE_DELTA:
|
|
1502
|
+
case h.MESSAGE_COMPLETE:
|
|
1503
|
+
this.sseEmitter.emit(
|
|
1504
|
+
h.MESSAGE,
|
|
1505
|
+
t
|
|
1506
|
+
);
|
|
1507
|
+
break;
|
|
1508
|
+
case h.TOOL_CALL_START:
|
|
1509
|
+
case h.TOOL_CALL_COMPLETE:
|
|
1510
|
+
this.sseEmitter.emit(
|
|
1511
|
+
h.TOOL_CALL,
|
|
1512
|
+
t
|
|
1513
|
+
);
|
|
1514
|
+
break;
|
|
1515
|
+
case h.DONE:
|
|
1516
|
+
this.sseEmitter.emit(
|
|
1517
|
+
h.DONE,
|
|
1518
|
+
t
|
|
1519
|
+
);
|
|
1520
|
+
break;
|
|
1521
|
+
case h.ERROR:
|
|
1522
|
+
this.sseEmitter.emit(
|
|
1523
|
+
h.ERROR,
|
|
1524
|
+
t
|
|
1525
|
+
);
|
|
1526
|
+
break;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
fetchSse(t, e) {
|
|
1530
|
+
var r, i;
|
|
1531
|
+
(r = e == null ? void 0 : e.onSseStart) == null || r.call(e), Wt({
|
|
1385
1532
|
apiKey: this.apiKey,
|
|
1386
1533
|
endpoint: this.endpoint,
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
customChannelId: t.customChannelId,
|
|
1390
|
-
customMessageId: t == null ? void 0 : t.customMessageId,
|
|
1391
|
-
text: t.text
|
|
1392
|
-
}
|
|
1534
|
+
debugMode: this.debugMode,
|
|
1535
|
+
payload: ((i = this.transformSsePayload) == null ? void 0 : i.call(this, t)) ?? t
|
|
1393
1536
|
}).pipe(
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1537
|
+
Rt((o) => mt(o).pipe(Ut((e == null ? void 0 : e.delayTime) ?? 50))),
|
|
1538
|
+
$t(this.destroy$),
|
|
1539
|
+
Nt(3)
|
|
1397
1540
|
).subscribe({
|
|
1398
|
-
next: (
|
|
1541
|
+
next: (o) => {
|
|
1399
1542
|
var s;
|
|
1400
|
-
(s = e == null ? void 0 : e.onSseMessage) == null || s.call(e,
|
|
1543
|
+
(s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, o), this.handleEvent(o);
|
|
1401
1544
|
},
|
|
1402
|
-
error: (
|
|
1545
|
+
error: (o) => {
|
|
1403
1546
|
var s;
|
|
1404
|
-
(s = e == null ? void 0 : e.onSseError) == null || s.call(e,
|
|
1547
|
+
(s = e == null ? void 0 : e.onSseError) == null || s.call(e, o);
|
|
1405
1548
|
},
|
|
1406
1549
|
complete: () => {
|
|
1407
|
-
var
|
|
1408
|
-
(
|
|
1550
|
+
var o;
|
|
1551
|
+
(o = e == null ? void 0 : e.onSseCompleted) == null || o.call(e);
|
|
1409
1552
|
}
|
|
1410
1553
|
});
|
|
1411
1554
|
}
|
|
1412
1555
|
close() {
|
|
1413
|
-
this.
|
|
1556
|
+
this.destroy$.next(), this.destroy$.complete();
|
|
1414
1557
|
}
|
|
1415
1558
|
}
|
|
1416
|
-
class
|
|
1417
|
-
constructor(
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
this
|
|
1559
|
+
class Re {
|
|
1560
|
+
constructor(t) {
|
|
1561
|
+
m(this, "client");
|
|
1562
|
+
m(this, "customChannelId");
|
|
1563
|
+
m(this, "customMessageId");
|
|
1564
|
+
m(this, "isConnecting$");
|
|
1565
|
+
m(this, "conversation$");
|
|
1566
|
+
m(this, "statesObserver");
|
|
1567
|
+
m(this, "statesSubscription");
|
|
1568
|
+
if (!t.client)
|
|
1569
|
+
throw new Error("client must be required");
|
|
1570
|
+
if (!t.customChannelId)
|
|
1571
|
+
throw new Error("customChannelId must be required");
|
|
1572
|
+
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new re(!1), this.conversation$ = new re(t.conversation), this.statesObserver = t.statesObserver;
|
|
1421
1573
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
})
|
|
1574
|
+
static async reset(t, e, r) {
|
|
1575
|
+
const i = new Re(t);
|
|
1576
|
+
try {
|
|
1577
|
+
return i.subscribe(), await i.resetChannel(e, r), i;
|
|
1578
|
+
} catch (o) {
|
|
1579
|
+
throw i.close(), o;
|
|
1580
|
+
}
|
|
1427
1581
|
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1582
|
+
subscribe() {
|
|
1583
|
+
this.statesSubscription = Pt([
|
|
1584
|
+
this.isConnecting$,
|
|
1585
|
+
this.conversation$
|
|
1586
|
+
]).pipe(
|
|
1587
|
+
F(([t, e]) => ({
|
|
1588
|
+
isConnecting: t,
|
|
1589
|
+
conversation: e
|
|
1590
|
+
}))
|
|
1591
|
+
).subscribe(this.statesObserver);
|
|
1592
|
+
}
|
|
1593
|
+
fetchSse(t, e) {
|
|
1594
|
+
return new Promise((r, i) => {
|
|
1595
|
+
this.isConnecting$.next(!0), this.client.fetchSse(t, {
|
|
1596
|
+
onSseStart: e == null ? void 0 : e.onSseStart,
|
|
1597
|
+
onSseMessage: (o) => {
|
|
1598
|
+
var s;
|
|
1599
|
+
(s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, o), this.conversation$.next(this.conversation$.value.onMessage(o));
|
|
1600
|
+
},
|
|
1601
|
+
onSseError: (o) => {
|
|
1602
|
+
var s;
|
|
1603
|
+
(s = e == null ? void 0 : e.onSseError) == null || s.call(e, o), this.isConnecting$.next(!1), i(o);
|
|
1604
|
+
},
|
|
1605
|
+
onSseCompleted: () => {
|
|
1606
|
+
var o;
|
|
1607
|
+
(o = e == null ? void 0 : e.onSseCompleted) == null || o.call(e), this.isConnecting$.next(!1), r();
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1433
1610
|
});
|
|
1434
1611
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1612
|
+
resetChannel(t, e) {
|
|
1613
|
+
return this.fetchSse(
|
|
1614
|
+
{
|
|
1615
|
+
action: K.RESET_CHANNEL,
|
|
1616
|
+
customChannelId: this.customChannelId,
|
|
1617
|
+
customMessageId: this.customMessageId,
|
|
1618
|
+
text: (t == null ? void 0 : t.text) || "",
|
|
1619
|
+
payload: t == null ? void 0 : t.payload
|
|
1620
|
+
},
|
|
1621
|
+
e
|
|
1622
|
+
);
|
|
1623
|
+
}
|
|
1624
|
+
sendMessage(t, e) {
|
|
1625
|
+
const r = t.text.trim(), i = t.customMessageId ?? crypto.randomUUID();
|
|
1626
|
+
return this.conversation$.next(
|
|
1627
|
+
this.conversation$.value.pushMessage({
|
|
1628
|
+
type: "user",
|
|
1629
|
+
messageId: i,
|
|
1630
|
+
text: r,
|
|
1631
|
+
time: /* @__PURE__ */ new Date()
|
|
1632
|
+
})
|
|
1633
|
+
), this.fetchSse(
|
|
1634
|
+
{
|
|
1635
|
+
action: K.NONE,
|
|
1636
|
+
customChannelId: this.customChannelId,
|
|
1637
|
+
customMessageId: i,
|
|
1638
|
+
payload: t == null ? void 0 : t.payload,
|
|
1639
|
+
text: r
|
|
1640
|
+
},
|
|
1641
|
+
e
|
|
1642
|
+
);
|
|
1643
|
+
}
|
|
1644
|
+
close() {
|
|
1645
|
+
var t;
|
|
1646
|
+
this.isConnecting$.complete(), this.conversation$.complete(), (t = this.statesSubscription) == null || t.unsubscribe();
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
class C {
|
|
1650
|
+
constructor({ messages: t }) {
|
|
1651
|
+
m(this, "messages", null);
|
|
1652
|
+
this.messages = t;
|
|
1653
|
+
}
|
|
1654
|
+
pushMessage(t) {
|
|
1655
|
+
const e = new Map(this.messages);
|
|
1656
|
+
return e.set(t.messageId, t), new C({ messages: e });
|
|
1657
|
+
}
|
|
1658
|
+
onMessage(t) {
|
|
1659
|
+
switch (t.eventType) {
|
|
1660
|
+
case h.MESSAGE_START:
|
|
1661
|
+
return this.onMessageStart(
|
|
1662
|
+
t
|
|
1443
1663
|
);
|
|
1444
|
-
case
|
|
1445
|
-
return
|
|
1446
|
-
t
|
|
1447
|
-
e,
|
|
1448
|
-
{ showDebugMessage: i }
|
|
1664
|
+
case h.MESSAGE_DELTA:
|
|
1665
|
+
return this.onMessageDelta(
|
|
1666
|
+
t
|
|
1449
1667
|
);
|
|
1450
|
-
case
|
|
1451
|
-
return
|
|
1452
|
-
t
|
|
1453
|
-
e,
|
|
1454
|
-
{ showDebugMessage: i }
|
|
1668
|
+
case h.MESSAGE_COMPLETE:
|
|
1669
|
+
return this.onMessageComplete(
|
|
1670
|
+
t
|
|
1455
1671
|
);
|
|
1456
|
-
case
|
|
1457
|
-
return
|
|
1672
|
+
case h.ERROR:
|
|
1673
|
+
return this.onMessageError(t);
|
|
1458
1674
|
default:
|
|
1459
|
-
return
|
|
1675
|
+
return this;
|
|
1460
1676
|
}
|
|
1461
1677
|
}
|
|
1462
|
-
onMessageStart(t
|
|
1463
|
-
const
|
|
1464
|
-
return
|
|
1465
|
-
messages: t.messages,
|
|
1466
|
-
typingMessages: s
|
|
1467
|
-
}) : (s.set(i.messageId, {
|
|
1678
|
+
onMessageStart(t) {
|
|
1679
|
+
const e = t.fact.messageStart.message, r = new Map(this.messages);
|
|
1680
|
+
return r.set(e.messageId, {
|
|
1468
1681
|
type: "bot",
|
|
1469
|
-
eventType:
|
|
1682
|
+
eventType: h.MESSAGE_START,
|
|
1470
1683
|
isTyping: !0,
|
|
1471
1684
|
typingText: "",
|
|
1472
|
-
messageId:
|
|
1473
|
-
message:
|
|
1685
|
+
messageId: e.messageId,
|
|
1686
|
+
message: e,
|
|
1474
1687
|
time: /* @__PURE__ */ new Date()
|
|
1475
|
-
}), new
|
|
1476
|
-
messages: t.messages,
|
|
1477
|
-
typingMessages: s
|
|
1478
|
-
}));
|
|
1688
|
+
}), new C({ messages: r });
|
|
1479
1689
|
}
|
|
1480
|
-
onMessageDelta(t
|
|
1481
|
-
const
|
|
1482
|
-
if (
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
typingMessages: o
|
|
1486
|
-
});
|
|
1487
|
-
const u = `${(c == null ? void 0 : c.typingText) ?? ""}${i.text}`;
|
|
1488
|
-
return o.set(i.messageId, {
|
|
1690
|
+
onMessageDelta(t) {
|
|
1691
|
+
const e = t.fact.messageDelta.message, r = new Map(this.messages), i = r.get(e.messageId);
|
|
1692
|
+
if ((i == null ? void 0 : i.type) !== "bot") return this;
|
|
1693
|
+
const o = `${(i == null ? void 0 : i.typingText) ?? ""}${e.text}`;
|
|
1694
|
+
return r.set(e.messageId, {
|
|
1489
1695
|
type: "bot",
|
|
1490
|
-
eventType:
|
|
1696
|
+
eventType: h.MESSAGE_DELTA,
|
|
1491
1697
|
isTyping: !0,
|
|
1492
|
-
typingText:
|
|
1493
|
-
messageId:
|
|
1494
|
-
message:
|
|
1698
|
+
typingText: o,
|
|
1699
|
+
messageId: e.messageId,
|
|
1700
|
+
message: e,
|
|
1495
1701
|
time: /* @__PURE__ */ new Date()
|
|
1496
|
-
}), new
|
|
1497
|
-
messages: t.messages,
|
|
1498
|
-
typingMessages: o
|
|
1499
|
-
});
|
|
1702
|
+
}), new C({ messages: r });
|
|
1500
1703
|
}
|
|
1501
|
-
onMessageComplete(t
|
|
1502
|
-
const
|
|
1503
|
-
return
|
|
1504
|
-
messages: s,
|
|
1505
|
-
typingMessages: o
|
|
1506
|
-
}) : (s.set(i.messageId, {
|
|
1704
|
+
onMessageComplete(t) {
|
|
1705
|
+
const e = t.fact.messageComplete.message, r = new Map(this.messages);
|
|
1706
|
+
return r.set(e.messageId, {
|
|
1507
1707
|
type: "bot",
|
|
1508
|
-
eventType:
|
|
1708
|
+
eventType: h.MESSAGE_COMPLETE,
|
|
1509
1709
|
isTyping: !1,
|
|
1510
1710
|
typingText: null,
|
|
1511
|
-
messageId:
|
|
1512
|
-
message:
|
|
1711
|
+
messageId: e.messageId,
|
|
1712
|
+
message: e,
|
|
1513
1713
|
time: /* @__PURE__ */ new Date()
|
|
1514
|
-
}),
|
|
1515
|
-
messages: s,
|
|
1516
|
-
typingMessages: o
|
|
1517
|
-
}));
|
|
1714
|
+
}), new C({ messages: r });
|
|
1518
1715
|
}
|
|
1519
|
-
|
|
1520
|
-
const e =
|
|
1521
|
-
return
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1716
|
+
onMessageError(t) {
|
|
1717
|
+
const e = crypto.randomUUID(), r = t.fact.runError.error, i = new Map(this.messages);
|
|
1718
|
+
return i.set(e, {
|
|
1719
|
+
type: "error",
|
|
1720
|
+
eventType: h.ERROR,
|
|
1721
|
+
messageId: e,
|
|
1722
|
+
error: r,
|
|
1723
|
+
time: /* @__PURE__ */ new Date()
|
|
1724
|
+
}), new C({ messages: i });
|
|
1527
1725
|
}
|
|
1528
1726
|
}
|
|
1529
1727
|
export {
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1728
|
+
zt as AsgardServiceClient,
|
|
1729
|
+
Re as Channel,
|
|
1730
|
+
C as Conversation,
|
|
1731
|
+
h as EventType,
|
|
1732
|
+
K as FetchSseAction,
|
|
1534
1733
|
Ne as MessageTemplateType
|
|
1535
1734
|
};
|
|
1536
1735
|
//# sourceMappingURL=index.mjs.map
|