@telia-ace/widget-conversation-flamingo 1.1.76-rc.44 → 1.1.76-rc.46
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +1 -1
- package/index.mjs +2 -2
- package/package.json +2 -2
package/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";var Ti=Object.defineProperty;var Li=(s,e,t)=>e in s?Ti(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var x=(s,e,t)=>(Li(s,typeof e!="symbol"?e+"":e,t),t),Oi=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)};var $t=(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 Be=(s,e,t)=>(Oi(s,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Pi=async s=>{s.registerComponent("conversation",Promise.resolve().then(()=>jl))};class Wt{constructor(){this.registeredProviders=new Map}static async getInstance(e){let t=await e.get("conversation");return t||(t=new Wt,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 ye(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 Ri(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 gs(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 me(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 se(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 pe(s){return this instanceof pe?(this.v=s,this):new pe(s)}function Ii(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(b,f){r.push([p,d,b,f])>1||a(p,d)})})}function a(p,d){try{l(n[p](d))}catch(b){u(r[0][3],b)}}function l(p){p.value instanceof pe?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 Mi(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 me=="function"?me(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 $(s){return typeof s=="function"}function ms(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 xt=ms(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 Ot(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=me(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($(h))try{h()}catch(f){r=f instanceof xt?f.errors:[f]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var p=me(u),d=p.next();!d.done;d=p.next()){var b=d.value;try{Sn(b)}catch(f){r=r??[],f instanceof xt?r=se(se([],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 xt(r)}},s.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Sn(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)&&Ot(t,e)},s.prototype.remove=function(e){var t=this._finalizers;t&&Ot(t,e),e instanceof s&&e._removeParent(this)},s.EMPTY=function(){var e=new s;return e.closed=!0,e}(),s}(),vs=lt.EMPTY;function bs(s){return s instanceof lt||s&&"closed"in s&&$(s.remove)&&$(s.add)&&$(s.unsubscribe)}function Sn(s){$(s)?s():s.unsubscribe()}var ys={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Pt={setTimeout:function(s,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Pt.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,se([s,e],Q(t))):setTimeout.apply(void 0,se([s,e],Q(t)))},clearTimeout:function(s){var e=Pt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(s)},delegate:void 0};function $s(s){Pt.setTimeout(function(){throw s})}function Qe(){}function We(s){s()}var Yt=function(s){ye(e,s);function e(t){var n=s.call(this)||this;return n.isStopped=!1,t?(n.destination=t,bs(t)&&t.add(n)):n.destination=Di,n}return e.create=function(t,n,i){return new Rt(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),zi=Function.prototype.bind;function wt(s,e){return zi.call(s,e)}var Ui=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){Ne(n)}},s.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Ne(n)}else Ne(e)},s.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Ne(t)}},s}(),Rt=function(s){ye(e,s);function e(t,n,i){var r=s.call(this)||this,o;if($(t)||!t)o={next:t??void 0,error:n??void 0,complete:i??void 0};else{var a;r&&ys.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return r.unsubscribe()},o={next:t.next&&wt(t.next,a),error:t.error&&wt(t.error,a),complete:t.complete&&wt(t.complete,a)}):o=t}return r.destination=new Ui(o),r}return e}(Yt);function Ne(s){$s(s)}function ji(s){throw s}var Di={closed:!0,next:Qe,error:ji,complete:Qe},Qt=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 A=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=Ni(e)?e:new Rt(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=Cn(t),new t(function(i,r){var o=new Rt({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[Qt]=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=Cn(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 Cn(s){var e;return(e=s??ys.Promise)!==null&&e!==void 0?e:Promise}function Bi(s){return s&&$(s.next)&&$(s.error)&&$(s.complete)}function Ni(s){return s&&s instanceof Yt||Bi(s)&&bs(s)}function Fi(s){return $(s==null?void 0:s.lift)}function K(s){return function(e){if(Fi(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 R(s,e,t,n,i){return new qi(s,e,t,n,i)}var qi=function(s){ye(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}(Yt),Zi=ms(function(s){return function(){s(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),_=function(s){ye(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 An(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=me(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?vs:(this.currentObservers=null,a.push(t),new lt(function(){n.currentObservers=null,Ot(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 A;return t.source=this,t},e.create=function(t,n){return new An(t,n)},e}(A),An=function(s){ye(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:vs},e}(_),U=function(s){ye(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}(_),Re=new A(function(s){return s.complete()});function Wi(s){return s&&$(s.schedule)}function Gt(s){return s[s.length-1]}function xs(s){return $(Gt(s))?s.pop():void 0}function Kt(s){return Wi(Gt(s))?s.pop():void 0}function Yi(s,e){return typeof Gt(s)=="number"?s.pop():e}var Xt=function(s){return s&&typeof s.length=="number"&&typeof s!="function"};function ws(s){return $(s==null?void 0:s.then)}function ks(s){return $(s[Qt])}function _s(s){return Symbol.asyncIterator&&$(s==null?void 0:s[Symbol.asyncIterator])}function Ss(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 Qi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Cs=Qi();function As(s){return $(s==null?void 0:s[Cs])}function Es(s){return Ii(this,arguments,function(){var t,n,i,r;return gs(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,pe(t.read())];case 3:return n=o.sent(),i=n.value,r=n.done,r?[4,pe(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,pe(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 Ts(s){return $(s==null?void 0:s.getReader)}function B(s){if(s instanceof A)return s;if(s!=null){if(ks(s))return Gi(s);if(Xt(s))return Ki(s);if(ws(s))return Xi(s);if(_s(s))return Ls(s);if(As(s))return Vi(s);if(Ts(s))return Ji(s)}throw Ss(s)}function Gi(s){return new A(function(e){var t=s[Qt]();if($(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ki(s){return new A(function(e){for(var t=0;t<s.length&&!e.closed;t++)e.next(s[t]);e.complete()})}function Xi(s){return new A(function(e){s.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,$s)})}function Vi(s){return new A(function(e){var t,n;try{for(var i=me(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 Ls(s){return new A(function(e){er(s,e).catch(function(t){return e.error(t)})})}function Ji(s){return Ls(Es(s))}function er(s,e){var t,n,i,r;return Ri(this,void 0,void 0,function(){var o,a;return gs(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=Mi(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 q(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),K(function(t,n){t.subscribe(R(n,function(i){return q(n,s,function(){return n.next(i)},e)},function(){return q(n,s,function(){return n.complete()},e)},function(i){return q(n,s,function(){return n.error(i)},e)}))})}function Ps(s,e){return e===void 0&&(e=0),K(function(t,n){n.add(s.schedule(function(){return t.subscribe(n)},e))})}function tr(s,e){return B(s).pipe(Ps(e),Os(e))}function nr(s,e){return B(s).pipe(Ps(e),Os(e))}function sr(s,e){return new A(function(t){var n=0;return e.schedule(function(){n===s.length?t.complete():(t.next(s[n++]),t.closed||this.schedule())})})}function ir(s,e){return new A(function(t){var n;return q(t,e,function(){n=s[Cs](),q(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 $(n==null?void 0:n.return)&&n.return()}})}function Rs(s,e){if(!s)throw new Error("Iterable cannot be null");return new A(function(t){q(t,e,function(){var n=s[Symbol.asyncIterator]();q(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}function rr(s,e){return Rs(Es(s),e)}function or(s,e){if(s!=null){if(ks(s))return tr(s,e);if(Xt(s))return sr(s,e);if(ws(s))return nr(s,e);if(_s(s))return Rs(s,e);if(As(s))return ir(s,e);if(Ts(s))return rr(s,e)}throw Ss(s)}function ct(s,e){return e?or(s,e):B(s)}function It(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s);return ct(s,t)}function Ge(s,e){return K(function(t,n){var i=0;t.subscribe(R(n,function(r){n.next(s.call(e,r,i++))}))})}var ar=Array.isArray;function lr(s,e){return ar(e)?s.apply(void 0,se([],Q(e))):s(e)}function Is(s){return Ge(function(e){return lr(s,e)})}var cr=Array.isArray,hr=Object.getPrototypeOf,ur=Object.prototype,pr=Object.keys;function dr(s){if(s.length===1){var e=s[0];if(cr(e))return{args:e,keys:null};if(fr(e)){var t=pr(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:s,keys:null}}function fr(s){return s&&typeof s=="object"&&hr(s)===ur}function gr(s,e){return s.reduce(function(t,n,i){return t[n]=e[i],t},{})}function mr(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s),n=xs(s),i=dr(s),r=i.args,o=i.keys;if(r.length===0)return ct([],t);var a=new A(vr(r,t,o?function(l){return gr(o,l)}:Pe));return n?a.pipe(Is(n)):a}function vr(s,e,t){return t===void 0&&(t=Pe),function(n){En(e,function(){for(var i=s.length,r=new Array(i),o=i,a=i,l=function(h){En(e,function(){var u=ct(s[h],e),p=!1;u.subscribe(R(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 En(s,e,t){s?q(t,s,e):e()}function br(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?b(f):l.push(f)},b=function(f){r&&e.next(f),c++;var I=!1;B(t(f,h++)).subscribe(R(e,function(N){i==null||i(N),r?d(N):e.next(N)},function(){I=!0},void 0,function(){if(I)try{c--;for(var N=function(){var J=l.shift();o?q(e,o,function(){return b(J)}):b(J)};l.length&&c<n;)N();p()}catch(J){e.error(J)}}))};return s.subscribe(R(e,d,function(){u=!0,p()})),function(){a==null||a()}}function Vt(s,e,t){return t===void 0&&(t=1/0),$(e)?Vt(function(n,i){return Ge(function(r,o){return e(n,r,i,o)})(B(s(n,i)))},t):(typeof e=="number"&&(t=e),K(function(n,i){return br(n,i,s,t)}))}function yr(s){return s===void 0&&(s=1/0),Vt(Pe,s)}var $r=["addListener","removeListener"],xr=["addEventListener","removeEventListener"],wr=["on","off"];function Ke(s,e,t,n){if($(t)&&(n=t,t=void 0),n)return Ke(s,e,t).pipe(Is(n));var i=Q(Sr(s)?xr.map(function(a){return function(l){return s[a](e,l,t)}}):kr(s)?$r.map(Tn(s,e)):_r(s)?wr.map(Tn(s,e)):[],2),r=i[0],o=i[1];if(!r&&Xt(s))return Vt(function(a){return Ke(a,e,t)})(B(s));if(!r)throw new TypeError("Invalid event target");return new A(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 Tn(s,e){return function(t){return function(n){return s[t](e,n)}}}function kr(s){return $(s.addListener)&&$(s.removeListener)}function _r(s){return $(s.on)&&$(s.off)}function Sr(s){return $(s.addEventListener)&&$(s.removeEventListener)}function Cr(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s),n=Yi(s,1/0),i=s;return i.length?i.length===1?B(i[0]):yr(n)(ct(i,t)):Re}function Mt(s){return s<=0?function(){return Re}:K(function(e,t){var n=0;e.subscribe(R(t,function(i){++n<=s&&(t.next(i),s<=n&&t.complete())}))})}function de(s,e){return K(function(t,n){var i=null,r=0,o=!1,a=function(){return o&&!i&&n.complete()};t.subscribe(R(n,function(l){i==null||i.unsubscribe();var c=0,h=r++;B(s(l,h)).subscribe(i=R(n,function(u){return n.next(e?e(l,u,h,c++):u)},function(){i=null,a()}))},function(){o=!0,a()}))})}function zt(s){return K(function(e,t){B(s).subscribe(R(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=xs(s);return K(function(n,i){for(var r=s.length,o=new Array(r),a=s.map(function(){return!1}),l=!1,c=function(u){B(s[u]).subscribe(R(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(R(i,function(u){if(l){var p=se([u],Q(o));i.next(t?t.apply(void 0,se([],Q(p))):p)}}))})}var Z=(s=>(s.User="user",s.Agent="agent",s.System="system",s))(Z||{});const Ar=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+s/4).toString(16)),Ms=()=>typeof crypto.randomUUID=="function"?crypto.randomUUID():Ar();function Er(s){let e=s;const t=/https?:\/\/[^\s<]+/gi,n=/<a [^>]*href="([^"]*)"[^>]*>[^<]*<\/a>/g,i=s.match(t)||[],r=[];let o;for(;(o=n.exec(s))!==null;)r.push(o[1]);return i.filter(l=>!r.includes(l)).forEach(l=>{const c=l.endsWith(".")?l.slice(0,-1):l,h=new RegExp(`(?<!<a[^>]*>)${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![^<]*</a>)`,"gi");e=e.replace(h,`<a title='${c}' target='_blank' href='${c}'>${c}</a>`)}),e}function zs(s){if(s.includes("aceChatGuideTitle"))return Tr(s);const e=/<a [^>]*>https?:\/\/[^<]*<\/a>/gim;return s.replace(e,t=>{const n=Us(t);if(!n)return t;const i=50;if(n.length>i){const r=/^(https?:\/\/[^/]+)(\/.*)?$/i,o=n.match(r);if(!o)return t;const a=o[1],c=(o[2]||"/").split("?")[0],h=c.split("/").pop(),u=i-a.length;let p=c;h&&h.length<u&&c.length>u?p=c.substring(0,u-h.length-4)+".../"+h:p=c.substring(0,u-3)+"...";const d=`${a}${p}`;return jt(t,d)}return jt(t,n)})}function Us(s){const e=s.match(/href=["']([^'"]*)["']/);if(e&&e.length>1){let t=e[1];return t.endsWith(".")&&(t=t.slice(0,-1)),t}return null}function jt(s,e){return s.replace(/>[^<]*<\/a>/,`>${e}</a>`)}function Tr(s){const e=/<a [^>]*aceChatGuideTitle[^>]*>[^<]*<\/a>/gm;return s.replace(e,t=>{const n=Us(t);if(!n)return t;const i=n.split("?").pop(),o=new URLSearchParams(i).get("aceChatGuideTitle");return o?jt(t,o):t})}class Ie{constructor(e,t,n){this.type=e,this.sender=t,this.messages=n,this.status="delivered",this.didUpdate=new _,this.actions$=new _,this.remove$=new _,this.timestamp=Date.now(),this.id=Ms()}update(e){this.messages=[{items:e}],this.didUpdate.next(this)}setStatus(e){this.status=e,this.didUpdate.next(this)}remove(){this.remove$.next()}}class js{constructor(e){this.name=e,this.print$=new _}print(e,t="html",n=this.name){const i=new Ie(Z.Agent,{name:n},[{items:[[t,{content:e}]]}]);return this.print$.next(i),i}subscribe(){return this.print$.asObservable()}}class Ds{constructor(e){this.name=e,this.print$=new _}print(e){const t=new Ie(Z.User,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class Lr{constructor(){this.print$=new _,this.name="system"}print(e){const t=new Ie(Z.System,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class Or{constructor(e,t){this.name=e,this.component=t,this.print$=new _,this.typingState$=new U(!1),this.complete$=new _,this.system=this.createSystem(),this.rehydrate$=new _,this.saveToCurrentSession$=new _,this.showChatOverlay$=new U(!1),this.onComplete=()=>this.complete$.asObservable()}connect(e={}){this.complete$.pipe(Mt(1)).subscribe(()=>{this.disconnected()})}disconnected(){}onUserSubmit(e){this.print(Z.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 js(e);return t.subscribe().subscribe(n=>{this.playNotification(),this.printEntry(n)}),t}createUser(e){const t=new Ds(e);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}createSystem(){const e=new Lr;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){}}/**
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function Ot(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=me(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($(h))try{h()}catch(f){r=f instanceof xt?f.errors:[f]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var p=me(u),d=p.next();!d.done;d=p.next()){var b=d.value;try{Sn(b)}catch(f){r=r??[],f instanceof xt?r=se(se([],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 xt(r)}},s.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Sn(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)&&Ot(t,e)},s.prototype.remove=function(e){var t=this._finalizers;t&&Ot(t,e),e instanceof s&&e._removeParent(this)},s.EMPTY=function(){var e=new s;return e.closed=!0,e}(),s}(),vs=lt.EMPTY;function bs(s){return s instanceof lt||s&&"closed"in s&&$(s.remove)&&$(s.add)&&$(s.unsubscribe)}function Sn(s){$(s)?s():s.unsubscribe()}var ys={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Pt={setTimeout:function(s,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Pt.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,se([s,e],Q(t))):setTimeout.apply(void 0,se([s,e],Q(t)))},clearTimeout:function(s){var e=Pt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(s)},delegate:void 0};function $s(s){Pt.setTimeout(function(){throw s})}function Qe(){}function We(s){s()}var Yt=function(s){ye(e,s);function e(t){var n=s.call(this)||this;return n.isStopped=!1,t?(n.destination=t,bs(t)&&t.add(n)):n.destination=Di,n}return e.create=function(t,n,i){return new Rt(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),zi=Function.prototype.bind;function wt(s,e){return zi.call(s,e)}var Ui=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){Ne(n)}},s.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Ne(n)}else Ne(e)},s.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Ne(t)}},s}(),Rt=function(s){ye(e,s);function e(t,n,i){var r=s.call(this)||this,o;if($(t)||!t)o={next:t??void 0,error:n??void 0,complete:i??void 0};else{var a;r&&ys.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return r.unsubscribe()},o={next:t.next&&wt(t.next,a),error:t.error&&wt(t.error,a),complete:t.complete&&wt(t.complete,a)}):o=t}return r.destination=new Ui(o),r}return e}(Yt);function Ne(s){$s(s)}function ji(s){throw s}var Di={closed:!0,next:Qe,error:ji,complete:Qe},Qt=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 A=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=Ni(e)?e:new Rt(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=Cn(t),new t(function(i,r){var o=new Rt({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[Qt]=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=Cn(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 Cn(s){var e;return(e=s??ys.Promise)!==null&&e!==void 0?e:Promise}function Bi(s){return s&&$(s.next)&&$(s.error)&&$(s.complete)}function Ni(s){return s&&s instanceof Yt||Bi(s)&&bs(s)}function Fi(s){return $(s==null?void 0:s.lift)}function K(s){return function(e){if(Fi(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 R(s,e,t,n,i){return new qi(s,e,t,n,i)}var qi=function(s){ye(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}(Yt),Zi=ms(function(s){return function(){s(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),_=function(s){ye(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 An(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=me(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?vs:(this.currentObservers=null,a.push(t),new lt(function(){n.currentObservers=null,Ot(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 A;return t.source=this,t},e.create=function(t,n){return new An(t,n)},e}(A),An=function(s){ye(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:vs},e}(_),U=function(s){ye(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}(_),Re=new A(function(s){return s.complete()});function Wi(s){return s&&$(s.schedule)}function Gt(s){return s[s.length-1]}function xs(s){return $(Gt(s))?s.pop():void 0}function Kt(s){return Wi(Gt(s))?s.pop():void 0}function Yi(s,e){return typeof Gt(s)=="number"?s.pop():e}var Xt=function(s){return s&&typeof s.length=="number"&&typeof s!="function"};function ws(s){return $(s==null?void 0:s.then)}function ks(s){return $(s[Qt])}function _s(s){return Symbol.asyncIterator&&$(s==null?void 0:s[Symbol.asyncIterator])}function Ss(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 Qi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Cs=Qi();function As(s){return $(s==null?void 0:s[Cs])}function Es(s){return Ii(this,arguments,function(){var t,n,i,r;return gs(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,pe(t.read())];case 3:return n=o.sent(),i=n.value,r=n.done,r?[4,pe(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,pe(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 Ts(s){return $(s==null?void 0:s.getReader)}function B(s){if(s instanceof A)return s;if(s!=null){if(ks(s))return Gi(s);if(Xt(s))return Ki(s);if(ws(s))return Xi(s);if(_s(s))return Ls(s);if(As(s))return Vi(s);if(Ts(s))return Ji(s)}throw Ss(s)}function Gi(s){return new A(function(e){var t=s[Qt]();if($(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ki(s){return new A(function(e){for(var t=0;t<s.length&&!e.closed;t++)e.next(s[t]);e.complete()})}function Xi(s){return new A(function(e){s.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,$s)})}function Vi(s){return new A(function(e){var t,n;try{for(var i=me(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 Ls(s){return new A(function(e){er(s,e).catch(function(t){return e.error(t)})})}function Ji(s){return Ls(Es(s))}function er(s,e){var t,n,i,r;return Ri(this,void 0,void 0,function(){var o,a;return gs(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=Mi(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 q(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),K(function(t,n){t.subscribe(R(n,function(i){return q(n,s,function(){return n.next(i)},e)},function(){return q(n,s,function(){return n.complete()},e)},function(i){return q(n,s,function(){return n.error(i)},e)}))})}function Ps(s,e){return e===void 0&&(e=0),K(function(t,n){n.add(s.schedule(function(){return t.subscribe(n)},e))})}function tr(s,e){return B(s).pipe(Ps(e),Os(e))}function nr(s,e){return B(s).pipe(Ps(e),Os(e))}function sr(s,e){return new A(function(t){var n=0;return e.schedule(function(){n===s.length?t.complete():(t.next(s[n++]),t.closed||this.schedule())})})}function ir(s,e){return new A(function(t){var n;return q(t,e,function(){n=s[Cs](),q(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 $(n==null?void 0:n.return)&&n.return()}})}function Rs(s,e){if(!s)throw new Error("Iterable cannot be null");return new A(function(t){q(t,e,function(){var n=s[Symbol.asyncIterator]();q(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}function rr(s,e){return Rs(Es(s),e)}function or(s,e){if(s!=null){if(ks(s))return tr(s,e);if(Xt(s))return sr(s,e);if(ws(s))return nr(s,e);if(_s(s))return Rs(s,e);if(As(s))return ir(s,e);if(Ts(s))return rr(s,e)}throw Ss(s)}function ct(s,e){return e?or(s,e):B(s)}function It(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s);return ct(s,t)}function Ge(s,e){return K(function(t,n){var i=0;t.subscribe(R(n,function(r){n.next(s.call(e,r,i++))}))})}var ar=Array.isArray;function lr(s,e){return ar(e)?s.apply(void 0,se([],Q(e))):s(e)}function Is(s){return Ge(function(e){return lr(s,e)})}var cr=Array.isArray,hr=Object.getPrototypeOf,ur=Object.prototype,pr=Object.keys;function dr(s){if(s.length===1){var e=s[0];if(cr(e))return{args:e,keys:null};if(fr(e)){var t=pr(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:s,keys:null}}function fr(s){return s&&typeof s=="object"&&hr(s)===ur}function gr(s,e){return s.reduce(function(t,n,i){return t[n]=e[i],t},{})}function mr(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s),n=xs(s),i=dr(s),r=i.args,o=i.keys;if(r.length===0)return ct([],t);var a=new A(vr(r,t,o?function(l){return gr(o,l)}:Pe));return n?a.pipe(Is(n)):a}function vr(s,e,t){return t===void 0&&(t=Pe),function(n){En(e,function(){for(var i=s.length,r=new Array(i),o=i,a=i,l=function(h){En(e,function(){var u=ct(s[h],e),p=!1;u.subscribe(R(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 En(s,e,t){s?q(t,s,e):e()}function br(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?b(f):l.push(f)},b=function(f){r&&e.next(f),c++;var I=!1;B(t(f,h++)).subscribe(R(e,function(N){i==null||i(N),r?d(N):e.next(N)},function(){I=!0},void 0,function(){if(I)try{c--;for(var N=function(){var J=l.shift();o?q(e,o,function(){return b(J)}):b(J)};l.length&&c<n;)N();p()}catch(J){e.error(J)}}))};return s.subscribe(R(e,d,function(){u=!0,p()})),function(){a==null||a()}}function Vt(s,e,t){return t===void 0&&(t=1/0),$(e)?Vt(function(n,i){return Ge(function(r,o){return e(n,r,i,o)})(B(s(n,i)))},t):(typeof e=="number"&&(t=e),K(function(n,i){return br(n,i,s,t)}))}function yr(s){return s===void 0&&(s=1/0),Vt(Pe,s)}var $r=["addListener","removeListener"],xr=["addEventListener","removeEventListener"],wr=["on","off"];function Ke(s,e,t,n){if($(t)&&(n=t,t=void 0),n)return Ke(s,e,t).pipe(Is(n));var i=Q(Sr(s)?xr.map(function(a){return function(l){return s[a](e,l,t)}}):kr(s)?$r.map(Tn(s,e)):_r(s)?wr.map(Tn(s,e)):[],2),r=i[0],o=i[1];if(!r&&Xt(s))return Vt(function(a){return Ke(a,e,t)})(B(s));if(!r)throw new TypeError("Invalid event target");return new A(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 Tn(s,e){return function(t){return function(n){return s[t](e,n)}}}function kr(s){return $(s.addListener)&&$(s.removeListener)}function _r(s){return $(s.on)&&$(s.off)}function Sr(s){return $(s.addEventListener)&&$(s.removeEventListener)}function Cr(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=Kt(s),n=Yi(s,1/0),i=s;return i.length?i.length===1?B(i[0]):yr(n)(ct(i,t)):Re}function Mt(s){return s<=0?function(){return Re}:K(function(e,t){var n=0;e.subscribe(R(t,function(i){++n<=s&&(t.next(i),s<=n&&t.complete())}))})}function de(s,e){return K(function(t,n){var i=null,r=0,o=!1,a=function(){return o&&!i&&n.complete()};t.subscribe(R(n,function(l){i==null||i.unsubscribe();var c=0,h=r++;B(s(l,h)).subscribe(i=R(n,function(u){return n.next(e?e(l,u,h,c++):u)},function(){i=null,a()}))},function(){o=!0,a()}))})}function zt(s){return K(function(e,t){B(s).subscribe(R(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=xs(s);return K(function(n,i){for(var r=s.length,o=new Array(r),a=s.map(function(){return!1}),l=!1,c=function(u){B(s[u]).subscribe(R(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(R(i,function(u){if(l){var p=se([u],Q(o));i.next(t?t.apply(void 0,se([],Q(p))):p)}}))})}var Z=(s=>(s.User="user",s.Agent="agent",s.System="system",s))(Z||{});const Ar=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+s/4).toString(16)),Ms=()=>typeof crypto.randomUUID=="function"?crypto.randomUUID():Ar();function Er(s){let e=s;const t=/https?:\/\/[^\s<]+/gi,n=/<a [^>]*href="([^"]*)"[^>]*>[^<]*<\/a>/g,i=s.match(t)||[],r=[];let o;for(;(o=n.exec(s))!==null;)r.push(o[1]);return i.filter(l=>!r.includes(l)).forEach(l=>{const c=l.endsWith(".")?l.slice(0,-1):l,h=new RegExp(`(?<!<a[^>]*>)${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![^<]*</a>)`,"gi");e=e.replace(h,`<a title='${c}' target='_blank' href='${c}'>${c}</a>`)}),e}function zs(s){if(s.includes("aceChatGuideTitle"))return Tr(s);const e=/<a [^>]*>https?:\/\/[^<]*<\/a>/gim;return s.replace(e,t=>{const n=Us(t);if(!n)return t;const i=50;if(n.length>i){const r=/^(https?:\/\/[^/]+)(\/.*)?$/i,o=n.match(r);if(!o)return t;const a=o[1],c=(o[2]||"/").split("?")[0],h=c.split("/").pop(),u=i-a.length;let p=c;h&&h.length<u&&c.length>u?p=c.substring(0,u-h.length-4)+".../"+h:p=c.substring(0,u-3)+"...";const d=`${a}${p}`;return jt(t,d)}return jt(t,n)})}function Us(s){const e=s.match(/href=["']([^'"]*)["']/);if(e&&e.length>1){let t=e[1];return t.endsWith(".")&&(t=t.slice(0,-1)),t}return null}function jt(s,e){return s.replace(/>[^<]*<\/a>/,`>${e}</a>`)}function Tr(s){const e=/<a [^>]*aceChatGuideTitle[^>]*>[^<]*<\/a>/gm;return s.replace(e,t=>{const n=Us(t);if(!n)return t;const i=n.split("?").pop(),o=new URLSearchParams(i).get("aceChatGuideTitle");return o?jt(t,o):t})}class Ie{constructor(e,t,n){this.type=e,this.sender=t,this.messages=n,this.status="delivered",this.didUpdate=new _,this.actions$=new _,this.remove$=new _,this.timestamp=Date.now(),this.id=Ms()}update(e){this.messages=[{items:e}],this.didUpdate.next(this)}setStatus(e){this.status=e,this.didUpdate.next(this)}remove(){this.remove$.next()}}class js{constructor(e){this.name=e,this.print$=new _}print(e,t="html",n=this.name){const i=new Ie(Z.Agent,{name:n},[{items:[[t,{content:e}]]}]);return this.print$.next(i),i}subscribe(){return this.print$.asObservable()}}class Ds{constructor(e){this.name=e,this.print$=new _}print(e){const t=new Ie(Z.User,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class Lr{constructor(){this.print$=new _,this.name="system"}print(e){const t=new Ie(Z.System,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class Or{constructor(e,t){this.name=e,this.component=t,this.print$=new _,this.typingState$=new U(!1),this.complete$=new _,this.system=this.createSystem(),this.rehydrate$=new _,this.saveToCurrentSession$=new _,this.showChatOverlay$=new U(!1),this.onComplete=()=>this.complete$.asObservable()}connect(e={}){this.complete$.pipe(Mt(1)).subscribe(()=>{this.disconnected()})}disconnected(){}onUserSubmit(e){this.print(Z.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 js(e);return t.subscribe().subscribe(n=>{this.playNotification(),this.printEntry(n)}),t}createUser(e){const t=new Ds(e);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}createSystem(){const e=new Lr;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=!document.hidden&&this.component.application.storage.get("open"),t="https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";!this.component.application.storage.get("muteAudioNotifications")&&!e&&new Audio(t).play().catch(i=>{})}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
|
package/index.mjs
CHANGED
@@ -1490,8 +1490,8 @@ class Dl {
|
|
1490
1490
|
return this.print$.asObservable();
|
1491
1491
|
}
|
1492
1492
|
playNotification() {
|
1493
|
-
const e = "https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";
|
1494
|
-
this.component.application.storage.get("muteAudioNotifications")
|
1493
|
+
const e = !document.hidden && this.component.application.storage.get("open"), t = "https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";
|
1494
|
+
!this.component.application.storage.get("muteAudioNotifications") && !e && new Audio(t).play().catch((i) => {
|
1495
1495
|
});
|
1496
1496
|
}
|
1497
1497
|
complete() {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@telia-ace/widget-conversation-flamingo",
|
3
|
-
"version": "1.1.76-rc.
|
3
|
+
"version": "1.1.76-rc.46",
|
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.76-rc.
|
12
|
+
"@telia-ace/widget-core-flamingo": "1.1.76-rc.46",
|
13
13
|
"lit-html": "^3.0.2",
|
14
14
|
"rxjs": "^7.8.1",
|
15
15
|
"marked": "^12.0.2"
|