@telia-ace/widget-conversation-flamingo 1.1.67-rc.6 → 1.1.67-rc.7
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +2 -2
- package/index.mjs +5 -5
- package/package.json +2 -2
package/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";var Ei=Object.defineProperty;var Ti=(s,e,t)=>e in s?Ei(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var x=(s,e,t)=>(Ti(s,typeof e!="symbol"?e+"":e,t),t),Oi=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)};var xt=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)};var De=(s,e,t)=>(Oi(s,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Li=async s=>{s.registerComponent("conversation",Promise.resolve().then(()=>Il))};class qt{constructor(){this.registeredProviders=new Map}static async getInstance(e){let t=await e.get("conversation");return t||(t=new qt,await e.register("conversation",t),t)}registerProvider(e,t){this.registeredProviders.set(e,t)}}var Lt=function(s,e){return Lt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Lt(s,e)};function ge(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Lt(s,e);function t(){this.constructor=s}s.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Pi(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(n.next(h))}catch(u){o(u)}}function l(h){try{c(n.throw(h))}catch(u){o(u)}}function c(h){h.done?r(h.value):i(h.value).then(a,l)}c((n=n.apply(s,e||[])).next())})}function fs(s,e){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(h){return l([c,h])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(n=1,i&&(r=c[0]&2?i.return:c[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,c[1])).done)return r;switch(i=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(r=t.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){t.label=c[1];break}if(c[0]===6&&t.label<r[1]){t.label=r[1],r=c;break}if(r&&t.label<r[2]){t.label=r[2],t.ops.push(c);break}r[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(s,t)}catch(h){c=[6,h],i=0}finally{n=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function de(s){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&s[e],n=0;if(t)return t.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&n>=s.length&&(s=void 0),{value:s&&s[n++],done:!s}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(s,e){var t=typeof Symbol=="function"&&s[Symbol.iterator];if(!t)return s;var n=t.call(s),i,r=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)r.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return r}function J(s,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,r;n<i;n++)(r||!(n in e))&&(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return s.concat(r||Array.prototype.slice.call(e))}function ce(s){return this instanceof ce?(this.v=s,this):new ce(s)}function Ri(s,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(s,e||[]),i,r=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(d){return new Promise(function(v,f){r.push([p,d,v,f])>1||a(p,d)})})}function a(p,d){try{l(n[p](d))}catch(v){u(r[0][3],v)}}function l(p){p.value instanceof ce?Promise.resolve(p.value.v).then(c,h):u(r[0][2],p)}function c(p){a("next",p)}function h(p){a("throw",p)}function u(p,d){p(d),r.shift(),r.length&&a(r[0][0],r[0][1])}}function Ii(s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=s[Symbol.asyncIterator],t;return e?e.call(s):(s=typeof de=="function"?de(s):s[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=s[r]&&function(o){return new Promise(function(a,l){o=s[r](o),i(a,l,o.done,o.value)})}}function i(r,o,a,l){Promise.resolve(l).then(function(c){r({value:c,done:a})},o)}}function y(s){return typeof s=="function"}function gs(s){var e=function(n){Error.call(n),n.stack=new Error().stack},t=s(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var wt=gs(function(s){return function(t){s(this),this.message=t?t.length+` errors occurred during unsubscription:
|
2
2
|
`+t.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=t}});function Pt(s,e){if(s){var t=s.indexOf(e);0<=t&&s.splice(t,1)}}var lt=function(){function s(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return s.prototype.unsubscribe=function(){var e,t,n,i,r;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=de(o),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(f){e={error:f}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else o.remove(this);var h=this.initialTeardown;if(y(h))try{h()}catch(f){r=f instanceof wt?f.errors:[f]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var p=de(u),d=p.next();!d.done;d=p.next()){var v=d.value;try{kn(v)}catch(f){r=r??[],f instanceof wt?r=J(J([],q(r)),q(f.errors)):r.push(f)}}}catch(f){n={error:f}}finally{try{d&&!d.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}if(r)throw new wt(r)}},s.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)kn(e);else{if(e instanceof s){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},s.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},s.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},s.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Pt(t,e)},s.prototype.remove=function(e){var t=this._finalizers;t&&Pt(t,e),e instanceof s&&e._removeParent(this)},s.EMPTY=function(){var e=new s;return e.closed=!0,e}(),s}(),ms=lt.EMPTY;function vs(s){return s instanceof lt||s&&"closed"in s&&y(s.remove)&&y(s.add)&&y(s.unsubscribe)}function kn(s){y(s)?s():s.unsubscribe()}var bs={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Rt={setTimeout:function(s,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Rt.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,J([s,e],q(t))):setTimeout.apply(void 0,J([s,e],q(t)))},clearTimeout:function(s){var e=Rt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(s)},delegate:void 0};function $s(s){Rt.setTimeout(function(){throw s})}function Qe(){}function We(s){s()}var Wt=function(s){ge(e,s);function e(t){var n=s.call(this)||this;return n.isStopped=!1,t?(n.destination=t,vs(t)&&t.add(n)):n.destination=ji,n}return e.create=function(t,n,i){return new It(t,n,i)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,s.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(lt),Mi=Function.prototype.bind;function kt(s,e){return Mi.call(s,e)}var zi=function(){function s(e){this.partialObserver=e}return s.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){Be(n)}},s.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Be(n)}else Be(e)},s.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Be(t)}},s}(),It=function(s){ge(e,s);function e(t,n,i){var r=s.call(this)||this,o;if(y(t)||!t)o={next:t??void 0,error:n??void 0,complete:i??void 0};else{var a;r&&bs.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return r.unsubscribe()},o={next:t.next&&kt(t.next,a),error:t.error&&kt(t.error,a),complete:t.complete&&kt(t.complete,a)}):o=t}return r.destination=new zi(o),r}return e}(Wt);function Be(s){$s(s)}function Ui(s){throw s}var ji={closed:!0,next:Qe,error:Ui,complete:Qe},Yt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Pe(s){return s}function Hi(s){return s.length===0?Pe:s.length===1?s[0]:function(t){return s.reduce(function(n,i){return i(n)},t)}}var C=function(){function s(e){e&&(this._subscribe=e)}return s.prototype.lift=function(e){var t=new s;return t.source=this,t.operator=e,t},s.prototype.subscribe=function(e,t,n){var i=this,r=Bi(e)?e:new It(e,t,n);return We(function(){var o=i,a=o.operator,l=o.source;r.add(a?a.call(r,l):l?i._subscribe(r):i._trySubscribe(r))}),r},s.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},s.prototype.forEach=function(e,t){var n=this;return t=_n(t),new t(function(i,r){var o=new It({next:function(a){try{e(a)}catch(l){r(l),o.unsubscribe()}},error:r,complete:i});n.subscribe(o)})},s.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},s.prototype[Yt]=function(){return this},s.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Hi(e)(this)},s.prototype.toPromise=function(e){var t=this;return e=_n(e),new e(function(n,i){var r;t.subscribe(function(o){return r=o},function(o){return i(o)},function(){return n(r)})})},s.create=function(e){return new s(e)},s}();function _n(s){var e;return(e=s??bs.Promise)!==null&&e!==void 0?e:Promise}function Di(s){return s&&y(s.next)&&y(s.error)&&y(s.complete)}function Bi(s){return s&&s instanceof Wt||Di(s)&&vs(s)}function Ni(s){return y(s==null?void 0:s.lift)}function Y(s){return function(e){if(Ni(e))return e.lift(function(t){try{return s(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function P(s,e,t,n,i){return new Fi(s,e,t,n,i)}var Fi=function(s){ge(e,s);function e(t,n,i,r,o,a){var l=s.call(this,t)||this;return l.onFinalize=o,l.shouldUnsubscribe=a,l._next=n?function(c){try{n(c)}catch(h){t.error(h)}}:s.prototype._next,l._error=r?function(c){try{r(c)}catch(h){t.error(h)}finally{this.unsubscribe()}}:s.prototype._error,l._complete=i?function(){try{i()}catch(c){t.error(c)}finally{this.unsubscribe()}}:s.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;s.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(Wt),Zi=gs(function(s){return function(){s(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),S=function(s){ge(e,s);function e(){var t=s.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new Sn(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Zi},e.prototype.next=function(t){var n=this;We(function(){var i,r;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var o=de(n.currentObservers),a=o.next();!a.done;a=o.next()){var l=a.value;l.next(t)}}catch(c){i={error:c}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;We(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;We(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),s.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,r=i.hasError,o=i.isStopped,a=i.observers;return r||o?ms:(this.currentObservers=null,a.push(t),new lt(function(){n.currentObservers=null,Pt(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,r=n.thrownError,o=n.isStopped;i?t.error(r):o&&t.complete()},e.prototype.asObservable=function(){var t=new C;return t.source=this,t},e.create=function(t,n){return new Sn(t,n)},e}(C),Sn=function(s){ge(e,s);function e(t,n){var i=s.call(this)||this;return i.destination=t,i.source=n,i}return e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:ms},e}(S),D=function(s){ge(e,s);function e(t){var n=s.call(this)||this;return n._value=t,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=s.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,r=t._value;if(n)throw i;return this._throwIfClosed(),r},e.prototype.next=function(t){s.prototype.next.call(this,this._value=t)},e}(S),Re=new C(function(s){return s.complete()});function qi(s){return s&&y(s.schedule)}function Qt(s){return s[s.length-1]}function ys(s){return y(Qt(s))?s.pop():void 0}function Kt(s){return qi(Qt(s))?s.pop():void 0}function Wi(s,e){return typeof Qt(s)=="number"?s.pop():e}var Gt=function(s){return s&&typeof s.length=="number"&&typeof s!="function"};function xs(s){return y(s==null?void 0:s.then)}function ws(s){return y(s[Yt])}function ks(s){return Symbol.asyncIterator&&y(s==null?void 0:s[Symbol.asyncIterator])}function _s(s){return new TypeError("You provided "+(s!==null&&typeof s=="object"?"an invalid object":"'"+s+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Yi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ss=Yi();function Cs(s){return y(s==null?void 0:s[Ss])}function As(s){return Ri(this,arguments,function(){var t,n,i,r;return fs(this,function(o){switch(o.label){case 0:t=s.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,ce(t.read())];case 3:return n=o.sent(),i=n.value,r=n.done,r?[4,ce(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ce(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Es(s){return y(s==null?void 0:s.getReader)}function j(s){if(s instanceof C)return s;if(s!=null){if(ws(s))return Qi(s);if(Gt(s))return Ki(s);if(xs(s))return Gi(s);if(ks(s))return Ts(s);if(Cs(s))return Xi(s);if(Es(s))return Ji(s)}throw _s(s)}function Qi(s){return new C(function(e){var t=s[Yt]();if(y(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ki(s){return new C(function(e){for(var t=0;t<s.length&&!e.closed;t++)e.next(s[t]);e.complete()})}function Gi(s){return new C(function(e){s.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,$s)})}function Xi(s){return new C(function(e){var t,n;try{for(var i=de(s),r=i.next();!r.done;r=i.next()){var o=r.value;if(e.next(o),e.closed)return}}catch(a){t={error:a}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}function Ts(s){return new C(function(e){Vi(s,e).catch(function(t){return e.error(t)})})}function Ji(s){return Ts(As(s))}function Vi(s,e){var t,n,i,r;return Pi(this,void 0,void 0,function(){var o,a;return fs(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=Ii(s),l.label=1;case 1:return[4,t.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),i={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function B(s,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var r=e.schedule(function(){t(),i?s.add(this.schedule(null,n)):this.unsubscribe()},n);if(s.add(r),!i)return r}function Os(s,e){return e===void 0&&(e=0),Y(function(t,n){t.subscribe(P(n,function(i){return B(n,s,function(){return n.next(i)},e)},function(){return B(n,s,function(){return n.complete()},e)},function(i){return B(n,s,function(){return n.error(i)},e)}))})}function Ls(s,e){return e===void 0&&(e=0),Y(function(t,n){n.add(s.schedule(function(){return t.subscribe(n)},e))})}function er(s,e){return j(s).pipe(Ls(e),Os(e))}function tr(s,e){return j(s).pipe(Ls(e),Os(e))}function nr(s,e){return new C(function(t){var n=0;return e.schedule(function(){n===s.length?t.complete():(t.next(s[n++]),t.closed||this.schedule())})})}function sr(s,e){return new C(function(t){var n;return B(t,e,function(){n=s[Ss](),B(t,e,function(){var i,r,o;try{i=n.next(),r=i.value,o=i.done}catch(a){t.error(a);return}o?t.complete():t.next(r)},0,!0)}),function(){return y(n==null?void 0:n.return)&&n.return()}})}function Ps(s,e){if(!s)throw new Error("Iterable cannot be null");return new C(function(t){B(t,e,function(){var n=s[Symbol.asyncIterator]();B(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}function ir(s,e){return Ps(As(s),e)}function rr(s,e){if(s!=null){if(ws(s))return er(s,e);if(Gt(s))return nr(s,e);if(xs(s))return tr(s,e);if(ks(s))return Ps(s,e);if(Cs(s))return sr(s,e);if(Es(s))return ir(s,e)}throw _s(s)}function ct(s,e){return e?rr(s,e):j(s)}function Mt(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s);return ct(s,t)}function Ke(s,e){return Y(function(t,n){var i=0;t.subscribe(P(n,function(r){n.next(s.call(e,r,i++))}))})}var or=Array.isArray;function ar(s,e){return or(e)?s.apply(void 0,J([],q(e))):s(e)}function Rs(s){return Ke(function(e){return ar(s,e)})}var lr=Array.isArray,cr=Object.getPrototypeOf,hr=Object.prototype,ur=Object.keys;function pr(s){if(s.length===1){var e=s[0];if(lr(e))return{args:e,keys:null};if(dr(e)){var t=ur(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:s,keys:null}}function dr(s){return s&&typeof s=="object"&&cr(s)===hr}function fr(s,e){return s.reduce(function(t,n,i){return t[n]=e[i],t},{})}function gr(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s),n=ys(s),i=pr(s),r=i.args,o=i.keys;if(r.length===0)return ct([],t);var a=new C(mr(r,t,o?function(l){return fr(o,l)}:Pe));return n?a.pipe(Rs(n)):a}function mr(s,e,t){return t===void 0&&(t=Pe),function(n){Cn(e,function(){for(var i=s.length,r=new Array(i),o=i,a=i,l=function(h){Cn(e,function(){var u=ct(s[h],e),p=!1;u.subscribe(P(n,function(d){r[h]=d,p||(p=!0,a--),a||n.next(t(r.slice()))},function(){--o||n.complete()}))},n)},c=0;c<i;c++)l(c)},n)}}function Cn(s,e,t){s?B(t,s,e):e()}function vr(s,e,t,n,i,r,o,a){var l=[],c=0,h=0,u=!1,p=function(){u&&!l.length&&!c&&e.complete()},d=function(f){return c<n?v(f):l.push(f)},v=function(f){r&&e.next(f),c++;var I=!1;j(t(f,h++)).subscribe(P(e,function(H){i==null||i(H),r?d(H):e.next(H)},function(){I=!0},void 0,function(){if(I)try{c--;for(var H=function(){var Q=l.shift();o?B(e,o,function(){return v(Q)}):v(Q)};l.length&&c<n;)H();p()}catch(Q){e.error(Q)}}))};return s.subscribe(P(e,d,function(){u=!0,p()})),function(){a==null||a()}}function Xt(s,e,t){return t===void 0&&(t=1/0),y(e)?Xt(function(n,i){return Ke(function(r,o){return e(n,r,i,o)})(j(s(n,i)))},t):(typeof e=="number"&&(t=e),Y(function(n,i){return vr(n,i,s,t)}))}function br(s){return s===void 0&&(s=1/0),Xt(Pe,s)}var $r=["addListener","removeListener"],yr=["addEventListener","removeEventListener"],xr=["on","off"];function Ge(s,e,t,n){if(y(t)&&(n=t,t=void 0),n)return Ge(s,e,t).pipe(Rs(n));var i=q(_r(s)?yr.map(function(a){return function(l){return s[a](e,l,t)}}):wr(s)?$r.map(An(s,e)):kr(s)?xr.map(An(s,e)):[],2),r=i[0],o=i[1];if(!r&&Gt(s))return Xt(function(a){return Ge(a,e,t)})(j(s));if(!r)throw new TypeError("Invalid event target");return new C(function(a){var l=function(){for(var c=[],h=0;h<arguments.length;h++)c[h]=arguments[h];return a.next(1<c.length?c:c[0])};return r(l),function(){return o(l)}})}function An(s,e){return function(t){return function(n){return s[t](e,n)}}}function wr(s){return y(s.addListener)&&y(s.removeListener)}function kr(s){return y(s.on)&&y(s.off)}function _r(s){return y(s.addEventListener)&&y(s.removeEventListener)}function Sr(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s),n=Wi(s,1/0),i=s;return i.length?i.length===1?j(i[0]):br(n)(ct(i,t)):Re}function zt(s){return s<=0?function(){return Re}:Y(function(e,t){var n=0;e.subscribe(P(t,function(i){++n<=s&&(t.next(i),s<=n&&t.complete())}))})}function he(s,e){return Y(function(t,n){var i=null,r=0,o=!1,a=function(){return o&&!i&&n.complete()};t.subscribe(P(n,function(l){i==null||i.unsubscribe();var c=0,h=r++;j(s(l,h)).subscribe(i=P(n,function(u){return n.next(e?e(l,u,h,c++):u)},function(){i=null,a()}))},function(){o=!0,a()}))})}function En(s){return Y(function(e,t){j(s).subscribe(P(t,function(){return t.complete()},Qe)),!t.closed&&e.subscribe(t)})}function Ut(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=ys(s);return Y(function(n,i){for(var r=s.length,o=new Array(r),a=s.map(function(){return!1}),l=!1,c=function(u){j(s[u]).subscribe(P(i,function(p){o[u]=p,!l&&!a[u]&&(a[u]=!0,(l=a.every(Pe))&&(a=null))},Qe))},h=0;h<r;h++)c(h);n.subscribe(P(i,function(u){if(l){var p=J([u],q(o));i.next(t?t.apply(void 0,J([],q(p))):p)}}))})}var N=(s=>(s.User="user",s.Agent="agent",s.System="system",s))(N||{});const Is=()=>crypto.randomUUID();class Ie{constructor(e,t,n){this.type=e,this.sender=t,this.messages=n,this.status="delivered",this.didUpdate=new S,this.actions$=new S,this.remove$=new S,this.timestamp=Date.now(),this.id=Is()}update(e){this.messages=[{items:e}],this.didUpdate.next(this)}setStatus(e){this.status=e,this.didUpdate.next(this)}remove(){this.remove$.next()}}class Ms{constructor(e){this.name=e,this.print$=new S}print(e,t="html"){const n=new Ie(N.Agent,{name:this.name},[{items:[[t,{content:e}]]}]);return this.print$.next(n),n}subscribe(){return this.print$.asObservable()}}class zs{constructor(e){this.name=e,this.print$=new S}print(e){const t=new Ie(N.User,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class Cr{constructor(){this.print$=new S,this.name="system"}print(e){const t=new Ie(N.System,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class Ar{constructor(e,t){this.name=e,this.component=t,this.print$=new S,this.typingState$=new D(!1),this.complete$=new S,this.system=this.createSystem(),this.rehydrate$=new S,this.saveToCurrentSession$=new S,this.showChatOverlay$=new D(!1),this.onComplete=()=>this.complete$.asObservable()}connect(e={}){this.complete$.pipe(zt(1)).subscribe(()=>{this.disconnected()})}disconnected(){}onUserSubmit(e){this.print(N.User,e.text)}print(e,t){const n=new Ie(e,{name:""},[{items:[["html",{content:t}]]}]);return this.printEntry(n)}printEntry(e){return this.print$.next(e),e}createAgent(e){const t=new Ms(e);return t.subscribe().subscribe(n=>{this.playNotification(),this.printEntry(n)}),t}createUser(e){const t=new zs(e);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}createSystem(){const e=new Cr;return e.subscribe().subscribe(t=>{this.printEntry(t)}),e}setTypingState(e){this.typingState$.next(e)}setToastMessage(e){this.component.setToastMessage(e)}isTyping(){return this.typingState$.asObservable()}actions(){return this.print$.asObservable()}playNotification(){const e="https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";this.component.application.branding().other.disableSound||new Audio(e).play().catch(i=>{})}complete(){this.complete$.next()}save(e){this.saveToCurrentSession$.next(e)}async rehydrate(e){}}/**
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function Pt(s,e){if(s){var t=s.indexOf(e);0<=t&&s.splice(t,1)}}var lt=function(){function s(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return s.prototype.unsubscribe=function(){var e,t,n,i,r;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=de(o),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(f){e={error:f}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else o.remove(this);var h=this.initialTeardown;if(y(h))try{h()}catch(f){r=f instanceof wt?f.errors:[f]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var p=de(u),d=p.next();!d.done;d=p.next()){var v=d.value;try{kn(v)}catch(f){r=r??[],f instanceof wt?r=J(J([],q(r)),q(f.errors)):r.push(f)}}}catch(f){n={error:f}}finally{try{d&&!d.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}if(r)throw new wt(r)}},s.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)kn(e);else{if(e instanceof s){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},s.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},s.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},s.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Pt(t,e)},s.prototype.remove=function(e){var t=this._finalizers;t&&Pt(t,e),e instanceof s&&e._removeParent(this)},s.EMPTY=function(){var e=new s;return e.closed=!0,e}(),s}(),ms=lt.EMPTY;function vs(s){return s instanceof lt||s&&"closed"in s&&y(s.remove)&&y(s.add)&&y(s.unsubscribe)}function kn(s){y(s)?s():s.unsubscribe()}var bs={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Rt={setTimeout:function(s,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Rt.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,J([s,e],q(t))):setTimeout.apply(void 0,J([s,e],q(t)))},clearTimeout:function(s){var e=Rt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(s)},delegate:void 0};function $s(s){Rt.setTimeout(function(){throw s})}function Qe(){}function We(s){s()}var Wt=function(s){ge(e,s);function e(t){var n=s.call(this)||this;return n.isStopped=!1,t?(n.destination=t,vs(t)&&t.add(n)):n.destination=ji,n}return e.create=function(t,n,i){return new It(t,n,i)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,s.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(lt),Mi=Function.prototype.bind;function kt(s,e){return Mi.call(s,e)}var zi=function(){function s(e){this.partialObserver=e}return s.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){Be(n)}},s.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Be(n)}else Be(e)},s.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Be(t)}},s}(),It=function(s){ge(e,s);function e(t,n,i){var r=s.call(this)||this,o;if(y(t)||!t)o={next:t??void 0,error:n??void 0,complete:i??void 0};else{var a;r&&bs.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return r.unsubscribe()},o={next:t.next&&kt(t.next,a),error:t.error&&kt(t.error,a),complete:t.complete&&kt(t.complete,a)}):o=t}return r.destination=new zi(o),r}return e}(Wt);function Be(s){$s(s)}function Ui(s){throw s}var ji={closed:!0,next:Qe,error:Ui,complete:Qe},Yt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Pe(s){return s}function Hi(s){return s.length===0?Pe:s.length===1?s[0]:function(t){return s.reduce(function(n,i){return i(n)},t)}}var C=function(){function s(e){e&&(this._subscribe=e)}return s.prototype.lift=function(e){var t=new s;return t.source=this,t.operator=e,t},s.prototype.subscribe=function(e,t,n){var i=this,r=Bi(e)?e:new It(e,t,n);return We(function(){var o=i,a=o.operator,l=o.source;r.add(a?a.call(r,l):l?i._subscribe(r):i._trySubscribe(r))}),r},s.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},s.prototype.forEach=function(e,t){var n=this;return t=_n(t),new t(function(i,r){var o=new It({next:function(a){try{e(a)}catch(l){r(l),o.unsubscribe()}},error:r,complete:i});n.subscribe(o)})},s.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},s.prototype[Yt]=function(){return this},s.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Hi(e)(this)},s.prototype.toPromise=function(e){var t=this;return e=_n(e),new e(function(n,i){var r;t.subscribe(function(o){return r=o},function(o){return i(o)},function(){return n(r)})})},s.create=function(e){return new s(e)},s}();function _n(s){var e;return(e=s??bs.Promise)!==null&&e!==void 0?e:Promise}function Di(s){return s&&y(s.next)&&y(s.error)&&y(s.complete)}function Bi(s){return s&&s instanceof Wt||Di(s)&&vs(s)}function Ni(s){return y(s==null?void 0:s.lift)}function Y(s){return function(e){if(Ni(e))return e.lift(function(t){try{return s(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function P(s,e,t,n,i){return new Fi(s,e,t,n,i)}var Fi=function(s){ge(e,s);function e(t,n,i,r,o,a){var l=s.call(this,t)||this;return l.onFinalize=o,l.shouldUnsubscribe=a,l._next=n?function(c){try{n(c)}catch(h){t.error(h)}}:s.prototype._next,l._error=r?function(c){try{r(c)}catch(h){t.error(h)}finally{this.unsubscribe()}}:s.prototype._error,l._complete=i?function(){try{i()}catch(c){t.error(c)}finally{this.unsubscribe()}}:s.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;s.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(Wt),Zi=gs(function(s){return function(){s(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),S=function(s){ge(e,s);function e(){var t=s.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new Sn(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Zi},e.prototype.next=function(t){var n=this;We(function(){var i,r;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var o=de(n.currentObservers),a=o.next();!a.done;a=o.next()){var l=a.value;l.next(t)}}catch(c){i={error:c}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;We(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;We(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),s.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,r=i.hasError,o=i.isStopped,a=i.observers;return r||o?ms:(this.currentObservers=null,a.push(t),new lt(function(){n.currentObservers=null,Pt(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,r=n.thrownError,o=n.isStopped;i?t.error(r):o&&t.complete()},e.prototype.asObservable=function(){var t=new C;return t.source=this,t},e.create=function(t,n){return new Sn(t,n)},e}(C),Sn=function(s){ge(e,s);function e(t,n){var i=s.call(this)||this;return i.destination=t,i.source=n,i}return e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:ms},e}(S),D=function(s){ge(e,s);function e(t){var n=s.call(this)||this;return n._value=t,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=s.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,r=t._value;if(n)throw i;return this._throwIfClosed(),r},e.prototype.next=function(t){s.prototype.next.call(this,this._value=t)},e}(S),Re=new C(function(s){return s.complete()});function qi(s){return s&&y(s.schedule)}function Qt(s){return s[s.length-1]}function ys(s){return y(Qt(s))?s.pop():void 0}function Kt(s){return qi(Qt(s))?s.pop():void 0}function Wi(s,e){return typeof Qt(s)=="number"?s.pop():e}var Gt=function(s){return s&&typeof s.length=="number"&&typeof s!="function"};function xs(s){return y(s==null?void 0:s.then)}function ws(s){return y(s[Yt])}function ks(s){return Symbol.asyncIterator&&y(s==null?void 0:s[Symbol.asyncIterator])}function _s(s){return new TypeError("You provided "+(s!==null&&typeof s=="object"?"an invalid object":"'"+s+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Yi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ss=Yi();function Cs(s){return y(s==null?void 0:s[Ss])}function As(s){return Ri(this,arguments,function(){var t,n,i,r;return fs(this,function(o){switch(o.label){case 0:t=s.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,ce(t.read())];case 3:return n=o.sent(),i=n.value,r=n.done,r?[4,ce(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ce(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Es(s){return y(s==null?void 0:s.getReader)}function j(s){if(s instanceof C)return s;if(s!=null){if(ws(s))return Qi(s);if(Gt(s))return Ki(s);if(xs(s))return Gi(s);if(ks(s))return Ts(s);if(Cs(s))return Xi(s);if(Es(s))return Ji(s)}throw _s(s)}function Qi(s){return new C(function(e){var t=s[Yt]();if(y(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ki(s){return new C(function(e){for(var t=0;t<s.length&&!e.closed;t++)e.next(s[t]);e.complete()})}function Gi(s){return new C(function(e){s.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,$s)})}function Xi(s){return new C(function(e){var t,n;try{for(var i=de(s),r=i.next();!r.done;r=i.next()){var o=r.value;if(e.next(o),e.closed)return}}catch(a){t={error:a}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}function Ts(s){return new C(function(e){Vi(s,e).catch(function(t){return e.error(t)})})}function Ji(s){return Ts(As(s))}function Vi(s,e){var t,n,i,r;return Pi(this,void 0,void 0,function(){var o,a;return fs(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=Ii(s),l.label=1;case 1:return[4,t.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),i={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function B(s,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var r=e.schedule(function(){t(),i?s.add(this.schedule(null,n)):this.unsubscribe()},n);if(s.add(r),!i)return r}function Os(s,e){return e===void 0&&(e=0),Y(function(t,n){t.subscribe(P(n,function(i){return B(n,s,function(){return n.next(i)},e)},function(){return B(n,s,function(){return n.complete()},e)},function(i){return B(n,s,function(){return n.error(i)},e)}))})}function Ls(s,e){return e===void 0&&(e=0),Y(function(t,n){n.add(s.schedule(function(){return t.subscribe(n)},e))})}function er(s,e){return j(s).pipe(Ls(e),Os(e))}function tr(s,e){return j(s).pipe(Ls(e),Os(e))}function nr(s,e){return new C(function(t){var n=0;return e.schedule(function(){n===s.length?t.complete():(t.next(s[n++]),t.closed||this.schedule())})})}function sr(s,e){return new C(function(t){var n;return B(t,e,function(){n=s[Ss](),B(t,e,function(){var i,r,o;try{i=n.next(),r=i.value,o=i.done}catch(a){t.error(a);return}o?t.complete():t.next(r)},0,!0)}),function(){return y(n==null?void 0:n.return)&&n.return()}})}function Ps(s,e){if(!s)throw new Error("Iterable cannot be null");return new C(function(t){B(t,e,function(){var n=s[Symbol.asyncIterator]();B(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}function ir(s,e){return Ps(As(s),e)}function rr(s,e){if(s!=null){if(ws(s))return er(s,e);if(Gt(s))return nr(s,e);if(xs(s))return tr(s,e);if(ks(s))return Ps(s,e);if(Cs(s))return sr(s,e);if(Es(s))return ir(s,e)}throw _s(s)}function ct(s,e){return e?rr(s,e):j(s)}function Mt(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s);return ct(s,t)}function Ke(s,e){return Y(function(t,n){var i=0;t.subscribe(P(n,function(r){n.next(s.call(e,r,i++))}))})}var or=Array.isArray;function ar(s,e){return or(e)?s.apply(void 0,J([],q(e))):s(e)}function Rs(s){return Ke(function(e){return ar(s,e)})}var lr=Array.isArray,cr=Object.getPrototypeOf,hr=Object.prototype,ur=Object.keys;function pr(s){if(s.length===1){var e=s[0];if(lr(e))return{args:e,keys:null};if(dr(e)){var t=ur(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:s,keys:null}}function dr(s){return s&&typeof s=="object"&&cr(s)===hr}function fr(s,e){return s.reduce(function(t,n,i){return t[n]=e[i],t},{})}function gr(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s),n=ys(s),i=pr(s),r=i.args,o=i.keys;if(r.length===0)return ct([],t);var a=new C(mr(r,t,o?function(l){return fr(o,l)}:Pe));return n?a.pipe(Rs(n)):a}function mr(s,e,t){return t===void 0&&(t=Pe),function(n){Cn(e,function(){for(var i=s.length,r=new Array(i),o=i,a=i,l=function(h){Cn(e,function(){var u=ct(s[h],e),p=!1;u.subscribe(P(n,function(d){r[h]=d,p||(p=!0,a--),a||n.next(t(r.slice()))},function(){--o||n.complete()}))},n)},c=0;c<i;c++)l(c)},n)}}function Cn(s,e,t){s?B(t,s,e):e()}function vr(s,e,t,n,i,r,o,a){var l=[],c=0,h=0,u=!1,p=function(){u&&!l.length&&!c&&e.complete()},d=function(f){return c<n?v(f):l.push(f)},v=function(f){r&&e.next(f),c++;var I=!1;j(t(f,h++)).subscribe(P(e,function(H){i==null||i(H),r?d(H):e.next(H)},function(){I=!0},void 0,function(){if(I)try{c--;for(var H=function(){var Q=l.shift();o?B(e,o,function(){return v(Q)}):v(Q)};l.length&&c<n;)H();p()}catch(Q){e.error(Q)}}))};return s.subscribe(P(e,d,function(){u=!0,p()})),function(){a==null||a()}}function Xt(s,e,t){return t===void 0&&(t=1/0),y(e)?Xt(function(n,i){return Ke(function(r,o){return e(n,r,i,o)})(j(s(n,i)))},t):(typeof e=="number"&&(t=e),Y(function(n,i){return vr(n,i,s,t)}))}function br(s){return s===void 0&&(s=1/0),Xt(Pe,s)}var $r=["addListener","removeListener"],yr=["addEventListener","removeEventListener"],xr=["on","off"];function Ge(s,e,t,n){if(y(t)&&(n=t,t=void 0),n)return Ge(s,e,t).pipe(Rs(n));var i=q(_r(s)?yr.map(function(a){return function(l){return s[a](e,l,t)}}):wr(s)?$r.map(An(s,e)):kr(s)?xr.map(An(s,e)):[],2),r=i[0],o=i[1];if(!r&&Gt(s))return Xt(function(a){return Ge(a,e,t)})(j(s));if(!r)throw new TypeError("Invalid event target");return new C(function(a){var l=function(){for(var c=[],h=0;h<arguments.length;h++)c[h]=arguments[h];return a.next(1<c.length?c:c[0])};return r(l),function(){return o(l)}})}function An(s,e){return function(t){return function(n){return s[t](e,n)}}}function wr(s){return y(s.addListener)&&y(s.removeListener)}function kr(s){return y(s.on)&&y(s.off)}function _r(s){return y(s.addEventListener)&&y(s.removeEventListener)}function Sr(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s),n=Wi(s,1/0),i=s;return i.length?i.length===1?j(i[0]):br(n)(ct(i,t)):Re}function zt(s){return s<=0?function(){return Re}:Y(function(e,t){var n=0;e.subscribe(P(t,function(i){++n<=s&&(t.next(i),s<=n&&t.complete())}))})}function he(s,e){return Y(function(t,n){var i=null,r=0,o=!1,a=function(){return o&&!i&&n.complete()};t.subscribe(P(n,function(l){i==null||i.unsubscribe();var c=0,h=r++;j(s(l,h)).subscribe(i=P(n,function(u){return n.next(e?e(l,u,h,c++):u)},function(){i=null,a()}))},function(){o=!0,a()}))})}function En(s){return Y(function(e,t){j(s).subscribe(P(t,function(){return t.complete()},Qe)),!t.closed&&e.subscribe(t)})}function Ut(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=ys(s);return Y(function(n,i){for(var r=s.length,o=new Array(r),a=s.map(function(){return!1}),l=!1,c=function(u){j(s[u]).subscribe(P(i,function(p){o[u]=p,!l&&!a[u]&&(a[u]=!0,(l=a.every(Pe))&&(a=null))},Qe))},h=0;h<r;h++)c(h);n.subscribe(P(i,function(u){if(l){var p=J([u],q(o));i.next(t?t.apply(void 0,J([],q(p))):p)}}))})}var N=(s=>(s.User="user",s.Agent="agent",s.System="system",s))(N||{});const Is=()=>crypto.randomUUID();class Ie{constructor(e,t,n){this.type=e,this.sender=t,this.messages=n,this.status="delivered",this.didUpdate=new S,this.actions$=new S,this.remove$=new S,this.timestamp=Date.now(),this.id=Is()}update(e){this.messages=[{items:e}],this.didUpdate.next(this)}setStatus(e){this.status=e,this.didUpdate.next(this)}remove(){this.remove$.next()}}class Ms{constructor(e){this.name=e,this.print$=new S}print(e,t="html"){const n=new Ie(N.Agent,{name:this.name},[{items:[[t,{content:e}]]}]);return this.print$.next(n),n}subscribe(){return this.print$.asObservable()}}class zs{constructor(e){this.name=e,this.print$=new S}print(e){const t=new Ie(N.User,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class Cr{constructor(){this.print$=new S,this.name="system"}print(e){const t=new Ie(N.System,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class Ar{constructor(e,t){this.name=e,this.component=t,this.print$=new S,this.typingState$=new D(!1),this.complete$=new S,this.system=this.createSystem(),this.rehydrate$=new S,this.saveToCurrentSession$=new S,this.showChatOverlay$=new D(!1),this.onComplete=()=>this.complete$.asObservable()}connect(e={}){this.complete$.pipe(zt(1)).subscribe(()=>{this.disconnected()})}disconnected(){}onUserSubmit(e){this.print(N.User,e.text)}print(e,t){const n=new Ie(e,{name:""},[{items:[["html",{content:t}]]}]);return this.printEntry(n)}printEntry(e){return this.print$.next(e),e}createAgent(e){const t=new Ms(e);return t.subscribe().subscribe(n=>{this.playNotification(),this.printEntry(n)}),t}createUser(e){const t=new zs(e);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}createSystem(){const e=new Cr;return e.subscribe().subscribe(t=>{this.printEntry(t)}),e}setTypingState(e){this.typingState$.next(e)}setToastMessage(e){this.component.setToastMessage(e)}isTyping(){return this.typingState$.asObservable()}actions(){return this.print$.asObservable()}playNotification(){const e="https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";this.component.application.storage.get("muteAudioNotifications")||new Audio(e).play().catch(n=>{})}complete(){this.complete$.next()}save(e){this.saveToCurrentSession$.next(e)}async rehydrate(e){}}/**
|
4
4
|
* @license
|
5
5
|
* Copyright 2019 Google LLC
|
6
6
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -766,7 +766,7 @@ Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An err
|
|
766
766
|
width: 80%;
|
767
767
|
max-width: 700px;
|
768
768
|
}
|
769
|
-
`];Ci([w({attribute:!0})],Oe.prototype,"imageUrl",2);Oe=Ci([Vo("ace-lightbox")],Oe);var Ll=Object.defineProperty,Pl=Object.getOwnPropertyDescriptor,ie=(s,e,t,n)=>{for(var i=n>1?void 0:n?Pl(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&Ll(e,t,i),i};const Rl=s=>{s.scrollTo?s.scrollTo({top:s.scrollHeight,behavior:"smooth"}):s.scrollTop=s.scrollHeight};customElements.get("conversation-entry")||customElements.define("conversation-entry",un);customElements.get("ace-conversation-feed")||customElements.define("ace-conversation-feed",vt);customElements.get("conversation-group")||customElements.define("conversation-group",pn);customElements.get("ace-typing-state")||customElements.define("ace-typing-state",pi);customElements.get("message-type-html")||customElements.define("message-type-html",dn);customElements.get("message-type-markdown")||customElements.define("message-type-markdown",$t);customElements.get("ace-lightbox")||customElements.define("ace-lightbox",Oe);const Ai=ci(k);class R extends Ai{constructor(){super(...arguments),this.message="",this.disabled=!1,this.chatOverlayActive=!1,this.textAreaLength=0,this.conversationContentRef=xe(),this.formRef=xe(),this.inputRef=xe(),this.chatScrollHeight=0,this.toast=new La(this),this.messageMaxLength=1e3,this.platform=null,this.entries=[],this.typing=!1,this.conversationState$=new D("waiting"),this.stateMachine=new Ra(this.conversationState$,this),this.provider$=this.stateMachine.session().pipe(he(e=>e?e==null?void 0:e.provider$:Mt(null)))}async connectedCallback(){super.connectedCallback(),this.messageMaxLength=this.properties.messageMaxLength??this.messageMaxLength;const e=await this.application.container.get("conversation");this.platform=e||null,this.stateSubscription=gr([this.stateMachine.entries(),this.stateMachine.isTyping()]).subscribe(([t,n])=>{this.entries=t,this.typing=n}),this.userSubmitSubscription=Ge(this,"user-submit").pipe(Ut(this.provider$)).subscribe(([t,n])=>{n&&n.onUserSubmit(t.detail)}),this._addHeaderOptions(),this.provider$.pipe(Ut(this.provider$)).subscribe(([t,n])=>{n&&n.showChatOverlay$.pipe().subscribe(i=>{this.chatOverlayActive=i})})}disconnectedCallback(){var e,t;super.disconnectedCallback(),(e=this.userSubmitSubscription)==null||e.unsubscribe(),(t=this.stateSubscription)==null||t.unsubscribe()}_actionHandler(e){}onSessionUpdated(){const e=this.conversationContentRef.value;e&&setTimeout(()=>{const t=e.scrollHeight;t>this.chatScrollHeight&&(Rl(e),this.chatScrollHeight=t)},300)}disableInput(){this.disabled=!0}enableInput(){this.disabled=!1}setToastMessage(e){this.toast.message=e}async _onSendMessage(e){var n;if(e.preventDefault(),this.message.length<=0){(n=this.formRef.value)==null||n.classList.add("shake"),setTimeout(()=>{var i;(i=this.formRef.value)==null||i.classList.remove("shake")},500);return}this.message=this.message.slice(0,this.messageMaxLength);const t=new CustomEvent("user-submit",{detail:{text:this.message}});this.dispatchEvent(t),this.message="",this.inputRef.value.style.height=this.style.getPropertyValue("--textarea-default-height")}_addHeaderOptions(){const e=this.application.getComponent("widget-header");if(!e)return;const t=this.application.texts,n=t.getOrFallback("conversation.mute","Mute"),i=t.getOrFallback("conversation.unmute","Unmute"),
|
769
|
+
`];Ci([w({attribute:!0})],Oe.prototype,"imageUrl",2);Oe=Ci([Vo("ace-lightbox")],Oe);var Ll=Object.defineProperty,Pl=Object.getOwnPropertyDescriptor,ie=(s,e,t,n)=>{for(var i=n>1?void 0:n?Pl(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&Ll(e,t,i),i};const Rl=s=>{s.scrollTo?s.scrollTo({top:s.scrollHeight,behavior:"smooth"}):s.scrollTop=s.scrollHeight};customElements.get("conversation-entry")||customElements.define("conversation-entry",un);customElements.get("ace-conversation-feed")||customElements.define("ace-conversation-feed",vt);customElements.get("conversation-group")||customElements.define("conversation-group",pn);customElements.get("ace-typing-state")||customElements.define("ace-typing-state",pi);customElements.get("message-type-html")||customElements.define("message-type-html",dn);customElements.get("message-type-markdown")||customElements.define("message-type-markdown",$t);customElements.get("ace-lightbox")||customElements.define("ace-lightbox",Oe);const Ai=ci(k);class R extends Ai{constructor(){super(...arguments),this.message="",this.disabled=!1,this.chatOverlayActive=!1,this.textAreaLength=0,this.conversationContentRef=xe(),this.formRef=xe(),this.inputRef=xe(),this.chatScrollHeight=0,this.toast=new La(this),this.messageMaxLength=1e3,this.platform=null,this.entries=[],this.typing=!1,this.conversationState$=new D("waiting"),this.stateMachine=new Ra(this.conversationState$,this),this.provider$=this.stateMachine.session().pipe(he(e=>e?e==null?void 0:e.provider$:Mt(null)))}async connectedCallback(){super.connectedCallback(),this.messageMaxLength=this.properties.messageMaxLength??this.messageMaxLength;const e=await this.application.container.get("conversation");this.platform=e||null,this.stateSubscription=gr([this.stateMachine.entries(),this.stateMachine.isTyping()]).subscribe(([t,n])=>{this.entries=t,this.typing=n}),this.userSubmitSubscription=Ge(this,"user-submit").pipe(Ut(this.provider$)).subscribe(([t,n])=>{n&&n.onUserSubmit(t.detail)}),this._addHeaderOptions(),this.provider$.pipe(Ut(this.provider$)).subscribe(([t,n])=>{n&&n.showChatOverlay$.pipe().subscribe(i=>{this.chatOverlayActive=i})})}disconnectedCallback(){var e,t;super.disconnectedCallback(),(e=this.userSubmitSubscription)==null||e.unsubscribe(),(t=this.stateSubscription)==null||t.unsubscribe()}_actionHandler(e){}onSessionUpdated(){const e=this.conversationContentRef.value;e&&setTimeout(()=>{const t=e.scrollHeight;t>this.chatScrollHeight&&(Rl(e),this.chatScrollHeight=t)},300)}disableInput(){this.disabled=!0}enableInput(){this.disabled=!1}setToastMessage(e){this.toast.message=e}async _onSendMessage(e){var n;if(e.preventDefault(),this.message.length<=0){(n=this.formRef.value)==null||n.classList.add("shake"),setTimeout(()=>{var i;(i=this.formRef.value)==null||i.classList.remove("shake")},500);return}this.message=this.message.slice(0,this.messageMaxLength);const t=new CustomEvent("user-submit",{detail:{text:this.message}});this.dispatchEvent(t),this.message="",this.inputRef.value.style.height=this.style.getPropertyValue("--textarea-default-height")}_addHeaderOptions(){const e=this.application.getComponent("widget-header");if(!e)return;const t=this.application.texts,n=t.getOrFallback("conversation.mute","Mute"),i=t.getOrFallback("conversation.unmute","Unmute"),r=!!this.application.storage.get("muteAudioNotifications"),o=e.addOption({label:r?i:n,icon:r?Hn.svg:Dn.svg,closeOnClick:!1,datatestid:"options-mute-button",onClick:()=>{!!this.application.storage.get("muteAudioNotifications")?(this.application.unmute(),o.updateLabel(n),o.updateIcon(Dn.svg)):(this.application.mute(),o.updateLabel(i),o.updateIcon(Hn.svg))}})}_inputHandler(e){this.message=e.target.value,e.target.style.height=this.style.getPropertyValue("--textarea-default-height"),e.target.style.height=e.target.scrollHeight+"px",this.textAreaLength=e.target.value.length}_keyDownHandler(e){e.key==="Enter"&&!e.shiftKey&&(this._onSendMessage(e),e.preventDefault())}handover(e,t){this.enableInput(),this.setToastMessage(null);const n=new CustomEvent("handover",{detail:{providerKey:e,providerOptions:t}});return this.dispatchEvent(n),n.detail.complete||Re}render(){var t;const e=this.application.texts;return this.conversationState$.value==="waiting"&&((t=this.application)!=null&&t.storage)&&this.platform&&(this.stateMachine.setStorage(this.application.storage),this.conversationState$.next("init")),m` <div
|
770
770
|
@action=${this._actionHandler}
|
771
771
|
class=${Te({conversation:!0,disabled:this.disabled,"conversation--has-toast":this.toast.hasMessage(),"conversation--input-has-text":this.message.length>0,"overlay-mode":this.chatOverlayActive})}
|
772
772
|
>
|
package/index.mjs
CHANGED
@@ -1422,7 +1422,7 @@ class Ml {
|
|
1422
1422
|
}
|
1423
1423
|
playNotification() {
|
1424
1424
|
const e = "https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";
|
1425
|
-
this.component.application.
|
1425
|
+
this.component.application.storage.get("muteAudioNotifications") || new Audio(e).play().catch((n) => {
|
1426
1426
|
});
|
1427
1427
|
}
|
1428
1428
|
complete() {
|
@@ -6137,13 +6137,13 @@ class U extends Si {
|
|
6137
6137
|
const e = this.application.getComponent("widget-header");
|
6138
6138
|
if (!e)
|
6139
6139
|
return;
|
6140
|
-
const t = this.application.texts, n = t.getOrFallback("conversation.mute", "Mute"), i = t.getOrFallback("conversation.unmute", "Unmute"),
|
6141
|
-
label:
|
6142
|
-
icon:
|
6140
|
+
const t = this.application.texts, n = t.getOrFallback("conversation.mute", "Mute"), i = t.getOrFallback("conversation.unmute", "Unmute"), r = !!this.application.storage.get("muteAudioNotifications"), o = e.addOption({
|
6141
|
+
label: r ? i : n,
|
6142
|
+
icon: r ? jn.svg : Hn.svg,
|
6143
6143
|
closeOnClick: !1,
|
6144
6144
|
datatestid: "options-mute-button",
|
6145
6145
|
onClick: () => {
|
6146
|
-
!!this.application.
|
6146
|
+
!!this.application.storage.get("muteAudioNotifications") ? (this.application.unmute(), o.updateLabel(n), o.updateIcon(Hn.svg)) : (this.application.mute(), o.updateLabel(i), o.updateIcon(jn.svg));
|
6147
6147
|
}
|
6148
6148
|
});
|
6149
6149
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@telia-ace/widget-conversation-flamingo",
|
3
|
-
"version": "1.1.67-rc.
|
3
|
+
"version": "1.1.67-rc.7",
|
4
4
|
"publishConfig": {
|
5
5
|
"registry": "https://registry.npmjs.org"
|
6
6
|
},
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"@lit-labs/motion": "^1.0.4",
|
10
10
|
"@teliads/icons": "^8.4.0",
|
11
11
|
"@teliads/components": "^22.1.1",
|
12
|
-
"@telia-ace/widget-core-flamingo": "1.1.67-rc.
|
12
|
+
"@telia-ace/widget-core-flamingo": "1.1.67-rc.7",
|
13
13
|
"lit-html": "^3.0.2",
|
14
14
|
"rxjs": "^7.8.1",
|
15
15
|
"marked": "^12.0.2"
|