@telia-ace/widget-conversation-flamingo 1.1.18-rc.4 → 1.1.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,1218 +0,0 @@
1
- let _;
2
- const vt = new Uint8Array(16);
3
- function yt() {
4
- if (!_ && (_ = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !_))
5
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
6
- return _(vt);
7
- }
8
- const p = [];
9
- for (let t = 0; t < 256; ++t)
10
- p.push((t + 256).toString(16).slice(1));
11
- function bt(t, e = 0) {
12
- return p[t[e + 0]] + p[t[e + 1]] + p[t[e + 2]] + p[t[e + 3]] + "-" + p[t[e + 4]] + p[t[e + 5]] + "-" + p[t[e + 6]] + p[t[e + 7]] + "-" + p[t[e + 8]] + p[t[e + 9]] + "-" + p[t[e + 10]] + p[t[e + 11]] + p[t[e + 12]] + p[t[e + 13]] + p[t[e + 14]] + p[t[e + 15]];
13
- }
14
- const mt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), G = {
15
- randomUUID: mt
16
- };
17
- function wt(t, e, r) {
18
- if (G.randomUUID && !e && !t)
19
- return G.randomUUID();
20
- t = t || {};
21
- const n = t.random || (t.rng || yt)();
22
- if (n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, e) {
23
- r = r || 0;
24
- for (let o = 0; o < 16; ++o)
25
- e[r + o] = n[o];
26
- return e;
27
- }
28
- return bt(n);
29
- }
30
- var $ = function(t, e) {
31
- return $ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
32
- r.__proto__ = n;
33
- } || function(r, n) {
34
- for (var o in n)
35
- Object.prototype.hasOwnProperty.call(n, o) && (r[o] = n[o]);
36
- }, $(t, e);
37
- };
38
- function g(t, e) {
39
- if (typeof e != "function" && e !== null)
40
- throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
41
- $(t, e);
42
- function r() {
43
- this.constructor = t;
44
- }
45
- t.prototype = e === null ? Object.create(e) : (r.prototype = e.prototype, new r());
46
- }
47
- function St(t, e, r, n) {
48
- function o(i) {
49
- return i instanceof r ? i : new r(function(s) {
50
- s(i);
51
- });
52
- }
53
- return new (r || (r = Promise))(function(i, s) {
54
- function u(f) {
55
- try {
56
- c(n.next(f));
57
- } catch (b) {
58
- s(b);
59
- }
60
- }
61
- function a(f) {
62
- try {
63
- c(n.throw(f));
64
- } catch (b) {
65
- s(b);
66
- }
67
- }
68
- function c(f) {
69
- f.done ? i(f.value) : o(f.value).then(u, a);
70
- }
71
- c((n = n.apply(t, e || [])).next());
72
- });
73
- }
74
- function J(t, e) {
75
- var r = { label: 0, sent: function() {
76
- if (i[0] & 1)
77
- throw i[1];
78
- return i[1];
79
- }, trys: [], ops: [] }, n, o, i, s;
80
- return s = { next: u(0), throw: u(1), return: u(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
81
- return this;
82
- }), s;
83
- function u(c) {
84
- return function(f) {
85
- return a([c, f]);
86
- };
87
- }
88
- function a(c) {
89
- if (n)
90
- throw new TypeError("Generator is already executing.");
91
- for (; s && (s = 0, c[0] && (r = 0)), r; )
92
- try {
93
- if (n = 1, o && (i = c[0] & 2 ? o.return : c[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, c[1])).done)
94
- return i;
95
- switch (o = 0, i && (c = [c[0] & 2, i.value]), c[0]) {
96
- case 0:
97
- case 1:
98
- i = c;
99
- break;
100
- case 4:
101
- return r.label++, { value: c[1], done: !1 };
102
- case 5:
103
- r.label++, o = c[1], c = [0];
104
- continue;
105
- case 7:
106
- c = r.ops.pop(), r.trys.pop();
107
- continue;
108
- default:
109
- if (i = r.trys, !(i = i.length > 0 && i[i.length - 1]) && (c[0] === 6 || c[0] === 2)) {
110
- r = 0;
111
- continue;
112
- }
113
- if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
114
- r.label = c[1];
115
- break;
116
- }
117
- if (c[0] === 6 && r.label < i[1]) {
118
- r.label = i[1], i = c;
119
- break;
120
- }
121
- if (i && r.label < i[2]) {
122
- r.label = i[2], r.ops.push(c);
123
- break;
124
- }
125
- i[2] && r.ops.pop(), r.trys.pop();
126
- continue;
127
- }
128
- c = e.call(t, r);
129
- } catch (f) {
130
- c = [6, f], o = 0;
131
- } finally {
132
- n = i = 0;
133
- }
134
- if (c[0] & 5)
135
- throw c[1];
136
- return { value: c[0] ? c[1] : void 0, done: !0 };
137
- }
138
- }
139
- function S(t) {
140
- var e = typeof Symbol == "function" && Symbol.iterator, r = e && t[e], n = 0;
141
- if (r)
142
- return r.call(t);
143
- if (t && typeof t.length == "number")
144
- return {
145
- next: function() {
146
- return t && n >= t.length && (t = void 0), { value: t && t[n++], done: !t };
147
- }
148
- };
149
- throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
150
- }
151
- function P(t, e) {
152
- var r = typeof Symbol == "function" && t[Symbol.iterator];
153
- if (!r)
154
- return t;
155
- var n = r.call(t), o, i = [], s;
156
- try {
157
- for (; (e === void 0 || e-- > 0) && !(o = n.next()).done; )
158
- i.push(o.value);
159
- } catch (u) {
160
- s = { error: u };
161
- } finally {
162
- try {
163
- o && !o.done && (r = n.return) && r.call(n);
164
- } finally {
165
- if (s)
166
- throw s.error;
167
- }
168
- }
169
- return i;
170
- }
171
- function U(t, e, r) {
172
- if (r || arguments.length === 2)
173
- for (var n = 0, o = e.length, i; n < o; n++)
174
- (i || !(n in e)) && (i || (i = Array.prototype.slice.call(e, 0, n)), i[n] = e[n]);
175
- return t.concat(i || Array.prototype.slice.call(e));
176
- }
177
- function w(t) {
178
- return this instanceof w ? (this.v = t, this) : new w(t);
179
- }
180
- function gt(t, e, r) {
181
- if (!Symbol.asyncIterator)
182
- throw new TypeError("Symbol.asyncIterator is not defined.");
183
- var n = r.apply(t, e || []), o, i = [];
184
- return o = {}, s("next"), s("throw"), s("return"), o[Symbol.asyncIterator] = function() {
185
- return this;
186
- }, o;
187
- function s(l) {
188
- n[l] && (o[l] = function(v) {
189
- return new Promise(function(E, d) {
190
- i.push([l, v, E, d]) > 1 || u(l, v);
191
- });
192
- });
193
- }
194
- function u(l, v) {
195
- try {
196
- a(n[l](v));
197
- } catch (E) {
198
- b(i[0][3], E);
199
- }
200
- }
201
- function a(l) {
202
- l.value instanceof w ? Promise.resolve(l.value.v).then(c, f) : b(i[0][2], l);
203
- }
204
- function c(l) {
205
- u("next", l);
206
- }
207
- function f(l) {
208
- u("throw", l);
209
- }
210
- function b(l, v) {
211
- l(v), i.shift(), i.length && u(i[0][0], i[0][1]);
212
- }
213
- }
214
- function xt(t) {
215
- if (!Symbol.asyncIterator)
216
- throw new TypeError("Symbol.asyncIterator is not defined.");
217
- var e = t[Symbol.asyncIterator], r;
218
- return e ? e.call(t) : (t = typeof S == "function" ? S(t) : t[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() {
219
- return this;
220
- }, r);
221
- function n(i) {
222
- r[i] = t[i] && function(s) {
223
- return new Promise(function(u, a) {
224
- s = t[i](s), o(u, a, s.done, s.value);
225
- });
226
- };
227
- }
228
- function o(i, s, u, a) {
229
- Promise.resolve(a).then(function(c) {
230
- i({ value: c, done: u });
231
- }, s);
232
- }
233
- }
234
- function h(t) {
235
- return typeof t == "function";
236
- }
237
- function Q(t) {
238
- var e = function(n) {
239
- Error.call(n), n.stack = new Error().stack;
240
- }, r = t(e);
241
- return r.prototype = Object.create(Error.prototype), r.prototype.constructor = r, r;
242
- }
243
- var j = Q(function(t) {
244
- return function(r) {
245
- t(this), this.message = r ? r.length + ` errors occurred during unsubscription:
246
- ` + r.map(function(n, o) {
247
- return o + 1 + ") " + n.toString();
248
- }).join(`
249
- `) : "", this.name = "UnsubscriptionError", this.errors = r;
250
- };
251
- });
252
- function C(t, e) {
253
- if (t) {
254
- var r = t.indexOf(e);
255
- 0 <= r && t.splice(r, 1);
256
- }
257
- }
258
- var A = function() {
259
- function t(e) {
260
- this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
261
- }
262
- return t.prototype.unsubscribe = function() {
263
- var e, r, n, o, i;
264
- if (!this.closed) {
265
- this.closed = !0;
266
- var s = this._parentage;
267
- if (s)
268
- if (this._parentage = null, Array.isArray(s))
269
- try {
270
- for (var u = S(s), a = u.next(); !a.done; a = u.next()) {
271
- var c = a.value;
272
- c.remove(this);
273
- }
274
- } catch (d) {
275
- e = { error: d };
276
- } finally {
277
- try {
278
- a && !a.done && (r = u.return) && r.call(u);
279
- } finally {
280
- if (e)
281
- throw e.error;
282
- }
283
- }
284
- else
285
- s.remove(this);
286
- var f = this.initialTeardown;
287
- if (h(f))
288
- try {
289
- f();
290
- } catch (d) {
291
- i = d instanceof j ? d.errors : [d];
292
- }
293
- var b = this._finalizers;
294
- if (b) {
295
- this._finalizers = null;
296
- try {
297
- for (var l = S(b), v = l.next(); !v.done; v = l.next()) {
298
- var E = v.value;
299
- try {
300
- H(E);
301
- } catch (d) {
302
- i = i ?? [], d instanceof j ? i = U(U([], P(i)), P(d.errors)) : i.push(d);
303
- }
304
- }
305
- } catch (d) {
306
- n = { error: d };
307
- } finally {
308
- try {
309
- v && !v.done && (o = l.return) && o.call(l);
310
- } finally {
311
- if (n)
312
- throw n.error;
313
- }
314
- }
315
- }
316
- if (i)
317
- throw new j(i);
318
- }
319
- }, t.prototype.add = function(e) {
320
- var r;
321
- if (e && e !== this)
322
- if (this.closed)
323
- H(e);
324
- else {
325
- if (e instanceof t) {
326
- if (e.closed || e._hasParent(this))
327
- return;
328
- e._addParent(this);
329
- }
330
- (this._finalizers = (r = this._finalizers) !== null && r !== void 0 ? r : []).push(e);
331
- }
332
- }, t.prototype._hasParent = function(e) {
333
- var r = this._parentage;
334
- return r === e || Array.isArray(r) && r.includes(e);
335
- }, t.prototype._addParent = function(e) {
336
- var r = this._parentage;
337
- this._parentage = Array.isArray(r) ? (r.push(e), r) : r ? [r, e] : e;
338
- }, t.prototype._removeParent = function(e) {
339
- var r = this._parentage;
340
- r === e ? this._parentage = null : Array.isArray(r) && C(r, e);
341
- }, t.prototype.remove = function(e) {
342
- var r = this._finalizers;
343
- r && C(r, e), e instanceof t && e._removeParent(this);
344
- }, t.EMPTY = function() {
345
- var e = new t();
346
- return e.closed = !0, e;
347
- }(), t;
348
- }(), W = A.EMPTY;
349
- function X(t) {
350
- return t instanceof A || t && "closed" in t && h(t.remove) && h(t.add) && h(t.unsubscribe);
351
- }
352
- function H(t) {
353
- h(t) ? t() : t.unsubscribe();
354
- }
355
- var Z = {
356
- onUnhandledError: null,
357
- onStoppedNotification: null,
358
- Promise: void 0,
359
- useDeprecatedSynchronousErrorHandling: !1,
360
- useDeprecatedNextContext: !1
361
- }, R = {
362
- setTimeout: function(t, e) {
363
- for (var r = [], n = 2; n < arguments.length; n++)
364
- r[n - 2] = arguments[n];
365
- var o = R.delegate;
366
- return o != null && o.setTimeout ? o.setTimeout.apply(o, U([t, e], P(r))) : setTimeout.apply(void 0, U([t, e], P(r)));
367
- },
368
- clearTimeout: function(t) {
369
- var e = R.delegate;
370
- return ((e == null ? void 0 : e.clearTimeout) || clearTimeout)(t);
371
- },
372
- delegate: void 0
373
- };
374
- function N(t) {
375
- R.setTimeout(function() {
376
- throw t;
377
- });
378
- }
379
- function q() {
380
- }
381
- function O(t) {
382
- t();
383
- }
384
- var L = function(t) {
385
- g(e, t);
386
- function e(r) {
387
- var n = t.call(this) || this;
388
- return n.isStopped = !1, r ? (n.destination = r, X(r) && r.add(n)) : n.destination = Ot, n;
389
- }
390
- return e.create = function(r, n, o) {
391
- return new F(r, n, o);
392
- }, e.prototype.next = function(r) {
393
- this.isStopped || this._next(r);
394
- }, e.prototype.error = function(r) {
395
- this.isStopped || (this.isStopped = !0, this._error(r));
396
- }, e.prototype.complete = function() {
397
- this.isStopped || (this.isStopped = !0, this._complete());
398
- }, e.prototype.unsubscribe = function() {
399
- this.closed || (this.isStopped = !0, t.prototype.unsubscribe.call(this), this.destination = null);
400
- }, e.prototype._next = function(r) {
401
- this.destination.next(r);
402
- }, e.prototype._error = function(r) {
403
- try {
404
- this.destination.error(r);
405
- } finally {
406
- this.unsubscribe();
407
- }
408
- }, e.prototype._complete = function() {
409
- try {
410
- this.destination.complete();
411
- } finally {
412
- this.unsubscribe();
413
- }
414
- }, e;
415
- }(A), Et = Function.prototype.bind;
416
- function k(t, e) {
417
- return Et.call(t, e);
418
- }
419
- var _t = function() {
420
- function t(e) {
421
- this.partialObserver = e;
422
- }
423
- return t.prototype.next = function(e) {
424
- var r = this.partialObserver;
425
- if (r.next)
426
- try {
427
- r.next(e);
428
- } catch (n) {
429
- I(n);
430
- }
431
- }, t.prototype.error = function(e) {
432
- var r = this.partialObserver;
433
- if (r.error)
434
- try {
435
- r.error(e);
436
- } catch (n) {
437
- I(n);
438
- }
439
- else
440
- I(e);
441
- }, t.prototype.complete = function() {
442
- var e = this.partialObserver;
443
- if (e.complete)
444
- try {
445
- e.complete();
446
- } catch (r) {
447
- I(r);
448
- }
449
- }, t;
450
- }(), F = function(t) {
451
- g(e, t);
452
- function e(r, n, o) {
453
- var i = t.call(this) || this, s;
454
- if (h(r) || !r)
455
- s = {
456
- next: r ?? void 0,
457
- error: n ?? void 0,
458
- complete: o ?? void 0
459
- };
460
- else {
461
- var u;
462
- i && Z.useDeprecatedNextContext ? (u = Object.create(r), u.unsubscribe = function() {
463
- return i.unsubscribe();
464
- }, s = {
465
- next: r.next && k(r.next, u),
466
- error: r.error && k(r.error, u),
467
- complete: r.complete && k(r.complete, u)
468
- }) : s = r;
469
- }
470
- return i.destination = new _t(s), i;
471
- }
472
- return e;
473
- }(L);
474
- function I(t) {
475
- N(t);
476
- }
477
- function It(t) {
478
- throw t;
479
- }
480
- var Ot = {
481
- closed: !0,
482
- next: q,
483
- error: It,
484
- complete: q
485
- }, D = function() {
486
- return typeof Symbol == "function" && Symbol.observable || "@@observable";
487
- }();
488
- function Pt(t) {
489
- return t;
490
- }
491
- function Ut(t) {
492
- return t.length === 0 ? Pt : t.length === 1 ? t[0] : function(r) {
493
- return t.reduce(function(n, o) {
494
- return o(n);
495
- }, r);
496
- };
497
- }
498
- var y = function() {
499
- function t(e) {
500
- e && (this._subscribe = e);
501
- }
502
- return t.prototype.lift = function(e) {
503
- var r = new t();
504
- return r.source = this, r.operator = e, r;
505
- }, t.prototype.subscribe = function(e, r, n) {
506
- var o = this, i = Tt(e) ? e : new F(e, r, n);
507
- return O(function() {
508
- var s = o, u = s.operator, a = s.source;
509
- i.add(u ? u.call(i, a) : a ? o._subscribe(i) : o._trySubscribe(i));
510
- }), i;
511
- }, t.prototype._trySubscribe = function(e) {
512
- try {
513
- return this._subscribe(e);
514
- } catch (r) {
515
- e.error(r);
516
- }
517
- }, t.prototype.forEach = function(e, r) {
518
- var n = this;
519
- return r = z(r), new r(function(o, i) {
520
- var s = new F({
521
- next: function(u) {
522
- try {
523
- e(u);
524
- } catch (a) {
525
- i(a), s.unsubscribe();
526
- }
527
- },
528
- error: i,
529
- complete: o
530
- });
531
- n.subscribe(s);
532
- });
533
- }, t.prototype._subscribe = function(e) {
534
- var r;
535
- return (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e);
536
- }, t.prototype[D] = function() {
537
- return this;
538
- }, t.prototype.pipe = function() {
539
- for (var e = [], r = 0; r < arguments.length; r++)
540
- e[r] = arguments[r];
541
- return Ut(e)(this);
542
- }, t.prototype.toPromise = function(e) {
543
- var r = this;
544
- return e = z(e), new e(function(n, o) {
545
- var i;
546
- r.subscribe(function(s) {
547
- return i = s;
548
- }, function(s) {
549
- return o(s);
550
- }, function() {
551
- return n(i);
552
- });
553
- });
554
- }, t.create = function(e) {
555
- return new t(e);
556
- }, t;
557
- }();
558
- function z(t) {
559
- var e;
560
- return (e = t ?? Z.Promise) !== null && e !== void 0 ? e : Promise;
561
- }
562
- function At(t) {
563
- return t && h(t.next) && h(t.error) && h(t.complete);
564
- }
565
- function Tt(t) {
566
- return t && t instanceof L || At(t) && X(t);
567
- }
568
- function jt(t) {
569
- return h(t == null ? void 0 : t.lift);
570
- }
571
- function V(t) {
572
- return function(e) {
573
- if (jt(e))
574
- return e.lift(function(r) {
575
- try {
576
- return t(r, this);
577
- } catch (n) {
578
- this.error(n);
579
- }
580
- });
581
- throw new TypeError("Unable to lift unknown Observable type");
582
- };
583
- }
584
- function tt(t, e, r, n, o) {
585
- return new kt(t, e, r, n, o);
586
- }
587
- var kt = function(t) {
588
- g(e, t);
589
- function e(r, n, o, i, s, u) {
590
- var a = t.call(this, r) || this;
591
- return a.onFinalize = s, a.shouldUnsubscribe = u, a._next = n ? function(c) {
592
- try {
593
- n(c);
594
- } catch (f) {
595
- r.error(f);
596
- }
597
- } : t.prototype._next, a._error = i ? function(c) {
598
- try {
599
- i(c);
600
- } catch (f) {
601
- r.error(f);
602
- } finally {
603
- this.unsubscribe();
604
- }
605
- } : t.prototype._error, a._complete = o ? function() {
606
- try {
607
- o();
608
- } catch (c) {
609
- r.error(c);
610
- } finally {
611
- this.unsubscribe();
612
- }
613
- } : t.prototype._complete, a;
614
- }
615
- return e.prototype.unsubscribe = function() {
616
- var r;
617
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
618
- var n = this.closed;
619
- t.prototype.unsubscribe.call(this), !n && ((r = this.onFinalize) === null || r === void 0 || r.call(this));
620
- }
621
- }, e;
622
- }(L), $t = Q(function(t) {
623
- return function() {
624
- t(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
625
- };
626
- }), x = function(t) {
627
- g(e, t);
628
- function e() {
629
- var r = t.call(this) || this;
630
- return r.closed = !1, r.currentObservers = null, r.observers = [], r.isStopped = !1, r.hasError = !1, r.thrownError = null, r;
631
- }
632
- return e.prototype.lift = function(r) {
633
- var n = new K(this, this);
634
- return n.operator = r, n;
635
- }, e.prototype._throwIfClosed = function() {
636
- if (this.closed)
637
- throw new $t();
638
- }, e.prototype.next = function(r) {
639
- var n = this;
640
- O(function() {
641
- var o, i;
642
- if (n._throwIfClosed(), !n.isStopped) {
643
- n.currentObservers || (n.currentObservers = Array.from(n.observers));
644
- try {
645
- for (var s = S(n.currentObservers), u = s.next(); !u.done; u = s.next()) {
646
- var a = u.value;
647
- a.next(r);
648
- }
649
- } catch (c) {
650
- o = { error: c };
651
- } finally {
652
- try {
653
- u && !u.done && (i = s.return) && i.call(s);
654
- } finally {
655
- if (o)
656
- throw o.error;
657
- }
658
- }
659
- }
660
- });
661
- }, e.prototype.error = function(r) {
662
- var n = this;
663
- O(function() {
664
- if (n._throwIfClosed(), !n.isStopped) {
665
- n.hasError = n.isStopped = !0, n.thrownError = r;
666
- for (var o = n.observers; o.length; )
667
- o.shift().error(r);
668
- }
669
- });
670
- }, e.prototype.complete = function() {
671
- var r = this;
672
- O(function() {
673
- if (r._throwIfClosed(), !r.isStopped) {
674
- r.isStopped = !0;
675
- for (var n = r.observers; n.length; )
676
- n.shift().complete();
677
- }
678
- });
679
- }, e.prototype.unsubscribe = function() {
680
- this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
681
- }, Object.defineProperty(e.prototype, "observed", {
682
- get: function() {
683
- var r;
684
- return ((r = this.observers) === null || r === void 0 ? void 0 : r.length) > 0;
685
- },
686
- enumerable: !1,
687
- configurable: !0
688
- }), e.prototype._trySubscribe = function(r) {
689
- return this._throwIfClosed(), t.prototype._trySubscribe.call(this, r);
690
- }, e.prototype._subscribe = function(r) {
691
- return this._throwIfClosed(), this._checkFinalizedStatuses(r), this._innerSubscribe(r);
692
- }, e.prototype._innerSubscribe = function(r) {
693
- var n = this, o = this, i = o.hasError, s = o.isStopped, u = o.observers;
694
- return i || s ? W : (this.currentObservers = null, u.push(r), new A(function() {
695
- n.currentObservers = null, C(u, r);
696
- }));
697
- }, e.prototype._checkFinalizedStatuses = function(r) {
698
- var n = this, o = n.hasError, i = n.thrownError, s = n.isStopped;
699
- o ? r.error(i) : s && r.complete();
700
- }, e.prototype.asObservable = function() {
701
- var r = new y();
702
- return r.source = this, r;
703
- }, e.create = function(r, n) {
704
- return new K(r, n);
705
- }, e;
706
- }(y), K = function(t) {
707
- g(e, t);
708
- function e(r, n) {
709
- var o = t.call(this) || this;
710
- return o.destination = r, o.source = n, o;
711
- }
712
- return e.prototype.next = function(r) {
713
- var n, o;
714
- (o = (n = this.destination) === null || n === void 0 ? void 0 : n.next) === null || o === void 0 || o.call(n, r);
715
- }, e.prototype.error = function(r) {
716
- var n, o;
717
- (o = (n = this.destination) === null || n === void 0 ? void 0 : n.error) === null || o === void 0 || o.call(n, r);
718
- }, e.prototype.complete = function() {
719
- var r, n;
720
- (n = (r = this.destination) === null || r === void 0 ? void 0 : r.complete) === null || n === void 0 || n.call(r);
721
- }, e.prototype._subscribe = function(r) {
722
- var n, o;
723
- return (o = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(r)) !== null && o !== void 0 ? o : W;
724
- }, e;
725
- }(x), rt = function(t) {
726
- g(e, t);
727
- function e(r) {
728
- var n = t.call(this) || this;
729
- return n._value = r, n;
730
- }
731
- return Object.defineProperty(e.prototype, "value", {
732
- get: function() {
733
- return this.getValue();
734
- },
735
- enumerable: !1,
736
- configurable: !0
737
- }), e.prototype._subscribe = function(r) {
738
- var n = t.prototype._subscribe.call(this, r);
739
- return !n.closed && r.next(this._value), n;
740
- }, e.prototype.getValue = function() {
741
- var r = this, n = r.hasError, o = r.thrownError, i = r._value;
742
- if (n)
743
- throw o;
744
- return this._throwIfClosed(), i;
745
- }, e.prototype.next = function(r) {
746
- t.prototype.next.call(this, this._value = r);
747
- }, e;
748
- }(x), Ct = new y(function(t) {
749
- return t.complete();
750
- });
751
- function Rt(t) {
752
- return t && h(t.schedule);
753
- }
754
- function Ft(t) {
755
- return t[t.length - 1];
756
- }
757
- function Lt(t) {
758
- return Rt(Ft(t)) ? t.pop() : void 0;
759
- }
760
- var et = function(t) {
761
- return t && typeof t.length == "number" && typeof t != "function";
762
- };
763
- function nt(t) {
764
- return h(t == null ? void 0 : t.then);
765
- }
766
- function ot(t) {
767
- return h(t[D]);
768
- }
769
- function it(t) {
770
- return Symbol.asyncIterator && h(t == null ? void 0 : t[Symbol.asyncIterator]);
771
- }
772
- function st(t) {
773
- 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.");
774
- }
775
- function Dt() {
776
- return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
777
- }
778
- var ut = Dt();
779
- function ct(t) {
780
- return h(t == null ? void 0 : t[ut]);
781
- }
782
- function at(t) {
783
- return gt(this, arguments, function() {
784
- var r, n, o, i;
785
- return J(this, function(s) {
786
- switch (s.label) {
787
- case 0:
788
- r = t.getReader(), s.label = 1;
789
- case 1:
790
- s.trys.push([1, , 9, 10]), s.label = 2;
791
- case 2:
792
- return [4, w(r.read())];
793
- case 3:
794
- return n = s.sent(), o = n.value, i = n.done, i ? [4, w(void 0)] : [3, 5];
795
- case 4:
796
- return [2, s.sent()];
797
- case 5:
798
- return [4, w(o)];
799
- case 6:
800
- return [4, s.sent()];
801
- case 7:
802
- return s.sent(), [3, 2];
803
- case 8:
804
- return [3, 10];
805
- case 9:
806
- return r.releaseLock(), [7];
807
- case 10:
808
- return [2];
809
- }
810
- });
811
- });
812
- }
813
- function lt(t) {
814
- return h(t == null ? void 0 : t.getReader);
815
- }
816
- function Y(t) {
817
- if (t instanceof y)
818
- return t;
819
- if (t != null) {
820
- if (ot(t))
821
- return Vt(t);
822
- if (et(t))
823
- return Yt(t);
824
- if (nt(t))
825
- return Bt(t);
826
- if (it(t))
827
- return ft(t);
828
- if (ct(t))
829
- return Mt(t);
830
- if (lt(t))
831
- return Gt(t);
832
- }
833
- throw st(t);
834
- }
835
- function Vt(t) {
836
- return new y(function(e) {
837
- var r = t[D]();
838
- if (h(r.subscribe))
839
- return r.subscribe(e);
840
- throw new TypeError("Provided object does not correctly implement Symbol.observable");
841
- });
842
- }
843
- function Yt(t) {
844
- return new y(function(e) {
845
- for (var r = 0; r < t.length && !e.closed; r++)
846
- e.next(t[r]);
847
- e.complete();
848
- });
849
- }
850
- function Bt(t) {
851
- return new y(function(e) {
852
- t.then(function(r) {
853
- e.closed || (e.next(r), e.complete());
854
- }, function(r) {
855
- return e.error(r);
856
- }).then(null, N);
857
- });
858
- }
859
- function Mt(t) {
860
- return new y(function(e) {
861
- var r, n;
862
- try {
863
- for (var o = S(t), i = o.next(); !i.done; i = o.next()) {
864
- var s = i.value;
865
- if (e.next(s), e.closed)
866
- return;
867
- }
868
- } catch (u) {
869
- r = { error: u };
870
- } finally {
871
- try {
872
- i && !i.done && (n = o.return) && n.call(o);
873
- } finally {
874
- if (r)
875
- throw r.error;
876
- }
877
- }
878
- e.complete();
879
- });
880
- }
881
- function ft(t) {
882
- return new y(function(e) {
883
- Ht(t, e).catch(function(r) {
884
- return e.error(r);
885
- });
886
- });
887
- }
888
- function Gt(t) {
889
- return ft(at(t));
890
- }
891
- function Ht(t, e) {
892
- var r, n, o, i;
893
- return St(this, void 0, void 0, function() {
894
- var s, u;
895
- return J(this, function(a) {
896
- switch (a.label) {
897
- case 0:
898
- a.trys.push([0, 5, 6, 11]), r = xt(t), a.label = 1;
899
- case 1:
900
- return [4, r.next()];
901
- case 2:
902
- if (n = a.sent(), !!n.done)
903
- return [3, 4];
904
- if (s = n.value, e.next(s), e.closed)
905
- return [2];
906
- a.label = 3;
907
- case 3:
908
- return [3, 1];
909
- case 4:
910
- return [3, 11];
911
- case 5:
912
- return u = a.sent(), o = { error: u }, [3, 11];
913
- case 6:
914
- return a.trys.push([6, , 9, 10]), n && !n.done && (i = r.return) ? [4, i.call(r)] : [3, 8];
915
- case 7:
916
- a.sent(), a.label = 8;
917
- case 8:
918
- return [3, 10];
919
- case 9:
920
- if (o)
921
- throw o.error;
922
- return [7];
923
- case 10:
924
- return [7];
925
- case 11:
926
- return e.complete(), [2];
927
- }
928
- });
929
- });
930
- }
931
- function m(t, e, r, n, o) {
932
- n === void 0 && (n = 0), o === void 0 && (o = !1);
933
- var i = e.schedule(function() {
934
- r(), o ? t.add(this.schedule(null, n)) : this.unsubscribe();
935
- }, n);
936
- if (t.add(i), !o)
937
- return i;
938
- }
939
- function ht(t, e) {
940
- return e === void 0 && (e = 0), V(function(r, n) {
941
- r.subscribe(tt(n, function(o) {
942
- return m(n, t, function() {
943
- return n.next(o);
944
- }, e);
945
- }, function() {
946
- return m(n, t, function() {
947
- return n.complete();
948
- }, e);
949
- }, function(o) {
950
- return m(n, t, function() {
951
- return n.error(o);
952
- }, e);
953
- }));
954
- });
955
- }
956
- function pt(t, e) {
957
- return e === void 0 && (e = 0), V(function(r, n) {
958
- n.add(t.schedule(function() {
959
- return r.subscribe(n);
960
- }, e));
961
- });
962
- }
963
- function qt(t, e) {
964
- return Y(t).pipe(pt(e), ht(e));
965
- }
966
- function zt(t, e) {
967
- return Y(t).pipe(pt(e), ht(e));
968
- }
969
- function Kt(t, e) {
970
- return new y(function(r) {
971
- var n = 0;
972
- return e.schedule(function() {
973
- n === t.length ? r.complete() : (r.next(t[n++]), r.closed || this.schedule());
974
- });
975
- });
976
- }
977
- function Jt(t, e) {
978
- return new y(function(r) {
979
- var n;
980
- return m(r, e, function() {
981
- n = t[ut](), m(r, e, function() {
982
- var o, i, s;
983
- try {
984
- o = n.next(), i = o.value, s = o.done;
985
- } catch (u) {
986
- r.error(u);
987
- return;
988
- }
989
- s ? r.complete() : r.next(i);
990
- }, 0, !0);
991
- }), function() {
992
- return h(n == null ? void 0 : n.return) && n.return();
993
- };
994
- });
995
- }
996
- function dt(t, e) {
997
- if (!t)
998
- throw new Error("Iterable cannot be null");
999
- return new y(function(r) {
1000
- m(r, e, function() {
1001
- var n = t[Symbol.asyncIterator]();
1002
- m(r, e, function() {
1003
- n.next().then(function(o) {
1004
- o.done ? r.complete() : r.next(o.value);
1005
- });
1006
- }, 0, !0);
1007
- });
1008
- });
1009
- }
1010
- function Qt(t, e) {
1011
- return dt(at(t), e);
1012
- }
1013
- function Wt(t, e) {
1014
- if (t != null) {
1015
- if (ot(t))
1016
- return qt(t, e);
1017
- if (et(t))
1018
- return Kt(t, e);
1019
- if (nt(t))
1020
- return zt(t, e);
1021
- if (it(t))
1022
- return dt(t, e);
1023
- if (ct(t))
1024
- return Jt(t, e);
1025
- if (lt(t))
1026
- return Qt(t, e);
1027
- }
1028
- throw st(t);
1029
- }
1030
- function Xt(t, e) {
1031
- return e ? Wt(t, e) : Y(t);
1032
- }
1033
- function Zt() {
1034
- for (var t = [], e = 0; e < arguments.length; e++)
1035
- t[e] = arguments[e];
1036
- var r = Lt(t);
1037
- return Xt(t, r);
1038
- }
1039
- function Nt(t) {
1040
- return t <= 0 ? function() {
1041
- return Ct;
1042
- } : V(function(e, r) {
1043
- var n = 0;
1044
- e.subscribe(tt(r, function(o) {
1045
- ++n <= t && (r.next(o), t <= n && r.complete());
1046
- }));
1047
- });
1048
- }
1049
- class tr {
1050
- constructor(e, r) {
1051
- this.id = e, this.entries$ = new rt([]), r.addEventListener("user-submit", (n) => {
1052
- if (!this.provider) {
1053
- console.warn(
1054
- "No provider activated, unable to print message to conversation."
1055
- );
1056
- return;
1057
- }
1058
- this.provider.onUserSubmit(n.detail);
1059
- });
1060
- }
1061
- write(e) {
1062
- this.entries$.pipe(Nt(1)).subscribe((r) => {
1063
- this.entries$.next([...r, e]);
1064
- });
1065
- }
1066
- entries() {
1067
- return this.entries$.asObservable();
1068
- }
1069
- setProvider(e) {
1070
- this.provider = e, this.provider.actions().subscribe((r) => {
1071
- this.write(r);
1072
- });
1073
- }
1074
- isTyping() {
1075
- return this.provider ? this.provider.isTyping() : Zt(!1);
1076
- }
1077
- }
1078
- class B {
1079
- constructor() {
1080
- this.sessions = /* @__PURE__ */ new Map(), this.registeredProviders = /* @__PURE__ */ new Map(), this.activeSessionId = null;
1081
- }
1082
- static async getInstance(e) {
1083
- let r = await e.get("conversation");
1084
- return r || (r = new B(), await e.register("conversation", r), r);
1085
- }
1086
- registerProvider(e, r) {
1087
- this.registeredProviders.set(e, r);
1088
- }
1089
- createSession(e) {
1090
- const r = new tr(wt(), e), n = this.getProviderByConfiguration(e);
1091
- if (n) {
1092
- const o = n();
1093
- r.setProvider(o);
1094
- }
1095
- return this.sessions.set(r.id, r), this.activeSessionId = r.id, r;
1096
- }
1097
- getProviderByConfiguration(e) {
1098
- const [r] = e.properties.providers || [];
1099
- if (!r) {
1100
- console.warn(
1101
- "No providers registered. You most likely forgot to add a provider to the conversation component properties."
1102
- );
1103
- return;
1104
- }
1105
- return this.registeredProviders.get(r);
1106
- }
1107
- }
1108
- const nr = async (t) => {
1109
- t.registerComponent("conversation", import("./conversation-3926f29b.mjs").then((e) => e.c)), await B.getInstance(t.container);
1110
- };
1111
- var T = /* @__PURE__ */ ((t) => (t.User = "user", t.Agent = "agent", t.System = "system", t))(T || {});
1112
- class M {
1113
- constructor(e, r, n) {
1114
- this.type = e, this.sender = r, this.messages = n, this.didUpdate = new x(), this.timestamp = Date.now();
1115
- }
1116
- update(e) {
1117
- this.messages = [
1118
- {
1119
- items: e
1120
- }
1121
- ], this.didUpdate.next(this);
1122
- }
1123
- }
1124
- class rr {
1125
- constructor(e) {
1126
- this.name = e, this.print$ = new x();
1127
- }
1128
- print(e) {
1129
- const r = new M(
1130
- T.Agent,
1131
- { name: this.name },
1132
- [
1133
- {
1134
- items: [["html", { content: e }]]
1135
- }
1136
- ]
1137
- );
1138
- return this.print$.next(r), r;
1139
- }
1140
- subscribe() {
1141
- return this.print$.asObservable();
1142
- }
1143
- }
1144
- class er {
1145
- constructor(e) {
1146
- this.name = e, this.print$ = new x();
1147
- }
1148
- print(e) {
1149
- const r = new M(
1150
- T.User,
1151
- { name: this.name },
1152
- [
1153
- {
1154
- items: [["html", { content: e }]]
1155
- }
1156
- ]
1157
- );
1158
- return this.print$.next(r), r;
1159
- }
1160
- subscribe() {
1161
- return this.print$.asObservable();
1162
- }
1163
- }
1164
- class or {
1165
- constructor(e) {
1166
- this.name = e, this.print$ = new x(), this.typingState$ = new rt(!1);
1167
- }
1168
- onUserSubmit(e) {
1169
- this.print(T.User, e.text);
1170
- }
1171
- print(e, r) {
1172
- const n = new M(
1173
- e,
1174
- {
1175
- name: ""
1176
- },
1177
- [
1178
- {
1179
- items: [["html", { content: r }]]
1180
- }
1181
- ]
1182
- );
1183
- return this.printEntry(n);
1184
- }
1185
- printEntry(e) {
1186
- return this.print$.next(e), e;
1187
- }
1188
- createAgent(e) {
1189
- const r = new rr(e);
1190
- return r.subscribe().subscribe((n) => {
1191
- this.printEntry(n);
1192
- }), r;
1193
- }
1194
- createUser(e) {
1195
- const r = new er(e);
1196
- return r.subscribe().subscribe((n) => {
1197
- this.printEntry(n);
1198
- }), r;
1199
- }
1200
- setTypingState(e) {
1201
- this.typingState$.next(e);
1202
- }
1203
- isTyping() {
1204
- return this.typingState$.asObservable();
1205
- }
1206
- actions() {
1207
- return this.print$.asObservable();
1208
- }
1209
- }
1210
- export {
1211
- rr as A,
1212
- T as C,
1213
- er as U,
1214
- nr as a,
1215
- B as b,
1216
- or as c,
1217
- M as d
1218
- };