@asgard-js/core 0.2.61 → 0.2.63
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 +95 -20
- package/dist/constants/enum.d.ts +7 -0
- package/dist/constants/enum.d.ts.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1555 -1145
- package/dist/index.mjs.map +1 -1
- package/dist/lib/channel.d.ts +39 -1
- package/dist/lib/channel.d.ts.map +1 -1
- package/dist/lib/channel.spec.d.ts +2 -0
- package/dist/lib/channel.spec.d.ts.map +1 -0
- package/dist/lib/client.d.ts +16 -1
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.spec.d.ts +2 -0
- package/dist/lib/client.spec.d.ts.map +1 -0
- package/dist/lib/conversation.d.ts +18 -0
- package/dist/lib/conversation.d.ts.map +1 -1
- package/dist/lib/conversation.spec.d.ts +2 -0
- package/dist/lib/conversation.spec.d.ts.map +1 -0
- package/dist/lib/create-sse-observable.d.ts +4 -1
- package/dist/lib/create-sse-observable.d.ts.map +1 -1
- package/dist/lib/derived-stores.d.ts +39 -0
- package/dist/lib/derived-stores.d.ts.map +1 -0
- package/dist/lib/derived-stores.spec.d.ts +2 -0
- package/dist/lib/derived-stores.spec.d.ts.map +1 -0
- package/dist/lib/subagent-reducer.d.ts +46 -0
- package/dist/lib/subagent-reducer.d.ts.map +1 -0
- package/dist/lib/subagent-reducer.spec.d.ts +2 -0
- package/dist/lib/subagent-reducer.spec.d.ts.map +1 -0
- package/dist/lib/task-reducer.d.ts +23 -0
- package/dist/lib/task-reducer.d.ts.map +1 -0
- package/dist/lib/task-reducer.spec.d.ts +2 -0
- package/dist/lib/task-reducer.spec.d.ts.map +1 -0
- package/dist/types/channel.d.ts +73 -1
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/client.d.ts +9 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/sse-response.d.ts +66 -0
- package/dist/types/sse-response.d.ts.map +1 -1
- package/dist/types/subagent.d.ts +37 -0
- package/dist/types/subagent.d.ts.map +1 -0
- package/dist/types/task.d.ts +21 -0
- package/dist/types/task.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,528 +1,528 @@
|
|
|
1
|
-
class
|
|
1
|
+
class te extends Error {
|
|
2
2
|
status;
|
|
3
3
|
statusText;
|
|
4
4
|
body;
|
|
5
|
-
constructor(
|
|
6
|
-
super(`HTTP ${
|
|
5
|
+
constructor(t, e, r) {
|
|
6
|
+
super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = r;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return n instanceof
|
|
9
|
+
function En(n) {
|
|
10
|
+
return n instanceof te;
|
|
11
11
|
}
|
|
12
|
-
var
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
} || function(
|
|
16
|
-
for (var
|
|
17
|
-
},
|
|
12
|
+
var H = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n))(H || {}), d = /* @__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.MESSAGE_USER = "asgard.message.user", n.MESSAGE_THINKING_START = "asgard.message.thinking.start", n.MESSAGE_THINKING_DELTA = "asgard.message.thinking.delta", n.MESSAGE_THINKING_COMPLETE = "asgard.message.thinking.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.TOOL_CALL_CONSENT = "asgard.tool_call.consent", n.SUBAGENT_START = "asgard.subagent.start", n.SUBAGENT_COMPLETE = "asgard.subagent.complete", n.CHANNEL_TITLE_UPDATE = "asgard.channel.title.update", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(d || {}), Ke = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Ke || {}), Fe = /* @__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.TABLE = "TABLE", n.ATTACHMENT = "ATTACHMENT", n))(Fe || {}), z = function(n, t) {
|
|
13
|
+
return z = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
14
|
+
e.__proto__ = r;
|
|
15
|
+
} || function(e, r) {
|
|
16
|
+
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
|
|
17
|
+
}, z(n, t);
|
|
18
18
|
};
|
|
19
|
-
function
|
|
20
|
-
if (typeof
|
|
21
|
-
throw new TypeError("Class extends value " + String(
|
|
22
|
-
|
|
23
|
-
function
|
|
19
|
+
function w(n, t) {
|
|
20
|
+
if (typeof t != "function" && t !== null)
|
|
21
|
+
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
22
|
+
z(n, t);
|
|
23
|
+
function e() {
|
|
24
24
|
this.constructor = n;
|
|
25
25
|
}
|
|
26
|
-
n.prototype =
|
|
26
|
+
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
function o
|
|
30
|
-
return
|
|
31
|
-
|
|
28
|
+
function Be(n, t, e, r) {
|
|
29
|
+
function s(o) {
|
|
30
|
+
return o instanceof e ? o : new e(function(i) {
|
|
31
|
+
i(o);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
return new (
|
|
35
|
-
function a(
|
|
34
|
+
return new (e || (e = Promise))(function(o, i) {
|
|
35
|
+
function a(h) {
|
|
36
36
|
try {
|
|
37
|
-
|
|
38
|
-
} catch (
|
|
39
|
-
|
|
37
|
+
c(r.next(h));
|
|
38
|
+
} catch (g) {
|
|
39
|
+
i(g);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function u(h) {
|
|
43
43
|
try {
|
|
44
|
-
|
|
45
|
-
} catch (
|
|
46
|
-
|
|
44
|
+
c(r.throw(h));
|
|
45
|
+
} catch (g) {
|
|
46
|
+
i(g);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
49
|
+
function c(h) {
|
|
50
|
+
h.done ? o(h.value) : s(h.value).then(a, u);
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
c((r = r.apply(n, t || [])).next());
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
var
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
59
|
-
}, trys: [], ops: [] }, r, o, i
|
|
60
|
-
return
|
|
55
|
+
function ve(n, t) {
|
|
56
|
+
var e = { label: 0, sent: function() {
|
|
57
|
+
if (o[0] & 1) throw o[1];
|
|
58
|
+
return o[1];
|
|
59
|
+
}, trys: [], ops: [] }, r, s, o, i = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
60
|
+
return i.next = a(0), i.throw = a(1), i.return = a(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
|
|
61
61
|
return this;
|
|
62
|
-
}),
|
|
63
|
-
function a(
|
|
64
|
-
return function(
|
|
65
|
-
return
|
|
62
|
+
}), i;
|
|
63
|
+
function a(c) {
|
|
64
|
+
return function(h) {
|
|
65
|
+
return u([c, h]);
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function c
|
|
68
|
+
function u(c) {
|
|
69
69
|
if (r) throw new TypeError("Generator is already executing.");
|
|
70
|
-
for (;
|
|
71
|
-
if (r = 1,
|
|
72
|
-
switch (
|
|
70
|
+
for (; i && (i = 0, c[0] && (e = 0)), e; ) try {
|
|
71
|
+
if (r = 1, s && (o = c[0] & 2 ? s.return : c[0] ? s.throw || ((o = s.return) && o.call(s), 0) : s.next) && !(o = o.call(s, c[1])).done) return o;
|
|
72
|
+
switch (s = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
|
|
73
73
|
case 0:
|
|
74
74
|
case 1:
|
|
75
|
-
|
|
75
|
+
o = c;
|
|
76
76
|
break;
|
|
77
77
|
case 4:
|
|
78
|
-
return
|
|
78
|
+
return e.label++, { value: c[1], done: !1 };
|
|
79
79
|
case 5:
|
|
80
|
-
|
|
80
|
+
e.label++, s = c[1], c = [0];
|
|
81
81
|
continue;
|
|
82
82
|
case 7:
|
|
83
|
-
|
|
83
|
+
c = e.ops.pop(), e.trys.pop();
|
|
84
84
|
continue;
|
|
85
85
|
default:
|
|
86
|
-
if (
|
|
87
|
-
|
|
86
|
+
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
87
|
+
e = 0;
|
|
88
88
|
continue;
|
|
89
89
|
}
|
|
90
|
-
if (
|
|
91
|
-
|
|
90
|
+
if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
|
|
91
|
+
e.label = c[1];
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
|
-
if (
|
|
95
|
-
|
|
94
|
+
if (c[0] === 6 && e.label < o[1]) {
|
|
95
|
+
e.label = o[1], o = c;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
|
-
if (
|
|
99
|
-
|
|
98
|
+
if (o && e.label < o[2]) {
|
|
99
|
+
e.label = o[2], e.ops.push(c);
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
o[2] && e.ops.pop(), e.trys.pop();
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
} catch (
|
|
107
|
-
|
|
105
|
+
c = t.call(n, e);
|
|
106
|
+
} catch (h) {
|
|
107
|
+
c = [6, h], s = 0;
|
|
108
108
|
} finally {
|
|
109
|
-
r =
|
|
109
|
+
r = o = 0;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
112
|
-
return { value:
|
|
111
|
+
if (c[0] & 5) throw c[1];
|
|
112
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
var
|
|
117
|
-
if (
|
|
115
|
+
function k(n) {
|
|
116
|
+
var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
|
|
117
|
+
if (e) return e.call(n);
|
|
118
118
|
if (n && typeof n.length == "number") return {
|
|
119
119
|
next: function() {
|
|
120
120
|
return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
throw new TypeError(
|
|
123
|
+
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
var
|
|
127
|
-
if (!
|
|
128
|
-
var r =
|
|
125
|
+
function R(n, t) {
|
|
126
|
+
var e = typeof Symbol == "function" && n[Symbol.iterator];
|
|
127
|
+
if (!e) return n;
|
|
128
|
+
var r = e.call(n), s, o = [], i;
|
|
129
129
|
try {
|
|
130
|
-
for (; (
|
|
130
|
+
for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; ) o.push(s.value);
|
|
131
131
|
} catch (a) {
|
|
132
|
-
|
|
132
|
+
i = { error: a };
|
|
133
133
|
} finally {
|
|
134
134
|
try {
|
|
135
|
-
|
|
135
|
+
s && !s.done && (e = r.return) && e.call(r);
|
|
136
136
|
} finally {
|
|
137
|
-
if (
|
|
137
|
+
if (i) throw i.error;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
return
|
|
140
|
+
return o;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
if (
|
|
144
|
-
(
|
|
145
|
-
return n.concat(
|
|
142
|
+
function $(n, t, e) {
|
|
143
|
+
if (e || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
|
|
144
|
+
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
145
|
+
return n.concat(o || Array.prototype.slice.call(t));
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return this instanceof
|
|
147
|
+
function L(n) {
|
|
148
|
+
return this instanceof L ? (this.v = n, this) : new L(n);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function qe(n, t, e) {
|
|
151
151
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
152
|
-
var r =
|
|
153
|
-
return
|
|
152
|
+
var r = e.apply(n, t || []), s, o = [];
|
|
153
|
+
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", i), s[Symbol.asyncIterator] = function() {
|
|
154
154
|
return this;
|
|
155
|
-
},
|
|
156
|
-
function
|
|
157
|
-
return function(
|
|
158
|
-
return Promise.resolve(
|
|
155
|
+
}, s;
|
|
156
|
+
function i(l) {
|
|
157
|
+
return function(f) {
|
|
158
|
+
return Promise.resolve(f).then(l, g);
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
function a(l,
|
|
162
|
-
r[l] && (
|
|
163
|
-
return new Promise(function(
|
|
164
|
-
|
|
161
|
+
function a(l, f) {
|
|
162
|
+
r[l] && (s[l] = function(p) {
|
|
163
|
+
return new Promise(function(A, I) {
|
|
164
|
+
o.push([l, p, A, I]) > 1 || u(l, p);
|
|
165
165
|
});
|
|
166
|
-
},
|
|
166
|
+
}, f && (s[l] = f(s[l])));
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function u(l, f) {
|
|
169
169
|
try {
|
|
170
|
-
|
|
171
|
-
} catch (
|
|
172
|
-
|
|
170
|
+
c(r[l](f));
|
|
171
|
+
} catch (p) {
|
|
172
|
+
v(o[0][3], p);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
l.value instanceof
|
|
175
|
+
function c(l) {
|
|
176
|
+
l.value instanceof L ? Promise.resolve(l.value.v).then(h, g) : v(o[0][2], l);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
|
|
178
|
+
function h(l) {
|
|
179
|
+
u("next", l);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
181
|
+
function g(l) {
|
|
182
|
+
u("throw", l);
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
l(
|
|
184
|
+
function v(l, f) {
|
|
185
|
+
l(f), o.shift(), o.length && u(o[0][0], o[0][1]);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function Ve(n) {
|
|
189
189
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
190
|
-
var
|
|
191
|
-
return
|
|
190
|
+
var t = n[Symbol.asyncIterator], e;
|
|
191
|
+
return t ? t.call(n) : (n = typeof k == "function" ? k(n) : n[Symbol.iterator](), e = {}, r("next"), r("throw"), r("return"), e[Symbol.asyncIterator] = function() {
|
|
192
192
|
return this;
|
|
193
|
-
},
|
|
194
|
-
function r(
|
|
195
|
-
|
|
196
|
-
return new Promise(function(a,
|
|
197
|
-
|
|
193
|
+
}, e);
|
|
194
|
+
function r(o) {
|
|
195
|
+
e[o] = n[o] && function(i) {
|
|
196
|
+
return new Promise(function(a, u) {
|
|
197
|
+
i = n[o](i), s(a, u, i.done, i.value);
|
|
198
198
|
});
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
function o
|
|
202
|
-
Promise.resolve(
|
|
203
|
-
|
|
204
|
-
},
|
|
201
|
+
function s(o, i, a, u) {
|
|
202
|
+
Promise.resolve(u).then(function(c) {
|
|
203
|
+
o({ value: c, done: a });
|
|
204
|
+
}, i);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
function m(n) {
|
|
208
208
|
return typeof n == "function";
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
var
|
|
210
|
+
function ye(n) {
|
|
211
|
+
var t = function(r) {
|
|
212
212
|
Error.call(r), r.stack = new Error().stack;
|
|
213
|
-
},
|
|
214
|
-
return
|
|
213
|
+
}, e = n(t);
|
|
214
|
+
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
|
215
215
|
}
|
|
216
|
-
var
|
|
217
|
-
return function(
|
|
218
|
-
n(this), this.message =
|
|
219
|
-
` +
|
|
220
|
-
return
|
|
216
|
+
var W = ye(function(n) {
|
|
217
|
+
return function(e) {
|
|
218
|
+
n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
219
|
+
` + e.map(function(r, s) {
|
|
220
|
+
return s + 1 + ") " + r.toString();
|
|
221
221
|
}).join(`
|
|
222
|
-
`) : "", this.name = "UnsubscriptionError", this.errors =
|
|
222
|
+
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
223
223
|
};
|
|
224
224
|
});
|
|
225
|
-
function
|
|
225
|
+
function F(n, t) {
|
|
226
226
|
if (n) {
|
|
227
|
-
var
|
|
228
|
-
0 <=
|
|
227
|
+
var e = n.indexOf(t);
|
|
228
|
+
0 <= e && n.splice(e, 1);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
var
|
|
232
|
-
function n(
|
|
233
|
-
this.initialTeardown =
|
|
231
|
+
var U = (function() {
|
|
232
|
+
function n(t) {
|
|
233
|
+
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
234
234
|
}
|
|
235
235
|
return n.prototype.unsubscribe = function() {
|
|
236
|
-
var
|
|
236
|
+
var t, e, r, s, o;
|
|
237
237
|
if (!this.closed) {
|
|
238
238
|
this.closed = !0;
|
|
239
|
-
var
|
|
240
|
-
if (
|
|
241
|
-
if (this._parentage = null, Array.isArray(
|
|
239
|
+
var i = this._parentage;
|
|
240
|
+
if (i)
|
|
241
|
+
if (this._parentage = null, Array.isArray(i))
|
|
242
242
|
try {
|
|
243
|
-
for (var a =
|
|
244
|
-
var
|
|
245
|
-
|
|
243
|
+
for (var a = k(i), u = a.next(); !u.done; u = a.next()) {
|
|
244
|
+
var c = u.value;
|
|
245
|
+
c.remove(this);
|
|
246
246
|
}
|
|
247
|
-
} catch (
|
|
248
|
-
|
|
247
|
+
} catch (p) {
|
|
248
|
+
t = { error: p };
|
|
249
249
|
} finally {
|
|
250
250
|
try {
|
|
251
|
-
|
|
251
|
+
u && !u.done && (e = a.return) && e.call(a);
|
|
252
252
|
} finally {
|
|
253
|
-
if (
|
|
253
|
+
if (t) throw t.error;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
else
|
|
257
|
-
|
|
258
|
-
var
|
|
259
|
-
if (m(
|
|
257
|
+
i.remove(this);
|
|
258
|
+
var h = this.initialTeardown;
|
|
259
|
+
if (m(h))
|
|
260
260
|
try {
|
|
261
|
-
|
|
262
|
-
} catch (
|
|
263
|
-
|
|
261
|
+
h();
|
|
262
|
+
} catch (p) {
|
|
263
|
+
o = p instanceof W ? p.errors : [p];
|
|
264
264
|
}
|
|
265
|
-
var
|
|
266
|
-
if (
|
|
265
|
+
var g = this._finalizers;
|
|
266
|
+
if (g) {
|
|
267
267
|
this._finalizers = null;
|
|
268
268
|
try {
|
|
269
|
-
for (var
|
|
270
|
-
var
|
|
269
|
+
for (var v = k(g), l = v.next(); !l.done; l = v.next()) {
|
|
270
|
+
var f = l.value;
|
|
271
271
|
try {
|
|
272
|
-
|
|
273
|
-
} catch (
|
|
274
|
-
|
|
272
|
+
ie(f);
|
|
273
|
+
} catch (p) {
|
|
274
|
+
o = o ?? [], p instanceof W ? o = $($([], R(o)), R(p.errors)) : o.push(p);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
} catch (
|
|
278
|
-
r = { error:
|
|
277
|
+
} catch (p) {
|
|
278
|
+
r = { error: p };
|
|
279
279
|
} finally {
|
|
280
280
|
try {
|
|
281
|
-
l && !l.done && (
|
|
281
|
+
l && !l.done && (s = v.return) && s.call(v);
|
|
282
282
|
} finally {
|
|
283
283
|
if (r) throw r.error;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
if (
|
|
288
|
-
throw new
|
|
287
|
+
if (o)
|
|
288
|
+
throw new W(o);
|
|
289
289
|
}
|
|
290
|
-
}, n.prototype.add = function(
|
|
291
|
-
var
|
|
292
|
-
if (
|
|
290
|
+
}, n.prototype.add = function(t) {
|
|
291
|
+
var e;
|
|
292
|
+
if (t && t !== this)
|
|
293
293
|
if (this.closed)
|
|
294
|
-
|
|
294
|
+
ie(t);
|
|
295
295
|
else {
|
|
296
|
-
if (
|
|
297
|
-
if (
|
|
296
|
+
if (t instanceof n) {
|
|
297
|
+
if (t.closed || t._hasParent(this))
|
|
298
298
|
return;
|
|
299
|
-
|
|
299
|
+
t._addParent(this);
|
|
300
300
|
}
|
|
301
|
-
(this._finalizers = (
|
|
301
|
+
(this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(t);
|
|
302
302
|
}
|
|
303
|
-
}, n.prototype._hasParent = function(
|
|
304
|
-
var
|
|
305
|
-
return
|
|
306
|
-
}, n.prototype._addParent = function(
|
|
307
|
-
var
|
|
308
|
-
this._parentage = Array.isArray(
|
|
309
|
-
}, n.prototype._removeParent = function(
|
|
310
|
-
var
|
|
311
|
-
|
|
312
|
-
}, n.prototype.remove = function(
|
|
313
|
-
var
|
|
314
|
-
|
|
303
|
+
}, n.prototype._hasParent = function(t) {
|
|
304
|
+
var e = this._parentage;
|
|
305
|
+
return e === t || Array.isArray(e) && e.includes(t);
|
|
306
|
+
}, n.prototype._addParent = function(t) {
|
|
307
|
+
var e = this._parentage;
|
|
308
|
+
this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
|
|
309
|
+
}, n.prototype._removeParent = function(t) {
|
|
310
|
+
var e = this._parentage;
|
|
311
|
+
e === t ? this._parentage = null : Array.isArray(e) && F(e, t);
|
|
312
|
+
}, n.prototype.remove = function(t) {
|
|
313
|
+
var e = this._finalizers;
|
|
314
|
+
e && F(e, t), t instanceof n && t._removeParent(this);
|
|
315
315
|
}, n.EMPTY = (function() {
|
|
316
|
-
var
|
|
317
|
-
return
|
|
316
|
+
var t = new n();
|
|
317
|
+
return t.closed = !0, t;
|
|
318
318
|
})(), n;
|
|
319
|
-
})(),
|
|
320
|
-
function
|
|
321
|
-
return n instanceof
|
|
319
|
+
})(), be = U.EMPTY;
|
|
320
|
+
function Se(n) {
|
|
321
|
+
return n instanceof U || n && "closed" in n && m(n.remove) && m(n.add) && m(n.unsubscribe);
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function ie(n) {
|
|
324
324
|
m(n) ? n() : n.unsubscribe();
|
|
325
325
|
}
|
|
326
|
-
var
|
|
326
|
+
var Ye = {
|
|
327
327
|
Promise: void 0
|
|
328
|
-
},
|
|
329
|
-
setTimeout: function(n,
|
|
330
|
-
for (var
|
|
331
|
-
|
|
332
|
-
return setTimeout.apply(void 0,
|
|
328
|
+
}, We = {
|
|
329
|
+
setTimeout: function(n, t) {
|
|
330
|
+
for (var e = [], r = 2; r < arguments.length; r++)
|
|
331
|
+
e[r - 2] = arguments[r];
|
|
332
|
+
return setTimeout.apply(void 0, $([n, t], R(e)));
|
|
333
333
|
},
|
|
334
334
|
clearTimeout: function(n) {
|
|
335
335
|
return clearTimeout(n);
|
|
336
336
|
},
|
|
337
337
|
delegate: void 0
|
|
338
338
|
};
|
|
339
|
-
function
|
|
340
|
-
|
|
339
|
+
function Ie(n) {
|
|
340
|
+
We.setTimeout(function() {
|
|
341
341
|
throw n;
|
|
342
342
|
});
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function J() {
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function G(n) {
|
|
347
347
|
n();
|
|
348
348
|
}
|
|
349
|
-
var
|
|
350
|
-
|
|
351
|
-
function e
|
|
349
|
+
var ne = (function(n) {
|
|
350
|
+
w(t, n);
|
|
351
|
+
function t(e) {
|
|
352
352
|
var r = n.call(this) || this;
|
|
353
|
-
return r.isStopped = !1,
|
|
354
|
-
}
|
|
355
|
-
return
|
|
356
|
-
return new
|
|
357
|
-
},
|
|
358
|
-
this.isStopped || this._next(
|
|
359
|
-
},
|
|
360
|
-
this.isStopped || (this.isStopped = !0, this._error(
|
|
361
|
-
},
|
|
353
|
+
return r.isStopped = !1, e ? (r.destination = e, Se(e) && e.add(r)) : r.destination = Je, r;
|
|
354
|
+
}
|
|
355
|
+
return t.create = function(e, r, s) {
|
|
356
|
+
return new Q(e, r, s);
|
|
357
|
+
}, t.prototype.next = function(e) {
|
|
358
|
+
this.isStopped || this._next(e);
|
|
359
|
+
}, t.prototype.error = function(e) {
|
|
360
|
+
this.isStopped || (this.isStopped = !0, this._error(e));
|
|
361
|
+
}, t.prototype.complete = function() {
|
|
362
362
|
this.isStopped || (this.isStopped = !0, this._complete());
|
|
363
|
-
},
|
|
363
|
+
}, t.prototype.unsubscribe = function() {
|
|
364
364
|
this.closed || (this.isStopped = !0, n.prototype.unsubscribe.call(this), this.destination = null);
|
|
365
|
-
},
|
|
366
|
-
this.destination.next(
|
|
367
|
-
},
|
|
365
|
+
}, t.prototype._next = function(e) {
|
|
366
|
+
this.destination.next(e);
|
|
367
|
+
}, t.prototype._error = function(e) {
|
|
368
368
|
try {
|
|
369
|
-
this.destination.error(
|
|
369
|
+
this.destination.error(e);
|
|
370
370
|
} finally {
|
|
371
371
|
this.unsubscribe();
|
|
372
372
|
}
|
|
373
|
-
},
|
|
373
|
+
}, t.prototype._complete = function() {
|
|
374
374
|
try {
|
|
375
375
|
this.destination.complete();
|
|
376
376
|
} finally {
|
|
377
377
|
this.unsubscribe();
|
|
378
378
|
}
|
|
379
|
-
},
|
|
380
|
-
})(
|
|
381
|
-
function n(
|
|
382
|
-
this.partialObserver =
|
|
379
|
+
}, t;
|
|
380
|
+
})(U), Xe = (function() {
|
|
381
|
+
function n(t) {
|
|
382
|
+
this.partialObserver = t;
|
|
383
383
|
}
|
|
384
|
-
return n.prototype.next = function(
|
|
385
|
-
var
|
|
386
|
-
if (
|
|
384
|
+
return n.prototype.next = function(t) {
|
|
385
|
+
var e = this.partialObserver;
|
|
386
|
+
if (e.next)
|
|
387
387
|
try {
|
|
388
|
-
|
|
388
|
+
e.next(t);
|
|
389
389
|
} catch (r) {
|
|
390
|
-
|
|
390
|
+
D(r);
|
|
391
391
|
}
|
|
392
|
-
}, n.prototype.error = function(
|
|
393
|
-
var
|
|
394
|
-
if (
|
|
392
|
+
}, n.prototype.error = function(t) {
|
|
393
|
+
var e = this.partialObserver;
|
|
394
|
+
if (e.error)
|
|
395
395
|
try {
|
|
396
|
-
|
|
396
|
+
e.error(t);
|
|
397
397
|
} catch (r) {
|
|
398
|
-
|
|
398
|
+
D(r);
|
|
399
399
|
}
|
|
400
400
|
else
|
|
401
|
-
|
|
401
|
+
D(t);
|
|
402
402
|
}, n.prototype.complete = function() {
|
|
403
|
-
var
|
|
404
|
-
if (
|
|
403
|
+
var t = this.partialObserver;
|
|
404
|
+
if (t.complete)
|
|
405
405
|
try {
|
|
406
|
-
|
|
407
|
-
} catch (
|
|
408
|
-
|
|
406
|
+
t.complete();
|
|
407
|
+
} catch (e) {
|
|
408
|
+
D(e);
|
|
409
409
|
}
|
|
410
410
|
}, n;
|
|
411
|
-
})(),
|
|
412
|
-
|
|
413
|
-
function e
|
|
414
|
-
var
|
|
415
|
-
return m(
|
|
416
|
-
next:
|
|
411
|
+
})(), Q = (function(n) {
|
|
412
|
+
w(t, n);
|
|
413
|
+
function t(e, r, s) {
|
|
414
|
+
var o = n.call(this) || this, i;
|
|
415
|
+
return m(e) || !e ? i = {
|
|
416
|
+
next: e ?? void 0,
|
|
417
417
|
error: r ?? void 0,
|
|
418
|
-
complete:
|
|
419
|
-
} :
|
|
418
|
+
complete: s ?? void 0
|
|
419
|
+
} : i = e, o.destination = new Xe(i), o;
|
|
420
420
|
}
|
|
421
|
-
return
|
|
422
|
-
})(
|
|
423
|
-
function
|
|
424
|
-
|
|
421
|
+
return t;
|
|
422
|
+
})(ne);
|
|
423
|
+
function D(n) {
|
|
424
|
+
Ie(n);
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function ze(n) {
|
|
427
427
|
throw n;
|
|
428
428
|
}
|
|
429
|
-
var
|
|
429
|
+
var Je = {
|
|
430
430
|
closed: !0,
|
|
431
|
-
next:
|
|
432
|
-
error:
|
|
433
|
-
complete:
|
|
434
|
-
},
|
|
431
|
+
next: J,
|
|
432
|
+
error: ze,
|
|
433
|
+
complete: J
|
|
434
|
+
}, re = (function() {
|
|
435
435
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
436
436
|
})();
|
|
437
|
-
function
|
|
437
|
+
function q(n) {
|
|
438
438
|
return n;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
return n.length === 0 ?
|
|
442
|
-
return n.reduce(function(r,
|
|
443
|
-
return
|
|
444
|
-
},
|
|
440
|
+
function Qe(n) {
|
|
441
|
+
return n.length === 0 ? q : n.length === 1 ? n[0] : function(e) {
|
|
442
|
+
return n.reduce(function(r, s) {
|
|
443
|
+
return s(r);
|
|
444
|
+
}, e);
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
var
|
|
448
|
-
function n(
|
|
449
|
-
|
|
447
|
+
var S = (function() {
|
|
448
|
+
function n(t) {
|
|
449
|
+
t && (this._subscribe = t);
|
|
450
450
|
}
|
|
451
|
-
return n.prototype.lift = function(
|
|
452
|
-
var
|
|
453
|
-
return
|
|
454
|
-
}, n.prototype.subscribe = function(
|
|
455
|
-
var
|
|
456
|
-
return
|
|
457
|
-
var
|
|
458
|
-
|
|
459
|
-
}),
|
|
460
|
-
}, n.prototype._trySubscribe = function(
|
|
451
|
+
return n.prototype.lift = function(t) {
|
|
452
|
+
var e = new n();
|
|
453
|
+
return e.source = this, e.operator = t, e;
|
|
454
|
+
}, n.prototype.subscribe = function(t, e, r) {
|
|
455
|
+
var s = this, o = et(t) ? t : new Q(t, e, r);
|
|
456
|
+
return G(function() {
|
|
457
|
+
var i = s, a = i.operator, u = i.source;
|
|
458
|
+
o.add(a ? a.call(o, u) : u ? s._subscribe(o) : s._trySubscribe(o));
|
|
459
|
+
}), o;
|
|
460
|
+
}, n.prototype._trySubscribe = function(t) {
|
|
461
461
|
try {
|
|
462
|
-
return this._subscribe(
|
|
463
|
-
} catch (
|
|
464
|
-
|
|
462
|
+
return this._subscribe(t);
|
|
463
|
+
} catch (e) {
|
|
464
|
+
t.error(e);
|
|
465
465
|
}
|
|
466
|
-
}, n.prototype.forEach = function(
|
|
466
|
+
}, n.prototype.forEach = function(t, e) {
|
|
467
467
|
var r = this;
|
|
468
|
-
return
|
|
469
|
-
var
|
|
468
|
+
return e = ae(e), new e(function(s, o) {
|
|
469
|
+
var i = new Q({
|
|
470
470
|
next: function(a) {
|
|
471
471
|
try {
|
|
472
|
-
|
|
473
|
-
} catch (
|
|
474
|
-
|
|
472
|
+
t(a);
|
|
473
|
+
} catch (u) {
|
|
474
|
+
o(u), i.unsubscribe();
|
|
475
475
|
}
|
|
476
476
|
},
|
|
477
|
-
error:
|
|
478
|
-
complete:
|
|
477
|
+
error: o,
|
|
478
|
+
complete: s
|
|
479
479
|
});
|
|
480
|
-
r.subscribe(
|
|
480
|
+
r.subscribe(i);
|
|
481
481
|
});
|
|
482
|
-
}, n.prototype._subscribe = function(
|
|
483
|
-
var
|
|
484
|
-
return (
|
|
485
|
-
}, n.prototype[
|
|
482
|
+
}, n.prototype._subscribe = function(t) {
|
|
483
|
+
var e;
|
|
484
|
+
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
|
|
485
|
+
}, n.prototype[re] = function() {
|
|
486
486
|
return this;
|
|
487
487
|
}, n.prototype.pipe = function() {
|
|
488
|
-
for (var
|
|
489
|
-
e
|
|
490
|
-
return
|
|
491
|
-
}, n.prototype.toPromise = function(
|
|
492
|
-
var
|
|
493
|
-
return
|
|
494
|
-
var
|
|
495
|
-
|
|
496
|
-
return
|
|
497
|
-
}, function(
|
|
498
|
-
return
|
|
488
|
+
for (var t = [], e = 0; e < arguments.length; e++)
|
|
489
|
+
t[e] = arguments[e];
|
|
490
|
+
return Qe(t)(this);
|
|
491
|
+
}, n.prototype.toPromise = function(t) {
|
|
492
|
+
var e = this;
|
|
493
|
+
return t = ae(t), new t(function(r, s) {
|
|
494
|
+
var o;
|
|
495
|
+
e.subscribe(function(i) {
|
|
496
|
+
return o = i;
|
|
497
|
+
}, function(i) {
|
|
498
|
+
return s(i);
|
|
499
499
|
}, function() {
|
|
500
|
-
return r(
|
|
500
|
+
return r(o);
|
|
501
501
|
});
|
|
502
502
|
});
|
|
503
|
-
}, n.create = function(
|
|
504
|
-
return new n(
|
|
503
|
+
}, n.create = function(t) {
|
|
504
|
+
return new n(t);
|
|
505
505
|
}, n;
|
|
506
506
|
})();
|
|
507
|
-
function
|
|
508
|
-
var
|
|
509
|
-
return (
|
|
507
|
+
function ae(n) {
|
|
508
|
+
var t;
|
|
509
|
+
return (t = n ?? Ye.Promise) !== null && t !== void 0 ? t : Promise;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function Ze(n) {
|
|
512
512
|
return n && m(n.next) && m(n.error) && m(n.complete);
|
|
513
513
|
}
|
|
514
|
-
function
|
|
515
|
-
return n && n instanceof
|
|
514
|
+
function et(n) {
|
|
515
|
+
return n && n instanceof ne || Ze(n) && Se(n);
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function tt(n) {
|
|
518
518
|
return m(n?.lift);
|
|
519
519
|
}
|
|
520
|
-
function
|
|
521
|
-
return function(
|
|
522
|
-
if (
|
|
523
|
-
return
|
|
520
|
+
function M(n) {
|
|
521
|
+
return function(t) {
|
|
522
|
+
if (tt(t))
|
|
523
|
+
return t.lift(function(e) {
|
|
524
524
|
try {
|
|
525
|
-
return n(
|
|
525
|
+
return n(e, this);
|
|
526
526
|
} catch (r) {
|
|
527
527
|
this.error(r);
|
|
528
528
|
}
|
|
@@ -530,820 +530,800 @@ function L(n) {
|
|
|
530
530
|
throw new TypeError("Unable to lift unknown Observable type");
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
|
-
function O(n,
|
|
534
|
-
return new
|
|
533
|
+
function O(n, t, e, r, s) {
|
|
534
|
+
return new nt(n, t, e, r, s);
|
|
535
535
|
}
|
|
536
|
-
var
|
|
537
|
-
|
|
538
|
-
function e
|
|
539
|
-
var
|
|
540
|
-
return
|
|
536
|
+
var nt = (function(n) {
|
|
537
|
+
w(t, n);
|
|
538
|
+
function t(e, r, s, o, i, a) {
|
|
539
|
+
var u = n.call(this, e) || this;
|
|
540
|
+
return u.onFinalize = i, u.shouldUnsubscribe = a, u._next = r ? function(c) {
|
|
541
541
|
try {
|
|
542
|
-
r(
|
|
543
|
-
} catch (
|
|
544
|
-
|
|
542
|
+
r(c);
|
|
543
|
+
} catch (h) {
|
|
544
|
+
e.error(h);
|
|
545
545
|
}
|
|
546
|
-
} : n.prototype._next,
|
|
546
|
+
} : n.prototype._next, u._error = o ? function(c) {
|
|
547
547
|
try {
|
|
548
|
-
|
|
549
|
-
} catch (
|
|
550
|
-
|
|
548
|
+
o(c);
|
|
549
|
+
} catch (h) {
|
|
550
|
+
e.error(h);
|
|
551
551
|
} finally {
|
|
552
552
|
this.unsubscribe();
|
|
553
553
|
}
|
|
554
|
-
} : n.prototype._error,
|
|
554
|
+
} : n.prototype._error, u._complete = s ? function() {
|
|
555
555
|
try {
|
|
556
|
-
|
|
557
|
-
} catch (
|
|
558
|
-
|
|
556
|
+
s();
|
|
557
|
+
} catch (c) {
|
|
558
|
+
e.error(c);
|
|
559
559
|
} finally {
|
|
560
560
|
this.unsubscribe();
|
|
561
561
|
}
|
|
562
|
-
} : n.prototype._complete,
|
|
562
|
+
} : n.prototype._complete, u;
|
|
563
563
|
}
|
|
564
|
-
return
|
|
565
|
-
var
|
|
564
|
+
return t.prototype.unsubscribe = function() {
|
|
565
|
+
var e;
|
|
566
566
|
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
567
567
|
var r = this.closed;
|
|
568
|
-
n.prototype.unsubscribe.call(this), !r && ((
|
|
568
|
+
n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
569
569
|
}
|
|
570
|
-
},
|
|
571
|
-
})(
|
|
570
|
+
}, t;
|
|
571
|
+
})(ne), rt = ye(function(n) {
|
|
572
572
|
return function() {
|
|
573
573
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
574
574
|
};
|
|
575
|
-
}),
|
|
576
|
-
|
|
577
|
-
function
|
|
578
|
-
var
|
|
579
|
-
return
|
|
575
|
+
}), se = (function(n) {
|
|
576
|
+
w(t, n);
|
|
577
|
+
function t() {
|
|
578
|
+
var e = n.call(this) || this;
|
|
579
|
+
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
580
580
|
}
|
|
581
|
-
return
|
|
582
|
-
var r = new
|
|
583
|
-
return r.operator =
|
|
584
|
-
},
|
|
581
|
+
return t.prototype.lift = function(e) {
|
|
582
|
+
var r = new ce(this, this);
|
|
583
|
+
return r.operator = e, r;
|
|
584
|
+
}, t.prototype._throwIfClosed = function() {
|
|
585
585
|
if (this.closed)
|
|
586
|
-
throw new
|
|
587
|
-
},
|
|
586
|
+
throw new rt();
|
|
587
|
+
}, t.prototype.next = function(e) {
|
|
588
588
|
var r = this;
|
|
589
|
-
|
|
590
|
-
var
|
|
589
|
+
G(function() {
|
|
590
|
+
var s, o;
|
|
591
591
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
592
592
|
r.currentObservers || (r.currentObservers = Array.from(r.observers));
|
|
593
593
|
try {
|
|
594
|
-
for (var
|
|
595
|
-
var
|
|
596
|
-
|
|
594
|
+
for (var i = k(r.currentObservers), a = i.next(); !a.done; a = i.next()) {
|
|
595
|
+
var u = a.value;
|
|
596
|
+
u.next(e);
|
|
597
597
|
}
|
|
598
|
-
} catch (
|
|
599
|
-
|
|
598
|
+
} catch (c) {
|
|
599
|
+
s = { error: c };
|
|
600
600
|
} finally {
|
|
601
601
|
try {
|
|
602
|
-
a && !a.done && (
|
|
602
|
+
a && !a.done && (o = i.return) && o.call(i);
|
|
603
603
|
} finally {
|
|
604
|
-
if (
|
|
604
|
+
if (s) throw s.error;
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
});
|
|
609
|
-
},
|
|
609
|
+
}, t.prototype.error = function(e) {
|
|
610
610
|
var r = this;
|
|
611
|
-
|
|
611
|
+
G(function() {
|
|
612
612
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
613
|
-
r.hasError = r.isStopped = !0, r.thrownError =
|
|
614
|
-
for (var
|
|
615
|
-
|
|
613
|
+
r.hasError = r.isStopped = !0, r.thrownError = e;
|
|
614
|
+
for (var s = r.observers; s.length; )
|
|
615
|
+
s.shift().error(e);
|
|
616
616
|
}
|
|
617
617
|
});
|
|
618
|
-
},
|
|
619
|
-
var
|
|
620
|
-
|
|
621
|
-
if (
|
|
622
|
-
|
|
623
|
-
for (var r =
|
|
618
|
+
}, t.prototype.complete = function() {
|
|
619
|
+
var e = this;
|
|
620
|
+
G(function() {
|
|
621
|
+
if (e._throwIfClosed(), !e.isStopped) {
|
|
622
|
+
e.isStopped = !0;
|
|
623
|
+
for (var r = e.observers; r.length; )
|
|
624
624
|
r.shift().complete();
|
|
625
625
|
}
|
|
626
626
|
});
|
|
627
|
-
},
|
|
627
|
+
}, t.prototype.unsubscribe = function() {
|
|
628
628
|
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
|
|
629
|
-
}, Object.defineProperty(
|
|
629
|
+
}, Object.defineProperty(t.prototype, "observed", {
|
|
630
630
|
get: function() {
|
|
631
|
-
var
|
|
632
|
-
return ((
|
|
631
|
+
var e;
|
|
632
|
+
return ((e = this.observers) === null || e === void 0 ? void 0 : e.length) > 0;
|
|
633
633
|
},
|
|
634
634
|
enumerable: !1,
|
|
635
635
|
configurable: !0
|
|
636
|
-
}),
|
|
637
|
-
return this._throwIfClosed(), n.prototype._trySubscribe.call(this,
|
|
638
|
-
},
|
|
639
|
-
return this._throwIfClosed(), this._checkFinalizedStatuses(
|
|
640
|
-
},
|
|
641
|
-
var r = this,
|
|
642
|
-
return
|
|
643
|
-
r.currentObservers = null,
|
|
636
|
+
}), t.prototype._trySubscribe = function(e) {
|
|
637
|
+
return this._throwIfClosed(), n.prototype._trySubscribe.call(this, e);
|
|
638
|
+
}, t.prototype._subscribe = function(e) {
|
|
639
|
+
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
|
640
|
+
}, t.prototype._innerSubscribe = function(e) {
|
|
641
|
+
var r = this, s = this, o = s.hasError, i = s.isStopped, a = s.observers;
|
|
642
|
+
return o || i ? be : (this.currentObservers = null, a.push(e), new U(function() {
|
|
643
|
+
r.currentObservers = null, F(a, e);
|
|
644
644
|
}));
|
|
645
|
-
},
|
|
646
|
-
var r = this,
|
|
647
|
-
|
|
648
|
-
},
|
|
649
|
-
var
|
|
650
|
-
return
|
|
651
|
-
},
|
|
652
|
-
return new
|
|
653
|
-
},
|
|
654
|
-
})(
|
|
655
|
-
|
|
656
|
-
function e
|
|
657
|
-
var
|
|
658
|
-
return
|
|
659
|
-
}
|
|
660
|
-
return
|
|
661
|
-
var r,
|
|
662
|
-
(
|
|
663
|
-
},
|
|
664
|
-
var r,
|
|
665
|
-
(
|
|
666
|
-
},
|
|
667
|
-
var
|
|
668
|
-
(r = (
|
|
669
|
-
},
|
|
670
|
-
var r,
|
|
671
|
-
return (
|
|
672
|
-
},
|
|
673
|
-
})(
|
|
674
|
-
|
|
675
|
-
function e
|
|
645
|
+
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
646
|
+
var r = this, s = r.hasError, o = r.thrownError, i = r.isStopped;
|
|
647
|
+
s ? e.error(o) : i && e.complete();
|
|
648
|
+
}, t.prototype.asObservable = function() {
|
|
649
|
+
var e = new S();
|
|
650
|
+
return e.source = this, e;
|
|
651
|
+
}, t.create = function(e, r) {
|
|
652
|
+
return new ce(e, r);
|
|
653
|
+
}, t;
|
|
654
|
+
})(S), ce = (function(n) {
|
|
655
|
+
w(t, n);
|
|
656
|
+
function t(e, r) {
|
|
657
|
+
var s = n.call(this) || this;
|
|
658
|
+
return s.destination = e, s.source = r, s;
|
|
659
|
+
}
|
|
660
|
+
return t.prototype.next = function(e) {
|
|
661
|
+
var r, s;
|
|
662
|
+
(s = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || s === void 0 || s.call(r, e);
|
|
663
|
+
}, t.prototype.error = function(e) {
|
|
664
|
+
var r, s;
|
|
665
|
+
(s = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || s === void 0 || s.call(r, e);
|
|
666
|
+
}, t.prototype.complete = function() {
|
|
667
|
+
var e, r;
|
|
668
|
+
(r = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || r === void 0 || r.call(e);
|
|
669
|
+
}, t.prototype._subscribe = function(e) {
|
|
670
|
+
var r, s;
|
|
671
|
+
return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s : be;
|
|
672
|
+
}, t;
|
|
673
|
+
})(se), N = (function(n) {
|
|
674
|
+
w(t, n);
|
|
675
|
+
function t(e) {
|
|
676
676
|
var r = n.call(this) || this;
|
|
677
|
-
return r._value =
|
|
677
|
+
return r._value = e, r;
|
|
678
678
|
}
|
|
679
|
-
return Object.defineProperty(
|
|
679
|
+
return Object.defineProperty(t.prototype, "value", {
|
|
680
680
|
get: function() {
|
|
681
681
|
return this.getValue();
|
|
682
682
|
},
|
|
683
683
|
enumerable: !1,
|
|
684
684
|
configurable: !0
|
|
685
|
-
}),
|
|
686
|
-
var r = n.prototype._subscribe.call(this,
|
|
687
|
-
return !r.closed &&
|
|
688
|
-
},
|
|
689
|
-
var
|
|
685
|
+
}), t.prototype._subscribe = function(e) {
|
|
686
|
+
var r = n.prototype._subscribe.call(this, e);
|
|
687
|
+
return !r.closed && e.next(this._value), r;
|
|
688
|
+
}, t.prototype.getValue = function() {
|
|
689
|
+
var e = this, r = e.hasError, s = e.thrownError, o = e._value;
|
|
690
690
|
if (r)
|
|
691
|
-
throw
|
|
692
|
-
return this._throwIfClosed(),
|
|
693
|
-
},
|
|
694
|
-
n.prototype.next.call(this, this._value =
|
|
695
|
-
},
|
|
696
|
-
})(
|
|
691
|
+
throw s;
|
|
692
|
+
return this._throwIfClosed(), o;
|
|
693
|
+
}, t.prototype.next = function(e) {
|
|
694
|
+
n.prototype.next.call(this, this._value = e);
|
|
695
|
+
}, t;
|
|
696
|
+
})(se), st = {
|
|
697
697
|
now: function() {
|
|
698
698
|
return Date.now();
|
|
699
699
|
}
|
|
700
|
-
},
|
|
701
|
-
|
|
702
|
-
function e
|
|
700
|
+
}, ot = (function(n) {
|
|
701
|
+
w(t, n);
|
|
702
|
+
function t(e, r) {
|
|
703
703
|
return n.call(this) || this;
|
|
704
704
|
}
|
|
705
|
-
return
|
|
705
|
+
return t.prototype.schedule = function(e, r) {
|
|
706
706
|
return this;
|
|
707
|
-
},
|
|
708
|
-
})(
|
|
709
|
-
setInterval: function(n,
|
|
710
|
-
for (var
|
|
711
|
-
|
|
712
|
-
return setInterval.apply(void 0,
|
|
707
|
+
}, t;
|
|
708
|
+
})(U), ue = {
|
|
709
|
+
setInterval: function(n, t) {
|
|
710
|
+
for (var e = [], r = 2; r < arguments.length; r++)
|
|
711
|
+
e[r - 2] = arguments[r];
|
|
712
|
+
return setInterval.apply(void 0, $([n, t], R(e)));
|
|
713
713
|
},
|
|
714
714
|
clearInterval: function(n) {
|
|
715
715
|
return clearInterval(n);
|
|
716
716
|
},
|
|
717
717
|
delegate: void 0
|
|
718
|
-
},
|
|
719
|
-
|
|
720
|
-
function e
|
|
721
|
-
var
|
|
722
|
-
return
|
|
723
|
-
}
|
|
724
|
-
return
|
|
725
|
-
var
|
|
718
|
+
}, it = (function(n) {
|
|
719
|
+
w(t, n);
|
|
720
|
+
function t(e, r) {
|
|
721
|
+
var s = n.call(this, e, r) || this;
|
|
722
|
+
return s.scheduler = e, s.work = r, s.pending = !1, s;
|
|
723
|
+
}
|
|
724
|
+
return t.prototype.schedule = function(e, r) {
|
|
725
|
+
var s;
|
|
726
726
|
if (r === void 0 && (r = 0), this.closed)
|
|
727
727
|
return this;
|
|
728
|
-
this.state =
|
|
729
|
-
var
|
|
730
|
-
return
|
|
731
|
-
},
|
|
732
|
-
return
|
|
733
|
-
},
|
|
734
|
-
if (
|
|
728
|
+
this.state = e;
|
|
729
|
+
var o = this.id, i = this.scheduler;
|
|
730
|
+
return o != null && (this.id = this.recycleAsyncId(i, o, r)), this.pending = !0, this.delay = r, this.id = (s = this.id) !== null && s !== void 0 ? s : this.requestAsyncId(i, this.id, r), this;
|
|
731
|
+
}, t.prototype.requestAsyncId = function(e, r, s) {
|
|
732
|
+
return s === void 0 && (s = 0), ue.setInterval(e.flush.bind(e, this), s);
|
|
733
|
+
}, t.prototype.recycleAsyncId = function(e, r, s) {
|
|
734
|
+
if (s === void 0 && (s = 0), s != null && this.delay === s && this.pending === !1)
|
|
735
735
|
return r;
|
|
736
|
-
r != null &&
|
|
737
|
-
},
|
|
736
|
+
r != null && ue.clearInterval(r);
|
|
737
|
+
}, t.prototype.execute = function(e, r) {
|
|
738
738
|
if (this.closed)
|
|
739
739
|
return new Error("executing a cancelled action");
|
|
740
740
|
this.pending = !1;
|
|
741
|
-
var
|
|
742
|
-
if (
|
|
743
|
-
return
|
|
741
|
+
var s = this._execute(e, r);
|
|
742
|
+
if (s)
|
|
743
|
+
return s;
|
|
744
744
|
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
|
|
745
|
-
},
|
|
746
|
-
var
|
|
745
|
+
}, t.prototype._execute = function(e, r) {
|
|
746
|
+
var s = !1, o;
|
|
747
747
|
try {
|
|
748
|
-
this.work(
|
|
749
|
-
} catch (
|
|
750
|
-
|
|
748
|
+
this.work(e);
|
|
749
|
+
} catch (i) {
|
|
750
|
+
s = !0, o = i || new Error("Scheduled action threw falsy error");
|
|
751
751
|
}
|
|
752
|
-
if (
|
|
753
|
-
return this.unsubscribe(),
|
|
754
|
-
},
|
|
752
|
+
if (s)
|
|
753
|
+
return this.unsubscribe(), o;
|
|
754
|
+
}, t.prototype.unsubscribe = function() {
|
|
755
755
|
if (!this.closed) {
|
|
756
|
-
var
|
|
757
|
-
this.work = this.state = this.scheduler = null, this.pending = !1,
|
|
756
|
+
var e = this, r = e.id, s = e.scheduler, o = s.actions;
|
|
757
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, F(o, this), r != null && (this.id = this.recycleAsyncId(s, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
|
|
758
758
|
}
|
|
759
|
-
},
|
|
760
|
-
})(
|
|
761
|
-
function n(
|
|
762
|
-
|
|
763
|
-
}
|
|
764
|
-
return n.prototype.schedule = function(
|
|
765
|
-
return
|
|
766
|
-
}, n.now =
|
|
767
|
-
})(),
|
|
768
|
-
|
|
769
|
-
function e
|
|
770
|
-
r === void 0 && (r =
|
|
771
|
-
var
|
|
772
|
-
return
|
|
773
|
-
}
|
|
774
|
-
return
|
|
759
|
+
}, t;
|
|
760
|
+
})(ot), le = (function() {
|
|
761
|
+
function n(t, e) {
|
|
762
|
+
e === void 0 && (e = n.now), this.schedulerActionCtor = t, this.now = e;
|
|
763
|
+
}
|
|
764
|
+
return n.prototype.schedule = function(t, e, r) {
|
|
765
|
+
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
|
|
766
|
+
}, n.now = st.now, n;
|
|
767
|
+
})(), at = (function(n) {
|
|
768
|
+
w(t, n);
|
|
769
|
+
function t(e, r) {
|
|
770
|
+
r === void 0 && (r = le.now);
|
|
771
|
+
var s = n.call(this, e, r) || this;
|
|
772
|
+
return s.actions = [], s._active = !1, s;
|
|
773
|
+
}
|
|
774
|
+
return t.prototype.flush = function(e) {
|
|
775
775
|
var r = this.actions;
|
|
776
776
|
if (this._active) {
|
|
777
|
-
r.push(
|
|
777
|
+
r.push(e);
|
|
778
778
|
return;
|
|
779
779
|
}
|
|
780
|
-
var
|
|
780
|
+
var s;
|
|
781
781
|
this._active = !0;
|
|
782
782
|
do
|
|
783
|
-
if (
|
|
783
|
+
if (s = e.execute(e.state, e.delay))
|
|
784
784
|
break;
|
|
785
|
-
while (
|
|
786
|
-
if (this._active = !1,
|
|
787
|
-
for (;
|
|
788
|
-
|
|
789
|
-
throw
|
|
785
|
+
while (e = r.shift());
|
|
786
|
+
if (this._active = !1, s) {
|
|
787
|
+
for (; e = r.shift(); )
|
|
788
|
+
e.unsubscribe();
|
|
789
|
+
throw s;
|
|
790
790
|
}
|
|
791
|
-
},
|
|
792
|
-
})(
|
|
791
|
+
}, t;
|
|
792
|
+
})(le), Ee = new at(it), ct = Ee, ut = new S(function(n) {
|
|
793
793
|
return n.complete();
|
|
794
794
|
});
|
|
795
|
-
function
|
|
795
|
+
function we(n) {
|
|
796
796
|
return n && m(n.schedule);
|
|
797
797
|
}
|
|
798
|
-
function
|
|
798
|
+
function Te(n) {
|
|
799
799
|
return n[n.length - 1];
|
|
800
800
|
}
|
|
801
|
-
function
|
|
802
|
-
return m(
|
|
801
|
+
function lt(n) {
|
|
802
|
+
return m(Te(n)) ? n.pop() : void 0;
|
|
803
803
|
}
|
|
804
|
-
function
|
|
805
|
-
return
|
|
804
|
+
function Ce(n) {
|
|
805
|
+
return we(Te(n)) ? n.pop() : void 0;
|
|
806
806
|
}
|
|
807
|
-
var
|
|
807
|
+
var Oe = (function(n) {
|
|
808
808
|
return n && typeof n.length == "number" && typeof n != "function";
|
|
809
809
|
});
|
|
810
|
-
function
|
|
810
|
+
function Ae(n) {
|
|
811
811
|
return m(n?.then);
|
|
812
812
|
}
|
|
813
|
-
function
|
|
814
|
-
return m(n[
|
|
813
|
+
function _e(n) {
|
|
814
|
+
return m(n[re]);
|
|
815
815
|
}
|
|
816
|
-
function
|
|
816
|
+
function Me(n) {
|
|
817
817
|
return Symbol.asyncIterator && m(n?.[Symbol.asyncIterator]);
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function xe(n) {
|
|
820
820
|
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.");
|
|
821
821
|
}
|
|
822
|
-
function
|
|
822
|
+
function dt() {
|
|
823
823
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
824
824
|
}
|
|
825
|
-
var
|
|
826
|
-
function
|
|
827
|
-
return m(n?.[
|
|
825
|
+
var Le = dt();
|
|
826
|
+
function ke(n) {
|
|
827
|
+
return m(n?.[Le]);
|
|
828
828
|
}
|
|
829
|
-
function
|
|
830
|
-
return
|
|
831
|
-
var
|
|
832
|
-
return
|
|
833
|
-
switch (
|
|
829
|
+
function Pe(n) {
|
|
830
|
+
return qe(this, arguments, function() {
|
|
831
|
+
var e, r, s, o;
|
|
832
|
+
return ve(this, function(i) {
|
|
833
|
+
switch (i.label) {
|
|
834
834
|
case 0:
|
|
835
|
-
|
|
835
|
+
e = n.getReader(), i.label = 1;
|
|
836
836
|
case 1:
|
|
837
|
-
|
|
837
|
+
i.trys.push([1, , 9, 10]), i.label = 2;
|
|
838
838
|
case 2:
|
|
839
|
-
return [4,
|
|
839
|
+
return [4, L(e.read())];
|
|
840
840
|
case 3:
|
|
841
|
-
return r =
|
|
841
|
+
return r = i.sent(), s = r.value, o = r.done, o ? [4, L(void 0)] : [3, 5];
|
|
842
842
|
case 4:
|
|
843
|
-
return [2,
|
|
843
|
+
return [2, i.sent()];
|
|
844
844
|
case 5:
|
|
845
|
-
return [4,
|
|
845
|
+
return [4, L(s)];
|
|
846
846
|
case 6:
|
|
847
|
-
return [4,
|
|
847
|
+
return [4, i.sent()];
|
|
848
848
|
case 7:
|
|
849
|
-
return
|
|
849
|
+
return i.sent(), [3, 2];
|
|
850
850
|
case 8:
|
|
851
851
|
return [3, 10];
|
|
852
852
|
case 9:
|
|
853
|
-
return
|
|
853
|
+
return e.releaseLock(), [7];
|
|
854
854
|
case 10:
|
|
855
855
|
return [2];
|
|
856
856
|
}
|
|
857
857
|
});
|
|
858
858
|
});
|
|
859
859
|
}
|
|
860
|
-
function
|
|
860
|
+
function Ue(n) {
|
|
861
861
|
return m(n?.getReader);
|
|
862
862
|
}
|
|
863
|
-
function
|
|
864
|
-
if (n instanceof
|
|
863
|
+
function x(n) {
|
|
864
|
+
if (n instanceof S)
|
|
865
865
|
return n;
|
|
866
866
|
if (n != null) {
|
|
867
|
-
if (Ie(n))
|
|
868
|
-
return ut(n);
|
|
869
|
-
if (Ee(n))
|
|
870
|
-
return lt(n);
|
|
871
|
-
if (Oe(n))
|
|
872
|
-
return ft(n);
|
|
873
|
-
if (Ce(n))
|
|
874
|
-
return Pe(n);
|
|
875
867
|
if (_e(n))
|
|
876
|
-
return dt(n);
|
|
877
|
-
if (xe(n))
|
|
878
868
|
return ht(n);
|
|
869
|
+
if (Oe(n))
|
|
870
|
+
return ft(n);
|
|
871
|
+
if (Ae(n))
|
|
872
|
+
return pt(n);
|
|
873
|
+
if (Me(n))
|
|
874
|
+
return Ne(n);
|
|
875
|
+
if (ke(n))
|
|
876
|
+
return gt(n);
|
|
877
|
+
if (Ue(n))
|
|
878
|
+
return mt(n);
|
|
879
879
|
}
|
|
880
|
-
throw
|
|
880
|
+
throw xe(n);
|
|
881
881
|
}
|
|
882
|
-
function
|
|
883
|
-
return new
|
|
884
|
-
var
|
|
885
|
-
if (m(
|
|
886
|
-
return
|
|
882
|
+
function ht(n) {
|
|
883
|
+
return new S(function(t) {
|
|
884
|
+
var e = n[re]();
|
|
885
|
+
if (m(e.subscribe))
|
|
886
|
+
return e.subscribe(t);
|
|
887
887
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
888
888
|
});
|
|
889
889
|
}
|
|
890
|
-
function
|
|
891
|
-
return new
|
|
892
|
-
for (var
|
|
893
|
-
|
|
894
|
-
|
|
890
|
+
function ft(n) {
|
|
891
|
+
return new S(function(t) {
|
|
892
|
+
for (var e = 0; e < n.length && !t.closed; e++)
|
|
893
|
+
t.next(n[e]);
|
|
894
|
+
t.complete();
|
|
895
895
|
});
|
|
896
896
|
}
|
|
897
|
-
function
|
|
898
|
-
return new
|
|
899
|
-
n.then(function(
|
|
900
|
-
|
|
901
|
-
}, function(
|
|
902
|
-
return
|
|
903
|
-
}).then(null,
|
|
897
|
+
function pt(n) {
|
|
898
|
+
return new S(function(t) {
|
|
899
|
+
n.then(function(e) {
|
|
900
|
+
t.closed || (t.next(e), t.complete());
|
|
901
|
+
}, function(e) {
|
|
902
|
+
return t.error(e);
|
|
903
|
+
}).then(null, Ie);
|
|
904
904
|
});
|
|
905
905
|
}
|
|
906
|
-
function
|
|
907
|
-
return new
|
|
908
|
-
var
|
|
906
|
+
function gt(n) {
|
|
907
|
+
return new S(function(t) {
|
|
908
|
+
var e, r;
|
|
909
909
|
try {
|
|
910
|
-
for (var
|
|
911
|
-
var
|
|
912
|
-
if (
|
|
910
|
+
for (var s = k(n), o = s.next(); !o.done; o = s.next()) {
|
|
911
|
+
var i = o.value;
|
|
912
|
+
if (t.next(i), t.closed)
|
|
913
913
|
return;
|
|
914
914
|
}
|
|
915
915
|
} catch (a) {
|
|
916
|
-
|
|
916
|
+
e = { error: a };
|
|
917
917
|
} finally {
|
|
918
918
|
try {
|
|
919
|
-
|
|
919
|
+
o && !o.done && (r = s.return) && r.call(s);
|
|
920
920
|
} finally {
|
|
921
|
-
if (
|
|
921
|
+
if (e) throw e.error;
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
|
-
|
|
924
|
+
t.complete();
|
|
925
925
|
});
|
|
926
926
|
}
|
|
927
|
-
function
|
|
928
|
-
return new
|
|
929
|
-
|
|
930
|
-
return
|
|
927
|
+
function Ne(n) {
|
|
928
|
+
return new S(function(t) {
|
|
929
|
+
vt(n, t).catch(function(e) {
|
|
930
|
+
return t.error(e);
|
|
931
931
|
});
|
|
932
932
|
});
|
|
933
933
|
}
|
|
934
|
-
function
|
|
935
|
-
return Pe(
|
|
936
|
-
}
|
|
937
|
-
function
|
|
938
|
-
var
|
|
939
|
-
return
|
|
940
|
-
var
|
|
941
|
-
return
|
|
942
|
-
switch (
|
|
934
|
+
function mt(n) {
|
|
935
|
+
return Ne(Pe(n));
|
|
936
|
+
}
|
|
937
|
+
function vt(n, t) {
|
|
938
|
+
var e, r, s, o;
|
|
939
|
+
return Be(this, void 0, void 0, function() {
|
|
940
|
+
var i, a;
|
|
941
|
+
return ve(this, function(u) {
|
|
942
|
+
switch (u.label) {
|
|
943
943
|
case 0:
|
|
944
|
-
|
|
944
|
+
u.trys.push([0, 5, 6, 11]), e = Ve(n), u.label = 1;
|
|
945
945
|
case 1:
|
|
946
|
-
return [4,
|
|
946
|
+
return [4, e.next()];
|
|
947
947
|
case 2:
|
|
948
|
-
if (r =
|
|
949
|
-
if (
|
|
948
|
+
if (r = u.sent(), !!r.done) return [3, 4];
|
|
949
|
+
if (i = r.value, t.next(i), t.closed)
|
|
950
950
|
return [2];
|
|
951
|
-
|
|
951
|
+
u.label = 3;
|
|
952
952
|
case 3:
|
|
953
953
|
return [3, 1];
|
|
954
954
|
case 4:
|
|
955
955
|
return [3, 11];
|
|
956
956
|
case 5:
|
|
957
|
-
return a =
|
|
957
|
+
return a = u.sent(), s = { error: a }, [3, 11];
|
|
958
958
|
case 6:
|
|
959
|
-
return
|
|
959
|
+
return u.trys.push([6, , 9, 10]), r && !r.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
|
|
960
960
|
case 7:
|
|
961
|
-
|
|
961
|
+
u.sent(), u.label = 8;
|
|
962
962
|
case 8:
|
|
963
963
|
return [3, 10];
|
|
964
964
|
case 9:
|
|
965
|
-
if (
|
|
965
|
+
if (s) throw s.error;
|
|
966
966
|
return [7];
|
|
967
967
|
case 10:
|
|
968
968
|
return [7];
|
|
969
969
|
case 11:
|
|
970
|
-
return
|
|
970
|
+
return t.complete(), [2];
|
|
971
971
|
}
|
|
972
972
|
});
|
|
973
973
|
});
|
|
974
974
|
}
|
|
975
|
-
function
|
|
976
|
-
r === void 0 && (r = 0),
|
|
977
|
-
var
|
|
978
|
-
|
|
975
|
+
function C(n, t, e, r, s) {
|
|
976
|
+
r === void 0 && (r = 0), s === void 0 && (s = !1);
|
|
977
|
+
var o = t.schedule(function() {
|
|
978
|
+
e(), s ? n.add(this.schedule(null, r)) : this.unsubscribe();
|
|
979
979
|
}, r);
|
|
980
|
-
if (n.add(
|
|
981
|
-
return
|
|
982
|
-
}
|
|
983
|
-
function
|
|
984
|
-
return
|
|
985
|
-
|
|
986
|
-
return
|
|
987
|
-
return r.next(
|
|
988
|
-
},
|
|
980
|
+
if (n.add(o), !s)
|
|
981
|
+
return o;
|
|
982
|
+
}
|
|
983
|
+
function Re(n, t) {
|
|
984
|
+
return t === void 0 && (t = 0), M(function(e, r) {
|
|
985
|
+
e.subscribe(O(r, function(s) {
|
|
986
|
+
return C(r, n, function() {
|
|
987
|
+
return r.next(s);
|
|
988
|
+
}, t);
|
|
989
989
|
}, function() {
|
|
990
|
-
return
|
|
990
|
+
return C(r, n, function() {
|
|
991
991
|
return r.complete();
|
|
992
|
-
},
|
|
993
|
-
}, function(
|
|
994
|
-
return
|
|
995
|
-
return r.error(
|
|
996
|
-
},
|
|
992
|
+
}, t);
|
|
993
|
+
}, function(s) {
|
|
994
|
+
return C(r, n, function() {
|
|
995
|
+
return r.error(s);
|
|
996
|
+
}, t);
|
|
997
997
|
}));
|
|
998
998
|
});
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1001
|
-
return
|
|
1000
|
+
function $e(n, t) {
|
|
1001
|
+
return t === void 0 && (t = 0), M(function(e, r) {
|
|
1002
1002
|
r.add(n.schedule(function() {
|
|
1003
|
-
return
|
|
1004
|
-
},
|
|
1003
|
+
return e.subscribe(r);
|
|
1004
|
+
}, t));
|
|
1005
1005
|
});
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1008
|
-
return
|
|
1007
|
+
function yt(n, t) {
|
|
1008
|
+
return x(n).pipe($e(t), Re(t));
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1011
|
-
return
|
|
1010
|
+
function bt(n, t) {
|
|
1011
|
+
return x(n).pipe($e(t), Re(t));
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return new
|
|
1013
|
+
function St(n, t) {
|
|
1014
|
+
return new S(function(e) {
|
|
1015
1015
|
var r = 0;
|
|
1016
|
-
return
|
|
1017
|
-
r === n.length ?
|
|
1016
|
+
return t.schedule(function() {
|
|
1017
|
+
r === n.length ? e.complete() : (e.next(n[r++]), e.closed || this.schedule());
|
|
1018
1018
|
});
|
|
1019
1019
|
});
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1022
|
-
return new
|
|
1021
|
+
function It(n, t) {
|
|
1022
|
+
return new S(function(e) {
|
|
1023
1023
|
var r;
|
|
1024
|
-
return
|
|
1025
|
-
r = n[
|
|
1026
|
-
var o, i
|
|
1024
|
+
return C(e, t, function() {
|
|
1025
|
+
r = n[Le](), C(e, t, function() {
|
|
1026
|
+
var s, o, i;
|
|
1027
1027
|
try {
|
|
1028
|
-
|
|
1028
|
+
s = r.next(), o = s.value, i = s.done;
|
|
1029
1029
|
} catch (a) {
|
|
1030
|
-
|
|
1030
|
+
e.error(a);
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
|
-
|
|
1033
|
+
i ? e.complete() : e.next(o);
|
|
1034
1034
|
}, 0, !0);
|
|
1035
1035
|
}), function() {
|
|
1036
1036
|
return m(r?.return) && r.return();
|
|
1037
1037
|
};
|
|
1038
1038
|
});
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1040
|
+
function je(n, t) {
|
|
1041
1041
|
if (!n)
|
|
1042
1042
|
throw new Error("Iterable cannot be null");
|
|
1043
|
-
return new
|
|
1044
|
-
|
|
1043
|
+
return new S(function(e) {
|
|
1044
|
+
C(e, t, function() {
|
|
1045
1045
|
var r = n[Symbol.asyncIterator]();
|
|
1046
|
-
|
|
1047
|
-
r.next().then(function(
|
|
1048
|
-
|
|
1046
|
+
C(e, t, function() {
|
|
1047
|
+
r.next().then(function(s) {
|
|
1048
|
+
s.done ? e.complete() : e.next(s.value);
|
|
1049
1049
|
});
|
|
1050
1050
|
}, 0, !0);
|
|
1051
1051
|
});
|
|
1052
1052
|
});
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1055
|
-
return
|
|
1054
|
+
function Et(n, t) {
|
|
1055
|
+
return je(Pe(n), t);
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function wt(n, t) {
|
|
1058
1058
|
if (n != null) {
|
|
1059
|
-
if (Ie(n))
|
|
1060
|
-
return vt(n, e);
|
|
1061
|
-
if (Ee(n))
|
|
1062
|
-
return mt(n, e);
|
|
1063
|
-
if (Oe(n))
|
|
1064
|
-
return yt(n, e);
|
|
1065
|
-
if (Ce(n))
|
|
1066
|
-
return Ne(n, e);
|
|
1067
1059
|
if (_e(n))
|
|
1068
|
-
return
|
|
1069
|
-
if (
|
|
1070
|
-
return
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1060
|
+
return yt(n, t);
|
|
1061
|
+
if (Oe(n))
|
|
1062
|
+
return St(n, t);
|
|
1063
|
+
if (Ae(n))
|
|
1064
|
+
return bt(n, t);
|
|
1065
|
+
if (Me(n))
|
|
1066
|
+
return je(n, t);
|
|
1067
|
+
if (ke(n))
|
|
1068
|
+
return It(n, t);
|
|
1069
|
+
if (Ue(n))
|
|
1070
|
+
return Et(n, t);
|
|
1071
|
+
}
|
|
1072
|
+
throw xe(n);
|
|
1073
|
+
}
|
|
1074
|
+
function oe(n, t) {
|
|
1075
|
+
return t ? wt(n, t) : x(n);
|
|
1076
|
+
}
|
|
1077
|
+
function Tt() {
|
|
1078
|
+
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1079
|
+
n[t] = arguments[t];
|
|
1080
|
+
var e = Ce(n);
|
|
1081
|
+
return oe(n, e);
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1083
|
+
function Ct(n) {
|
|
1084
1084
|
return n instanceof Date && !isNaN(n);
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1087
|
-
return
|
|
1088
|
-
var
|
|
1089
|
-
|
|
1090
|
-
r.next(n.call(
|
|
1086
|
+
function P(n, t) {
|
|
1087
|
+
return M(function(e, r) {
|
|
1088
|
+
var s = 0;
|
|
1089
|
+
e.subscribe(O(r, function(o) {
|
|
1090
|
+
r.next(n.call(t, o, s++));
|
|
1091
1091
|
}));
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
1094
|
var Ot = Array.isArray;
|
|
1095
|
-
function
|
|
1096
|
-
return Ot(
|
|
1095
|
+
function At(n, t) {
|
|
1096
|
+
return Ot(t) ? n.apply(void 0, $([], R(t))) : n(t);
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1099
|
-
return
|
|
1100
|
-
return
|
|
1098
|
+
function _t(n) {
|
|
1099
|
+
return P(function(t) {
|
|
1100
|
+
return At(n, t);
|
|
1101
1101
|
});
|
|
1102
1102
|
}
|
|
1103
|
-
var
|
|
1104
|
-
function
|
|
1103
|
+
var Mt = Array.isArray, xt = Object.getPrototypeOf, Lt = Object.prototype, kt = Object.keys;
|
|
1104
|
+
function Pt(n) {
|
|
1105
1105
|
if (n.length === 1) {
|
|
1106
|
-
var
|
|
1107
|
-
if (
|
|
1108
|
-
return { args:
|
|
1109
|
-
if (
|
|
1110
|
-
var
|
|
1106
|
+
var t = n[0];
|
|
1107
|
+
if (Mt(t))
|
|
1108
|
+
return { args: t, keys: null };
|
|
1109
|
+
if (Ut(t)) {
|
|
1110
|
+
var e = kt(t);
|
|
1111
1111
|
return {
|
|
1112
|
-
args:
|
|
1113
|
-
return
|
|
1112
|
+
args: e.map(function(r) {
|
|
1113
|
+
return t[r];
|
|
1114
1114
|
}),
|
|
1115
|
-
keys:
|
|
1115
|
+
keys: e
|
|
1116
1116
|
};
|
|
1117
1117
|
}
|
|
1118
1118
|
}
|
|
1119
1119
|
return { args: n, keys: null };
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1122
|
-
return n && typeof n == "object" &&
|
|
1121
|
+
function Ut(n) {
|
|
1122
|
+
return n && typeof n == "object" && xt(n) === Lt;
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
return n.reduce(function(
|
|
1126
|
-
return
|
|
1124
|
+
function Nt(n, t) {
|
|
1125
|
+
return n.reduce(function(e, r, s) {
|
|
1126
|
+
return e[r] = t[s], e;
|
|
1127
1127
|
}, {});
|
|
1128
1128
|
}
|
|
1129
1129
|
function Rt() {
|
|
1130
|
-
for (var n = [],
|
|
1131
|
-
n[
|
|
1132
|
-
var
|
|
1133
|
-
if (
|
|
1134
|
-
return
|
|
1135
|
-
var a = new
|
|
1136
|
-
return
|
|
1137
|
-
} :
|
|
1138
|
-
return r ? a.pipe(
|
|
1139
|
-
}
|
|
1140
|
-
function
|
|
1141
|
-
return
|
|
1142
|
-
|
|
1143
|
-
for (var
|
|
1144
|
-
|
|
1145
|
-
var
|
|
1146
|
-
|
|
1147
|
-
|
|
1130
|
+
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1131
|
+
n[t] = arguments[t];
|
|
1132
|
+
var e = Ce(n), r = lt(n), s = Pt(n), o = s.args, i = s.keys;
|
|
1133
|
+
if (o.length === 0)
|
|
1134
|
+
return oe([], e);
|
|
1135
|
+
var a = new S($t(o, e, i ? function(u) {
|
|
1136
|
+
return Nt(i, u);
|
|
1137
|
+
} : q));
|
|
1138
|
+
return r ? a.pipe(_t(r)) : a;
|
|
1139
|
+
}
|
|
1140
|
+
function $t(n, t, e) {
|
|
1141
|
+
return e === void 0 && (e = q), function(r) {
|
|
1142
|
+
de(t, function() {
|
|
1143
|
+
for (var s = n.length, o = new Array(s), i = s, a = s, u = function(h) {
|
|
1144
|
+
de(t, function() {
|
|
1145
|
+
var g = oe(n[h], t), v = !1;
|
|
1146
|
+
g.subscribe(O(r, function(l) {
|
|
1147
|
+
o[h] = l, v || (v = !0, a--), a || r.next(e(o.slice()));
|
|
1148
1148
|
}, function() {
|
|
1149
|
-
--
|
|
1149
|
+
--i || r.complete();
|
|
1150
1150
|
}));
|
|
1151
1151
|
}, r);
|
|
1152
|
-
},
|
|
1153
|
-
c
|
|
1152
|
+
}, c = 0; c < s; c++)
|
|
1153
|
+
u(c);
|
|
1154
1154
|
}, r);
|
|
1155
1155
|
};
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1158
|
-
n ?
|
|
1159
|
-
}
|
|
1160
|
-
function
|
|
1161
|
-
var
|
|
1162
|
-
|
|
1163
|
-
}, l = function(
|
|
1164
|
-
return
|
|
1165
|
-
},
|
|
1166
|
-
|
|
1167
|
-
var
|
|
1168
|
-
|
|
1169
|
-
|
|
1157
|
+
function de(n, t, e) {
|
|
1158
|
+
n ? C(e, n, t) : t();
|
|
1159
|
+
}
|
|
1160
|
+
function jt(n, t, e, r, s, o, i, a) {
|
|
1161
|
+
var u = [], c = 0, h = 0, g = !1, v = function() {
|
|
1162
|
+
g && !u.length && !c && t.complete();
|
|
1163
|
+
}, l = function(p) {
|
|
1164
|
+
return c < r ? f(p) : u.push(p);
|
|
1165
|
+
}, f = function(p) {
|
|
1166
|
+
c++;
|
|
1167
|
+
var A = !1;
|
|
1168
|
+
x(e(p, h++)).subscribe(O(t, function(I) {
|
|
1169
|
+
t.next(I);
|
|
1170
1170
|
}, function() {
|
|
1171
|
-
|
|
1171
|
+
A = !0;
|
|
1172
1172
|
}, void 0, function() {
|
|
1173
|
-
if (
|
|
1173
|
+
if (A)
|
|
1174
1174
|
try {
|
|
1175
|
-
|
|
1176
|
-
for (var
|
|
1177
|
-
var _ =
|
|
1178
|
-
|
|
1179
|
-
};
|
|
1180
|
-
|
|
1181
|
-
|
|
1175
|
+
c--;
|
|
1176
|
+
for (var I = function() {
|
|
1177
|
+
var _ = u.shift();
|
|
1178
|
+
i || f(_);
|
|
1179
|
+
}; u.length && c < r; )
|
|
1180
|
+
I();
|
|
1181
|
+
v();
|
|
1182
1182
|
} catch (_) {
|
|
1183
|
-
|
|
1183
|
+
t.error(_);
|
|
1184
1184
|
}
|
|
1185
1185
|
}));
|
|
1186
1186
|
};
|
|
1187
|
-
return n.subscribe(O(
|
|
1188
|
-
|
|
1187
|
+
return n.subscribe(O(t, l, function() {
|
|
1188
|
+
g = !0, v();
|
|
1189
1189
|
})), function() {
|
|
1190
1190
|
};
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
return
|
|
1194
|
-
return
|
|
1195
|
-
return
|
|
1196
|
-
})(
|
|
1197
|
-
},
|
|
1198
|
-
return
|
|
1192
|
+
function B(n, t, e) {
|
|
1193
|
+
return e === void 0 && (e = 1 / 0), m(t) ? B(function(r, s) {
|
|
1194
|
+
return P(function(o, i) {
|
|
1195
|
+
return t(r, o, s, i);
|
|
1196
|
+
})(x(n(r, s)));
|
|
1197
|
+
}, e) : (typeof t == "number" && (e = t), M(function(r, s) {
|
|
1198
|
+
return jt(r, s, n, e);
|
|
1199
1199
|
}));
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1202
|
-
n === void 0 && (n = 0),
|
|
1201
|
+
function Dt(n, t, e) {
|
|
1202
|
+
n === void 0 && (n = 0), e === void 0 && (e = ct);
|
|
1203
1203
|
var r = -1;
|
|
1204
|
-
return
|
|
1205
|
-
var
|
|
1206
|
-
|
|
1207
|
-
var
|
|
1208
|
-
return
|
|
1209
|
-
|
|
1210
|
-
},
|
|
1204
|
+
return t != null && (we(t) ? e = t : r = t), new S(function(s) {
|
|
1205
|
+
var o = Ct(n) ? +n - e.now() : n;
|
|
1206
|
+
o < 0 && (o = 0);
|
|
1207
|
+
var i = 0;
|
|
1208
|
+
return e.schedule(function() {
|
|
1209
|
+
s.closed || (s.next(i++), 0 <= r ? this.schedule(void 0, r) : s.complete());
|
|
1210
|
+
}, o);
|
|
1211
1211
|
});
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1214
|
-
return m(
|
|
1213
|
+
function Ht(n, t) {
|
|
1214
|
+
return m(t) ? B(n, t, 1) : B(n, 1);
|
|
1215
1215
|
}
|
|
1216
|
-
function
|
|
1216
|
+
function Gt(n) {
|
|
1217
1217
|
return n <= 0 ? function() {
|
|
1218
|
-
return
|
|
1219
|
-
} :
|
|
1218
|
+
return ut;
|
|
1219
|
+
} : M(function(t, e) {
|
|
1220
1220
|
var r = 0;
|
|
1221
|
-
|
|
1222
|
-
++r <= n && (
|
|
1221
|
+
t.subscribe(O(e, function(s) {
|
|
1222
|
+
++r <= n && (e.next(s), n <= r && e.complete());
|
|
1223
1223
|
}));
|
|
1224
1224
|
});
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1227
|
-
return
|
|
1226
|
+
function Kt(n) {
|
|
1227
|
+
return P(function() {
|
|
1228
1228
|
return n;
|
|
1229
1229
|
});
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1232
|
-
return
|
|
1233
|
-
return
|
|
1231
|
+
function Ft(n, t) {
|
|
1232
|
+
return B(function(e, r) {
|
|
1233
|
+
return x(n(e, r)).pipe(Gt(1), Kt(e));
|
|
1234
1234
|
});
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1237
|
-
|
|
1238
|
-
var
|
|
1239
|
-
return
|
|
1240
|
-
return
|
|
1236
|
+
function Bt(n, t) {
|
|
1237
|
+
t === void 0 && (t = Ee);
|
|
1238
|
+
var e = Dt(n, t);
|
|
1239
|
+
return Ft(function() {
|
|
1240
|
+
return e;
|
|
1241
1241
|
});
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
var u = 0, f, p = function() {
|
|
1251
|
-
var h = !1;
|
|
1252
|
-
f = a.subscribe(O(c, function(l) {
|
|
1253
|
-
s && (u = 0), c.next(l);
|
|
1254
|
-
}, void 0, function(l) {
|
|
1255
|
-
if (u++ < r) {
|
|
1256
|
-
var y = function() {
|
|
1257
|
-
f ? (f.unsubscribe(), f = null, p()) : h = !0;
|
|
1258
|
-
};
|
|
1259
|
-
if (o != null) {
|
|
1260
|
-
var v = typeof o == "number" ? Ue(o) : T(o(l, u)), w = O(c, function() {
|
|
1261
|
-
w.unsubscribe(), y();
|
|
1262
|
-
}, function() {
|
|
1263
|
-
c.complete();
|
|
1264
|
-
});
|
|
1265
|
-
v.subscribe(w);
|
|
1266
|
-
} else
|
|
1267
|
-
y();
|
|
1268
|
-
} else
|
|
1269
|
-
c.error(l);
|
|
1270
|
-
})), h && (f.unsubscribe(), f = null, p());
|
|
1271
|
-
};
|
|
1272
|
-
p();
|
|
1243
|
+
function Z(n, t) {
|
|
1244
|
+
return t === void 0 && (t = q), n = n ?? qt, M(function(e, r) {
|
|
1245
|
+
var s, o = !0;
|
|
1246
|
+
e.subscribe(O(r, function(i) {
|
|
1247
|
+
var a = t(i);
|
|
1248
|
+
(o || !n(s, a)) && (o = !1, s = a, r.next(i));
|
|
1249
|
+
}));
|
|
1273
1250
|
});
|
|
1274
1251
|
}
|
|
1275
|
-
function
|
|
1276
|
-
return
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1252
|
+
function qt(n, t) {
|
|
1253
|
+
return n === t;
|
|
1254
|
+
}
|
|
1255
|
+
function Vt(n) {
|
|
1256
|
+
return M(function(t, e) {
|
|
1257
|
+
x(n).subscribe(O(e, function() {
|
|
1258
|
+
return e.complete();
|
|
1259
|
+
}, J)), !e.closed && t.subscribe(e);
|
|
1280
1260
|
});
|
|
1281
1261
|
}
|
|
1282
|
-
async function
|
|
1283
|
-
const
|
|
1262
|
+
async function Yt(n, t) {
|
|
1263
|
+
const e = n.getReader();
|
|
1284
1264
|
let r;
|
|
1285
|
-
for (; !(r = await
|
|
1286
|
-
|
|
1287
|
-
}
|
|
1288
|
-
function
|
|
1289
|
-
let
|
|
1290
|
-
return function(
|
|
1291
|
-
|
|
1292
|
-
const a =
|
|
1293
|
-
let
|
|
1294
|
-
for (;
|
|
1295
|
-
|
|
1296
|
-
let
|
|
1297
|
-
for (;
|
|
1298
|
-
switch (e
|
|
1265
|
+
for (; !(r = await e.read()).done; )
|
|
1266
|
+
t(r.value);
|
|
1267
|
+
}
|
|
1268
|
+
function Wt(n) {
|
|
1269
|
+
let t, e, r, s = !1;
|
|
1270
|
+
return function(i) {
|
|
1271
|
+
t === void 0 ? (t = i, e = 0, r = -1) : t = zt(t, i);
|
|
1272
|
+
const a = t.length;
|
|
1273
|
+
let u = 0;
|
|
1274
|
+
for (; e < a; ) {
|
|
1275
|
+
s && (t[e] === 10 && (u = ++e), s = !1);
|
|
1276
|
+
let c = -1;
|
|
1277
|
+
for (; e < a && c === -1; ++e)
|
|
1278
|
+
switch (t[e]) {
|
|
1299
1279
|
case 58:
|
|
1300
|
-
r === -1 && (r =
|
|
1280
|
+
r === -1 && (r = e - u);
|
|
1301
1281
|
break;
|
|
1302
1282
|
case 13:
|
|
1303
|
-
|
|
1283
|
+
s = !0;
|
|
1304
1284
|
case 10:
|
|
1305
|
-
|
|
1285
|
+
c = e;
|
|
1306
1286
|
break;
|
|
1307
1287
|
}
|
|
1308
|
-
if (
|
|
1288
|
+
if (c === -1)
|
|
1309
1289
|
break;
|
|
1310
|
-
n(
|
|
1290
|
+
n(t.subarray(u, c), r), u = e, r = -1;
|
|
1311
1291
|
}
|
|
1312
|
-
|
|
1292
|
+
u === a ? t = void 0 : u !== 0 && (t = t.subarray(u), e -= u);
|
|
1313
1293
|
};
|
|
1314
1294
|
}
|
|
1315
|
-
function
|
|
1316
|
-
let r =
|
|
1317
|
-
const
|
|
1318
|
-
return function(
|
|
1319
|
-
if (
|
|
1320
|
-
|
|
1295
|
+
function Xt(n, t, e) {
|
|
1296
|
+
let r = he();
|
|
1297
|
+
const s = new TextDecoder();
|
|
1298
|
+
return function(i, a) {
|
|
1299
|
+
if (i.length === 0)
|
|
1300
|
+
e?.(r), r = he();
|
|
1321
1301
|
else if (a > 0) {
|
|
1322
|
-
const
|
|
1323
|
-
switch (
|
|
1302
|
+
const u = s.decode(i.subarray(0, a)), c = a + (i[a + 1] === 32 ? 2 : 1), h = s.decode(i.subarray(c));
|
|
1303
|
+
switch (u) {
|
|
1324
1304
|
case "data":
|
|
1325
1305
|
r.data = r.data ? r.data + `
|
|
1326
|
-
` +
|
|
1306
|
+
` + h : h;
|
|
1327
1307
|
break;
|
|
1328
1308
|
case "event":
|
|
1329
|
-
r.event =
|
|
1309
|
+
r.event = h;
|
|
1330
1310
|
break;
|
|
1331
1311
|
case "id":
|
|
1332
|
-
n(r.id =
|
|
1312
|
+
n(r.id = h);
|
|
1333
1313
|
break;
|
|
1334
1314
|
case "retry":
|
|
1335
|
-
const
|
|
1336
|
-
isNaN(
|
|
1315
|
+
const g = parseInt(h, 10);
|
|
1316
|
+
isNaN(g) || t(r.retry = g);
|
|
1337
1317
|
break;
|
|
1338
1318
|
}
|
|
1339
1319
|
}
|
|
1340
1320
|
};
|
|
1341
1321
|
}
|
|
1342
|
-
function
|
|
1343
|
-
const
|
|
1344
|
-
return
|
|
1322
|
+
function zt(n, t) {
|
|
1323
|
+
const e = new Uint8Array(n.length + t.length);
|
|
1324
|
+
return e.set(n), e.set(t, n.length), e;
|
|
1345
1325
|
}
|
|
1346
|
-
function
|
|
1326
|
+
function he() {
|
|
1347
1327
|
return {
|
|
1348
1328
|
data: "",
|
|
1349
1329
|
event: "",
|
|
@@ -1351,216 +1331,274 @@ function ue() {
|
|
|
1351
1331
|
retry: void 0
|
|
1352
1332
|
};
|
|
1353
1333
|
}
|
|
1354
|
-
var
|
|
1355
|
-
var
|
|
1356
|
-
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) &&
|
|
1334
|
+
var Jt = function(n, t) {
|
|
1335
|
+
var e = {};
|
|
1336
|
+
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && t.indexOf(r) < 0 && (e[r] = n[r]);
|
|
1357
1337
|
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1358
|
-
for (var
|
|
1359
|
-
|
|
1360
|
-
return
|
|
1338
|
+
for (var s = 0, r = Object.getOwnPropertySymbols(n); s < r.length; s++)
|
|
1339
|
+
t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[s]) && (e[r[s]] = n[r[s]]);
|
|
1340
|
+
return e;
|
|
1361
1341
|
};
|
|
1362
|
-
const
|
|
1363
|
-
function
|
|
1364
|
-
var { signal:
|
|
1365
|
-
return new Promise((
|
|
1342
|
+
const ee = "text/event-stream", Qt = 1e3, fe = "last-event-id";
|
|
1343
|
+
function Zt(n, t) {
|
|
1344
|
+
var { signal: e, headers: r, onopen: s, onmessage: o, onclose: i, onerror: a, openWhenHidden: u, fetch: c } = t, h = Jt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
1345
|
+
return new Promise((g, v) => {
|
|
1366
1346
|
const l = Object.assign({}, r);
|
|
1367
|
-
l.accept || (l.accept =
|
|
1368
|
-
let
|
|
1369
|
-
function
|
|
1370
|
-
|
|
1347
|
+
l.accept || (l.accept = ee);
|
|
1348
|
+
let f;
|
|
1349
|
+
function p() {
|
|
1350
|
+
f.abort(), document.hidden || V();
|
|
1371
1351
|
}
|
|
1372
|
-
|
|
1373
|
-
let
|
|
1352
|
+
u || document.addEventListener("visibilitychange", p);
|
|
1353
|
+
let A = Qt, I = 0;
|
|
1374
1354
|
function _() {
|
|
1375
|
-
document.removeEventListener("visibilitychange",
|
|
1355
|
+
document.removeEventListener("visibilitychange", p), window.clearTimeout(I), f.abort();
|
|
1376
1356
|
}
|
|
1377
|
-
|
|
1378
|
-
_(),
|
|
1357
|
+
e?.addEventListener("abort", () => {
|
|
1358
|
+
_(), g();
|
|
1379
1359
|
});
|
|
1380
|
-
const
|
|
1381
|
-
async function
|
|
1382
|
-
var
|
|
1383
|
-
|
|
1360
|
+
const He = c ?? window.fetch, Ge = s ?? en;
|
|
1361
|
+
async function V() {
|
|
1362
|
+
var Y;
|
|
1363
|
+
f = new AbortController();
|
|
1384
1364
|
try {
|
|
1385
|
-
const
|
|
1386
|
-
await
|
|
1387
|
-
|
|
1388
|
-
}, (
|
|
1389
|
-
|
|
1390
|
-
},
|
|
1391
|
-
} catch (
|
|
1392
|
-
if (!
|
|
1365
|
+
const j = await He(n, Object.assign(Object.assign({}, h), { headers: l, signal: f.signal }));
|
|
1366
|
+
await Ge(j), await Yt(j.body, Wt(Xt((T) => {
|
|
1367
|
+
T ? l[fe] = T : delete l[fe];
|
|
1368
|
+
}, (T) => {
|
|
1369
|
+
A = T;
|
|
1370
|
+
}, o))), i?.(), _(), g();
|
|
1371
|
+
} catch (j) {
|
|
1372
|
+
if (!f.signal.aborted)
|
|
1393
1373
|
try {
|
|
1394
|
-
const
|
|
1395
|
-
window.clearTimeout(
|
|
1396
|
-
} catch (
|
|
1397
|
-
_(),
|
|
1374
|
+
const T = (Y = a?.(j)) !== null && Y !== void 0 ? Y : A;
|
|
1375
|
+
window.clearTimeout(I), I = window.setTimeout(V, T);
|
|
1376
|
+
} catch (T) {
|
|
1377
|
+
_(), v(T);
|
|
1398
1378
|
}
|
|
1399
1379
|
}
|
|
1400
1380
|
}
|
|
1401
|
-
|
|
1381
|
+
V();
|
|
1402
1382
|
});
|
|
1403
1383
|
}
|
|
1404
|
-
function
|
|
1405
|
-
const
|
|
1406
|
-
if (!
|
|
1407
|
-
throw new Error(`Expected content-type to be ${
|
|
1408
|
-
}
|
|
1409
|
-
function
|
|
1410
|
-
const { endpoint:
|
|
1411
|
-
return new
|
|
1412
|
-
const
|
|
1413
|
-
let c;
|
|
1414
|
-
const
|
|
1384
|
+
function en(n) {
|
|
1385
|
+
const t = n.headers.get("content-type");
|
|
1386
|
+
if (!t?.startsWith(ee))
|
|
1387
|
+
throw new Error(`Expected content-type to be ${ee}, Actual: ${t}`);
|
|
1388
|
+
}
|
|
1389
|
+
function pe(n) {
|
|
1390
|
+
const { endpoint: t, apiKey: e, payload: r, debugMode: s, customHeaders: o } = n, i = n.method ?? "POST";
|
|
1391
|
+
return new S((a) => {
|
|
1392
|
+
const u = new AbortController();
|
|
1393
|
+
let c, h = !1;
|
|
1394
|
+
const g = {
|
|
1415
1395
|
"Content-Type": "application/json",
|
|
1416
|
-
...
|
|
1396
|
+
...o
|
|
1417
1397
|
};
|
|
1418
|
-
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
body: r ? JSON.stringify(r) : void 0,
|
|
1426
|
-
signal: a.signal,
|
|
1398
|
+
e && (g["X-API-KEY"] = e);
|
|
1399
|
+
const v = new URL(t);
|
|
1400
|
+
return s && v.searchParams.set("is_debug", "true"), Zt(v.toString(), {
|
|
1401
|
+
method: i,
|
|
1402
|
+
headers: g,
|
|
1403
|
+
body: i === "POST" && r ? JSON.stringify(r) : void 0,
|
|
1404
|
+
signal: u.signal,
|
|
1427
1405
|
/**
|
|
1428
1406
|
* Allow SSE to work when the page is hidden.
|
|
1429
1407
|
* https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
|
|
1430
1408
|
*/
|
|
1431
1409
|
openWhenHidden: !0,
|
|
1432
|
-
onopen: async (
|
|
1433
|
-
if (
|
|
1434
|
-
c =
|
|
1410
|
+
onopen: async (l) => {
|
|
1411
|
+
if (l.ok)
|
|
1412
|
+
c = l.headers.get("X-Trace-Id") ?? void 0;
|
|
1435
1413
|
else {
|
|
1436
|
-
let
|
|
1414
|
+
let f;
|
|
1437
1415
|
try {
|
|
1438
|
-
|
|
1416
|
+
f = await l.json();
|
|
1439
1417
|
} catch {
|
|
1440
1418
|
try {
|
|
1441
|
-
|
|
1419
|
+
f = await l.text();
|
|
1442
1420
|
} catch {
|
|
1443
|
-
|
|
1421
|
+
f = null;
|
|
1444
1422
|
}
|
|
1445
1423
|
}
|
|
1446
|
-
|
|
1424
|
+
a.error(new te(l.status, l.statusText, f)), u.abort();
|
|
1447
1425
|
}
|
|
1448
1426
|
},
|
|
1449
|
-
onmessage: (
|
|
1450
|
-
|
|
1451
|
-
|
|
1427
|
+
onmessage: (l) => {
|
|
1428
|
+
l.id && (h = !0);
|
|
1429
|
+
const f = JSON.parse(l.data);
|
|
1430
|
+
c ? f.traceId = c : f.requestId && (f.traceId = f.requestId, c || (c = f.requestId)), a.next(f);
|
|
1452
1431
|
},
|
|
1453
1432
|
onclose: () => {
|
|
1454
|
-
|
|
1433
|
+
a.complete();
|
|
1455
1434
|
},
|
|
1456
|
-
onerror: (
|
|
1457
|
-
|
|
1435
|
+
onerror: (l) => {
|
|
1436
|
+
if (!h)
|
|
1437
|
+
throw a.error(l), u.abort(), l;
|
|
1458
1438
|
}
|
|
1459
1439
|
}), () => {
|
|
1460
|
-
|
|
1440
|
+
u.abort();
|
|
1461
1441
|
};
|
|
1462
1442
|
});
|
|
1463
1443
|
}
|
|
1464
|
-
class
|
|
1444
|
+
class tn {
|
|
1465
1445
|
listeners = {};
|
|
1466
|
-
on(
|
|
1446
|
+
on(t, e) {
|
|
1467
1447
|
this.listeners = Object.assign({}, this.listeners, {
|
|
1468
|
-
[
|
|
1448
|
+
[t]: (this.listeners[t] ?? []).concat(e)
|
|
1469
1449
|
});
|
|
1470
1450
|
}
|
|
1471
|
-
off(
|
|
1472
|
-
this.listeners[
|
|
1473
|
-
[
|
|
1451
|
+
off(t, e) {
|
|
1452
|
+
this.listeners[t] && (this.listeners = Object.assign({}, this.listeners, {
|
|
1453
|
+
[t]: (this.listeners[t] ?? []).filter((r) => r !== e)
|
|
1474
1454
|
}));
|
|
1475
1455
|
}
|
|
1476
|
-
remove(
|
|
1477
|
-
delete this.listeners[
|
|
1456
|
+
remove(t) {
|
|
1457
|
+
delete this.listeners[t];
|
|
1478
1458
|
}
|
|
1479
|
-
emit(
|
|
1480
|
-
this.listeners[
|
|
1459
|
+
emit(t, ...e) {
|
|
1460
|
+
this.listeners[t] && this.listeners[t].forEach((r) => r(...e));
|
|
1481
1461
|
}
|
|
1482
1462
|
}
|
|
1483
|
-
class
|
|
1463
|
+
class wn {
|
|
1484
1464
|
apiKey;
|
|
1485
1465
|
endpoint;
|
|
1486
1466
|
botProviderEndpoint;
|
|
1487
1467
|
debugMode;
|
|
1488
|
-
destroy$ = new
|
|
1468
|
+
destroy$ = new se();
|
|
1489
1469
|
closed = !1;
|
|
1490
1470
|
detached = !1;
|
|
1491
1471
|
detachTimer;
|
|
1492
1472
|
inFlight = 0;
|
|
1493
|
-
sseEmitter = new
|
|
1473
|
+
sseEmitter = new tn();
|
|
1494
1474
|
transformSsePayload;
|
|
1495
1475
|
customHeaders;
|
|
1496
|
-
constructor(
|
|
1497
|
-
if (!
|
|
1476
|
+
constructor(t) {
|
|
1477
|
+
if (!t.endpoint && !t.botProviderEndpoint)
|
|
1498
1478
|
throw new Error("Either endpoint or botProviderEndpoint must be provided");
|
|
1499
|
-
if (this.apiKey =
|
|
1500
|
-
...
|
|
1501
|
-
...
|
|
1502
|
-
}, !
|
|
1503
|
-
const
|
|
1504
|
-
this.endpoint = `${
|
|
1505
|
-
} else
|
|
1479
|
+
if (this.apiKey = t.apiKey, this.debugMode = t.debugMode, this.transformSsePayload = t.transformSsePayload, this.botProviderEndpoint = t.botProviderEndpoint, this.customHeaders = {
|
|
1480
|
+
...t.customHeaders,
|
|
1481
|
+
...t.userIdentityHint ? { "X-ASGARD-USER-IDENTITY-HINT": t.userIdentityHint } : {}
|
|
1482
|
+
}, !t.endpoint && t.botProviderEndpoint) {
|
|
1483
|
+
const e = t.botProviderEndpoint.replace(/\/+$/, "");
|
|
1484
|
+
this.endpoint = `${e}/message/sse`;
|
|
1485
|
+
} else t.endpoint && (this.endpoint = t.endpoint, this.debugMode && console.warn(
|
|
1506
1486
|
'[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".'
|
|
1507
1487
|
));
|
|
1508
1488
|
}
|
|
1509
|
-
on(
|
|
1510
|
-
this.sseEmitter.remove(
|
|
1489
|
+
on(t, e) {
|
|
1490
|
+
this.sseEmitter.remove(t), this.sseEmitter.on(t, e);
|
|
1511
1491
|
}
|
|
1512
|
-
handleEvent(
|
|
1513
|
-
switch (
|
|
1492
|
+
handleEvent(t) {
|
|
1493
|
+
switch (t.eventType) {
|
|
1514
1494
|
case d.INIT:
|
|
1515
|
-
this.sseEmitter.emit(d.INIT,
|
|
1495
|
+
this.sseEmitter.emit(d.INIT, t);
|
|
1516
1496
|
break;
|
|
1517
1497
|
case d.PROCESS_START:
|
|
1518
1498
|
case d.PROCESS_COMPLETE:
|
|
1519
|
-
this.sseEmitter.emit(d.PROCESS,
|
|
1499
|
+
this.sseEmitter.emit(d.PROCESS, t);
|
|
1520
1500
|
break;
|
|
1521
1501
|
case d.MESSAGE_START:
|
|
1522
1502
|
case d.MESSAGE_DELTA:
|
|
1523
1503
|
case d.MESSAGE_COMPLETE:
|
|
1524
|
-
this.sseEmitter.emit(d.MESSAGE,
|
|
1504
|
+
this.sseEmitter.emit(d.MESSAGE, t);
|
|
1525
1505
|
break;
|
|
1526
1506
|
case d.TOOL_CALL_START:
|
|
1527
1507
|
case d.TOOL_CALL_COMPLETE:
|
|
1528
|
-
this.sseEmitter.emit(d.TOOL_CALL,
|
|
1508
|
+
this.sseEmitter.emit(d.TOOL_CALL, t);
|
|
1529
1509
|
break;
|
|
1530
1510
|
case d.TOOL_CALL_CONSENT:
|
|
1531
1511
|
this.sseEmitter.emit(
|
|
1532
1512
|
d.TOOL_CALL_CONSENT,
|
|
1533
|
-
|
|
1513
|
+
t
|
|
1534
1514
|
);
|
|
1535
1515
|
break;
|
|
1536
1516
|
case d.DONE:
|
|
1537
|
-
this.sseEmitter.emit(d.DONE,
|
|
1517
|
+
this.sseEmitter.emit(d.DONE, t);
|
|
1538
1518
|
break;
|
|
1539
1519
|
case d.ERROR:
|
|
1540
|
-
this.sseEmitter.emit(d.ERROR,
|
|
1520
|
+
this.sseEmitter.emit(d.ERROR, t);
|
|
1541
1521
|
break;
|
|
1542
1522
|
}
|
|
1543
1523
|
}
|
|
1544
|
-
fetchSse(
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1524
|
+
fetchSse(t, e) {
|
|
1525
|
+
e?.onSseStart?.(), this.inFlight += 1, this.runSse(
|
|
1526
|
+
pe({
|
|
1527
|
+
apiKey: this.apiKey,
|
|
1528
|
+
endpoint: this.endpoint,
|
|
1529
|
+
debugMode: this.debugMode,
|
|
1530
|
+
payload: this.transformSsePayload?.(t) ?? t,
|
|
1531
|
+
customHeaders: this.customHeaders
|
|
1532
|
+
}),
|
|
1533
|
+
e
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Cold-start transcript rejoin (F-014): a `GET /message/sse?custom_channel_id=…` with an empty
|
|
1538
|
+
* `Last-Event-ID` replays the collapsed history (`message.user` + self-sufficient `*.complete`),
|
|
1539
|
+
* assembled through the same reducer. Reuses the F-002 native Last-Event-ID transport (no re-POST).
|
|
1540
|
+
*/
|
|
1541
|
+
rejoinSse(t, e) {
|
|
1542
|
+
e?.onSseStart?.(), this.inFlight += 1;
|
|
1543
|
+
const r = new URL(this.endpoint);
|
|
1544
|
+
r.searchParams.set("custom_channel_id", t), this.runSse(
|
|
1545
|
+
pe({
|
|
1546
|
+
apiKey: this.apiKey,
|
|
1547
|
+
endpoint: r.toString(),
|
|
1548
|
+
debugMode: this.debugMode,
|
|
1549
|
+
method: "GET",
|
|
1550
|
+
customHeaders: this.customHeaders
|
|
1551
|
+
}),
|
|
1552
|
+
e
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
deriveChannelMetadataEndpoint() {
|
|
1556
|
+
const t = this.getBaseEndpoint();
|
|
1557
|
+
return t ? `${t}/channel/metadata` : null;
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Join-init existence + restore gate (F-015): `GET {base}/channel/metadata?custom_channel_id=…`.
|
|
1561
|
+
* `200` → parsed {@link ChannelMetadata}; `404` → `null` (channel does not exist); any other non-OK
|
|
1562
|
+
* status or network error throws. The caller must never treat an indeterminate result (throw) as
|
|
1563
|
+
* "not exists" — that would let a mount-time reset wipe an existing channel's history.
|
|
1564
|
+
*/
|
|
1565
|
+
async channelMetadata(t) {
|
|
1566
|
+
const e = this.deriveChannelMetadataEndpoint();
|
|
1567
|
+
if (!e)
|
|
1568
|
+
throw new Error("Unable to derive channel metadata endpoint. Please provide botProviderEndpoint in config.");
|
|
1569
|
+
const r = new URL(e);
|
|
1570
|
+
r.searchParams.set("custom_channel_id", t);
|
|
1571
|
+
const s = { ...this.customHeaders };
|
|
1572
|
+
this.apiKey && (s["X-API-KEY"] = this.apiKey);
|
|
1573
|
+
const o = await fetch(r.toString(), { method: "GET", headers: s });
|
|
1574
|
+
if (o.status === 404)
|
|
1575
|
+
return null;
|
|
1576
|
+
if (!o.ok)
|
|
1577
|
+
throw new te(o.status, o.statusText, await o.text().catch(() => {
|
|
1578
|
+
}));
|
|
1579
|
+
const i = await o.json(), a = i.data ?? i;
|
|
1580
|
+
return {
|
|
1581
|
+
title: a.title ?? null,
|
|
1582
|
+
runState: a.runState ?? "IDLE",
|
|
1583
|
+
lastActivityAt: a.lastActivityAt
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
runSse(t, e) {
|
|
1587
|
+
t.pipe(
|
|
1588
|
+
// No RxJS-level retry: re-subscribing would re-POST and the backend would re-dispatch a duplicate
|
|
1589
|
+
// run. Mid-stream resume is the library's job (native Last-Event-ID reconnect in
|
|
1590
|
+
// create-sse-observable); a no-cursor failure surfaces via `error` below.
|
|
1591
|
+
Ht((r) => Tt(r).pipe(Bt(e?.delayTime ?? 50))),
|
|
1592
|
+
Vt(this.destroy$)
|
|
1555
1593
|
).subscribe({
|
|
1556
1594
|
next: (r) => {
|
|
1557
|
-
this.detached || (
|
|
1595
|
+
this.detached || (e?.onSseMessage?.(r), this.handleEvent(r));
|
|
1558
1596
|
},
|
|
1559
1597
|
error: (r) => {
|
|
1560
|
-
this.detached ||
|
|
1598
|
+
this.detached || e?.onSseError?.(r), this.onRunSettled();
|
|
1561
1599
|
},
|
|
1562
1600
|
complete: () => {
|
|
1563
|
-
this.detached ||
|
|
1601
|
+
this.detached || e?.onSseCompleted?.(), this.onRunSettled();
|
|
1564
1602
|
}
|
|
1565
1603
|
});
|
|
1566
1604
|
}
|
|
@@ -1578,13 +1616,13 @@ class sn {
|
|
|
1578
1616
|
* - A run gets stuck (stream stays open, no `run.done`/error) → the safety
|
|
1579
1617
|
* timeout force-closes it so the orphaned connection cannot leak.
|
|
1580
1618
|
*/
|
|
1581
|
-
detach(
|
|
1619
|
+
detach(t) {
|
|
1582
1620
|
if (!(this.detached || this.closed)) {
|
|
1583
1621
|
if (this.detached = !0, this.inFlight === 0) {
|
|
1584
1622
|
this.close();
|
|
1585
1623
|
return;
|
|
1586
1624
|
}
|
|
1587
|
-
this.detachTimer = setTimeout(() => this.close(),
|
|
1625
|
+
this.detachTimer = setTimeout(() => this.close(), t.timeoutMs);
|
|
1588
1626
|
}
|
|
1589
1627
|
}
|
|
1590
1628
|
onRunSettled() {
|
|
@@ -1597,51 +1635,51 @@ class sn {
|
|
|
1597
1635
|
* 上傳檔案到 Blob API
|
|
1598
1636
|
* 根據 API 文件:/ns/{namespace}/bot-provider/{bot_provider_name}/blob
|
|
1599
1637
|
*/
|
|
1600
|
-
async uploadFile(
|
|
1638
|
+
async uploadFile(t, e) {
|
|
1601
1639
|
const r = this.deriveBlobEndpoint();
|
|
1602
1640
|
if (!r)
|
|
1603
1641
|
throw new Error("Unable to derive blob endpoint. Please provide botProviderEndpoint in config.");
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1606
|
-
const
|
|
1642
|
+
const s = new FormData();
|
|
1643
|
+
s.append("file", t), s.append("customChannelId", e);
|
|
1644
|
+
const o = {
|
|
1607
1645
|
...this.customHeaders
|
|
1608
1646
|
};
|
|
1609
|
-
this.apiKey && (
|
|
1647
|
+
this.apiKey && (o["X-API-KEY"] = this.apiKey);
|
|
1610
1648
|
try {
|
|
1611
|
-
const
|
|
1649
|
+
const i = await fetch(r, {
|
|
1612
1650
|
method: "POST",
|
|
1613
|
-
headers:
|
|
1614
|
-
body:
|
|
1651
|
+
headers: o,
|
|
1652
|
+
body: s
|
|
1615
1653
|
});
|
|
1616
|
-
if (!
|
|
1617
|
-
throw new Error(`Upload failed: ${
|
|
1618
|
-
const a = await
|
|
1654
|
+
if (!i.ok)
|
|
1655
|
+
throw new Error(`Upload failed: ${i.status} ${i.statusText}`);
|
|
1656
|
+
const a = await i.json();
|
|
1619
1657
|
return this.debugMode && console.log("[AsgardServiceClient] File upload response:", a), a;
|
|
1620
|
-
} catch (
|
|
1621
|
-
throw console.error("[AsgardServiceClient] File upload error:",
|
|
1658
|
+
} catch (i) {
|
|
1659
|
+
throw console.error("[AsgardServiceClient] File upload error:", i), i;
|
|
1622
1660
|
}
|
|
1623
1661
|
}
|
|
1624
1662
|
/**
|
|
1625
1663
|
* 下載 channel sandbox 工作目錄裡的檔案(cwd:// URI action)。
|
|
1626
1664
|
* 呼叫 Edge Server GET <base>/cwd/download?custom_channel_id=xxx&relative_path=xxx 取回 binary。
|
|
1627
1665
|
*/
|
|
1628
|
-
async downloadCwdFile(
|
|
1666
|
+
async downloadCwdFile(t, e) {
|
|
1629
1667
|
const r = this.getBaseEndpoint();
|
|
1630
1668
|
if (!r)
|
|
1631
1669
|
throw new Error("Unable to derive cwd download endpoint. Please provide botProviderEndpoint in config.");
|
|
1632
|
-
const
|
|
1670
|
+
const s = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, o = `${r}/cwd/download?${s}`, i = {
|
|
1633
1671
|
...this.customHeaders
|
|
1634
1672
|
};
|
|
1635
|
-
this.apiKey && (
|
|
1673
|
+
this.apiKey && (i["X-API-KEY"] = this.apiKey);
|
|
1636
1674
|
try {
|
|
1637
|
-
const a = await fetch(
|
|
1675
|
+
const a = await fetch(o, {
|
|
1638
1676
|
method: "GET",
|
|
1639
|
-
headers:
|
|
1677
|
+
headers: i
|
|
1640
1678
|
});
|
|
1641
1679
|
if (!a.ok)
|
|
1642
1680
|
throw new Error(`CWD download failed: ${a.status} ${a.statusText}`);
|
|
1643
|
-
const
|
|
1644
|
-
return this.debugMode && console.log("[AsgardServiceClient] CWD download response:", { filename:
|
|
1681
|
+
const u = await a.blob(), c = t.split("/").pop() || "download";
|
|
1682
|
+
return this.debugMode && console.log("[AsgardServiceClient] CWD download response:", { filename: c, size: u.size }), { blob: u, filename: c };
|
|
1645
1683
|
} catch (a) {
|
|
1646
1684
|
throw console.error("[AsgardServiceClient] CWD download error:", a), a;
|
|
1647
1685
|
}
|
|
@@ -1650,309 +1688,681 @@ class sn {
|
|
|
1650
1688
|
* 從 botProviderEndpoint 衍生 Blob API endpoint
|
|
1651
1689
|
*/
|
|
1652
1690
|
deriveBlobEndpoint() {
|
|
1653
|
-
const
|
|
1654
|
-
return
|
|
1691
|
+
const t = this.getBaseEndpoint();
|
|
1692
|
+
return t ? `${t}/blob` : null;
|
|
1655
1693
|
}
|
|
1656
1694
|
/**
|
|
1657
1695
|
* 衍生 bot provider 的 base endpoint(不含子路徑)。
|
|
1658
1696
|
* 優先用 botProviderEndpoint;若只有 deprecated 的 endpoint 則反推(移除 /message/sse)。已去除尾部斜線。
|
|
1659
1697
|
*/
|
|
1660
1698
|
getBaseEndpoint() {
|
|
1661
|
-
let
|
|
1662
|
-
return !
|
|
1699
|
+
let t = this.botProviderEndpoint;
|
|
1700
|
+
return !t && this.endpoint && (t = this.endpoint.replace("/message/sse", "")), t ? t.replace(/\/+$/, "") : null;
|
|
1663
1701
|
}
|
|
1664
1702
|
}
|
|
1665
|
-
const
|
|
1703
|
+
const y = [];
|
|
1666
1704
|
for (let n = 0; n < 256; ++n)
|
|
1667
|
-
|
|
1668
|
-
function
|
|
1669
|
-
return (
|
|
1670
|
-
}
|
|
1671
|
-
let
|
|
1672
|
-
const
|
|
1673
|
-
function
|
|
1674
|
-
if (!
|
|
1705
|
+
y.push((n + 256).toString(16).slice(1));
|
|
1706
|
+
function nn(n, t = 0) {
|
|
1707
|
+
return (y[n[t + 0]] + y[n[t + 1]] + y[n[t + 2]] + y[n[t + 3]] + "-" + y[n[t + 4]] + y[n[t + 5]] + "-" + y[n[t + 6]] + y[n[t + 7]] + "-" + y[n[t + 8]] + y[n[t + 9]] + "-" + y[n[t + 10]] + y[n[t + 11]] + y[n[t + 12]] + y[n[t + 13]] + y[n[t + 14]] + y[n[t + 15]]).toLowerCase();
|
|
1708
|
+
}
|
|
1709
|
+
let X;
|
|
1710
|
+
const rn = new Uint8Array(16);
|
|
1711
|
+
function sn() {
|
|
1712
|
+
if (!X) {
|
|
1675
1713
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1676
1714
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1677
|
-
|
|
1715
|
+
X = crypto.getRandomValues.bind(crypto);
|
|
1678
1716
|
}
|
|
1679
|
-
return
|
|
1717
|
+
return X(rn);
|
|
1680
1718
|
}
|
|
1681
|
-
const
|
|
1682
|
-
function
|
|
1719
|
+
const on = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ge = { randomUUID: on };
|
|
1720
|
+
function an(n, t, e) {
|
|
1683
1721
|
n = n || {};
|
|
1684
|
-
const r = n.random ?? n.rng?.() ??
|
|
1722
|
+
const r = n.random ?? n.rng?.() ?? sn();
|
|
1685
1723
|
if (r.length < 16)
|
|
1686
1724
|
throw new Error("Random bytes length must be >= 16");
|
|
1687
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1725
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, nn(r);
|
|
1688
1726
|
}
|
|
1689
|
-
function
|
|
1690
|
-
return
|
|
1727
|
+
function De(n, t, e) {
|
|
1728
|
+
return ge.randomUUID && !n ? ge.randomUUID() : an(n);
|
|
1691
1729
|
}
|
|
1692
|
-
class
|
|
1730
|
+
class b {
|
|
1693
1731
|
messages = null;
|
|
1694
1732
|
pendingConsent = null;
|
|
1695
|
-
constructor({ messages:
|
|
1696
|
-
this.messages =
|
|
1733
|
+
constructor({ messages: t, pendingConsent: e = null }) {
|
|
1734
|
+
this.messages = t, this.pendingConsent = e ?? null;
|
|
1697
1735
|
}
|
|
1698
|
-
pushMessage(
|
|
1699
|
-
const
|
|
1700
|
-
return
|
|
1736
|
+
pushMessage(t) {
|
|
1737
|
+
const e = new Map(this.messages);
|
|
1738
|
+
return e.set(t.messageId, t), new b({ messages: e, pendingConsent: this.pendingConsent });
|
|
1701
1739
|
}
|
|
1702
1740
|
clearPendingConsent() {
|
|
1703
|
-
return this.pendingConsent ? new
|
|
1741
|
+
return this.pendingConsent ? new b({ messages: this.messages, pendingConsent: null }) : this;
|
|
1704
1742
|
}
|
|
1705
|
-
onMessage(
|
|
1706
|
-
switch (
|
|
1743
|
+
onMessage(t) {
|
|
1744
|
+
switch (t.eventType) {
|
|
1707
1745
|
case d.MESSAGE_START:
|
|
1708
|
-
return this.onMessageStart(
|
|
1746
|
+
return this.onMessageStart(t);
|
|
1709
1747
|
case d.MESSAGE_DELTA:
|
|
1710
|
-
return this.onMessageDelta(
|
|
1748
|
+
return this.onMessageDelta(t);
|
|
1711
1749
|
case d.MESSAGE_COMPLETE:
|
|
1712
|
-
return this.onMessageComplete(
|
|
1750
|
+
return this.onMessageComplete(t);
|
|
1751
|
+
case d.MESSAGE_USER:
|
|
1752
|
+
return this.onMessageUser(t);
|
|
1753
|
+
case d.MESSAGE_THINKING_START:
|
|
1754
|
+
return this.onThinkingStart(t);
|
|
1755
|
+
case d.MESSAGE_THINKING_DELTA:
|
|
1756
|
+
return this.onThinkingDelta(t);
|
|
1757
|
+
case d.MESSAGE_THINKING_COMPLETE:
|
|
1758
|
+
return this.onThinkingComplete(t);
|
|
1713
1759
|
case d.TOOL_CALL_START:
|
|
1714
|
-
return this.onToolCallStart(
|
|
1760
|
+
return this.onToolCallStart(t);
|
|
1715
1761
|
case d.TOOL_CALL_COMPLETE:
|
|
1716
|
-
return this.onToolCallComplete(
|
|
1762
|
+
return this.onToolCallComplete(t);
|
|
1717
1763
|
case d.TOOL_CALL_CONSENT:
|
|
1718
|
-
return this.onToolCallConsent(
|
|
1764
|
+
return this.onToolCallConsent(t);
|
|
1765
|
+
case d.SUBAGENT_START:
|
|
1766
|
+
return this.onSubagentStart(t);
|
|
1767
|
+
case d.SUBAGENT_COMPLETE:
|
|
1768
|
+
return this.onSubagentComplete(t);
|
|
1719
1769
|
case d.ERROR:
|
|
1720
|
-
return this.onMessageError(
|
|
1770
|
+
return this.onMessageError(t);
|
|
1721
1771
|
default:
|
|
1722
1772
|
return this;
|
|
1723
1773
|
}
|
|
1724
1774
|
}
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1775
|
+
/**
|
|
1776
|
+
* A message is terminal once `complete` has materialized it (a bot message with `isTyping === false`).
|
|
1777
|
+
* Terminal messages must never regress to typing/streaming — late `start`/`delta` frames from replay
|
|
1778
|
+
* or out-of-order delivery are ignored (F-011 / UC-018).
|
|
1779
|
+
*/
|
|
1780
|
+
isTerminalBot(t) {
|
|
1781
|
+
return t?.type === "bot" && !t.isTyping;
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* A thinking block is terminal once `thinking.complete` has settled it (`isThinking === false`).
|
|
1785
|
+
* Like the bot terminal guard (F-011), it must never regress to the streaming state — late
|
|
1786
|
+
* `thinking.start` / `thinking.delta` frames from replay or out-of-order delivery are ignored.
|
|
1787
|
+
*/
|
|
1788
|
+
isTerminalThinking(t) {
|
|
1789
|
+
return t?.type === "thinking" && !t.isThinking;
|
|
1790
|
+
}
|
|
1791
|
+
onMessageStart(t) {
|
|
1792
|
+
const e = t.fact.messageStart.message;
|
|
1793
|
+
if (this.isTerminalBot(this.messages?.get(e.messageId))) return this;
|
|
1794
|
+
const r = new Map(this.messages);
|
|
1795
|
+
return r.set(e.messageId, {
|
|
1728
1796
|
type: "bot",
|
|
1729
1797
|
eventType: d.MESSAGE_START,
|
|
1730
1798
|
isTyping: !0,
|
|
1731
1799
|
typingText: "",
|
|
1732
|
-
messageId:
|
|
1733
|
-
message:
|
|
1800
|
+
messageId: e.messageId,
|
|
1801
|
+
message: e,
|
|
1734
1802
|
time: /* @__PURE__ */ new Date(),
|
|
1735
|
-
traceId:
|
|
1803
|
+
traceId: t.traceId,
|
|
1736
1804
|
raw: ""
|
|
1737
|
-
}), new
|
|
1805
|
+
}), new b({ messages: r, pendingConsent: this.pendingConsent });
|
|
1738
1806
|
}
|
|
1739
|
-
onMessageDelta(
|
|
1740
|
-
const
|
|
1741
|
-
if (
|
|
1742
|
-
const
|
|
1743
|
-
return
|
|
1807
|
+
onMessageDelta(t) {
|
|
1808
|
+
const e = t.fact.messageDelta.message, r = this.messages?.get(e.messageId);
|
|
1809
|
+
if (this.isTerminalBot(r)) return this;
|
|
1810
|
+
const s = r?.type === "bot" ? r : void 0, o = new Map(this.messages);
|
|
1811
|
+
return o.set(e.messageId, {
|
|
1744
1812
|
type: "bot",
|
|
1745
1813
|
eventType: d.MESSAGE_DELTA,
|
|
1746
1814
|
isTyping: !0,
|
|
1747
|
-
typingText:
|
|
1748
|
-
messageId:
|
|
1749
|
-
message:
|
|
1815
|
+
typingText: `${s?.typingText ?? ""}${e.text}`,
|
|
1816
|
+
messageId: e.messageId,
|
|
1817
|
+
message: e,
|
|
1750
1818
|
time: /* @__PURE__ */ new Date(),
|
|
1751
|
-
traceId:
|
|
1752
|
-
raw:
|
|
1753
|
-
}), new
|
|
1819
|
+
traceId: t.traceId ?? s?.traceId,
|
|
1820
|
+
raw: s?.raw ?? ""
|
|
1821
|
+
}), new b({ messages: o, pendingConsent: this.pendingConsent });
|
|
1754
1822
|
}
|
|
1755
|
-
onMessageComplete(
|
|
1756
|
-
const
|
|
1757
|
-
return r.set(
|
|
1823
|
+
onMessageComplete(t) {
|
|
1824
|
+
const e = t.fact.messageComplete.message, r = new Map(this.messages), s = r.get(e.messageId);
|
|
1825
|
+
return r.set(e.messageId, {
|
|
1758
1826
|
type: "bot",
|
|
1759
1827
|
eventType: d.MESSAGE_COMPLETE,
|
|
1760
1828
|
isTyping: !1,
|
|
1761
1829
|
typingText: null,
|
|
1762
|
-
messageId:
|
|
1763
|
-
message:
|
|
1830
|
+
messageId: e.messageId,
|
|
1831
|
+
message: e,
|
|
1832
|
+
time: /* @__PURE__ */ new Date(),
|
|
1833
|
+
traceId: t.traceId ?? (s?.type === "bot" ? s.traceId : void 0),
|
|
1834
|
+
raw: JSON.stringify(t)
|
|
1835
|
+
}), new b({ messages: r, pendingConsent: this.pendingConsent });
|
|
1836
|
+
}
|
|
1837
|
+
onThinkingStart(t) {
|
|
1838
|
+
const e = t.fact.messageThinkingStart.message;
|
|
1839
|
+
if (this.isTerminalThinking(this.messages?.get(e.messageId))) return this;
|
|
1840
|
+
const r = new Map(this.messages), s = {
|
|
1841
|
+
type: "thinking",
|
|
1842
|
+
messageId: e.messageId,
|
|
1843
|
+
text: e.text,
|
|
1844
|
+
isThinking: !0,
|
|
1845
|
+
time: /* @__PURE__ */ new Date(),
|
|
1846
|
+
traceId: t.traceId
|
|
1847
|
+
};
|
|
1848
|
+
return r.set(e.messageId, s), new b({ messages: r, pendingConsent: this.pendingConsent });
|
|
1849
|
+
}
|
|
1850
|
+
onThinkingDelta(t) {
|
|
1851
|
+
const e = t.fact.messageThinkingDelta.message, r = this.messages?.get(e.messageId);
|
|
1852
|
+
if (this.isTerminalThinking(r)) return this;
|
|
1853
|
+
const s = r?.type === "thinking" ? r : void 0, o = new Map(this.messages), i = {
|
|
1854
|
+
type: "thinking",
|
|
1855
|
+
messageId: e.messageId,
|
|
1856
|
+
text: `${s?.text ?? ""}${e.text}`,
|
|
1857
|
+
isThinking: !0,
|
|
1858
|
+
time: s?.time ?? /* @__PURE__ */ new Date(),
|
|
1859
|
+
traceId: t.traceId ?? s?.traceId
|
|
1860
|
+
};
|
|
1861
|
+
return o.set(e.messageId, i), new b({ messages: o, pendingConsent: this.pendingConsent });
|
|
1862
|
+
}
|
|
1863
|
+
onThinkingComplete(t) {
|
|
1864
|
+
const e = t.fact.messageThinkingComplete.message, r = this.messages?.get(e.messageId), s = r?.type === "thinking" ? r : void 0, o = new Map(this.messages), i = {
|
|
1865
|
+
type: "thinking",
|
|
1866
|
+
messageId: e.messageId,
|
|
1867
|
+
// Self-sufficient (F-011): the complete frame carries the full reasoning, so a complete-only
|
|
1868
|
+
// replay (no start/delta) still renders the whole text.
|
|
1869
|
+
text: e.text,
|
|
1870
|
+
isThinking: !1,
|
|
1871
|
+
time: s?.time ?? /* @__PURE__ */ new Date(),
|
|
1872
|
+
traceId: t.traceId ?? s?.traceId
|
|
1873
|
+
};
|
|
1874
|
+
return o.set(e.messageId, i), new b({ messages: o, pendingConsent: this.pendingConsent });
|
|
1875
|
+
}
|
|
1876
|
+
onMessageUser(t) {
|
|
1877
|
+
const e = t.fact.messageUser;
|
|
1878
|
+
if ((this.messages?.get(e.messageId) ?? (e.customMessageId ? this.messages?.get(e.customMessageId) : void 0))?.type === "user") return this;
|
|
1879
|
+
const s = new Map(this.messages), o = {
|
|
1880
|
+
type: "user",
|
|
1881
|
+
messageId: e.messageId,
|
|
1882
|
+
text: e.text,
|
|
1883
|
+
blobIds: e.blobIds,
|
|
1884
|
+
customMessageId: e.customMessageId,
|
|
1885
|
+
identityHint: e.identityHint,
|
|
1764
1886
|
time: /* @__PURE__ */ new Date(),
|
|
1765
|
-
traceId:
|
|
1766
|
-
|
|
1767
|
-
|
|
1887
|
+
traceId: t.traceId
|
|
1888
|
+
};
|
|
1889
|
+
return s.set(e.messageId, o), new b({ messages: s, pendingConsent: this.pendingConsent });
|
|
1768
1890
|
}
|
|
1769
|
-
onMessageError(
|
|
1770
|
-
const
|
|
1771
|
-
return
|
|
1891
|
+
onMessageError(t) {
|
|
1892
|
+
const e = De(), r = t.fact.runError.error, s = new Map(this.messages);
|
|
1893
|
+
return s.set(e, {
|
|
1772
1894
|
type: "error",
|
|
1773
1895
|
eventType: d.ERROR,
|
|
1774
|
-
messageId:
|
|
1896
|
+
messageId: e,
|
|
1775
1897
|
error: r,
|
|
1776
1898
|
time: /* @__PURE__ */ new Date(),
|
|
1777
|
-
traceId:
|
|
1778
|
-
}), new
|
|
1899
|
+
traceId: t.traceId
|
|
1900
|
+
}), new b({ messages: s, pendingConsent: this.pendingConsent });
|
|
1779
1901
|
}
|
|
1780
|
-
onToolCallStart(
|
|
1781
|
-
const
|
|
1902
|
+
onToolCallStart(t) {
|
|
1903
|
+
const e = t.fact.toolCallStart, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, o = {
|
|
1782
1904
|
type: "tool-call",
|
|
1783
1905
|
eventType: d.TOOL_CALL_START,
|
|
1784
|
-
messageId:
|
|
1785
|
-
processId:
|
|
1786
|
-
callSeq:
|
|
1787
|
-
toolName:
|
|
1788
|
-
reason:
|
|
1789
|
-
toolsetName:
|
|
1790
|
-
parameter:
|
|
1906
|
+
messageId: s,
|
|
1907
|
+
processId: e.processId,
|
|
1908
|
+
callSeq: e.callSeq,
|
|
1909
|
+
toolName: e.toolCall.toolName,
|
|
1910
|
+
reason: e.toolCall.reason,
|
|
1911
|
+
toolsetName: e.toolCall.toolsetName,
|
|
1912
|
+
parameter: e.toolCall.parameter,
|
|
1913
|
+
toolUseId: e.toolUseId,
|
|
1914
|
+
parentToolUseId: e.parentToolUseId,
|
|
1791
1915
|
isComplete: !1,
|
|
1792
1916
|
time: /* @__PURE__ */ new Date(),
|
|
1793
|
-
traceId:
|
|
1917
|
+
traceId: t.traceId
|
|
1794
1918
|
};
|
|
1795
|
-
return r.set(
|
|
1919
|
+
return r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
|
|
1796
1920
|
}
|
|
1797
|
-
onToolCallComplete(
|
|
1798
|
-
const
|
|
1799
|
-
if (
|
|
1800
|
-
const
|
|
1801
|
-
...
|
|
1921
|
+
onToolCallComplete(t) {
|
|
1922
|
+
const e = t.fact.toolCallComplete, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, o = r.get(s);
|
|
1923
|
+
if (o?.type === "tool-call") {
|
|
1924
|
+
const i = {
|
|
1925
|
+
...o,
|
|
1802
1926
|
eventType: d.TOOL_CALL_COMPLETE,
|
|
1803
|
-
result:
|
|
1927
|
+
result: e.toolCallResult,
|
|
1928
|
+
isError: e.isError,
|
|
1929
|
+
sidecar: e.toolUseResultSidecar,
|
|
1804
1930
|
isComplete: !0,
|
|
1805
|
-
traceId:
|
|
1931
|
+
traceId: t.traceId ?? o.traceId
|
|
1806
1932
|
};
|
|
1807
|
-
r.set(
|
|
1933
|
+
r.set(s, i);
|
|
1808
1934
|
}
|
|
1809
|
-
return new
|
|
1935
|
+
return new b({ messages: r, pendingConsent: this.pendingConsent });
|
|
1936
|
+
}
|
|
1937
|
+
onToolCallConsent(t) {
|
|
1938
|
+
const e = t.fact.toolCallConsent;
|
|
1939
|
+
return new b({ messages: this.messages, pendingConsent: e });
|
|
1940
|
+
}
|
|
1941
|
+
onSubagentStart(t) {
|
|
1942
|
+
const e = t.fact.subagentStart, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:start`, o = {
|
|
1943
|
+
type: "subagent",
|
|
1944
|
+
messageId: s,
|
|
1945
|
+
kind: "start",
|
|
1946
|
+
parentToolUseId: e.parentToolUseId,
|
|
1947
|
+
agentId: e.agentId,
|
|
1948
|
+
subagentType: e.subagentType,
|
|
1949
|
+
description: e.description,
|
|
1950
|
+
time: /* @__PURE__ */ new Date(),
|
|
1951
|
+
traceId: t.traceId
|
|
1952
|
+
};
|
|
1953
|
+
return r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
|
|
1954
|
+
}
|
|
1955
|
+
onSubagentComplete(t) {
|
|
1956
|
+
const e = t.fact.subagentComplete, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:complete`, o = {
|
|
1957
|
+
type: "subagent",
|
|
1958
|
+
messageId: s,
|
|
1959
|
+
kind: "complete",
|
|
1960
|
+
parentToolUseId: e.parentToolUseId,
|
|
1961
|
+
agentId: e.agentId,
|
|
1962
|
+
subagentType: e.subagentType,
|
|
1963
|
+
status: e.status,
|
|
1964
|
+
summary: e.summary,
|
|
1965
|
+
time: /* @__PURE__ */ new Date(),
|
|
1966
|
+
traceId: t.traceId
|
|
1967
|
+
};
|
|
1968
|
+
return r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
|
|
1810
1969
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1970
|
+
}
|
|
1971
|
+
const cn = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
|
|
1972
|
+
function un(n) {
|
|
1973
|
+
return n.toolsetName === "" && cn.has(n.toolName);
|
|
1974
|
+
}
|
|
1975
|
+
function me(n) {
|
|
1976
|
+
return typeof n == "object" && n !== null ? n : void 0;
|
|
1977
|
+
}
|
|
1978
|
+
function E(n) {
|
|
1979
|
+
return typeof n == "string" ? n : void 0;
|
|
1980
|
+
}
|
|
1981
|
+
function ln(n) {
|
|
1982
|
+
const t = [], e = /* @__PURE__ */ new Map();
|
|
1983
|
+
for (const r of n) {
|
|
1984
|
+
const s = r.parameter ?? {}, o = r.sidecar ?? {};
|
|
1985
|
+
if (r.toolName === "TaskCreate") {
|
|
1986
|
+
const i = me(o.task), a = E(i?.id);
|
|
1987
|
+
if (!a) continue;
|
|
1988
|
+
e.has(a) || t.push(a), e.set(a, {
|
|
1989
|
+
id: a,
|
|
1990
|
+
subject: E(s.subject) || E(i?.subject) || "",
|
|
1991
|
+
activeForm: E(s.activeForm),
|
|
1992
|
+
description: E(s.description),
|
|
1993
|
+
status: e.get(a)?.status ?? "pending"
|
|
1994
|
+
// initial status = pending (keep existing on repeat)
|
|
1995
|
+
});
|
|
1996
|
+
} else if (r.toolName === "TaskUpdate") {
|
|
1997
|
+
const i = me(o.statusChange), a = E(s.taskId) || E(o.taskId), u = E(i?.to) || E(s.status);
|
|
1998
|
+
if (!a || !u) continue;
|
|
1999
|
+
const c = e.get(a);
|
|
2000
|
+
c && e.set(a, { ...c, status: u });
|
|
2001
|
+
}
|
|
1814
2002
|
}
|
|
2003
|
+
return t.map((r) => e.get(r));
|
|
1815
2004
|
}
|
|
1816
|
-
|
|
2005
|
+
function dn(n) {
|
|
2006
|
+
return n.toolsetName === "" && n.toolName === "Agent";
|
|
2007
|
+
}
|
|
2008
|
+
function hn(n) {
|
|
2009
|
+
return !!n;
|
|
2010
|
+
}
|
|
2011
|
+
function fn(n) {
|
|
2012
|
+
const t = [], e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = (o) => (e.has(o) || (t.push(o), e.set(o, { status: "running" }), r.set(o, /* @__PURE__ */ new Map())), e.get(o));
|
|
2013
|
+
for (const o of n)
|
|
2014
|
+
switch (o.kind) {
|
|
2015
|
+
case "agentStart": {
|
|
2016
|
+
const i = s(o.toolUseId);
|
|
2017
|
+
o.description && !i.description && (i.description = o.description);
|
|
2018
|
+
break;
|
|
2019
|
+
}
|
|
2020
|
+
case "subagentStart": {
|
|
2021
|
+
const i = s(o.parentToolUseId);
|
|
2022
|
+
i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description;
|
|
2023
|
+
break;
|
|
2024
|
+
}
|
|
2025
|
+
case "toolStart": {
|
|
2026
|
+
s(o.parentToolUseId), r.get(o.parentToolUseId).set(o.toolUseId, {
|
|
2027
|
+
toolsetName: o.toolsetName,
|
|
2028
|
+
toolName: o.toolName,
|
|
2029
|
+
parameter: o.parameter ?? {},
|
|
2030
|
+
reason: o.reason,
|
|
2031
|
+
status: "running"
|
|
2032
|
+
});
|
|
2033
|
+
break;
|
|
2034
|
+
}
|
|
2035
|
+
case "toolComplete": {
|
|
2036
|
+
const i = r.get(o.parentToolUseId)?.get(o.toolUseId);
|
|
2037
|
+
i && (i.status = o.isError ? "error" : "completed");
|
|
2038
|
+
break;
|
|
2039
|
+
}
|
|
2040
|
+
case "subagentComplete": {
|
|
2041
|
+
const i = s(o.parentToolUseId);
|
|
2042
|
+
i.status = o.status, i.summary = o.summary;
|
|
2043
|
+
break;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
return t.map((o) => ({
|
|
2047
|
+
parentToolUseId: o,
|
|
2048
|
+
...e.get(o),
|
|
2049
|
+
tools: Array.from(r.get(o).values())
|
|
2050
|
+
}));
|
|
2051
|
+
}
|
|
2052
|
+
function pn(n) {
|
|
2053
|
+
return typeof n == "string" ? n : void 0;
|
|
2054
|
+
}
|
|
2055
|
+
function gn(n) {
|
|
2056
|
+
const t = [];
|
|
2057
|
+
for (const e of n) {
|
|
2058
|
+
if (e.type === "tool-call" && dn(e)) {
|
|
2059
|
+
t.push({
|
|
2060
|
+
kind: "agentStart",
|
|
2061
|
+
toolUseId: e.toolUseId ?? e.messageId,
|
|
2062
|
+
description: pn(e.parameter.description)
|
|
2063
|
+
});
|
|
2064
|
+
continue;
|
|
2065
|
+
}
|
|
2066
|
+
if (e.type === "tool-call" && hn(e.parentToolUseId)) {
|
|
2067
|
+
const r = e.toolUseId ?? e.messageId;
|
|
2068
|
+
t.push({
|
|
2069
|
+
kind: "toolStart",
|
|
2070
|
+
parentToolUseId: e.parentToolUseId,
|
|
2071
|
+
toolUseId: r,
|
|
2072
|
+
toolsetName: e.toolsetName,
|
|
2073
|
+
toolName: e.toolName,
|
|
2074
|
+
parameter: e.parameter,
|
|
2075
|
+
reason: e.reason
|
|
2076
|
+
}), e.isComplete && t.push({
|
|
2077
|
+
kind: "toolComplete",
|
|
2078
|
+
parentToolUseId: e.parentToolUseId,
|
|
2079
|
+
toolUseId: r,
|
|
2080
|
+
isError: e.isError
|
|
2081
|
+
});
|
|
2082
|
+
continue;
|
|
2083
|
+
}
|
|
2084
|
+
if (e.type === "subagent" && e.kind === "start") {
|
|
2085
|
+
t.push({
|
|
2086
|
+
kind: "subagentStart",
|
|
2087
|
+
parentToolUseId: e.parentToolUseId,
|
|
2088
|
+
agentId: e.agentId,
|
|
2089
|
+
subagentType: e.subagentType,
|
|
2090
|
+
description: e.description
|
|
2091
|
+
});
|
|
2092
|
+
continue;
|
|
2093
|
+
}
|
|
2094
|
+
e.type === "subagent" && e.kind === "complete" && e.status && t.push({
|
|
2095
|
+
kind: "subagentComplete",
|
|
2096
|
+
parentToolUseId: e.parentToolUseId,
|
|
2097
|
+
status: e.status,
|
|
2098
|
+
summary: e.summary
|
|
2099
|
+
});
|
|
2100
|
+
}
|
|
2101
|
+
return t;
|
|
2102
|
+
}
|
|
2103
|
+
function mn(n) {
|
|
2104
|
+
const t = Array.from(n.messages?.values() ?? []).filter(
|
|
2105
|
+
(e) => e.type === "tool-call" && e.isComplete && un(e)
|
|
2106
|
+
);
|
|
2107
|
+
return ln(t);
|
|
2108
|
+
}
|
|
2109
|
+
function vn(n) {
|
|
2110
|
+
return fn(gn(Array.from(n.messages?.values() ?? [])));
|
|
2111
|
+
}
|
|
2112
|
+
function yn(n, t) {
|
|
2113
|
+
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
|
|
2114
|
+
const s = t[r];
|
|
2115
|
+
return e.id === s.id && e.status === s.status && e.subject === s.subject && e.activeForm === s.activeForm && e.description === s.description;
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
function bn(n, t) {
|
|
2119
|
+
return n.length !== t.length ? !1 : n.every((e, r) => {
|
|
2120
|
+
const s = t[r];
|
|
2121
|
+
return e.toolName === s.toolName && e.toolsetName === s.toolsetName && e.status === s.status && e.reason === s.reason;
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
function Sn(n, t) {
|
|
2125
|
+
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
|
|
2126
|
+
const s = t[r];
|
|
2127
|
+
return e.parentToolUseId === s.parentToolUseId && e.status === s.status && e.subagentType === s.subagentType && e.description === s.description && e.summary === s.summary && bn(e.tools, s.tools);
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
function In(n) {
|
|
2131
|
+
const t = new N([]), e = new N([]), r = new U();
|
|
2132
|
+
return r.add(n.pipe(P(mn), Z(yn)).subscribe(t)), r.add(
|
|
2133
|
+
n.pipe(P(vn), Z(Sn)).subscribe(e)
|
|
2134
|
+
), {
|
|
2135
|
+
tasks$: t.asObservable(),
|
|
2136
|
+
subagents$: e.asObservable(),
|
|
2137
|
+
getTasks: () => t.value,
|
|
2138
|
+
getSubagents: () => e.value,
|
|
2139
|
+
teardown: () => r.unsubscribe()
|
|
2140
|
+
};
|
|
2141
|
+
}
|
|
2142
|
+
class K {
|
|
1817
2143
|
client;
|
|
1818
2144
|
customChannelId;
|
|
1819
2145
|
customMessageId;
|
|
1820
2146
|
isConnecting$;
|
|
1821
2147
|
conversation$;
|
|
2148
|
+
channelTitleSubject;
|
|
2149
|
+
derivedStores;
|
|
1822
2150
|
statesObserver;
|
|
1823
2151
|
statesSubscription;
|
|
2152
|
+
/** Reactive Task Check List store (F-013): emits only when the list changes; replays the snapshot. */
|
|
2153
|
+
tasks$;
|
|
2154
|
+
/** Reactive Subagent list store (F-013): emits only when the list changes; replays the snapshot. */
|
|
2155
|
+
subagents$;
|
|
2156
|
+
/** Reactive channel title store (F-016): seeded from metadata, updated by `title.update`; replay-safe. */
|
|
2157
|
+
channelTitle$;
|
|
1824
2158
|
currentUserMessageId;
|
|
1825
2159
|
// The most-recently-sent user message id. Unlike currentUserMessageId (which
|
|
1826
2160
|
// is cleared once a traceId is attached), this is kept across the SSE
|
|
1827
2161
|
// lifecycle so RESPONSE_TOOL_CALL_CONSENT — fired after run.done — can echo
|
|
1828
2162
|
// back the message id the bot is waiting on.
|
|
1829
2163
|
lastSentMessageId;
|
|
1830
|
-
constructor(
|
|
1831
|
-
if (!
|
|
2164
|
+
constructor(t) {
|
|
2165
|
+
if (!t.client)
|
|
1832
2166
|
throw new Error("client must be required");
|
|
1833
|
-
if (!
|
|
2167
|
+
if (!t.customChannelId)
|
|
1834
2168
|
throw new Error("customChannelId must be required");
|
|
1835
|
-
this.client =
|
|
2169
|
+
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new N(!1), this.conversation$ = new N(t.conversation), this.channelTitleSubject = new N(t.channelTitle ?? null), this.derivedStores = In(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(Z()), this.statesObserver = t.statesObserver;
|
|
2170
|
+
}
|
|
2171
|
+
/** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2172
|
+
getTasks() {
|
|
2173
|
+
return this.derivedStores.getTasks();
|
|
2174
|
+
}
|
|
2175
|
+
/** Current Subagent list snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2176
|
+
getSubagents() {
|
|
2177
|
+
return this.derivedStores.getSubagents();
|
|
2178
|
+
}
|
|
2179
|
+
/** Current channel title snapshot (F-016) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2180
|
+
getChannelTitle() {
|
|
2181
|
+
return this.channelTitleSubject.value;
|
|
2182
|
+
}
|
|
2183
|
+
/** Seed / override the channel title (F-016) — used by the join-restore metadata seed (F-015). */
|
|
2184
|
+
setChannelTitle(t) {
|
|
2185
|
+
this.channelTitleSubject.next(t);
|
|
1836
2186
|
}
|
|
1837
|
-
static create(
|
|
1838
|
-
const
|
|
1839
|
-
return
|
|
2187
|
+
static create(t) {
|
|
2188
|
+
const e = new K(t);
|
|
2189
|
+
return e.subscribe(), e;
|
|
1840
2190
|
}
|
|
1841
|
-
static async reset(
|
|
1842
|
-
const
|
|
2191
|
+
static async reset(t, e, r, s) {
|
|
2192
|
+
const o = new K(t);
|
|
1843
2193
|
try {
|
|
1844
|
-
return
|
|
1845
|
-
} catch (
|
|
1846
|
-
throw
|
|
2194
|
+
return o.subscribe(), s?.(o), await o.resetChannel(e, r), o;
|
|
2195
|
+
} catch (i) {
|
|
2196
|
+
throw o.close(), i;
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Join an **existing** channel without resetting it (F-015). Seeds the title from `config.channelTitle`
|
|
2201
|
+
* (the `GET /channel/metadata` value) at construction, then replays the server transcript via GET
|
|
2202
|
+
* `rejoinSse` and holds `isConnecting` until the run reaches a terminal. Never sends `RESET_CHANNEL`,
|
|
2203
|
+
* so the channel's history / session / title are preserved — this is the fix for the mount-time
|
|
2204
|
+
* "join an existing channel and wipe its history" data-loss bug.
|
|
2205
|
+
*/
|
|
2206
|
+
static async restore(t, e, r) {
|
|
2207
|
+
const s = new K(t);
|
|
2208
|
+
try {
|
|
2209
|
+
return s.subscribe(), r?.(s), await s.rejoinChannel(e), s;
|
|
2210
|
+
} catch (o) {
|
|
2211
|
+
throw s.close(), o;
|
|
1847
2212
|
}
|
|
1848
2213
|
}
|
|
1849
2214
|
subscribe() {
|
|
1850
|
-
this.statesSubscription = Rt([
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
2215
|
+
this.statesSubscription = Rt([
|
|
2216
|
+
this.isConnecting$,
|
|
2217
|
+
this.conversation$,
|
|
2218
|
+
this.derivedStores.tasks$,
|
|
2219
|
+
this.derivedStores.subagents$,
|
|
2220
|
+
this.channelTitle$
|
|
2221
|
+
]).pipe(
|
|
2222
|
+
P(([t, e, r, s, o]) => ({
|
|
2223
|
+
isConnecting: t,
|
|
2224
|
+
conversation: e,
|
|
2225
|
+
tasks: r,
|
|
2226
|
+
subagents: s,
|
|
2227
|
+
channelTitle: o
|
|
1854
2228
|
}))
|
|
1855
2229
|
).subscribe(this.statesObserver);
|
|
1856
2230
|
}
|
|
1857
2231
|
/**
|
|
1858
2232
|
* Resolves payload by executing it if it's a function, otherwise returns as-is.
|
|
1859
2233
|
*/
|
|
1860
|
-
resolvePayload(
|
|
1861
|
-
if (typeof
|
|
2234
|
+
resolvePayload(t) {
|
|
2235
|
+
if (typeof t == "function")
|
|
1862
2236
|
try {
|
|
1863
|
-
return
|
|
1864
|
-
} catch (
|
|
2237
|
+
return t();
|
|
2238
|
+
} catch (e) {
|
|
1865
2239
|
throw new Error(
|
|
1866
|
-
`Failed to resolve payload function: ${
|
|
2240
|
+
`Failed to resolve payload function: ${e instanceof Error ? e.message : String(e)}`
|
|
1867
2241
|
);
|
|
1868
2242
|
}
|
|
1869
|
-
return
|
|
2243
|
+
return t;
|
|
1870
2244
|
}
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
onSseCompleted: () => {
|
|
1889
|
-
t?.onSseCompleted?.(), this.isConnecting$.next(!1), this.currentUserMessageId = void 0, r();
|
|
2245
|
+
/**
|
|
2246
|
+
* The SSE run handlers shared by every run kind (POST send/reset and GET rejoin): fold each frame
|
|
2247
|
+
* through the conversation reducer, keep the title store in sync, attach the traceId to the pending
|
|
2248
|
+
* user bubble, and settle the run promise (releasing `isConnecting`) on completion / error.
|
|
2249
|
+
*/
|
|
2250
|
+
buildRunHandlers(t, e, r) {
|
|
2251
|
+
return {
|
|
2252
|
+
onSseStart: t?.onSseStart,
|
|
2253
|
+
onSseMessage: (s) => {
|
|
2254
|
+
if (t?.onSseMessage?.(s), s.eventType === d.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
|
|
2255
|
+
s.fact.channelTitleUpdate.title
|
|
2256
|
+
), this.currentUserMessageId && s.traceId) {
|
|
2257
|
+
const o = new Map(this.conversation$.value.messages), i = o.get(this.currentUserMessageId);
|
|
2258
|
+
i && i.type === "user" && (o.set(this.currentUserMessageId, {
|
|
2259
|
+
...i,
|
|
2260
|
+
traceId: s.traceId
|
|
2261
|
+
}), this.conversation$.next(new b({ messages: o }))), this.currentUserMessageId = void 0;
|
|
1890
2262
|
}
|
|
1891
|
-
|
|
2263
|
+
this.conversation$.next(this.conversation$.value.onMessage(s));
|
|
2264
|
+
},
|
|
2265
|
+
onSseError: (s) => {
|
|
2266
|
+
t?.onSseError?.(s), this.isConnecting$.next(!1), this.currentUserMessageId = void 0, r(s);
|
|
2267
|
+
},
|
|
2268
|
+
onSseCompleted: () => {
|
|
2269
|
+
t?.onSseCompleted?.(), this.isConnecting$.next(!1), this.currentUserMessageId = void 0, e();
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
fetchSse(t, e) {
|
|
2274
|
+
return new Promise((r, s) => {
|
|
2275
|
+
this.isConnecting$.next(!0), this.client.fetchSse(t, this.buildRunHandlers(e, r, s));
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* Join-restore transport (F-015): replay the server transcript via GET `rejoinSse` (F-014) and, if a
|
|
2280
|
+
* run is still live, keep listening until its terminal — holding `isConnecting` the whole time so the
|
|
2281
|
+
* input stays gated (F-003). A client without GET-replay support settles immediately (nothing to
|
|
2282
|
+
* restore), so the input is released rather than stuck.
|
|
2283
|
+
*/
|
|
2284
|
+
rejoinChannel(t) {
|
|
2285
|
+
return new Promise((e, r) => {
|
|
2286
|
+
if (!this.client.rejoinSse) {
|
|
2287
|
+
e();
|
|
2288
|
+
return;
|
|
2289
|
+
}
|
|
2290
|
+
this.isConnecting$.next(!0), this.client.rejoinSse(this.customChannelId, this.buildRunHandlers(t, e, r));
|
|
1892
2291
|
});
|
|
1893
2292
|
}
|
|
1894
|
-
resetChannel(
|
|
2293
|
+
resetChannel(t, e) {
|
|
1895
2294
|
return this.fetchSse(
|
|
1896
2295
|
{
|
|
1897
|
-
action:
|
|
2296
|
+
action: H.RESET_CHANNEL,
|
|
1898
2297
|
customChannelId: this.customChannelId,
|
|
1899
2298
|
customMessageId: this.customMessageId,
|
|
1900
|
-
text:
|
|
1901
|
-
payload: this.resolvePayload(
|
|
2299
|
+
text: t?.text || "",
|
|
2300
|
+
payload: this.resolvePayload(t?.payload)
|
|
1902
2301
|
},
|
|
1903
|
-
|
|
2302
|
+
e
|
|
1904
2303
|
);
|
|
1905
2304
|
}
|
|
1906
|
-
sendMessage(
|
|
1907
|
-
const r =
|
|
1908
|
-
return this.currentUserMessageId =
|
|
2305
|
+
sendMessage(t, e) {
|
|
2306
|
+
const r = t.text.trim(), s = t.customMessageId ?? De();
|
|
2307
|
+
return this.currentUserMessageId = s, this.lastSentMessageId = s, this.conversation$.next(
|
|
1909
2308
|
this.conversation$.value.pushMessage({
|
|
1910
2309
|
type: "user",
|
|
1911
|
-
messageId:
|
|
2310
|
+
messageId: s,
|
|
1912
2311
|
text: r,
|
|
1913
|
-
blobIds:
|
|
1914
|
-
filePreviewUrls:
|
|
1915
|
-
documentNames:
|
|
2312
|
+
blobIds: t.blobIds,
|
|
2313
|
+
filePreviewUrls: t.filePreviewUrls,
|
|
2314
|
+
documentNames: t.documentNames,
|
|
1916
2315
|
time: /* @__PURE__ */ new Date()
|
|
1917
2316
|
})
|
|
1918
2317
|
), this.fetchSse(
|
|
1919
2318
|
{
|
|
1920
|
-
action:
|
|
2319
|
+
action: H.NONE,
|
|
1921
2320
|
customChannelId: this.customChannelId,
|
|
1922
|
-
customMessageId:
|
|
1923
|
-
payload: this.resolvePayload(
|
|
2321
|
+
customMessageId: s,
|
|
2322
|
+
payload: this.resolvePayload(t?.payload),
|
|
1924
2323
|
text: r,
|
|
1925
|
-
blobIds:
|
|
2324
|
+
blobIds: t?.blobIds
|
|
1926
2325
|
},
|
|
1927
|
-
|
|
2326
|
+
e
|
|
1928
2327
|
);
|
|
1929
2328
|
}
|
|
1930
|
-
replyToolCallConsents(
|
|
2329
|
+
replyToolCallConsents(t, e, r) {
|
|
1931
2330
|
return this.conversation$.next(this.conversation$.value.clearPendingConsent()), this.fetchSse(
|
|
1932
2331
|
{
|
|
1933
|
-
action:
|
|
2332
|
+
action: H.RESPONSE_TOOL_CALL_CONSENT,
|
|
1934
2333
|
customChannelId: this.customChannelId,
|
|
1935
2334
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
1936
2335
|
payload: this.resolvePayload(r),
|
|
1937
2336
|
text: "",
|
|
1938
|
-
toolCallConsents:
|
|
2337
|
+
toolCallConsents: t
|
|
1939
2338
|
},
|
|
1940
|
-
|
|
2339
|
+
e
|
|
1941
2340
|
);
|
|
1942
2341
|
}
|
|
1943
2342
|
close() {
|
|
1944
|
-
this.isConnecting$.complete(), this.conversation$.complete(), this.statesSubscription?.unsubscribe();
|
|
2343
|
+
this.isConnecting$.complete(), this.conversation$.complete(), this.channelTitleSubject.complete(), this.derivedStores.teardown(), this.statesSubscription?.unsubscribe();
|
|
1945
2344
|
}
|
|
1946
2345
|
}
|
|
1947
2346
|
export {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
2347
|
+
wn as AsgardServiceClient,
|
|
2348
|
+
K as Channel,
|
|
2349
|
+
b as Conversation,
|
|
1951
2350
|
d as EventType,
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2351
|
+
H as FetchSseAction,
|
|
2352
|
+
te as HttpError,
|
|
2353
|
+
Fe as MessageTemplateType,
|
|
2354
|
+
Ke as ToolCallConsentResult,
|
|
2355
|
+
gn as conversationToSubagentEvents,
|
|
2356
|
+
In as createDerivedStores,
|
|
2357
|
+
vn as deriveSubagents,
|
|
2358
|
+
mn as deriveTasks,
|
|
2359
|
+
dn as isAgentTool,
|
|
2360
|
+
En as isHttpError,
|
|
2361
|
+
hn as isSubagentChildTool,
|
|
2362
|
+
un as isTaskTool,
|
|
2363
|
+
fn as reduceSubagents,
|
|
2364
|
+
ln as reduceTaskEvents,
|
|
2365
|
+
Sn as subagentsEqual,
|
|
2366
|
+
yn as tasksEqual
|
|
1957
2367
|
};
|
|
1958
2368
|
//# sourceMappingURL=index.mjs.map
|