@asgard-js/core 0.0.1 → 0.0.2

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