@asgard-js/core 0.0.3 → 0.0.5

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