@telia-ace/widget-conversation-flamingo 1.1.13 → 1.1.14-rc.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import { C as wt } from "./index-4ba82b09.mjs";
1
+ import { C as wt } from "./index-7ce12d5a.mjs";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
@@ -1479,7 +1479,7 @@ class U extends y {
1479
1479
  const t = (r = this.application) == null ? void 0 : r.triggerIcon;
1480
1480
  if (!t)
1481
1481
  return u;
1482
- const s = async (o) => await import("./index-217978bc.mjs").then(
1482
+ const s = async (o) => await import("./index-94b25fbe.mjs").then(
1483
1483
  (l) => l[o]
1484
1484
  ), { type: i, content: n } = t;
1485
1485
  switch (i) {
@@ -1,4 +1,4 @@
1
- "use strict";const wt=require("./index-494250de.js");/**
1
+ "use strict";const wt=require("./index-cec07deb.js");/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -48,7 +48,7 @@
48
48
  * @license
49
49
  * Copyright 2018 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
- */const Ft=bt(class extends zt{constructor(e){var t;if(super(e),e.type!==yt.ATTRIBUTE||e.name!=="class"||((t=e.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){var i,n;if(this.it===void 0){this.it=new Set,e.strings!==void 0&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!((i=this.st)!=null&&i.has(r))&&this.it.add(r);return this.render(t)}const s=e.element.classList;for(const r of this.it)r in t||(s.remove(r),this.it.delete(r));for(const r in t){const o=!!t[r];o===this.it.has(r)||(n=this.st)!=null&&n.has(r)||(o?(s.add(r),this.it.add(r)):(s.remove(r),this.it.delete(r)))}return C}}),st=(e,t,s)=>{e&&s.style.setProperty(t,e)},Ve=(e,t)=>{var s,i,n,r;st((s=e.colors)==null?void 0:s.primaryBackground,"--primary-background",t),st((i=e.colors)==null?void 0:i.textOnPrimaryBackground,"--text-on-primary-background",t),st((n=e.colors)==null?void 0:n.secondaryBackground,"--secondary-background",t),st((r=e.colors)==null?void 0:r.textOnSecondaryBackground,"--text-on-secondary-background",t)};var Oi=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,_t=(e,t,s,i)=>{for(var n=i>1?void 0:i?Pi(t,s):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(n=(i?o(t,s,n):o(n))||n);return i&&n&&Oi(t,s,n),n};class U extends y{constructor(){super(...arguments),this.active=!1,this.loaded=!1}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(),this.loaded=!0,this._applyBranding()}_toggleActive(){var t;if(!((t=this.application)!=null&&t.root)){console.warn("Could not activate widget. No root element assigned to widget.");return}this.active=!this.active,this.active?this.application.appendToDOM():this.application.removeFromDOM()}_applyBranding(){var t;(t=this.application)!=null&&t.settings&&Ve(this.application.settings.branding,this)}async _renderSymbol(){var r;const t=(r=this.application)==null?void 0:r.triggerIcon;if(!t)return u;const s=async o=>await Promise.resolve().then(()=>require("./index-43151bb4.js")).then(l=>l[o]),{type:i,content:n}=t;switch(i){case"Telia":{const o=await s(n);return o?$`<telia-icon
51
+ */const Ft=bt(class extends zt{constructor(e){var t;if(super(e),e.type!==yt.ATTRIBUTE||e.name!=="class"||((t=e.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){var i,n;if(this.it===void 0){this.it=new Set,e.strings!==void 0&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!((i=this.st)!=null&&i.has(r))&&this.it.add(r);return this.render(t)}const s=e.element.classList;for(const r of this.it)r in t||(s.remove(r),this.it.delete(r));for(const r in t){const o=!!t[r];o===this.it.has(r)||(n=this.st)!=null&&n.has(r)||(o?(s.add(r),this.it.add(r)):(s.remove(r),this.it.delete(r)))}return C}}),st=(e,t,s)=>{e&&s.style.setProperty(t,e)},Ve=(e,t)=>{var s,i,n,r;st((s=e.colors)==null?void 0:s.primaryBackground,"--primary-background",t),st((i=e.colors)==null?void 0:i.textOnPrimaryBackground,"--text-on-primary-background",t),st((n=e.colors)==null?void 0:n.secondaryBackground,"--secondary-background",t),st((r=e.colors)==null?void 0:r.textOnSecondaryBackground,"--text-on-secondary-background",t)};var Oi=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,_t=(e,t,s,i)=>{for(var n=i>1?void 0:i?Pi(t,s):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(n=(i?o(t,s,n):o(n))||n);return i&&n&&Oi(t,s,n),n};class U extends y{constructor(){super(...arguments),this.active=!1,this.loaded=!1}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(),this.loaded=!0,this._applyBranding()}_toggleActive(){var t;if(!((t=this.application)!=null&&t.root)){console.warn("Could not activate widget. No root element assigned to widget.");return}this.active=!this.active,this.active?this.application.appendToDOM():this.application.removeFromDOM()}_applyBranding(){var t;(t=this.application)!=null&&t.settings&&Ve(this.application.settings.branding,this)}async _renderSymbol(){var r;const t=(r=this.application)==null?void 0:r.triggerIcon;if(!t)return u;const s=async o=>await Promise.resolve().then(()=>require("./index-b8394e84.js")).then(l=>l[o]),{type:i,content:n}=t;switch(i){case"Telia":{const o=await s(n);return o?$`<telia-icon
52
52
  class="trigger-icon"
53
53
  svg=${o.svg}
54
54
  size="lg"
@@ -1,11 +1,13 @@
1
1
  import { ConversationSessionState } from './models/conversation-session-state';
2
2
  import { ConversationProvider } from './models/conversation-provider';
3
3
  import Conversation from './conversation';
4
+ import { Container } from '@telia-ace/widget-core-flamingo';
4
5
  export type ProviderFactory = () => ConversationProvider;
5
6
  export declare class ConversationPlatform {
6
7
  sessions: Map<string, ConversationSessionState>;
7
8
  registeredProviders: Map<string, ProviderFactory>;
8
9
  activeSessionId: string | null;
10
+ static getInstance(container: Container): Promise<ConversationPlatform>;
9
11
  registerProvider(name: string, provider: ProviderFactory): void;
10
12
  createSession(component: Conversation): ConversationSessionState;
11
13
  private getProviderByConfiguration;
@@ -1,57 +1,50 @@
1
- const gt = async (e) => {
2
- e.registerComponent("conversation", import("./conversation-7da6b954.mjs").then((t) => t.c));
3
- const r = await Promise.resolve().then(() => yt).then(
4
- (t) => t.ConversationPlatform
5
- );
6
- e.container.register("conversation", new r());
7
- };
8
1
  let m;
9
- const q = new Uint8Array(16);
10
- function G() {
2
+ const G = new Uint8Array(16);
3
+ function J() {
11
4
  if (!m && (m = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !m))
12
5
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
13
- return m(q);
6
+ return m(G);
14
7
  }
15
8
  const a = [];
16
9
  for (let e = 0; e < 256; ++e)
17
10
  a.push((e + 256).toString(16).slice(1));
18
- function J(e, r = 0) {
11
+ function Q(e, r = 0) {
19
12
  return a[e[r + 0]] + a[e[r + 1]] + a[e[r + 2]] + a[e[r + 3]] + "-" + a[e[r + 4]] + a[e[r + 5]] + "-" + a[e[r + 6]] + a[e[r + 7]] + "-" + a[e[r + 8]] + a[e[r + 9]] + "-" + a[e[r + 10]] + a[e[r + 11]] + a[e[r + 12]] + a[e[r + 13]] + a[e[r + 14]] + a[e[r + 15]];
20
13
  }
21
- const Q = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), R = {
22
- randomUUID: Q
14
+ const W = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), B = {
15
+ randomUUID: W
23
16
  };
24
- function W(e, r, t) {
25
- if (R.randomUUID && !r && !e)
26
- return R.randomUUID();
17
+ function X(e, r, t) {
18
+ if (B.randomUUID && !r && !e)
19
+ return B.randomUUID();
27
20
  e = e || {};
28
- const n = e.random || (e.rng || G)();
21
+ const n = e.random || (e.rng || J)();
29
22
  if (n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, r) {
30
23
  t = t || 0;
31
24
  for (let i = 0; i < 16; ++i)
32
25
  r[t + i] = n[i];
33
26
  return r;
34
27
  }
35
- return J(n);
28
+ return Q(n);
36
29
  }
37
- var O = function(e, r) {
38
- return O = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
30
+ var P = function(e, r) {
31
+ return P = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
39
32
  t.__proto__ = n;
40
33
  } || function(t, n) {
41
34
  for (var i in n)
42
35
  Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
43
- }, O(e, r);
36
+ }, P(e, r);
44
37
  };
45
38
  function d(e, r) {
46
39
  if (typeof r != "function" && r !== null)
47
40
  throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
48
- O(e, r);
41
+ P(e, r);
49
42
  function t() {
50
43
  this.constructor = e;
51
44
  }
52
45
  e.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
53
46
  }
54
- function j(e) {
47
+ function A(e) {
55
48
  var r = typeof Symbol == "function" && Symbol.iterator, t = r && e[r], n = 0;
56
49
  if (t)
57
50
  return t.call(e);
@@ -92,13 +85,13 @@ function _(e, r, t) {
92
85
  function p(e) {
93
86
  return typeof e == "function";
94
87
  }
95
- function Y(e) {
88
+ function H(e) {
96
89
  var r = function(n) {
97
90
  Error.call(n), n.stack = new Error().stack;
98
91
  }, t = e(r);
99
92
  return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
100
93
  }
101
- var x = Y(function(e) {
94
+ var U = H(function(e) {
102
95
  return function(t) {
103
96
  e(this), this.message = t ? t.length + ` errors occurred during unsubscription:
104
97
  ` + t.map(function(n, i) {
@@ -107,7 +100,7 @@ var x = Y(function(e) {
107
100
  `) : "", this.name = "UnsubscriptionError", this.errors = t;
108
101
  };
109
102
  });
110
- function A(e, r) {
103
+ function j(e, r) {
111
104
  if (e) {
112
105
  var t = e.indexOf(r);
113
106
  0 <= t && e.splice(t, 1);
@@ -125,7 +118,7 @@ var E = function() {
125
118
  if (s)
126
119
  if (this._parentage = null, Array.isArray(s))
127
120
  try {
128
- for (var u = j(s), c = u.next(); !c.done; c = u.next()) {
121
+ for (var u = A(s), c = u.next(); !c.done; c = u.next()) {
129
122
  var h = c.value;
130
123
  h.remove(this);
131
124
  }
@@ -146,18 +139,18 @@ var E = function() {
146
139
  try {
147
140
  f();
148
141
  } catch (l) {
149
- o = l instanceof x ? l.errors : [l];
142
+ o = l instanceof U ? l.errors : [l];
150
143
  }
151
- var F = this._finalizers;
152
- if (F) {
144
+ var R = this._finalizers;
145
+ if (R) {
153
146
  this._finalizers = null;
154
147
  try {
155
- for (var y = j(F), b = y.next(); !b.done; b = y.next()) {
156
- var K = b.value;
148
+ for (var y = A(R), b = y.next(); !b.done; b = y.next()) {
149
+ var q = b.value;
157
150
  try {
158
- B(K);
151
+ V(q);
159
152
  } catch (l) {
160
- o = o ?? [], l instanceof x ? o = _(_([], w(o)), w(l.errors)) : o.push(l);
153
+ o = o ?? [], l instanceof U ? o = _(_([], w(o)), w(l.errors)) : o.push(l);
161
154
  }
162
155
  }
163
156
  } catch (l) {
@@ -172,13 +165,13 @@ var E = function() {
172
165
  }
173
166
  }
174
167
  if (o)
175
- throw new x(o);
168
+ throw new U(o);
176
169
  }
177
170
  }, e.prototype.add = function(r) {
178
171
  var t;
179
172
  if (r && r !== this)
180
173
  if (this.closed)
181
- B(r);
174
+ V(r);
182
175
  else {
183
176
  if (r instanceof e) {
184
177
  if (r.closed || r._hasParent(this))
@@ -195,46 +188,46 @@ var E = function() {
195
188
  this._parentage = Array.isArray(t) ? (t.push(r), t) : t ? [t, r] : r;
196
189
  }, e.prototype._removeParent = function(r) {
197
190
  var t = this._parentage;
198
- t === r ? this._parentage = null : Array.isArray(t) && A(t, r);
191
+ t === r ? this._parentage = null : Array.isArray(t) && j(t, r);
199
192
  }, e.prototype.remove = function(r) {
200
193
  var t = this._finalizers;
201
- t && A(t, r), r instanceof e && r._removeParent(this);
194
+ t && j(t, r), r instanceof e && r._removeParent(this);
202
195
  }, e.EMPTY = function() {
203
196
  var r = new e();
204
197
  return r.closed = !0, r;
205
198
  }(), e;
206
- }(), H = E.EMPTY;
199
+ }(), L = E.EMPTY;
207
200
  function z(e) {
208
201
  return e instanceof E || e && "closed" in e && p(e.remove) && p(e.add) && p(e.unsubscribe);
209
202
  }
210
- function B(e) {
203
+ function V(e) {
211
204
  p(e) ? e() : e.unsubscribe();
212
205
  }
213
- var L = {
206
+ var K = {
214
207
  onUnhandledError: null,
215
208
  onStoppedNotification: null,
216
209
  Promise: void 0,
217
210
  useDeprecatedSynchronousErrorHandling: !1,
218
211
  useDeprecatedNextContext: !1
219
- }, C = {
212
+ }, I = {
220
213
  setTimeout: function(e, r) {
221
214
  for (var t = [], n = 2; n < arguments.length; n++)
222
215
  t[n - 2] = arguments[n];
223
- var i = C.delegate;
216
+ var i = I.delegate;
224
217
  return i != null && i.setTimeout ? i.setTimeout.apply(i, _([e, r], w(t))) : setTimeout.apply(void 0, _([e, r], w(t)));
225
218
  },
226
219
  clearTimeout: function(e) {
227
- var r = C.delegate;
220
+ var r = I.delegate;
228
221
  return ((r == null ? void 0 : r.clearTimeout) || clearTimeout)(e);
229
222
  },
230
223
  delegate: void 0
231
224
  };
232
- function X(e) {
233
- C.setTimeout(function() {
225
+ function Z(e) {
226
+ I.setTimeout(function() {
234
227
  throw e;
235
228
  });
236
229
  }
237
- function V() {
230
+ function k() {
238
231
  }
239
232
  function g(e) {
240
233
  e();
@@ -243,7 +236,7 @@ var $ = function(e) {
243
236
  d(r, e);
244
237
  function r(t) {
245
238
  var n = e.call(this) || this;
246
- return n.isStopped = !1, t ? (n.destination = t, z(t) && t.add(n)) : n.destination = rt, n;
239
+ return n.isStopped = !1, t ? (n.destination = t, z(t) && t.add(n)) : n.destination = et, n;
247
240
  }
248
241
  return r.create = function(t, n, i) {
249
242
  return new T(t, n, i);
@@ -270,11 +263,11 @@ var $ = function(e) {
270
263
  this.unsubscribe();
271
264
  }
272
265
  }, r;
273
- }(E), Z = Function.prototype.bind;
274
- function U(e, r) {
275
- return Z.call(e, r);
266
+ }(E), N = Function.prototype.bind;
267
+ function O(e, r) {
268
+ return N.call(e, r);
276
269
  }
277
- var N = function() {
270
+ var tt = function() {
278
271
  function e(r) {
279
272
  this.partialObserver = r;
280
273
  }
@@ -317,43 +310,43 @@ var N = function() {
317
310
  };
318
311
  else {
319
312
  var u;
320
- o && L.useDeprecatedNextContext ? (u = Object.create(t), u.unsubscribe = function() {
313
+ o && K.useDeprecatedNextContext ? (u = Object.create(t), u.unsubscribe = function() {
321
314
  return o.unsubscribe();
322
315
  }, s = {
323
- next: t.next && U(t.next, u),
324
- error: t.error && U(t.error, u),
325
- complete: t.complete && U(t.complete, u)
316
+ next: t.next && O(t.next, u),
317
+ error: t.error && O(t.error, u),
318
+ complete: t.complete && O(t.complete, u)
326
319
  }) : s = t;
327
320
  }
328
- return o.destination = new N(s), o;
321
+ return o.destination = new tt(s), o;
329
322
  }
330
323
  return r;
331
324
  }($);
332
325
  function S(e) {
333
- X(e);
326
+ Z(e);
334
327
  }
335
- function tt(e) {
328
+ function rt(e) {
336
329
  throw e;
337
330
  }
338
- var rt = {
331
+ var et = {
339
332
  closed: !0,
340
- next: V,
341
- error: tt,
342
- complete: V
343
- }, et = function() {
333
+ next: k,
334
+ error: rt,
335
+ complete: k
336
+ }, nt = function() {
344
337
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
345
338
  }();
346
- function nt(e) {
339
+ function it(e) {
347
340
  return e;
348
341
  }
349
- function it(e) {
350
- return e.length === 0 ? nt : e.length === 1 ? e[0] : function(t) {
342
+ function ot(e) {
343
+ return e.length === 0 ? it : e.length === 1 ? e[0] : function(t) {
351
344
  return e.reduce(function(n, i) {
352
345
  return i(n);
353
346
  }, t);
354
347
  };
355
348
  }
356
- var I = function() {
349
+ var C = function() {
357
350
  function e(r) {
358
351
  r && (this._subscribe = r);
359
352
  }
@@ -361,7 +354,7 @@ var I = function() {
361
354
  var t = new e();
362
355
  return t.source = this, t.operator = r, t;
363
356
  }, e.prototype.subscribe = function(r, t, n) {
364
- var i = this, o = st(r) ? r : new T(r, t, n);
357
+ var i = this, o = ut(r) ? r : new T(r, t, n);
365
358
  return g(function() {
366
359
  var s = i, u = s.operator, c = s.source;
367
360
  o.add(u ? u.call(o, c) : c ? i._subscribe(o) : i._trySubscribe(o));
@@ -374,7 +367,7 @@ var I = function() {
374
367
  }
375
368
  }, e.prototype.forEach = function(r, t) {
376
369
  var n = this;
377
- return t = k(t), new t(function(i, o) {
370
+ return t = Y(t), new t(function(i, o) {
378
371
  var s = new T({
379
372
  next: function(u) {
380
373
  try {
@@ -391,15 +384,15 @@ var I = function() {
391
384
  }, e.prototype._subscribe = function(r) {
392
385
  var t;
393
386
  return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(r);
394
- }, e.prototype[et] = function() {
387
+ }, e.prototype[nt] = function() {
395
388
  return this;
396
389
  }, e.prototype.pipe = function() {
397
390
  for (var r = [], t = 0; t < arguments.length; t++)
398
391
  r[t] = arguments[t];
399
- return it(r)(this);
392
+ return ot(r)(this);
400
393
  }, e.prototype.toPromise = function(r) {
401
394
  var t = this;
402
- return r = k(r), new r(function(n, i) {
395
+ return r = Y(r), new r(function(n, i) {
403
396
  var o;
404
397
  t.subscribe(function(s) {
405
398
  return o = s;
@@ -413,22 +406,22 @@ var I = function() {
413
406
  return new e(r);
414
407
  }, e;
415
408
  }();
416
- function k(e) {
409
+ function Y(e) {
417
410
  var r;
418
- return (r = e ?? L.Promise) !== null && r !== void 0 ? r : Promise;
419
- }
420
- function ot(e) {
421
- return e && p(e.next) && p(e.error) && p(e.complete);
411
+ return (r = e ?? K.Promise) !== null && r !== void 0 ? r : Promise;
422
412
  }
423
413
  function st(e) {
424
- return e && e instanceof $ || ot(e) && z(e);
414
+ return e && p(e.next) && p(e.error) && p(e.complete);
425
415
  }
426
416
  function ut(e) {
427
- return p(e == null ? void 0 : e.lift);
417
+ return e && e instanceof $ || st(e) && z(e);
428
418
  }
429
419
  function ct(e) {
420
+ return p(e == null ? void 0 : e.lift);
421
+ }
422
+ function at(e) {
430
423
  return function(r) {
431
- if (ut(r))
424
+ if (ct(r))
432
425
  return r.lift(function(t) {
433
426
  try {
434
427
  return e(t, this);
@@ -439,10 +432,10 @@ function ct(e) {
439
432
  throw new TypeError("Unable to lift unknown Observable type");
440
433
  };
441
434
  }
442
- function at(e, r, t, n, i) {
443
- return new lt(e, r, t, n, i);
435
+ function lt(e, r, t, n, i) {
436
+ return new pt(e, r, t, n, i);
444
437
  }
445
- var lt = function(e) {
438
+ var pt = function(e) {
446
439
  d(r, e);
447
440
  function r(t, n, i, o, s, u) {
448
441
  var c = e.call(this, t) || this;
@@ -477,7 +470,7 @@ var lt = function(e) {
477
470
  e.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
478
471
  }
479
472
  }, r;
480
- }($), pt = Y(function(e) {
473
+ }($), ht = H(function(e) {
481
474
  return function() {
482
475
  e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
483
476
  };
@@ -492,7 +485,7 @@ var lt = function(e) {
492
485
  return n.operator = t, n;
493
486
  }, r.prototype._throwIfClosed = function() {
494
487
  if (this.closed)
495
- throw new pt();
488
+ throw new ht();
496
489
  }, r.prototype.next = function(t) {
497
490
  var n = this;
498
491
  g(function() {
@@ -500,7 +493,7 @@ var lt = function(e) {
500
493
  if (n._throwIfClosed(), !n.isStopped) {
501
494
  n.currentObservers || (n.currentObservers = Array.from(n.observers));
502
495
  try {
503
- for (var s = j(n.currentObservers), u = s.next(); !u.done; u = s.next()) {
496
+ for (var s = A(n.currentObservers), u = s.next(); !u.done; u = s.next()) {
504
497
  var c = u.value;
505
498
  c.next(t);
506
499
  }
@@ -549,19 +542,19 @@ var lt = function(e) {
549
542
  return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
550
543
  }, r.prototype._innerSubscribe = function(t) {
551
544
  var n = this, i = this, o = i.hasError, s = i.isStopped, u = i.observers;
552
- return o || s ? H : (this.currentObservers = null, u.push(t), new E(function() {
553
- n.currentObservers = null, A(u, t);
545
+ return o || s ? L : (this.currentObservers = null, u.push(t), new E(function() {
546
+ n.currentObservers = null, j(u, t);
554
547
  }));
555
548
  }, r.prototype._checkFinalizedStatuses = function(t) {
556
549
  var n = this, i = n.hasError, o = n.thrownError, s = n.isStopped;
557
550
  i ? t.error(o) : s && t.complete();
558
551
  }, r.prototype.asObservable = function() {
559
- var t = new I();
552
+ var t = new C();
560
553
  return t.source = this, t;
561
554
  }, r.create = function(t, n) {
562
555
  return new M(t, n);
563
556
  }, r;
564
- }(I), M = function(e) {
557
+ }(C), M = function(e) {
565
558
  d(r, e);
566
559
  function r(t, n) {
567
560
  var i = e.call(this) || this;
@@ -578,9 +571,9 @@ var lt = function(e) {
578
571
  (n = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || n === void 0 || n.call(t);
579
572
  }, r.prototype._subscribe = function(t) {
580
573
  var n, i;
581
- return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && i !== void 0 ? i : H;
574
+ return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && i !== void 0 ? i : L;
582
575
  }, r;
583
- }(v), ht = function(e) {
576
+ }(v), ft = function(e) {
584
577
  d(r, e);
585
578
  function r(t) {
586
579
  var n = e.call(this) || this;
@@ -603,22 +596,22 @@ var lt = function(e) {
603
596
  }, r.prototype.next = function(t) {
604
597
  e.prototype.next.call(this, this._value = t);
605
598
  }, r;
606
- }(v), ft = new I(function(e) {
599
+ }(v), dt = new C(function(e) {
607
600
  return e.complete();
608
601
  });
609
- function dt(e) {
602
+ function vt(e) {
610
603
  return e <= 0 ? function() {
611
- return ft;
612
- } : ct(function(r, t) {
604
+ return dt;
605
+ } : at(function(r, t) {
613
606
  var n = 0;
614
- r.subscribe(at(t, function(i) {
607
+ r.subscribe(lt(t, function(i) {
615
608
  ++n <= e && (t.next(i), e <= n && t.complete());
616
609
  }));
617
610
  });
618
611
  }
619
- class vt {
612
+ class bt {
620
613
  constructor(r, t) {
621
- this.id = r, this.entries$ = new ht([]), t.addEventListener("user-submit", (n) => {
614
+ this.id = r, this.entries$ = new ft([]), t.addEventListener("user-submit", (n) => {
622
615
  if (!this.provider) {
623
616
  console.warn(
624
617
  "No provider activated, unable to print message to conversation."
@@ -629,7 +622,7 @@ class vt {
629
622
  });
630
623
  }
631
624
  write(r) {
632
- this.entries$.pipe(dt(1)).subscribe((t) => {
625
+ this.entries$.pipe(vt(1)).subscribe((t) => {
633
626
  this.entries$.next([...t, r]);
634
627
  });
635
628
  }
@@ -642,15 +635,19 @@ class vt {
642
635
  });
643
636
  }
644
637
  }
645
- class bt {
638
+ class D {
646
639
  constructor() {
647
640
  this.sessions = /* @__PURE__ */ new Map(), this.registeredProviders = /* @__PURE__ */ new Map(), this.activeSessionId = null;
648
641
  }
642
+ static async getInstance(r) {
643
+ let t = await r.get("conversation");
644
+ return t || (t = new D(), await r.register("conversation", t), t);
645
+ }
649
646
  registerProvider(r, t) {
650
647
  this.registeredProviders.set(r, t);
651
648
  }
652
649
  createSession(r) {
653
- const t = new vt(W(), r), n = this.getProviderByConfiguration(r);
650
+ const t = new bt(X(), r), n = this.getProviderByConfiguration(r);
654
651
  if (n) {
655
652
  const i = n();
656
653
  t.setProvider(i);
@@ -668,12 +665,11 @@ class bt {
668
665
  return this.registeredProviders.get(t);
669
666
  }
670
667
  }
671
- const yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
672
- __proto__: null,
673
- ConversationPlatform: bt
674
- }, Symbol.toStringTag, { value: "Module" }));
675
- var P = /* @__PURE__ */ ((e) => (e.User = "user", e.Agent = "agent", e.System = "system", e))(P || {});
676
- class D {
668
+ const St = async (e) => {
669
+ e.registerComponent("conversation", import("./conversation-863ede7a.mjs").then((r) => r.c)), await D.getInstance(e.container);
670
+ };
671
+ var x = /* @__PURE__ */ ((e) => (e.User = "user", e.Agent = "agent", e.System = "system", e))(x || {});
672
+ class F {
677
673
  constructor(r, t, n) {
678
674
  this.type = r, this.sender = t, this.messages = n, this.didUpdate = new v(), this.timestamp = Date.now();
679
675
  }
@@ -685,13 +681,13 @@ class D {
685
681
  ], this.didUpdate.next(this);
686
682
  }
687
683
  }
688
- class mt {
684
+ class yt {
689
685
  constructor(r) {
690
686
  this.name = r, this.print$ = new v();
691
687
  }
692
688
  print(r) {
693
- const t = new D(
694
- P.Agent,
689
+ const t = new F(
690
+ x.Agent,
695
691
  { name: this.name },
696
692
  [
697
693
  {
@@ -705,13 +701,13 @@ class mt {
705
701
  return this.print$.asObservable();
706
702
  }
707
703
  }
708
- class St {
704
+ class mt {
709
705
  constructor(r) {
710
706
  this.name = r, this.print$ = new v();
711
707
  }
712
708
  print(r) {
713
- const t = new D(
714
- P.User,
709
+ const t = new F(
710
+ x.User,
715
711
  { name: this.name },
716
712
  [
717
713
  {
@@ -725,15 +721,15 @@ class St {
725
721
  return this.print$.asObservable();
726
722
  }
727
723
  }
728
- class wt {
724
+ class gt {
729
725
  constructor(r) {
730
726
  this.name = r, this.print$ = new v();
731
727
  }
732
728
  onUserSubmit(r) {
733
- this.print(P.User, r.text);
729
+ this.print(x.User, r.text);
734
730
  }
735
731
  print(r, t) {
736
- const n = new D(
732
+ const n = new F(
737
733
  r,
738
734
  {
739
735
  name: "Botsson"
@@ -751,13 +747,13 @@ class wt {
751
747
  return this.print$.next(r), r;
752
748
  }
753
749
  createAgent(r) {
754
- const t = new mt(r);
750
+ const t = new yt(r);
755
751
  return t.subscribe().subscribe((n) => {
756
752
  this.printEntry(n);
757
753
  }), t;
758
754
  }
759
755
  createUser(r) {
760
- const t = new St(r);
756
+ const t = new mt(r);
761
757
  return t.subscribe().subscribe((n) => {
762
758
  this.printEntry(n);
763
759
  }), t;
@@ -767,11 +763,11 @@ class wt {
767
763
  }
768
764
  }
769
765
  export {
770
- mt as A,
771
- P as C,
772
- St as U,
773
- gt as a,
774
- bt as b,
775
- wt as c,
776
- D as d
766
+ yt as A,
767
+ x as C,
768
+ mt as U,
769
+ St as a,
770
+ D as b,
771
+ gt as c,
772
+ F as d
777
773
  };