@asgard-js/core 0.0.40 → 0.0.41-canary.1

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