vendor: 4,252 bytes, lines 1-2
1/*! For license information please see widget.js.LICENSE.txt */ 2(()=>{var t={6479(t){var e;window,e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";var i,s=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},i(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=256,r=function(){function t(t){void 0===t&&(t="="),this._paddingCharacter=t}return t.prototype.encodedLength=function(t){return this._paddingCharacter?(t+2)/3*4|0:(8*t+5)/6|0},t.prototype.encode=function(t){for(var e="",n=0;n<t.length-2;n+=3){var i=t[n]<<16|t[n+1]<<8|t[n+2];e+=this._encodeByte(i>>>18&63),e+=this._encodeByte(i>>>12&63),e+=this._encodeByte(i>>>6&63),e+=this._encodeByte(i>>>0&63)}var s=t.length-n;return s>0&&(i=t[n]<<16|(2===s?t[n+1]<<8:0),e+=this._encodeByte(i>>>18&63),e+=this._encodeByte(i>>>12&63),e+=2===s?this._encodeByte(i>>>6&63):this._paddingCharacter||"",e+=this._paddingCharacter||""),e},t.prototype.maxDecodedLength=function(t){return this._paddingCharacter?t/4*3|0:(6*t+7)/8|0},t.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},t.prototype.decode=function(t){if(0===t.length)return new Uint8Array(0);for(var e=this._getPaddingLength(t),n=t.length-e,i=new Uint8Array(this.maxDecodedLength(n)),s=0,r=0,a=0,c=0,h=0,l=0,d=0;r<n-4;r+=4)c=this._decodeChar(t.charCodeAt(r+0)),h=this._decodeChar(t.charCodeAt(r+1)),l=this._decodeChar(t.charCodeAt(r+2)),d=this._decodeChar(t.charCodeAt(r+3)),i[s++]=c<<2|h>>>4,i[s++]=h<<4|l>>>2,i[s++]=l<<6|d,a|=c&o,a|=h&o,a|=l&o,a|=d&o;if(r<n-1&&(c=this._decodeChar(t.charCodeAt(r)),h=this._decodeChar(t.charCodeAt(r+1)),i[s++]=c<<2|h>>>4,a|=c&o,a|=h&o),r<n-2&&(l=this._decodeChar(t.charCodeAt(r+2)),i[s++]=h<<4|l>>>2,a|=l&o),r<n-3&&(d=this._decodeChar(t.charCodeAt(r+3)),i[s++]=l<<6|d,a|=d&o),0!==a)throw new Error("Base64Coder: incorrect characters for decoding");return i},t.prototype._encodeByte=function(t){var e=t;return e+=65,e+=25-t>>>8&6,e+=51-t>>>8&-75,e+=61-t>>>8&-15,e+=62-t>>>8&3,String.fromCharCode(e)},t.prototype._decodeChar=function(t){var e=o;return e+=(42-t&t-44)>>>8&-256+t-43+62,e+=(46-t&t-48)>>>8&-256+t-47+63,e+=(47-t&t-58)>>>8&-256+t-48+52,e+=(64-t&t-91)>>>8&-256+t-65+0,e+=(96-t&t-123)>>>8&-256+t-97+26},t.prototype._getPaddingLength=function(t){var e=0;if(this._paddingCharacter){for(var n=t.length-1;n>=0&&t[n]===this._paddingCharacter;n--)e++;if(t.length<4||e>2)throw new Error("Base64Coder: incorrect padding")}return e},t}();e.Coder=r;var a=new r;e.encode=function(t){return a.encode(t)},e.decode=function(t){return a.decode(t)};var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype._encodeByte=function(t){var e=t;return e+=65,e+=25-t>>>8&6,e+=51-t>>>8&-75,e+=61-t>>>8&-13,e+=62-t>>>8&49,String.fromCharCode(e)},e.prototype._decodeChar=function(t){var e=o;return e+=(44-t&t-46)>>>8&-256+t-45+62,e+=(94-t&t-96)>>>8&-256+t-95+63,e+=(47-t&t-58)>>>8&-256+t-48+52,e+=(64-t&t-91)>>>8&-256+t-65+0,e+=(96-t&t-123)>>>8&-256+t-97+26},e}(r);e.URLSafeCoder=c;var h=new c;e.encodeURLSafe=function(t){return h.encode(t)}
2,e.decodeURLSafe=function(t){return h.decode(t)},e.encodedLength=function(t){return a.encodedLength(t)},e.maxDecodedLength=function(t){return a.maxDecodedLength(t)},e.decodedLength=function(t){return a.decodedLength(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i="utf8: invalid string",s="utf8: invalid source encoding";function o(t){for(var e=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);if(s<128)e+=1;else if(s<2048)e+=2;else if(s<55296)e+=3;else{if(!(s<=57343))throw new Error(i);if(n>=t.length-1)throw new Error(i);n++,e+=4}}return e}e.encode=function(t){for(var e=new Uint8Array(o(t)),n=0,i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?e[n++]=s:s<2048?(e[n++]=192|s>>6,e[n++]=128|63&s):s<55296?(e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s):(i++,s=(1023&s)<<10,s|=1023&t.charCodeAt(i),s+=65536,e[n++]=240|s>>18,e[n++]=128|s>>12&63,e[n++]=128|s>>6&63,e[n++]=128|63&s)}return e},e.encodedLength=o,e.decode=function(t){for(var e=[],n=0;n<t.length;n++){var i=t[n];if(128&i){var o=void 0;if(i<224){if(n>=t.length)throw new Error(s);if(128!=(192&(r=t[++n])))throw new Error(s);i=(31&i)<<6|63&r,o=128}else if(i<240){if(n>=t.length-1)throw new Error(s);var r=t[++n],a=t[++n];if(128!=(192&r)||128!=(192&a))throw new Error(s);i=(15&i)<<12|(63&r)<<6|63&a,o=2048}else{if(!(i<248))throw new Error(s);if(n>=t.length-2)throw new Error(s);r=t[++n],a=t[++n];var c=t[++n];if(128!=(192&r)||128!=(192&a)||128!=(192&c))throw new Error(s);i=(15&i)<<18|(63&r)<<12|(63&a)<<6|63&c,o=65536}if(i<o||i>=55296&&i<=57343)throw new Error(s);if(i>=65536){if(i>1114111)throw new Error(s);i-=65536,e.push(String.fromCharCode(55296|i>>10)),i=56320|1023&i}}e.push(String.fromCharCode(i))}return e.join("")}},function(t,e,n){t.exports=n(3).default},function(t,e,n){"use strict";n.r(e);class i{constructor(t,e){this.lastId=0,this.prefix=t,this.name=e}create(t){this.lastId++;var e=this.lastId,n=this.prefix+e,i=this.name+"["+e+"]",s=!1,o=function(){s||(t.apply(null,arguments),s=!0)};return this[e]=o,{number:e,id:n,name:i,callback:o}}remove(t){delete this[t.number]}}var s=new i("_pusher_script_","Pusher.ScriptReceivers"),o={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},r=new i("_pusher_dependencies","Pusher.DependenciesReceivers"),a=new class{constructor(t){this.options=t,this.receivers=t.receivers||s,this.loading={}}load(t,e,n){var i=this;if(i.loading[t]&&i.loading[t].length>0)i.loading[t].push(n);else{i.loading[t]=[n];var s=le.createScriptRequest(i.getPath(t,e)),o=i.receivers.create(function(e){if(i.receivers.remove(o),i.loading[t]){var n=i.loading[t];delete i.loading[t];for(var r=function(t){t||s.cleanup()},a=0;a<n.length;a++)n[a](e,r)}});s.send(o)}}getRoot(t){var e=le.getDocument().location.protocol;return(t&&t.useTLS||"https:"===e?this.options.cdn_https:this.options.cdn_http).replace(/\/*$/,"")+"/"+this.options.version}getPath(t,e){return this.getRoot(e)+"/"+t+this.options.suffix+".js"}}({cdn_http:o.cdn_http,cdn_https:o.cdn_https,version:o.VERSION,suffix:o.dependency_suffix,receivers:r});const c={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var h,l=function(t){const e=c.urls[t];if(!e)return"";let n;return e.fullUrl?n=e.fullUrl:e.path&&(n=c.baseUrl+e.path),n?`See: ${n}`:""};!function(t){t.UserAuthentication="user-authentication",t.ChannelAuthorization="channel-authorization"}(h||(h={}));
vendor: 1,370 bytes, line 2
2class d extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}class u extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}class p extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}class b extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}class m extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}class g extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}class f extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}class v extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}class y extends Error{constructor(t,e){super(e),this.status=t,Object.setPrototypeOf(this,new.target.prototype)}}for(var w=function(t,e,n,i,s){const o=le.createXHR();for(var r in o.open("POST",n.endpoint,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.headers)o.setRequestHeader(r,n.headers[r]);if(null!=n.headersProvider){let t=n.headersProvider();for(var r in t)o.setRequestHeader(r,t[r])}return o.onreadystatechange=function(){if(4===o.readyState)if(200===o.status){let t,e=!1;try{t=JSON.parse(o.responseText),e=!0}catch(t){s(new y(200,`JSON returned from ${i.toString()}
2 endpoint was invalid, yet status code was 200. Data was: ${o.responseText}`),null)}e&&s(null,t)}else{let t="";switch(i){case h.UserAuthentication:t=l("authenticationEndpoint");break;case h.ChannelAuthorization:t=`Clients must be authorized to join private or presence channels. ${l("authorizationEndpoint")}`}s(new y(o.status,`Unable to retrieve auth string from ${i.toString()} endpoint - received status: ${o.status} from ${n.endpoint}. ${t}`),null)}},o.send(e),o},k=String.fromCharCode,x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_={},S=0;S<64;S++)_[x.charAt(S)]=S;var C=function(t){var e=t.charCodeAt(0);return e<128?t:e<2048?k(192|e>>>6)+k(128|63&e):k(224|e>>>12&15)+k(128|e>>>6&63)+k(128|63&e)},T=function(t){return t.replace(/[^\x00-\x7F]/g,C)},E=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[x.charAt(n>>>18),x.charAt(n>>>12&63),e>=2?"=":x.charAt(n>>>6&63),e>=1?"=":x.charAt(63&n)].join("")},P=window.btoa||function(t){return t.replace(/[\s\S]{1,3}/g,E)},O=class{constructor(t,e,n,i){this.clear=e,this.timer=t(()=>{this.timer&&(this.timer=i(this.timer))},n)}isRunning(){return null!==this.timer}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}};function L(t){window.clearTimeout(t)}function I(t){window.clearInterval(t)}class A extends O{constructor(t,e){super(setTimeout,L,t,function(t){return e(),null})}}class R extends O{constructor(t,e){super(setInterval,I,t,function(t){return e(),t})}}var M={now:()=>Date.now?Date.now():(new Date).valueOf(),defer:t=>new A(0,t),method(t,...e){var n=Array.prototype.slice.call(arguments,1);return function(e){return e[t].apply(e,n.concat(arguments))}}},j=M;function D(t,...e){for(var n=0;n<e.length;n++){var i=e[n];for(var s in i)i[s]&&i[s].constructor&&i[s].constructor===Object?t[s]=D(t[s]||{},i[s]):t[s]=i[s]}return t}function B(){for(var t=["Pusher"],e=0;e<arguments.length;e++)"string"==typeof arguments[e]?t.push(arguments[e]):t.push(Y(arguments[e]));return t.join(" : ")}function q(t,e){var n=Array.prototype.indexOf;if(null===t)return-1;if(n&&t.indexOf===n)return t.indexOf(e);for(var i=0,s=t.length;i<s;i++)if(t[i]===e)return i;return-1}function N(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(t[n],n,t)}function z(t){var e=[];return N(t,function(t,n){e.push(n)}),e}function H(t,e,n){for(var i=0;i<t.length;i++)e.call(n||window,t[i],i,t)}function W(t,e){for(var n=[],i=0;i<t.length;i++)n.push(e(t[i],i,t,n));return n}function U(t,e){e=e||function(t){return!!t};for(var n=[],i=0;i<t.length;i++)e(t[i],i,t,n)&&n.push(t[i]);return n}function F(t,e){var n={};return N(t,function(i,s){(e&&e(i,s,t,n)||Boolean(i))&&(n[s]=i)}),n}function X(t,e){for(var n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1}function $(t){return e=function(t){return"object"==typeof t&&(t=Y(t)),encodeURIComponent((e=t.toString(),P(T(e))));var e},n={},N(t,function(t,i){n[i]=e(t)}),n;var e,n}function J(t){var e,n,i=F(t,function(t){return void 0!==t});return W((e=$(i),n=[],N(e,function(t,e){n.push([e,t])}),n),j.method("join","=")).join("&")}function Y(t){try{return JSON.stringify(t)}catch(i){return JSON.stringify((e=[],n=[],function t(i,s){var o,r,a;switch(typeof i){case"object":if(!i)return null;for(o=0;o<e.length;o+=1)if(e[o]===i)return{$ref:n[o]};if(e.push(i),n.push(s),"[object Array]"===Object.prototype.toString.apply(i))for(a=[],o=0;o<i.length;o+=1)a[o]=t(i[o],s+"["+o+"]");else for(r in a={},i)Object.prototype.hasOwnProperty.call(i,r)&&(a[r]=t(i[r],s+"["+JSON.stringify(r)+"]"));return a;case"number":case"string":case"boolean":return i}}(t,"$")))}var e,n}var G=new class{constructor(){this.globalLog=t=>{window.console&&window.console.log&&window.console.log(t)}}debug(...t){this.log(this.globalLog,t)}warn(...t){this.log(this.globalLogWarn,t)}error(...t){this.log(this.globalLogError,t)}globalLogWarn(t){window.console&&window.console.warn?window.console.warn(t):this.globalLog(t)}globalLogError(t){window.console&&window.console.error?window.console.error(t):this.globalLogWarn(t)}log(t,...e){var n=B.apply(this,arguments);Le.log?Le.log(n):Le.logToConsole&&t.bind(this)(n)}},V=function(t,e,n,i,s){void 0===n.headers&&null==n.headersProvider||G.warn(`To send headers with the ${i.toString()} request, you must use AJAX, rather than JSONP.`);var o=t.nextAuthCallbackID.toString();t.nextAuthCallbackID++;var r=t.getDocument(),a=r.createElement("script");t.auth_callbacks[o]=function(t){s(null,t)};var c="Pusher.auth_callbacks['"+o+"']";a.src=n.endpoint+"?callback="+encodeURIComponent(c)+"&"+e;var h=r.getElementsByTagName("head")[0]||r.documentElement;h.insertBefore(a,h.firstChild)};class K{constructor(t){this.src=t}send(t){var e=this,n="Error loading "+e.src;e.script=document.createElement("script"),e.script.id=t.id,e.script.src=e.src,e.script.type="text/javascript",e.script.charset="UTF-8",e.script.addEventListener?(e.script.onerror=function(){t.callback(n)},e.script.onload=function(){t.callback(null)}):e.script.onreadystatechange=function(){"loaded"!==e.script.readyState&&"complete"!==e.script.readyState||t.callback(null)},void 0===e.script.async&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(e.errorScript=document.createElement("script"),e.errorScript.id=t.id+"_error",e.errorScript.text=t.name+"('"+n+"');",e.script.async=e.errorScript.async=!1):e.script.async=!0;var i=document.getElementsByTagName("head")[0];i.insertBefore(e.script,i.firstChild),e.errorScript&&i.insertBefore(e.errorScript,e.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class Q{constructor(t,e){this.url=t,this.data=e}send(t){if(!this.request){var e=J(this.data),n=this.url+"/"+t.number+"?"+e;this.request=le.createScriptRequest(n),this.request.send(t)}}cleanup(){this.request&&this.request.cleanup()}}var Z={name:"jsonp",getAgent:function(t,e){return function(n,i){var o="http"+(e?"s":"")+"://"+(t.host||t.options.host)+t.options.path,r=le.createJSONPRequest(o,n),a=le.ScriptReceivers.create(function(e,n){s.remove(a),r.cleanup(),n&&n.host&&(t.host=n.host),i&&i(e,n)});r.send(a)}}};function tt(t,e,n){return t+(e.useTLS?"s":"")+"://"+(e.useTLS?e.hostTLS:e.hostNonTLS)+n}function et(t,e){return"/app/"+t+"?protocol="+o.PROTOCOL+"&client=js&ver
2sion="+o.VERSION+(e?"&"+e:"")}var nt={getInitial:function(t,e){return tt("ws",e,(e.httpPath||"")+et(t,"flash=false"))}},it={getInitial:function(t,e){return tt("http",e,(e.httpPath||"/pusher")+et(t))}},st={getInitial:function(t,e){return tt("http",e,e.httpPath||"/pusher")},getPath:function(t,e){return et(t)}};class ot{constructor(){this._callbacks={}}get(t){return this._callbacks[rt(t)]}add(t,e,n){var i=rt(t);this._callbacks[i]=this._callbacks[i]||[],this._callbacks[i].push({fn:e,context:n})}remove(t,e,n){if(t||e||n){var i=t?[rt(t)]:z(this._callbacks);e||n?this.removeCallback(i,e,n):this.removeAllCallbacks(i)}else this._callbacks={}}removeCallback(t,e,n){H(t,function(t){this._callbacks[t]=U(this._callbacks[t]||[],function(t){return e&&e!==t.fn||n&&n!==t.context}),0===this._callbacks[t].length&&delete this._callbacks[t]},this)}removeAllCallbacks(t){H(t,function(t){delete this._callbacks[t]},this)}}function rt(t){return"_"+t}class at{constructor(t){this.callbacks=new ot,this.global_callbacks=[],this.failThrough=t}bind(t,e,n){return this.callbacks.add(t,e,n),this}bind_global(t){return this.global_callbacks.push(t),this}unbind(t,e,n){return this.callbacks.remove(t,e,n),this}unbind_global(t){return t?(this.global_callbacks=U(this.global_callbacks||[],e=>e!==t),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(t,e,n){for(var i=0;i<this.global_callbacks.length;i++)this.global_callbacks[i](t,e);var s=this.callbacks.get(t),o=[];if(n?o.push(e,n):e&&o.push(e),s&&s.length>0)for(i=0;i<s.length;i++)s[i].fn.apply(s[i].context||window,o);else this.failThrough&&this.failThrough(t,e);return this}}class ct extends at{constructor(t,e,n,i,s){super(),this.initialize=le.transportConnectionInitializer,this.hooks=t,this.name=e,this.priority=n,this.key=i,this.options=s,this.state="new",this.timeline=s.timeline,this.activityTimeout=s.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return Boolean(this.hooks.handlesActivityChecks)}supportsPing(){return Boolean(this.hooks.supportsPing)}connect(){if(this.socket||"initialized"!==this.state)return!1;var t=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(t,this.options)}catch(t){return j.defer(()=>{this.onError(t),this.changeState("closed")}),!1}return this.bindListeners(),G.debug("Connecting",{transport:this.name,url:t}),this.changeState("connecting"),!0}close(){return!!this.socket&&(this.socket.close(),!0)}send(t){return"open"===this.state&&(j.defer(()=>{this.socket&&this.socket.send(t)}),!0)}ping(){"open"===this.state&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(t){this.emit("error",{type:"WebSocketError",error:t}),this.timeline.error(this.buildTimelineMessage({error:t.toString()}))}onClose(t){t?this.changeState("closed",{code:t.code,reason:t.reason,wasClean:t.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(t){this.emit("message",t)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=t=>{this.onError(t)},this.socket.onclose=t=>{this.onClose(t)},this.socket.onmessage=t=>{this.onMessage(t)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(t,e){this.state=t,this.timeline.info(this.buildTimelineMessage({state:t,params:e})),this.emit(t,e)}buildTimelineMessage(t){return D({cid:this.id},t)}}class ht{constructor(t){this.hooks=t}isSupported(t){return this.hooks.isSupported(t)}createConnection(t,e,n,i){return new ct(this.hooks,t,e,n,i)}}var lt=new ht({urls:nt,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return Boolean(le.getWebSocketAPI())},isSupported:function(){return Boolean(le.getWebSocketAPI())},getSocket:function(t){return le.createWebSocket(t)}}),dt={urls:it,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},ut=D({getSocket:function(t){return le.HTTPFactory.createStreamingSocket(t)}},dt),pt=D({getSocket:function(t){return le.HTTPFactory.createPollingSocket(t)}},dt),bt={isSupported:function(){return le.isXHRSupported()}},mt={ws:lt,xhr_streaming:new ht(D({},ut,bt)),xhr_polling:new ht(D({},pt,bt))},gt=new ht({file:"sockjs",urls:st,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return void 0!==window.SockJS},getSocket:function(t,e){return new window.SockJS(t,null,{js_path:a.getPath("sockjs",{useTLS:e.useTLS}),ignore_null_origin:e.ignoreNullOrigin})},beforeOpen:function(t,e){t.send(JSON.stringify({path:e}))}}),ft={isSupported:function(t){return le.isXDRSupported(t.useTLS)}},vt=new ht(D({},ut,ft)),yt=new ht(D({},pt,ft));mt.xdr_streaming=vt,mt.xdr_polling=yt,mt.sockjs=gt;var wt=mt,kt=new class extends at{constructor(){super();var t=this;void 0!==window.addEventListener&&(window.addEventListener("online",function(){t.emit("online")},!1),window.addEventListener("offline",function(){t.emit("offline")},!1))}isOnline(){return void 0===window.navigator.onLine||window.navigator.onLine}};class xt{constructor(t,e,n){this.manager=t,this.transport=e,this.minPingDelay=n.minPingDelay,this.maxPingDelay=n.maxPingDelay,this.pingDelay=void 0}createConnection(t,e,n,i){i=D({},i,{activityTimeout:this.pingDelay});var s=this.transport.createConnection(t,e,n,i),o=null,r=function(){s.unbind("open",r),s.bind("closed",a),o=j.now()},a=t=>{if(s.unbind("closed",a),1002===t.code||1003===t.code)this.manager.reportDeath();else if(!t.wasClean&&o){var e=j.now()-o;e<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(e/2,this.minPingDelay))}};return s.bind("open",r),s}isSupported(t){return this.manager.isAlive()&&this.transport.isSupported(t)}}const _t={decodeMessage:function(t){try{var e=JSON.parse(t.data),n=e.data;if("string"==typeof n)try{n=JSON.parse(e.data)}catch(t){}var i={event:e.event,channel:e.channel,data:n};return e.user_id&&(i.user_id=e.user_id),i}catch(e){throw{type:"MessageParseError",error:e,data:t.data}}},encodeMessage:function(t){return JSON.stringify(t)},processHandshake:function(t){var e=_t.decodeMessage(t);if("pusher:connection_established"===e.event){if(!e.data.activity_timeout)throw"No activity timeout specified in handshake";
vendor: 5,378 bytes, line 2
2return{action:"connected",id:e.data.socket_id,activityTimeout:1e3*e.data.activity_timeout}}if("pusher:error"===e.event)return{action:this.getCloseAction(e.data),error:this.getCloseError(e.data)};throw"Invalid handshake"},getCloseAction:function(t){return t.code<4e3?t.code>=1002&&t.code<=1004?"backoff":null:4e3===t.code?"tls_only":t.code<4100?"refused":t.code<4200?"backoff":t.code<4300?"retry":"refused"},getCloseError:function(t){return 1e3!==t.code&&1001!==t.code?{type:"PusherError",data:{code:t.code,message:t.reason||t.message}}:null}};var St=_t;class Ct extends at{constructor(t,e){super(),this.id=t,this.transport=e,this.activityTimeout=e.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(t){return this.transport.send(t)}send_event(t,e,n){var i={event:t,data:e};return n&&(i.channel=n),G.debug("Event sent",i),this.send(St.encodeMessage(i))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var t={message:t=>{var e;try{e=St.decodeMessage(t)}catch(e){this.emit("error",{type:"MessageParseError",error:e,data:t.data})}if(void 0!==e){switch(G.debug("Event recd",e),e.event){case"pusher:error":this.emit("error",{type:"PusherError",data:e.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong")}this.emit("message",e)}},activity:()=>{this.emit("activity")},error:t=>{this.emit("error",t)},closed:t=>{e(),t&&t.code&&this.handleCloseEvent(t),this.transport=null,this.emit("closed")}},e=()=>{N(t,(t,e)=>{this.transport.unbind(e,t)})};N(t,(t,e)=>{this.transport.bind(e,t)})}handleCloseEvent(t){var e=St.getCloseAction(t),n=St.getCloseError(t);n&&this.emit("error",n),e&&this.emit(e,{action:e,error:n})}}class Tt{constructor(t,e){this.transport=t,this.callback=e,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=t=>{var e;this.unbindListeners();try{e=St.processHandshake(t)}catch(t){return this.finish("error",{error:t}),void this.transport.close()}"connected"===e.action?this.finish("connected",{connection:new Ct(e.id,this.transport),activityTimeout:e.activityTimeout}):(this.finish(e.action,{error:e.error}),this.transport.close())},this.onClosed=t=>{this.unbindListeners();var e=St.getCloseAction(t)||"backoff",n=St.getCloseError(t);this.finish(e,{error:n})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(t,e){this.callback(D({transport:this.transport,action:t},e))}}class Et{constructor(t,e){this.timeline=t,this.options=e||{}}send(t,e){this.timeline.isEmpty()||this.timeline.send(le.TimelineTransport.getAgent(this,t),e)}}class Pt extends at{constructor(t,e){super(function(e,n){G.debug("No callbacks on "+t+" for "+e)}),this.name=t,this.pusher=e,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(t,e){return e(null,{auth:""})}trigger(t,e){if(0!==t.indexOf("client-"))throw new d("Event '"+t+"' does not start with 'client-'");if(!this.subscribed){var n=l("triggeringClientEvents");G.warn(`Client event triggered before channel 'subscription_succeeded' event . ${n}`)}return this.pusher.send_event(t,e,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(t){var e=t.event,n=t.data;"pusher_internal:subscription_succeeded"===e?this.handleSubscriptionSucceededEvent(t):"pusher_internal:subscription_count"===e?this.handleSubscriptionCountEvent(t):0!==e.indexOf("pusher_internal:")&&this.emit(e,n,{})}handleSubscriptionSucceededEvent(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",t.data)}handleSubscriptionCountEvent(t){t.data.subscription_count&&(this.subscriptionCount=t.data.subscription_count),this.emit("pusher:subscription_count",t.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(t,e)=>{t?(this.subscriptionPending=!1,G.error(t.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:t.message},t instanceof y?{status:t.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:e.auth,channel_data:e.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class Ot extends Pt{authorize(t,e){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:t},e)}}class Lt{constructor(){this.reset()}get(t){return Object.prototype.hasOwnProperty.call(this.members,t)?{id:t,info:this.members[t]}:null}each(t){N(this.members,(e,n)=>{t(this.get(n))})}setMyID(t){this.myID=t}onSubscription(t){this.members=t.presence.hash,this.count=t.presence.count,this.me=this.get(this.myID)}addMember(t){return null===this.get(t.user_id)&&this.count++,this.members[t.user_id]=t.user_info,this.get(t.user_id)}removeMember(t){var e=this.get(t.user_id);return e&&(delete this.members[t.user_id],this.count--),e}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}
2var It=function(t,e,n,i){return new(n||(n=Promise))(function(s,o){function r(t){try{c(i.next(t))}catch(t){o(t)}}function a(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}c((i=i.apply(t,e||[])).next())})};class At extends Ot{constructor(t,e){super(t,e),this.members=new Lt}authorize(t,e){super.authorize(t,(t,n)=>It(this,void 0,void 0,function*(){if(!t)if(null!=n.channel_data){var i=JSON.parse(n.channel_data);this.members.setMyID(i.user_id)}else{if(yield this.pusher.user.signinDonePromise,null==this.pusher.user.user_data){let t=l("authorizationEndpoint");return G.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${t}, or the user should be signed in.`),void e("Invalid auth response")}this.members.setMyID(this.pusher.user.user_data.id)}e(t,n)}))}handleEvent(t){var e=t.event;if(0===e.indexOf("pusher_internal:"))this.handleInternalEvent(t);else{var n=t.data,i={};t.user_id&&(i.user_id=t.user_id),this.emit(e,n,i)}}handleInternalEvent(t){var e=t.event,n=t.data;switch(e){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(t);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(t);break;case"pusher_internal:member_added":var i=this.members.addMember(n);this.emit("pusher:member_added",i);break;case"pusher_internal:member_removed":var s=this.members.removeMember(n);s&&this.emit("pusher:member_removed",s)}}handleSubscriptionSucceededEvent(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(t.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Rt=n(1),Mt=n(0);class jt extends Ot{constructor(t,e,n){super(t,e),this.key=null,this.nacl=n}authorize(t,e){super.authorize(t,(t,n)=>{if(t)return void e(t,n);let i=n.shared_secret;i?(this.key=Object(Mt.decode)(i),delete n.shared_secret,e(null,n)):e(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null)})}trigger(t,e){throw new g("Client events are not currently supported for encrypted channels")}handleEvent(t){var e=t.event,n=t.data;0!==e.indexOf("pusher_internal:")&&0!==e.indexOf("pusher:")?this.handleEncryptedEvent(e,n):super.handleEvent(t)}handleEncryptedEvent(t,e){if(!this.key)return void G.debug("Received encrypted event before key has been retrieved from the authEndpoint");if(!e.ciphertext||!e.nonce)return void G.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+e);let n=Object(Mt.decode)(e.ciphertext);if(n.length<this.nacl.secretbox.overheadLength)return void G.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${n.length}`);let i=Object(Mt.decode)(e.nonce);if(i.length<this.nacl.secretbox.nonceLength)return void G.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${i.length}`);let s=this.nacl.secretbox.open(n,i,this.key);if(null===s)return G.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),void this.authorize(this.pusher.connection.socket_id,(e,o)=>{e?G.error(`Failed to make a request to the authEndpoint: ${o}. Unable to fetch new key, so dropping encrypted event`):(s=this.nacl.secretbox.open(n,i,this.key),null!==s?this.emit(t,this.getDataToEmit(s)):G.error("Failed to decrypt event with new key. Dropping encrypted event"))});this.emit(t,this.getDataToEmit(s))}getDataToEmit(t){let e=Object(Rt.decode)(t);try{return JSON.parse(e)}catch(t){return e}}}class Dt extends at{constructor(t,e){super(),this.state="initialized",this.connection=null,this.key=t,this.options=e,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var n=le.getNetwork();n.bind("online",()=>{this.timeline.info({netinfo:"online"}),"connecting"!==this.state&&"unavailable"!==this.state||this.retryIn(0)}),n.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){this.connection||this.runner||(this.strategy.isSupported()?(this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()):this.updateState("failed"))}send(t){return!!this.connection&&this.connection.send(t)}send_event(t,e,n){return!!this.connection&&this.connection.send_event(t,e,n)}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var t=(e,n)=>{e?this.runner=this.strategy.connect(0,t):"error"===n.action?(this.emit
vendor: 7,981 bytes, line 2
2("error",{type:"HandshakeError",error:n.error}),this.timeline.error({handshakeError:n.error})):(this.abortConnecting(),this.handshakeCallbacks[n.action](n))};this.runner=this.strategy.connect(0,t)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection&&this.abandonConnection().close()}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(t){this.timeline.info({action:"retry",delay:t}),t>0&&this.emit("connecting_in",Math.round(t/1e3)),this.retryTimer=new A(t||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new A(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new A(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new A(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(t){return D({},t,{message:t=>{this.resetActivityCheck(),this.emit("message",t)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:t=>{this.emit("error",t)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(t){return D({},t,{connected:t=>{this.activityTimeout=Math.min(this.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(t.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let t=t=>e=>{e.error&&this.emit("error",{type:"WebSocketError",error:e.error}),t(e)};return{tls_only:t(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:t(()=>{this.disconnect()}),backoff:t(()=>{this.retryIn(1e3)}),retry:t(()=>{this.retryIn(0)})}}setConnection(t){for(var e in this.connection=t,this.connectionCallbacks)this.connection.bind(e,this.connectionCallbacks[e]);this.resetActivityCheck()}abandonConnection(){if(this.connection){for(var t in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(t,this.connectionCallbacks[t]);var e=this.connection;return this.connection=null,e}}updateState(t,e){var n=this.state;if(this.state=t,n!==t){var i=t;"connected"===i&&(i+=" with new socket ID "+e.socket_id),G.debug("State changed",n+" -> "+i),this.timeline.info({state:t,params:e}),this.emit("state_change",{previous:n,current:t}),this.emit(t,e)}}shouldRetry(){return"connecting"===this.state||"connected"===this.state}}class Bt{constructor(){this.channels={}}add(t,e){return this.channels[t]||(this.channels[t]=function(t,e){if(0===t.indexOf("private-encrypted-")){if(e.config.nacl)return qt.createEncryptedChannel(t,e,e.config.nacl);let n="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",i=l("encryptedChannelSupport");throw new g(`${n}. ${i}`)}if(0===t.indexOf("private-"))return qt.createPrivateChannel(t,e);if(0===t.indexOf("presence-"))return qt.createPresenceChannel(t,e);if(0===t.indexOf("#"))throw new u('Cannot create a channel with name "'+t+'".');return qt.createChannel(t,e)}(t,e)),this.channels[t]}all(){return function(t){var e=[];return N(t,function(t){e.push(t)}),e}(this.channels)}find(t){return this.channels[t]}remove(t){var e=this.channels[t];return delete this.channels[t],e}disconnect(){N(this.channels,function(t){t.disconnect()})}}var qt={createChannels:()=>new Bt,createConnectionManager:(t,e)=>new Dt(t,e),createChannel:(t,e)=>new Pt(t,e),createPrivateChannel:(t,e)=>new Ot(t,e),createPresenceChannel:(t,e)=>new At(t,e),createEncryptedChannel:(t,e,n)=>new jt(t,e,n),createTimelineSender:(t,e)=>new Et(t,e),createHandshake:(t,e)=>new Tt(t,e),createAssistantToTheTransportManager:(t,e,n)=>new xt(t,e,n)};class Nt{constructor(t){this.options=t||{},this.livesLeft=this.options.lives||1/0}getAssistant(t){return qt.createAssistantToTheTransportManager(this,t,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class zt{constructor(t,e){this.strategies=t,this.loop=Boolean(e.loop),this.failFast=Boolean(e.failFast),this.timeout=e.timeout,this.timeoutLimit=e.timeoutLimit}isSupported(){return X(this.strategies,j.method("isSupported"))}connect(t,e){var n=this.strategies,i=0,s=this.timeout,o=null,r=(a,c)=>{c?e(null,c):(i+=1,this.loop&&(i%=n.length),i<n.length?(s&&(s*=2,this.timeoutLimit&&(s=Math.min(s,this.timeoutLimit))),o=this.tryStrategy(n[i],t,{timeout:s,failFast:this.failFast},r)):e(!0))};return o=this.tryStrategy(n[i],t,{timeout:s,failFast:this.failFast},r),{abort:function(){o.abort()},forceMinPriority:function(e){t=e,o&&o.forceMinPriority(e)}}}tryStrategy(t,e,n,i){var s=null,o=null;return n.timeout>0&&(s=new A(n.timeout,function(){o.abort(),i(!0)})),o=t.connect(e,function(t,e){t&&s&&s.isRunning()&&!n.failFast||(s&&s.ensureAborted(),i(t,e))}),{abort:function(){s&&s.ensureAborted(),o.abort()},forceMinPriority:function(t){o.forceMinPriority(t)}}}}class Ht{constructor(t){this.strategies=t}isSupported(){return X(this.strategies,j.method("isSupported"))}connect(t,e){return function(t,e,n){var i=W(t,function(t,i,s,o){return t.connect(e,n(i,o))});return{abort:function(){H(i,Wt)},forceMinPriority:function(t){H(i,function(e){e.forceMinPriority(t)})}}}(this.strategies,t,function(t,n){return function(i,s){n[t].error=i,i?function(t){return function(t,e){for(var n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0}(t,function(t){return Boolean(t.error)})}(n)&&e(!0):(H(n,function(t){t.forceMinPriority(s.transport.priority)}),e(null,s))}})}}function Wt(t){t.error||t.aborted||(t.abort(),t.aborted=!0)}class Ut{constructor(t,e,n){this.strategy=t,this.transports=e,this.ttl=n.ttl||18e5,this.usingTLS=n.useTLS,this.timeline=n.timeline}isSupported(){return this.strategy.isSupported()}connect(t,e){var n=this.usingTLS,i=function(t){var e=le.getLocalStorage();if(e)try{var n=e[Ft(t)];if(n)return JSON.parse(n)}catch(e){Xt(t)}return null}(n),s=i&&i.cacheSkipCount?i.cacheSkipCount:0,o=[this.strategy];if(i&&i.timestamp+this.ttl>=j.now()){var r=this.transports[i.transport];r&&(["ws","wss"].includes(i.transport)||s>3?(this.timeline.info({cached:!0,transport:i.transport,latency:i.latency}),o.push(new zt([r],{timeout:2*i.latency+1e3,failFast:!0}))):s++)}var a=j.now(),c=o.pop().connect(t,function i(r,h){r?(Xt(n),o.length>0?(a=j.now(),c=o.pop().connect(t,i)):e(r)):(function(t,e,n,i){var s=le.getLocalStorage();if(s)try{s[Ft(t)]=Y({timestamp:j.now(),transport:e,latency:n,cacheSkipCount:i})}catch(t){}}(n,h.transport.name,j.now()-a,s),e(null,h))});return{abort:function(){c.abort()},forceMinPriority:function(e){t=e,c&&c.forceMinPriority(e)}}}}function Ft(t){return"pusherTransport"+(t?"TLS":"NonTLS")}function Xt(t){var e=le.getLocalStorage();if(e)try{delete e[Ft(t)]}catch(t){}}class $t{constructor(t,{delay:e}){this.strategy=t,this.options={delay:e}}isSupported(){return this.strategy.isSupported()}connect(t,e){var n,i=this.strategy,s=new A(this.options.delay,function(){n=i.connect(t,e)});return{abort:function(){s.ensureAborted(),n&&n.abort()},forceMinPriority:function(e){t=e,n&&n.forceMinPriority(e)}}}}class Jt{constructor(t,e,n){this.test=t,this.trueBranch=e,this.falseBranch=n}isSupported(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()}connect(t,e){return(this.test()?this.trueBranch:this.falseBranch).connect(t,e)}}
vendor: 10,356 bytes, line 2
2class Yt{constructor(t){this.strategy=t}isSupported(){return this.strategy.isSupported()}connect(t,e){var n=this.strategy.connect(t,function(t,i){i&&n.abort(),e(t,i)});return n}}function Gt(t){return function(){return t.isSupported()}}var Vt,Kt=function(t,e,n){var i={};function s(e,s,o,r,a){var c=n(t,e,s,o,r,a);return i[e]=c,c}var o,r=Object.assign({},e,{hostNonTLS:t.wsHost+":"+t.wsPort,hostTLS:t.wsHost+":"+t.wssPort,httpPath:t.wsPath}),a=Object.assign({},r,{useTLS:!0}),c=Object.assign({},e,{hostNonTLS:t.httpHost+":"+t.httpPort,hostTLS:t.httpHost+":"+t.httpsPort,httpPath:t.httpPath}),h={loop:!0,timeout:15e3,timeoutLimit:6e4},l=new Nt({minPingDelay:1e4,maxPingDelay:t.activityTimeout}),d=new Nt({lives:2,minPingDelay:1e4,maxPingDelay:t.activityTimeout}),u=s("ws","ws",3,r,l),p=s("wss","ws",3,a,l),b=s("sockjs","sockjs",1,c),m=s("xhr_streaming","xhr_streaming",1,c,d),g=s("xdr_streaming","xdr_streaming",1,c,d),f=s("xhr_polling","xhr_polling",1,c),v=s("xdr_polling","xdr_polling",1,c),y=new zt([u],h),w=new zt([p],h),k=new zt([b],h),x=new zt([new Jt(Gt(m),m,g)],h),_=new zt([new Jt(Gt(f),f,v)],h),S=new zt([new Jt(Gt(x),new Ht([x,new $t(_,{delay:4e3})]),_)],h),C=new Jt(Gt(S),S,k);return o=e.useTLS?new Ht([y,new $t(C,{delay:2e3})]):new Ht([y,new $t(w,{delay:2e3}),new $t(C,{delay:5e3})]),new Ut(new Yt(new Jt(Gt(u),o,C)),i,{ttl:18e5,timeline:e.timeline,useTLS:e.useTLS})},Qt={getRequest:function(t){var e=new window.XDomainRequest;return e.ontimeout=function(){t.emit("error",new p),t.close()},e.onerror=function(e){t.emit("error",e),t.close()},e.onprogress=function(){e.responseText&&e.responseText.length>0&&t.onChunk(200,e.responseText)},e.onload=function(){e.responseText&&e.responseText.length>0&&t.onChunk(200,e.responseText),t.emit("finished",200),t.close()},e},abortRequest:function(t){t.ontimeout=t.onerror=t.onprogress=t.onload=null,t.abort()}};class Zt extends at{constructor(t,e,n){super(),this.hooks=t,this.method=e,this.url=n}start(t){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},le.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(t)}close(){this.unloader&&(le.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(t,e){for(;;){var n=this.advanceBuffer(e);if(!n)break;this.emit("chunk",{status:t,data:n})}this.isBufferTooLong(e)&&this.emit("buffer_too_long")}advanceBuffer(t){var e=t.slice(this.position),n=e.indexOf("\n");return-1!==n?(this.position+=n+1,e.slice(0,n)):null}isBufferTooLong(t){return this.position===t.length&&t.length>262144}}!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED"}(Vt||(Vt={}));var te=Vt,ee=1;function ne(t){var e=-1===t.indexOf("?")?"?":"&";return t+e+"t="+ +new Date+"&n="+ee++}function ie(t){return le.randomInt(t)}var se,oe=class{constructor(t,e){this.hooks=t,this.session=ie(1e3)+"/"+function(t){for(var e=[],n=0;n<t;n++)e.push(ie(32).toString(32));return e.join("")}(8),this.location=function(t){var e=/([^\?]*)\/*(\??.*)/.exec(t);return{base:e[1],queryString:e[2]}}(e),this.readyState=te.CONNECTING,this.openStream()}send(t){return this.sendRaw(JSON.stringify([t]))}ping(){this.hooks.sendHeartbeat(this)}close(t,e){this.onClose(t,e,!0)}sendRaw(t){if(this.readyState!==te.OPEN)return!1;try{return le.createSocketRequest("POST",ne((e=this.location,n=this.session,e.base+"/"+n+"/xhr_send"))).start(t),!0}catch(t){return!1}var e,n}reconnect(){this.closeStream(),this.openStream()}onClose(t,e,n){this.closeStream(),this.readyState=te.CLOSED,this.onclose&&this.onclose({code:t,reason:e,wasClean:n})}onChunk(t){var e;if(200===t.status)switch(this.readyState===te.OPEN&&this.onActivity(),t.data.slice(0,1)){case"o":e=JSON.parse(t.data.slice(1)||"{}"),this.onOpen(e);break;case"a":e=JSON.parse(t.data.slice(1)||"[]");for(var n=0;n<e.length;n++)this.onEvent(e[n]);break;case"m":e=JSON.parse(t.data.slice(1)||"null"),this.onEvent(e);break;case"h":this.hooks.onHeartbeat(this);break;case"c":e=JSON.parse(t.data.slice(1)||"[]"),this.onClose(e[0],e[1],!0)}}onOpen(t){var e,n,i;this.readyState===te.CONNECTING?(t&&t.hostname&&(this.location.base=(e=this.location.base,n=t.hostname,(i=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(e))[1]+n+i[3])),this.readyState=te.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(t){this.readyState===te.OPEN&&this.onmessage&&this.onmessage({data:t})}onActivity(){this.onactivity&&this.onactivity()}onError(t){this.onerror&&this.onerror(t)}openStream(){this.stream=le.createSocketRequest("POST",ne(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",t=>{this.onChunk(t)}),this.stream.bind("finished",t=>{this.hooks.onFinished(this,t)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(t){j.defer(()=>{this.onError(t),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}},re={getReceiveURL:function(t,e){return t.base+"/"+e+"/xhr_streaming"+t.queryString},onHeartbeat:function(t){t.sendRaw("[]")},sendHeartbeat:function(t){t.sendRaw("[]")},onFinished:function(t,e){t.onClose(1006,"Connection interrupted ("+e+")",!1)}},ae={getReceiveURL:function(t,e){return t.base+"/"+e+"/xhr"+t.queryString},onHeartbeat:function(){},sendHeartbeat:function(t){t.sendRaw("[]")},onFinished:function(t,e){200===e?t.reconnect():t.onClose(1006,"Connection interrupted ("+e+")",!1)}},ce={getRequest:function(t){var e=new(le.getXHRAPI());return e.onreadystatechange=e.onprogress=function(){switch(e.readyState){case 3:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText);break;case 4:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText),t.emit("finished",e.status),t.close()}},e},abortRequest:function(t){t.onreadystatechange=null,t.abort()}},he={createStreamingSocket(t){return this.createSocket(re,t)},createPollingSocket(t){return this.createSocket(ae,t)},createSocket:(t,e)=>new oe(t,e),createXHR(t,e){return this.createRequest(ce,t,e)},createRequest:(t,e,n)=>new Zt(t,e,n),createXDR:function(t,e){return this.createRequest(Qt,t,e)}},le={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:s,DependenciesReceivers:r,getDefaultStrategy:Kt,Transports:wt,transportConnectionInitializer:function(){var t=this;t.timeline.info(t.buildTimelineMessage({transport:t.name+(t.options.useTLS?"s":"")})),t.hooks.isInitialized()?t.changeState("initialized"):t.hooks.file?(t.changeState("initializing"),a.load(t.hooks.file,{useTLS:t.options.useTLS},function(e,n){t.hooks.isInitialized()?(t.changeState("initialized"),n(!0)):(e&&t.onError(e),t.onClose(),n(!1))})):t.onClose()},HTTPFactory:he,TimelineTransport:Z,getXHRAPI:()=>window.XMLHttpRequest,getWebSocketAPI:()=>window.WebSocket||window.MozWebSocket,setup(t){window.Pusher=t;var e=()=>{this.onDocumentBody(t.ready)};window.JSON?e():a.load("json2",{},e)},getDocument:()=>document,getProtocol(){return this.getDocument().location.protocol},getAuthorizers:()=>({ajax:w,jsonp:V}),onDocumentBody(t){document.body?t():setTimeout(()=>{this.onDocumentBody(t)},0)},createJSONPRequest:(t,e)=>new Q(t,e),createScriptRequest:t=>new K(t),getLocalStorage(){try{return window.localStorage}catch(t){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){return new(this.getXHRAPI())},createMicrosoftXHR:()=>new ActiveXObject("Microsoft.XMLHTTP"),getNetwork:()=>kt,createWebSocket(t){return new(this.getWebSocketAPI())(t)},createSocketRequest(t,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(t,e);if(this.isXDRSupported(0===e.indexOf("https:")))return this.HTTPFactory.createXDR(t,e);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var t=this.getXHRAPI();return Boolean(t)&&void 0!==(new t).withCredentials},isXDRSupported(t){var e=t?"https:":"http:",n=this.getProtocol();return Boolean(window.XDomainRequest)&&n===e},addUnloadListener(t){void 0!==window.addEventListener?window.addEventListener("unload",t,!1):void 0!==window.attachEvent&&window.attachEvent("onunload",t)},removeUnloadListener(t){void 0!==window.addEventListener?window.removeEventListener("unload",t,!1):void 0!==window.detachEvent&&window.detachEvent("onunload",t)},randomInt:t=>Math.floor((window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)*t)};!function(t){t[t.ERROR=3]="ERROR",t[t.INFO=6]="INFO",t[t.DEBUG=7]="DEBUG"}(se||(se={}));var de=se;class ue{constructor(t,e,n){this.key=t,this.session=e,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}log(t,e){t<=this.options.level&&(this.events.push(D({},e,{timestamp:j.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(t){this.log(de.ERROR,t)}info(t){this.log(de.INFO,t)}debug(t){this.log(de.DEBUG,t)}isEmpty(){return 0===this.events.length}send(t,e){var n=D({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],t(n,(t,n)=>{t||this.sent++,e&&e(t,n)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class pe{constructor(t,e,n,i){this.name=t,this.priority=e,this.transport=n,this.options=i||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(t,e){if(!this.isSupported())return be(new v,e);if(this.priority<t)return be(new b,e);var n=!1,i=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),s=null,o=function(){i.unbind("initialized",o),i.connect()},r=function(){s=qt.createHandshake(i,function(t){n=!0,h(),e(null,t)})},a=function(t){h(),e(t)},c=function(){var t;h(),t=Y(i),e(new m(t))},h=function(){i.unbind("initialized",o),i.unbind("open",r),i.unbind("error",a),i.unbind("closed",c)};return i.bind("initialized",o),i.bind("open",r),i.bind("error",a),i.bind("closed",c),i.initialize(),{abort:()=>{n||(h(),s?s.close():i.close())},forceMinPriority:t=>{n||this.priority<t&&(s?s.close():i.close())}}}}function be(t,e){return j.defer(function(){e(t)}),{abort:function(){},forceMinPriority:function(){}}}
2const{Transports:me}=le;var ge=function(t,e,n,i,s,o){var r,a=me[n];if(!a)throw new f(n);return t.enabledTransports&&-1===q(t.enabledTransports,e)||t.disabledTransports&&-1!==q(t.disabledTransports,e)?r=fe:(s=Object.assign({ignoreNullOrigin:t.ignoreNullOrigin},s),r=new pe(e,i,o?o.getAssistant(a):a,s)),r},fe={isSupported:function(){return!1},connect:function(t,e){var n=j.defer(function(){e(new v)});return{abort:function(){n.ensureAborted()},forceMinPriority:function(){}}}},ve=t=>{if(void 0===le.getAuthorizers()[t.transport])throw`'${t.transport}' is not a recognized auth transport`;return(e,n)=>{const i=((t,e)=>{var n="socket_id="+encodeURIComponent(t.socketId);for(var i in e.params)n+="&"+encodeURIComponent(i)+"="+encodeURIComponent(e.params[i]);if(null!=e.paramsProvider){let t=e.paramsProvider();for(var i in t)n+="&"+encodeURIComponent(i)+"="+encodeURIComponent(t[i])}return n})(e,t);le.getAuthorizers()[t.transport](le,i,t,h.UserAuthentication,n)}},ye=t=>{if(void 0===le.getAuthorizers()[t.transport])throw`'${t.transport}' is not a recognized auth transport`;return(e,n)=>{const i=((t,e)=>{var n="socket_id="+encodeURIComponent(t.socketId);for(var i in n+="&channel_name="+encodeURIComponent(t.channelName),e.params)n+="&"+encodeURIComponent(i)+"="+encodeURIComponent(e.params[i]);if(null!=e.paramsProvider){let t=e.paramsProvider();for(var i in t)n+="&"+encodeURIComponent(i)+"="+encodeURIComponent(t[i])}return n})(e,t);le.getAuthorizers()[t.transport](le,i,t,h.ChannelAuthorization,n)}};function we(t){return t.httpHost?t.httpHost:t.cluster?`sockjs-${t.cluster}.pusher.com`:o.httpHost}function ke(t){return t.wsHost?t.wsHost:`ws-${t.cluster}.pusher.com`}function xe(t){return"https:"===le.getProtocol()||!1!==t.forceTLS}function _e(t){return"enableStats"in t?t.enableStats:"disableStats"in t&&!t.disableStats}function Se(t){const e=Object.assign(Object.assign({},o.userAuthentication),t.userAuthentication);return"customHandler"in e&&null!=e.customHandler?e.customHandler:ve(e)}function Ce(t,e){const n=function(t,e){let n;return"channelAuthorization"in t?n=Object.assign(Object.assign({},o.channelAuthorization),t.channelAuthorization):(n={transport:t.authTransport||o.authTransport,endpoint:t.authEndpoint||o.authEndpoint},"auth"in t&&("params"in t.auth&&(n.params=t.auth.params),"headers"in t.auth&&(n.headers=t.auth.headers)),"authorizer"in t&&(n.customHandler=((t,e,n)=>{const i={authTransport:e.transport,authEndpoint:e.endpoint,auth:{params:e.params,headers:e.headers}};return(e,s)=>{const o=t.channel(e.channelName);n(o,i).authorize(e.socketId,s)}})(e,n,t.authorizer))),n}(t,e);return"customHandler"in n&&null!=n.customHandler?n.customHandler:ye(n)}class Te extends at{constructor(t){super(function(t,e){G.debug(`No callbacks on watchlist events for ${t}`)}),this.pusher=t,this.bindWatchlistInternalEvent()}handleEvent(t){t.data.events.forEach(t=>{this.emit(t.name,t)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",t=>{"pusher_internal:watchlist_events"===t.event&&this.handleEvent(t)})}}var Ee=function(){let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}};class Pe extends at{constructor(t){super(function(t,e){G.debug("No callbacks on user for "+t)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(t,e)=>{if(t)return G.warn(`Error during signin: ${t}`),void this._cleanup();this.pusher.send_event("pusher:signin",{auth:e.auth,user_data:e.user_data})},this.pusher=t,this.pusher.connection.bind("state_change",({previous:t,current:e})=>{"connected"!==t&&"connected"===e&&this._signin(),"connected"===t&&"connected"!==e&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Te(t),this.pusher.connection.bind("message",t=>{"pusher:signin_success"===t.event&&this._onSigninSuccess(t.data),this.serverToUserChannel&&this.serverToUserChannel.name===t.channel&&this.serverToUserChannel.handleEvent(t)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),"connected"===this.pusher.connection.state&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(t){try{this.user_data=JSON.parse(t.user_data)}catch(e){return G.error(`Failed parsing user data after signin: ${t.user_data}`),void this._cleanup()}if("string"!=typeof this.user_data.id||""===this.user_data.id)return G.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),void this._cleanup();this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){this.serverToUserChannel=new Pt(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((t,e)=>{0!==t.indexOf("pusher_internal:")&&0!==t.indexOf("pusher:")&&this.emit
vendor: 4,482 bytes, line 2
2(t,e)}),(t=>{t.subscriptionPending&&t.subscriptionCancelled?t.reinstateSubscription():t.subscriptionPending||"connected"!==this.pusher.connection.state||t.subscribe()})(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested)return;if(this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:t,resolve:e,reject:n}=Ee();t.done=!1;const i=()=>{t.done=!0};t.then(i).catch(i),this.signinDonePromise=t,this._signinDoneResolve=e}}class Oe{static ready(){Oe.isReady=!0;for(var t=0,e=Oe.instances.length;t<e;t++)Oe.instances[t].connect()}static getClientFeatures(){return z(F({ws:le.Transports.ws},function(t){return t.isSupported({})}))}constructor(t,e){!function(t){if(null==t)throw"You must pass your app key when you instantiate Pusher."}(t),function(t){if(null==t)throw"You must pass an options object";if(null==t.cluster)throw"Options object must provide a cluster";"disableStats"in t&&G.warn("The disableStats option is deprecated in favor of enableStats")}(e),this.key=t,this.config=function(t,e){let n={activityTimeout:t.activityTimeout||o.activityTimeout,cluster:t.cluster,httpPath:t.httpPath||o.httpPath,httpPort:t.httpPort||o.httpPort,httpsPort:t.httpsPort||o.httpsPort,pongTimeout:t.pongTimeout||o.pongTimeout,statsHost:t.statsHost||o.stats_host,unavailableTimeout:t.unavailableTimeout||o.unavailableTimeout,wsPath:t.wsPath||o.wsPath,wsPort:t.wsPort||o.wsPort,wssPort:t.wssPort||o.wssPort,enableStats:_e(t),httpHost:we(t),useTLS:xe(t),wsHost:ke(t),userAuthenticator:Se(t),channelAuthorizer:Ce(t,e)};return"disabledTransports"in t&&(n.disabledTransports=t.disabledTransports),"enabledTransports"in t&&(n.enabledTransports=t.enabledTransports),"ignoreNullOrigin"in t&&(n.ignoreNullOrigin=t.ignoreNullOrigin),"timelineParams"in t&&(n.timelineParams=t.timelineParams),"nacl"in t&&(n.nacl=t.nacl),n}(e,this),this.channels=qt.createChannels(),this.global_emitter=new at,this.sessionID=le.randomInt(1e9),this.timeline=new ue(this.key,this.sessionID,{cluster:this.config.cluster,features:Oe.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:de.INFO,version:o.VERSION}),this.config.enableStats&&(this.timelineSender=qt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+le.TimelineTransport.name})),this.connection=qt.createConnectionManager(this.key,{getStrategy:t=>le.getDefaultStrategy(this.config,t,ge),timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:Boolean(this.config.useTLS)}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",t=>{var e=0===t.event.indexOf("pusher_internal:");if(t.channel){var n=this.channel(t.channel);n&&n.handleEvent(t)}e||this.global_emitter.emit(t.event,t.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",t=>{G.warn(t)}),Oe.instances.push(this),this.timeline.info({instances:Oe.instances.length}),this.user=new Pe(this),Oe.isReady&&this.connect()}channel(t){return this.channels.find(t)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var t=this.connection.isUsingTLS(),e=this.timelineSender;this.timelineSenderTimer=new R(6e4,function(){e.send(t)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(t,e,n){return this.global_emitter.bind(t,e,n),this}unbind(t,e,n){return this.global_emitter.unbind(t,e,n),this}bind_global(t){return this.global_emitter.bind_global(t),this}unbind_global(t){return this.global_emitter.unbind_global(t),this}unbind_all(t){return this.global_emitter.unbind_all(),this}subscribeAll(){var t;for(t in this.channels.channels)this.channels.channels.hasOwnProperty(t)&&this.subscribe(t)}subscribe(t){var e=this.channels.add(t,this);return e.subscriptionPending&&e.subscriptionCancelled?e.reinstateSubscription():e.subscriptionPending||"connected"!==this.connection.state||e.subscribe(),e}
2unsubscribe(t){var e=this.channels.find(t);e&&e.subscriptionPending?e.cancelSubscription():(e=this.channels.remove(t))&&e.subscribed&&e.unsubscribe()}send_event(t,e,n){return this.connection.send_event(t,e,n)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Oe.instances=[],Oe.isReady=!1,Oe.logToConsole=!1,Oe.Runtime=le,Oe.ScriptReceivers=le.ScriptReceivers,Oe.DependenciesReceivers=le.DependenciesReceivers,Oe.auth_callbacks=le.auth_callbacks;var Le=e.default=Oe;le.setup(Oe)}])},t.exports=e()}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";class t{listenForWhisper(t,e){return this.listen(".client-"+t,e)}notification(t){return this.listen(".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated",t)}stopListeningForWhisper(t,e){return this.stopListening(".client-"+t,e)}}class e{constructor(t){this.namespace=t}format(t){return[".","\\"].includes(t.charAt(0))?t.substring(1):(this.namespace&&(t=this.namespace+"."+t),t.replace(/\./g,"\\"))}setNamespace(t){this.namespace=t}}class i extends t{constructor(t,n,i){super(),this.name=n,this.pusher=t,this.options=i,this.eventFormatter=new e(this.options.namespace),this.subscribe()}subscribe(){this.subscription=this.pusher.subscribe(this.name)}unsubscribe(){this.pusher.unsubscribe(this.name)}listen(t,e){return this.on(this.eventFormatter.format(t),e),this}listenToAll(t){return this.subscription.bind_global((e,n)=>{if(e.startsWith("pusher:"))return;let i=String(this.options.namespace??"").replace(/\./g,"\\"),s=e.startsWith(i)?e.substring(i.length+1):"."+e;t(s,n)}),this}stopListening(t,e){return e?this.subscription.unbind(this.eventFormatter.format(t),e):this.subscription.unbind(this.eventFormatter.format(t)),this}stopListeningToAll(t){return t?this.subscription.unbind_global(t):this.subscription.unbind_global(),this}subscribed(t){return this.on("pusher:subscription_succeeded",()=>{t()}),this}error(t){return this.on("pusher:subscription_error",e=>{t(e)}),this}on(t,e){return this.subscription.bind(t,e),this}}class s extends i{whisper(t,e){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,e),this}}class o extends i{whisper(t,e){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,e),this}}class r extends s{here(t){return this.on("pusher:subscription_succeeded",e=>{t(Object.keys(e.members).map(t=>e.members[t]))}),this}joining(t){return this.on("pusher:member_added",e=>{t(e.info)}),this}whisper(t,e){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,e),this}leaving(t){return this.on("pusher:member_removed",e=>{t(e.info)}),this}}class a extends t{constructor(t,n,i){super(),this.events={},this.listeners={},this.name=n,this.socket=t,this.options=i,this.eventFormatter=new e(this.options.namespace),this.subscribe()}subscribe(){this.socket.emit("subscribe",{channel:this.name,auth:this.options.auth||{}})}unsubscribe(){this.unbind(),this.socket.emit("unsubscribe",{channel:this.name,auth:this.options.auth||{}})}listen(t,e){return this.on(this.eventFormatter.format(t),e),this}stopListening(t,e){return this.unbindEvent(this.eventFormatter.format(t),e),this}subscribed(t){return this.on("connect",e=>{t(e)}),this}error(t){return this}on(t,e){return this.listeners[t]=this.listeners[t]||[],this.events[t]||(this.events[t]=(e,n)=>{this.name===e&&this.listeners[t]&&this.listeners[t].forEach(t=>t(n))},this.socket.on(t,this.events[t])),this.listeners[t].push(e),this}unbind(){Object.keys(this.events).forEach(t=>{this.unbindEvent(t)})}unbindEvent(t,e){this.listeners[t]=this.listeners[t]||[],e&&(this.listeners[t]=this.listeners[t].filter(t=>t!==e)),(!e||0===this.listeners[t].length)&&(this.events[t]&&(this.socket.removeListener(t,this.events[t]),delete this.events[t]),delete this.listeners[t])}}class c extends a{whisper(t,e){return this.socket.emit("client event",{channel:this.name,event:`client-${t}`,data:e}),this}}class h extends c{here(t){return this.on("presence:subscribed",e=>{t(e.map(t=>t.user_info))}),this}joining(t){return this.on("presence:joining",e=>t(e.user_info)),this}whisper(t,e){return this.socket.emit("client event",{channel:this.name,event:`client-${t}`,data:e}),this}leaving(t){return this.on("presence:leaving",e=>t(e.user_info)),this}}class l extends t{subscribe(){}unsubscribe(){}listen(t,e){return this}listenToAll(t){return this}stopListening(t,e){return this}subscribed(t){return this}error(t){return this}on(t,e){return this}}class d extends l{whisper(t,e){return this}}class u extends l{whisper(t,e){return this}}class p extends d{here(t){return this}joining(t){return this}whisper(t,e){return this}leaving(t){return this}}const b=class t{constructor(t){this.setOptions(t),this.connect()}setOptions(e){this.options={...t._defaultOptions,...e,broadcaster:e.broadcaster};let n=this.csrfToken();n&&(this.options.auth.headers["X-CSRF-TOKEN"]=n,this.options.userAuthentication.headers["X-CSRF-TOKEN"]=n),n=this.options.bearerToken,n&&(this.options.auth.headers.Authorization="Bearer "+n,this.options.userAuthentication.headers.Authorization="Bearer "+n)}csrfToken(){var t,e;return typeof window<"u"&&null!=(t=window.Laravel)&&t.csrfToken?window.Laravel.csrfToken:this.options.csrfToken?this.options.csrfToken:typeof document<"u"&&"function"==typeof document.querySelector?(null==(e=
2document.querySelector('meta[name="csrf-token"]'))?void 0:e.getAttribute("content"))??null:null}};b._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"};let m=b;class g extends m{constructor(){super(...arguments),this.channels={}}connect(){if(typeof this.options.client<"u")this.pusher=this.options.client;else if(this.options.Pusher)this.pusher=new this.options.Pusher(this.options.key,this.options);else{if(!(typeof window<"u"&&typeof window.Pusher<"u"))throw new Error("Pusher client not found. Should be globally available or passed via options.client");this.pusher=new window.Pusher(this.options.key,this.options)}}signin(){this.pusher.signin()}listen(t,e,n){return this.channel(t).listen(e,n)}channel(t){return this.channels[t]||(this.channels[t]=new i(this.pusher,t,this.options)),this.channels[t]}privateChannel(t){return this.channels["private-"+t]||(this.channels["private-"+t]=new s(this.pusher,"private-"+t,this.options)),this.channels["private-"+t]}encryptedPrivateChannel(t){return this.channels["private-encrypted-"+t]||(this.channels["private-encrypted-"+t]=new o(this.pusher,"private-encrypted-"+t,this.options)),this.channels["private-encrypted-"+t]}presenceChannel(t){return this.channels["presence-"+t]||(this.channels["presence-"+t]=new r(this.pusher,"presence-"+t,this.options)),this.channels["presence-"+t]}leave(t){[t,"private-"+t,"private-encrypted-"+t,"presence-"+t].forEach(t=>{this.leaveChannel(t)})}leaveChannel(t){this.channels[t]&&(this.channels[t].unsubscribe(),delete this.channels[t])}socketId(){return this.pusher.connection.socket_id}disconnect(){this.pusher.disconnect()}}class f extends m{constructor(){super(...arguments),this.channels={}}connect(){let t=this.getSocketIO();this.socket=t(this.options.host??void 0,this.options),this.socket.io.on("reconnect",()=>{Object.values(this.channels).forEach(t=>{t.subscribe()})})}getSocketIO(){if(typeof this.options.client<"u")return this.options.client;if(typeof window<"u"&&typeof window.io<"u")return window.io;throw new Error("Socket.io client not found. Should be globally available or passed via options.client")}listen(t,e,n){return this.channel(t).listen(e,n)}channel(t){return this.channels[t]||(this.channels[t]=new a(this.socket,t,this.options)),this.channels[t]}privateChannel(t){return this.channels["private-"+t]||(this.channels["private-"+t]=new c(this.socket,"private-"+t,this.options)),this.channels["private-"+t]}presenceChannel(t){return this.channels["presence-"+t]||(this.channels["presence-"+t]=new h(this.socket,"presence-"+t,this.options)),this.channels["presence-"+t]}leave(t){[t,"private-"+t,"presence-"+t].forEach(t=>{this.leaveChannel(t)})}leaveChannel(t){this.channels[t]&&(this.channels[t].unsubscribe(),delete this.channels[t])}socketId(){return this.socket.id}disconnect(){this.socket.disconnect()}}class v extends m{constructor(){super(...arguments),this.channels={}}connect(){}listen(t,e,n){return new l}channel(t){return new l}privateChannel(t){return new d}encryptedPrivateChannel(t){return new u}presenceChannel(t){return new p}leave(t){}leaveChannel(t){}socketId(){return"fake-socket-id"}disconnect(){}}function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function w(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,k(i.key),i)}}function k(t){var e=function(t,e){if("object"!=y(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=y(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==y(e)?e:e+""}var x=function(){return t=function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.element=e.element,this.avoidSelectors=e.avoidSelectors,this.setPosition=e.setPosition,this.getRect=e.getRect||function(){return n.element.getBoundingClientRect()},this.isAvoidable=e.isAvoidable||function(){return!0},this.isPaused=e.isPaused||function(){return!1},this.isCancelled=e.isCancelled||function(){return!1},this.margin=void 0===e.margin?16:e.margin,this.maxAttempts=void 0===e.maxAttempts?8:e.maxAttempts,this.pushDuration=void 0===e.pushDuration?180:e.pushDuration,this.settleDelay=void 0===e.settleDelay?500:e.settleDelay,this.pendingCheck=null,this.pushTimer=null,this.pendingOverlap=null,this.settleTimer=null},e=[{key:"avoidSelector",get:function(){return this.avoidSelectors.join(",")}},{key:"pushTransition",get:function(){return"left ".concat(this.pushDuration,"ms ease-out, ")+"top ".concat(this.pushDuration,"ms ease-out, transform .2s ease")}},{key:"prefersReducedMotion",value:function(){return Boolean(window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}},{key:"isVisibleElement",value:function(t,e){var n=e||t.getBoundingClientRect();if(n.width<=0||n.height<=0)return!1;var i=window.getComputedStyle(t);
2return"none"!==i.display&&"hidden"!==i.visibility&&0!==Number(i.opacity)}},{key:"rectanglesOverlap",value:function(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}},{key:"shouldAvoid",value:function(t,e){return Boolean(t)&&t!==this.element&&!this.element.contains(t)&&t.matches(this.avoidSelector)&&this.isVisibleElement(t,e)&&this.isAvoidable(t)}},{key:"measureAvoidTargets",value:function(){var t=this;return Array.from(document.body.querySelectorAll(this.avoidSelector)).filter(function(e){return e!==t.element&&!t.element.contains(e)}).map(function(t){return{element:t,rect:t.getBoundingClientRect()}}).filter(function(e){return t.isOnScreen(e.rect)}).filter(function(e){return t.isVisibleElement(e.element,e.rect)}).filter(function(e){return t.isAvoidable(e.element)})}},{key:"isOnScreen",value:function(t){return t.right>0&&t.bottom>0&&t.left<window.innerWidth&&t.top<window.innerHeight}},{key:"samplePointsInside",value:function(t){return[[t.left+t.width/2,t.top+t.height/2],[t.left+8,t.top+8],[t.right-8,t.top+8],[t.left+8,t.bottom-8],[t.right-8,t.bottom-8]]}},{key:"hitTestOverlappingElement",value:function(t){var e=this,n=this.element.style.pointerEvents;this.element.style.pointerEvents="none";var i=this.samplePointsInside(t).map(function(t){return document.elementsFromPoint(t[0],t[1]).map(function(t){return t.closest(e.avoidSelector)}).find(function(t){return e.shouldAvoid(t)})}).find(function(t){return t});return this.element.style.pointerEvents=n,i||null}},{key:"overlappingTarget",value:function(t,e){var n=this,i=e.find(function(e){return n.rectanglesOverlap(t,e.rect)});if(i)return i;var s=this.hitTestOverlappingElement(t);return s?{element:s,rect:s.getBoundingClientRect()}:null}},{key:"positionKey",value:function(t){return Math.round(t.left)+","+Math.round(t.top)}},{key:"moveRectTo",value:function(t,e){var n=this.getRect(),i=this.element.getBoundingClientRect();this.setPosition(t+(i.left-n.left),e+(i.top-n.top))}},{key:"nearestEscapePosition",value:function(t,e,n){var i=this,s=this.margin,o=[{left:t.left,top:e.top-t.height-s},{left:t.left,top:e.bottom+s},{left:e.left-t.width-s,top:t.top},{left:e.right+s,top:t.top}].filter(function(t){return!n||!n.has(i.positionKey(t))});if(0===o.length)return null;var r=function(e,n){return Math.abs(e.left-t.left)+Math.abs(e.top-t.top)-(Math.abs(n.left-t.left)+Math.abs(n.top-t.top))},a=o.filter(function(e){return e.left>=s&&e.top>=s&&e.left+t.width<=window.innerWidth-s&&e.top+t.height<=window.innerHeight-s}).sort(r);if(a.length>0)return a[0];var c=o.sort(r)[0];return{left:Math.min(Math.max(c.left,s),Math.max(window.innerWidth-t.width-s,s)),top:Math.min(Math.max(c.top,s),Math.max(window.innerHeight-t.height-s,s))}}},{key:"animateFrom",value:function(t){var e=this,n=this.element.getBoundingClientRect(),i=n.left,s=n.top;this.endPush(),Math.round(i)===Math.round(t.left)&&Math.round(s)===Math.round(t.top)||this.prefersReducedMotion()||(this.setPosition(t.left,t.top),this.element.offsetWidth,this.element.style.transition=this.pushTransition,this.setPosition(i,s),this.pushTimer=window.setTimeout(function(){return e.endPush()},this.pushDuration+50))}},{key:"endPush",value:function(){null!==this.pushTimer&&(window.clearTimeout(this.pushTimer),this.pushTimer=null),this.element.style.transition=""}},{key:"settleSignature",value:function(t,e){return this.positionKey(t.rect)+"/"+Math.round(t.rect.width)+"x"+Math.round(t.rect.height)+"@"+this.positionKey(e)}},{key:"hasSettledOn",value:function(t,e){var n=this,i=this.settleSignature(t,e),s=this.pendingOverlap;return s&&s.element===t.element&&s.signature===i?s.ready:(this.clearSettle(),this.pendingOverlap={element:t.element,signature:i,ready:!1},this.settleTimer=window.setTimeout(function(){n.settleTimer=null,n.pendingOverlap&&(n.pendingOverlap.ready=!0),n.resolve()},this.settleDelay),!1)}},{key:"clearSettle",value:function(){null!==this.settleTimer&&(window.clearTimeout(this.settleTimer),this.settleTimer=null),this.pendingOverlap=null}},{key:"resolve",value:function(){if(this.isPaused())return this.clearSettle(),void this.endPush();if(null===this.pushTimer){var t=this.measureAvoidTargets(),e=this.getRect(),n=this.overlappingTarget(e,t);if(!n)return this.clearSettle(),void this.endPush();if(this.hasSettledOn(n,e)){this.clearSettle();var i=this.element.getBoundingClientRect(),s=new Set([this.positionKey(e)]),o=e,r=!1;this.element.style.transition="none";for(var a=0;a<this.maxAttempts;a++){var c=this.nearestEscapePosition(o,n.rect,s);if(!c)break;if(s.add(this.positionKey(c)),this.moveRectTo(c.left,c.top),r=!0,o=this.getRect(),!(n=this.overlappingTarget(o,t)))break}r&&n&&this.setPosition(i.left,i.top),this.animateFrom(i)}}}},{key:"scheduleCheck",value:function(){var t=this;null===this.pendingCheck&&(this.pendingCheck=window.requestAnimationFrame(function(){t.pendingCheck=null,t.resolve()}))}},{key:"scheduleChecks",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=void 0===e.every?500:e.every,i=void 0===e.times?20:e.times,s=window.setInterval(function(){i<=0||t.isCancelled()?window.clearInterval(s):(t.resolve(),i--)},n);return s}}],e&&w(t.prototype,e),n&&w(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),_=[".chatbot-widget","[data-platform-feedback]","#save-bar",".sticky-save-button-container","[data-platform-floating-widget]"],S=["button","a[href]",'[role="button"]',"[onclick]",'[data-bs-toggle]:not([data-bs-toggle="tooltip"]):not([data-bs-toggle="popover"])',".btn"],C=_.concat(S),T=S.filter(function(t){return"a[href]"!==t}).join(","),E=_.join(",");function P(t){return!!t.matches(E)||!t.matches('[disabled],.disabled,[aria-disabled="true"],[inert]')&&!t.closest("[inert],fieldset[disabled]")&&("none"!==window.getComputedStyle(t).pointerEvents&&!function(t){return"A"===t.tagName&&!t.matches(T)&&"inline"===window.getComputedStyle(t).display&&""!==t.textContent.trim()}(t))}var O,L=n(6479),I=n.n(L);function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function R(){var t,e,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function o(n,i,s,o){var c=i&&i.prototype instanceof a?i:a,h=Object.create(c.prototype);return M(h,"_invoke",function(n,i,s){var o,a,c,h=0,l=s||[],d=!1,u={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,a=0,c=t,u.n=n,r}};function p(n,i){for(a=n,c=i,e=0;!d&&h&&!s&&e<l.length;e++){var s,o=l[e],p=u.p,b=o[2];n>3?(s=b===i)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=p&&((s=n<2&&p<o[1])?(a=0,u.v=i,u.n=o[1]):p<b&&(s=n<3||o[0]>i||i>b)&&(o[4]=n,o[5]=i,u.n=b,a=0))}if(s||n>1)return r;throw d=!0,i}return function(s,l,b){if(h>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,b),a=l,c=b;(e=a<2?t:c)||!d;){o||(a?a<3?(a>1&&(u.n=-1),p(a,c)):u.n=c:u.v=c);try{if(h=2,o){if(a||(s="next"),e=o[s]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");
2if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+s+"' method"),a=1);o=t}else if((e=(d=u.n<0)?c:n.call(i,u))!==r)break}catch(e){o=t,a=1,c=e}finally{h=1}}return{value:e,done:d}}}(n,s,o),!0),h}var r={};function a(){}function c(){}function h(){}e=Object.getPrototypeOf;var l=[][i]?e(e([][i]())):(M(e={},i,function(){return this}),e),d=h.prototype=a.prototype=Object.create(l);function u(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,M(t,s,"GeneratorFunction")),t.prototype=Object.create(d),t}return c.prototype=h,M(d,"constructor",h),M(h,"constructor",c),c.displayName="GeneratorFunction",M(h,s,"GeneratorFunction"),M(d),M(d,s,"Generator"),M(d,i,function(){return this}),M(d,"toString",function(){return"[object Generator]"}),(R=function(){return{w:o,m:u}})()}function M(t,e,n,i){var s=Object.defineProperty;try{s({},"",{})}catch(t){s=0}M=function(t,e,n,i){function o(e,n){M(t,e,function(t){return this._invoke(e,n,t)})}e?s?s(t,e,{value:n,enumerable:!i,configurable:!i,writable:!i}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},M(t,e,n,i)}function j(t,e,n,i,s,o,r){try{var a=t[o](r),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(i,s)}function D(t){return function(){var e=this,n=arguments;return new Promise(function(i,s){var o=t.apply(e,n);function r(t){j(o,i,s,r,a,"next",t)}function a(t){j(o,i,s,r,a,"throw",t)}r(void 0)})}}function B(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function q(t,e,n){return(e=z(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function N(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,z(i.key),i)}}function z(t){var e=function(t,e){if("object"!=A(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=A(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==A(e)?e:e+""}function H(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(window.chatbotTranslations||{})[t]||t;return Object.keys(e).forEach(function(t){var i=new RegExp(":".concat(t),"g");n=n.replace(i,e[t])}),n}window.Pusher=I(),window.Echo=new class{constructor(t){this.options=t,this.connect(),this.options.withoutInterceptors||this.registerInterceptors()}channel(t){return this.connector.channel(t)}connect(){if("reverb"===this.options.broadcaster)this.connector=new g({...this.options,cluster:""});else if("pusher"===this.options.broadcaster)this.connector=new g(this.options);else if("ably"===this.options.broadcaster)this.connector=new g({...this.options,cluster:"",broadcaster:"pusher"});else if("socket.io"===this.options.broadcaster)this.connector=new f(this.options);else if("null"===this.options.broadcaster)this.connector=new v(this.options);else{if("function"!=typeof this.options.broadcaster||!function(t){try{new t}catch(t){if(t instanceof Error&&t.message.includes("is not a constructor"))return!1}return!0}(this.options.broadcaster))throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} is not supported.`);this.connector=new this.options.broadcaster(this.options)}}disconnect(){this.connector.disconnect()}join(t){return this.connector.presenceChannel(t)}leave(t){this.connector.leave(t)}leaveChannel(t){this.connector.leaveChannel(t)}leaveAllChannels(){for(const t in this.connector.channels)this.leaveChannel(t)}listen(t,e,n){return this.connector.listen(t,e,n)}private(t){return this.connector.privateChannel(t)}encryptedPrivate(t){if(this.connectorSupportsEncryptedPrivateChannels(this.connector))return this.connector.encryptedPrivateChannel(t);throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} does not support encrypted private channels.`)}connectorSupportsEncryptedPrivateChannels(t){return t instanceof g||t instanceof v}socketId(){return this.connector.socketId()}registerInterceptors(){typeof Vue<"u"&&null!=Vue&&Vue.http&&this.registerVueRequestInterceptor(),"function"==typeof axios&&this.registerAxiosRequestInterceptor(),"function"==typeof jQuery&&this.registerjQueryAjaxSetup(),"object"==typeof Turbo&&this.registerTurboRequestInterceptor()}registerVueRequestInterceptor(){Vue.http.interceptors.push((t,e)=>{this.socketId()&&t.headers.set("X-Socket-ID",this.socketId()),e()})}registerAxiosRequestInterceptor(){axios.interceptors.request.use(t=>(this.socketId()&&(t.headers["X-Socket-Id"]=this.socketId()),t))}registerjQueryAjaxSetup(){typeof jQuery.ajax<"u"&&jQuery.ajaxPrefilter((t,e,n)=>{this.socketId()&&n.setRequestHeader("X-Socket-Id",this.socketId())})}registerTurboRequestInterceptor(){document.addEventListener("turbo:before-fetch-request",t
2=>{t.detail.fetchOptions.headers["X-Socket-Id"]=this.socketId()})}}({broadcaster:"reverb",key:"acGNQRF0RNkeN2VERWk9",wsHost:"socket.myevent.com",wsPort:null!=="443"?"443":80,wssPort:null!=="443"?"443":443,forceTLS:"https"===(null!==(O="https")?O:"https"),enabledTransports:["ws","wss"]});var W=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?B(Object(n),!0).forEach(function(e){q(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({apiBaseUrl:"/api/v1/chatbot",siteType:"myevent",position:"bottom-right",theme:"light",internalChat:!1,escalateButtonEnabled:!0,supportHours:null,agentAvailable:!0,userName:null},e),this.internalChat=this.options.internalChat,this.escalateButtonEnabled=this.options.escalateButtonEnabled,this.supportHours=this.options.supportHours,this.agentAvailable=this.options.agentAvailable,this.userName=this.options.userName,this.session=null,this.isOpen=!1,this.isConnected=!1,this.messages=[],this.websocketChannel=null,this.POSITION_KEY="chatbot_widget_position_".concat(this.options.siteType),this.typingDebounceTimeout=null,this.typingStopTimeout=null,this.isTypingSent=!1,this.isLiveChat=!1,this.isAiResponding=!1,this.loadDOMPurify(),this.init()},e=[{key:"loadDOMPurify",value:function(){if("undefined"==typeof DOMPurify){var t=document.createElement("script");t.src="https://cdn.jsdelivr.net/npm/[email protected]/dist/purify.min.js",t.async=!0,document.head.appendChild(t)}}},{key:"init",value:function(){this.createWidget(),this.attachEventListeners()}},{key:"createWidget",value:function(){var t=this;this.widget=document.createElement("div"),this.widget.className="chatbot-widget",this.widget.innerHTML=this.getWidgetHTML(),this.addStyles(),document.body.appendChild(this.widget),this.chatToggle=this.widget.querySelector(".chatbot-toggle"),this.chatTooltip=this.widget.querySelector(".chatbot-tooltip"),this.chatWindow=this.widget.querySelector(".chatbot-window"),this.chatMessages=this.widget.querySelector(".chatbot-messages"),this.chatInput=this.widget.querySelector(".chatbot-input"),this.sendButton=this.widget.querySelector(".chatbot-send"),this.escalateButton=this.widget.querySelector(".chatbot-escalate"),this.endLiveChatButton=this.widget.querySelector(".chatbot-end-live-chat"),this.closeButton=this.widget.querySelector(".chatbot-close"),this.postChatActions=this.widget.querySelector(".chatbot-post-chat-actions"),this.emailTranscriptButton=this.widget.querySelector(".chatbot-email-transcript"),this.startNewChatButton=this.widget.querySelector(".chatbot-start-new-chat"),this.chatHeader=this.widget.querySelector(".chatbot-header"),this.welcomeScreen=this.widget.querySelector(".chatbot-welcome-screen"),this.welcomeGreeting=this.widget.querySelector(".chatbot-welcome-greeting"),this.collision=new x({element:this.widget,avoidSelectors:C,getRect:function(){return t.getActiveWidgetElement().getBoundingClientRect()},setPosition:function(e,n){return t.setWidgetPosition(e,n)},isAvoidable:function(t){return P(t)&&(!t.matches("[data-platform-feedback]")||t.classList.contains("is-visible"))},isPaused:function(){return t.isDraggingWidget}}),this.resetSavedWidgetPosition(),this.collision.resolve(),this.collision.scheduleChecks()}},{key:"getWelcomeSuggestions",value:function(){var t={suggestion_edit_website:{icon:"ð¥ï¸",iconClass:"chatbot-welcome-icon-blue"},suggestion_tickets:{icon:"ðï¸",iconClass:"chatbot-welcome-icon-green"},suggestion_payout:{icon:"ðµ",iconClass:"chatbot-welcome-icon-orange"},suggestion_email:{icon:"âï¸",iconClass:"chatbot-welcome-icon-purple"},suggestion_domain:{icon:"ð",iconClass:"chatbot-welcome-icon-teal"}},e={myevent:["suggestion_edit_website","suggestion_tickets","suggestion_payout","suggestion_email","suggestion_domain"],myfunrun:["suggestion_edit_website","suggestion_tickets","suggestion_payout","suggestion_email","suggestion_domain"],websiteworks:["suggestion_edit_website","suggestion_payout","suggestion_domain"]};return(e[this.options.siteType]||e.myevent).map(function(e){var n=t[e],i=H(e);return'\n <button type="button" class="chatbot-welcome-suggestion" data-question="'.concat(i,'">
2\n <span class="chatbot-welcome-suggestion-icon ').concat(n.iconClass,'">').concat(n.icon,'</span>\n <span class="chatbot-welcome-suggestion-text">').concat(i,'</span>\n <span class="chatbot-welcome-suggestion-arrow">âº</span>\n </button>\n ')}).join("")}},{key:"getWidgetHTML",value:function(){var t;switch(this.options.siteType){case"myfunrun":t=H("myfunrun_assistant");break;case"websiteworks":t=H("websiteworks_assistant");break;default:t=H("myevent_assistant")}this.internalChat&&(t=H("internal_prefix")+" "+t);var e=this.escalateButtonEnabled?"":"display: none;";return'\n <div class="chatbot-toggle" title="Drag to move or click to open">\n <i class="fa-solid fa-comment-smile chatbot-icon"></i>\n <span class="chatbot-toggle-label">'.concat(H("button_help"),'</span>\n <span class="chatbot-badge" style="display: none;">1</span>\n </div>\n\n <div class="chatbot-window" style="display: none;">\n ').concat(!this.agentAvailable&&this.supportHours?'\n <div class="chatbot-support-banner">\n <i class="fa fa-clock"></i>\n <span>'.concat(this.supportHours,"</span>\n </div>\n "):"",'\n <div class="chatbot-header" title="Drag to move the chat window">\n <div class="chatbot-brand">\n <span class="chatbot-avatar" aria-hidden="true">\n <i class="fa-solid fa-comment-smile"></i>\n </span>\n <div class="chatbot-title">\n <span class="chatbot-title-text">').concat(t,'</span>\n <span class="chatbot-status">\n <span class="chatbot-status-dot" aria-hidden="true"></span>\n ').concat(H("status_online"),'\n </span>\n </div>\n </div>\n <span class="chatbot-drag-handle" aria-hidden="true">\n <i class="fa-solid fa-grip-lines"></i>\n </span>\n <div class="chatbot-actions">\n <button class="chatbot-escalate"\n data-bs-container="body"\n data-bs-toggle="tooltip"\n data-bs-placement="top"\n data-bs-title="').concat(H("button_talk_to_support"),'"\n title="').concat(H("button_talk_to_support"),'"\n aria-label="').concat(H("button_talk_to_support"),'"\n style="').concat(e,'">\n <i class="fa fa-headset"></i>\n </button>\n <button class="chatbot-end-live-chat"\n data-bs-container="body"\n data-bs-toggle="tooltip"\n data-bs-placement="top"\n data-bs-title="').concat(H("button_end_live_chat"),'"\n title="').concat(H("button_end_live_chat"),'"\n aria-label="').concat(H("button_end_live_chat"),'"\n style="display: none;">\n <i class="fa fa-phone-slash"></i>\n </button>\n <button class="chatbot-new"\n data-bs-container="body"\n data-bs-toggle="tooltip"\n data-bs-placement="top"\n data-bs-title="').concat(H("button_start_new_chat"),'"\n title="').concat(H("button_start_new_chat"),'"\n aria-label="').concat(H("button_start_new_chat"),'">\n <i class="fa fa-plus"></i>\n </button>\n <button class="chatbot-close" title="').concat(H("button_close"),'" aria-label="').concat(H("button_close"),'">\n <svg viewBox="0 0 24 24" fill="currentColor">\n <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>\n </svg>\n </button>\n </div>\n </div>\n\n <div class="chatbot-messages">\n <div class="chatbot-welcome-screen" style="display: none;">\n <div class="chatbot-welcome-content">\n <div class="chatbot-welcome-header">\n <div class="chatbot-welcome-avatar">ð</div>\n <div class="chatbot-welcome-greeting"></div>\n <div class="chatbot-welcome-heading">').concat(H("welcome_heading"),'</div>\n <div class="chatbot-welcome-subtitle">').concat(H("welcome_subtitle"),'</div>\n </div>\n <div class="chatbot-welcome-suggestions">\n ').concat(this.getWelcomeSuggestions(),'\n </div>\n <div class="chatbot-welcome-divider">
2\n <span>').concat(H("welcome_divider"),'</span>\n </div>\n </div>\n </div>\n <div class="chatbot-loading" id="chatbot-loading" style="display: none;">\n <div class="chatbot-typing">\n <span></span>\n <span></span>\n <span></span>\n </div>\n </div>\n </div>\n\n <div class="chatbot-quick-suggestions" style="display: none;">\n <div class="chatbot-suggestions-title">').concat(H("popular_questions"),'</div>\n <div class="chatbot-suggestions-list"></div>\n </div>\n\n <div class="chatbot-post-chat-actions" style="display: none;">\n <button type="button" class="chatbot-email-transcript">').concat(H("button_email_transcript"),'</button>\n <button type="button" class="chatbot-start-new-chat">').concat(H("button_start_new_chat_action"),'</button>\n </div>\n\n <div class="chatbot-input-container">\n <textarea class="chatbot-input"\n placeholder="').concat(H("placeholder_type_question"),'"\n maxlength="1000"\n rows="1"></textarea>\n <button class="chatbot-send" disabled>\n <svg viewBox="0 0 24 24" fill="currentColor">\n <path d="M2 21l21-9L2 3v7l15 2-15 2v7z"/>\n </svg>\n </button>\n </div>\n <div class="chatbot-disclaimer">\n <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>\n </svg>\n <span>').concat(H("welcome_disclaimer"),"</span>\n </div>\n </div>\n ")}},{key:"addStyles",value:function(){if(!document.getElementById("chatbot-styles")){var t=document.createElement("style");if(t.id="chatbot-styles",t.textContent="\n .chatbot-widget {\n position: fixed;\n ".concat(this.options.position.includes("right")?"right: 20px;":"left: 20px;","\n ").concat(this.options.position.includes("bottom")?"bottom: 20px;":"top: 20px;",'\n z-index: 1000000;\n font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif;\n transition: right 0.3s ease-in-out, bottom 0.3s ease-in-out, transform 0.2s ease;\n }\n\n .chatbot-widget.chatbot-dragging {\n transition: none;\n user-select: none;\n }\n\n .chatbot-toggle {\n background: linear-gradient(135deg, #176f95 0%, #2caae1 100%);\n border: 1px solid rgba(255, 255, 255, 0.32);\n border-radius: 999px;\n padding: 11px 18px;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n cursor: grab;\n box-shadow: 0 16px 30px rgba(23, 111, 149, 0.24), 0 4px 12px rgba(0, 0, 0, 0.16);\n transition: all 0.3s ease;\n position: relative;\n }\n\n .chatbot-toggle:hover {\n transform: scale(1.05);\n box-shadow: 0 6px 16px rgba(0,0,0,0.2);\n }\n\n .chatbot-icon {\n font-size: 16px;\n color: white;\n }\n\n .chatbot-toggle-label {\n font-size: 14px;\n font-weight: 600;\n color: white;\n letter-spacing: normal;\n line-height: 1;\n }\n\n .chatbot-badge {\n position: absolute;\n top: -5px;\n right: -5px;\n background: #ff4757;\n color: white;\n border-radius: 50%;
2\n width: 20px;\n height: 20px;\n font-size: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: bold;\n }\n\n .chatbot-window {\n width: 370px;\n height: 520px;\n max-height: min(520px, calc(100vh - 120px));\n background: #ffffff;\n border: 1px solid rgba(33, 128, 169, 0.16);\n border-radius: 20px;\n box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24), 0 8px 18px rgba(15, 23, 42, 0.12);\n margin-bottom: 12px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .chatbot-support-banner {\n background: #fff3cd;\n color: #856404;\n padding: 10px 16px;\n font-size: 13px;\n display: flex;\n align-items: center;\n gap: 8px;\n border-bottom: 1px solid #ffeaa7;\n }\n\n .chatbot-support-banner i {\n font-size: 14px;\n }\n\n .chatbot-header {\n background: linear-gradient(135deg, #176f95 0%, #2caae1 100%);\n color: white;\n padding: 14px 16px;\n display: grid;\n grid-template-columns: 1fr auto auto;\n align-items: center;\n gap: 12px;\n cursor: grab;\n }\n\n .chatbot-widget.chatbot-dragging .chatbot-header,\n .chatbot-widget.chatbot-dragging .chatbot-toggle {\n cursor: grabbing;\n }\n\n .chatbot-brand {\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n }\n\n .chatbot-avatar {\n width: 36px;\n height: 36px;\n border-radius: 12px;\n background: rgba(255, 255, 255, 0.18);\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);\n }\n\n .chatbot-title {\n display: flex;\n flex-direction: column;\n min-width: 0;\n }\n\n .chatbot-title-text {\n font-weight: 700;\n font-size: 15px;\n line-height: 1.2;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .chatbot-status {\n font-size: 12px;\n opacity: 0.9;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n }\n\n .chatbot-status-dot {\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background: #7cf2a1;\n box-shadow: 0 0 0 3px rgba(124, 242, 161, 0.18);\n }\n\n .chatbot-drag-handle {\n color: rgba(255, 255, 255, 0.76);\n display: flex;\n align-items: center;\n pointer-events: none;\n }\n\n .chatbot-actions {\n display: flex;\n gap: 6px;\n }\n\n .chatbot-actions button {\n width: 30px;\n height: 30px;\n background: rgba(255, 255, 255, 0.12);\n border: 1px solid rgba(255, 255, 255, 0.14);\n color: white;\n cursor: pointer;\n padding: 0;\n border-radius: 10px;\n transition: background 0.2s, transform 0.2s;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n\n .chatbot-actions button:hover {\n background: rgba(255, 255, 255, 0.22);\n transform: translateY(-1px);\n }\n\n .chatbot-actions svg {\n width: 16px;\n height: 16px;\n }\n\n .chatbot-messages {\n flex: 1;\n padding: 16px;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 12px;\n background: linear-gradient(180deg, #f8fbfd 0%, #ffffff 100%);\n }\n\n .chatbot-message {\n display: flex;\n gap: 8px;\n max-width: 80%;\n }\n\n .chatbot-message.user {\n align-self: flex-end;\n flex-direction: row-reverse;\n }\n\n .chatbot-message.bot {\n align-self: flex-start;\n }\n\n .chatbot-message.bot .chatbot-message-content {\n position: relative;\n padding-right: 30px;\n }\n\n .chatbot-message.agent {\n align-self: flex-start;\n flex-direction: column;\n }\n\n .chatbot-message-content {\n background: #f1f7fb;\n border: 1px solid #e0eef5;\n padding: 12px;\n border-radius: 14px;\n font-size: 14px;\n line-height: 1.2;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n .chatbot-message-content > :first-child {\n margin-top: 0 !important;\n }\n\n .chatbot-message-content > :last-child {\n margin-bottom: 0 !important;\n }\n\n .chatbot-message.user .chatbot-message-content {\n background: linear-gradient(135deg, #176f95 0%, #2caae1 100%);\n border-color: transparent;\n color: white;\n }\n\n .chatbot-message-content p,\n .chatbot-message-content ul,\n .chatbot-message-content ol,\n .chatbot-message-content h1,\n .chatbot-message-content h2,\n .chatbot-message-content h3,\n .chatbot-message-content h4,\n .chatbot-message-content h5,\n .chatbot-message-content h6 {\n margin: 0;\n padding: 0;\n }\n\n .chatbot-message-content p + p,\n .chatbot-message-content ul + p,\n .chatbot-message-content ol + p,\n .chatbot-message-content p + ul,\n .chatbot-message-content p + ol {\n margin-top: 0.3em;\n }\n\n .chatbot-message-content ul,\n .chatbot-message-content ol {\n padding-left: 1.5em;\n white-space: normal;\n }\n\n .chatbot-message-content li {\n margin: 0;\n white-space: normal;\n }\n\n .chatbot-agent-name {\n font-size: 12px;\n color: #667eea;\n margin-bottom: 4px;\n }\n\n .chatbot-message-time {\n font-size: 10px;\n color: #999;\n margin-top: 4px;\n }\n\n .chatbot-disclaimer-btn {\n position: absolute;\n top: 4px;\n right: 4px;\n background: rgba(255, 255, 255, 0.95);\n border: none;\n color: #f5a623;\n cursor: pointer;\n padding: 4px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n font-size: 12px;\n opacity: 0.7;\n transition: all 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n }\n\n .chatbot-disclaimer-btn:hover {\n opacity: 1;\n background: white;\n transform: scale(1.15);\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);\n }\n\n .chatbot-disclaimer-btn i {\n font-size: 12px;\n }\n\n .chatbot-message.user .chatbot-message-time {\n text-align: right;\n }\n\n .chatbot-message-content.chatbot-message-pending {\n opacity: 0.5;\n }\n\n .chatbot-message-actions {\n display: flex;\n gap: 8px;\n margin-top: 8px;\n }\n\n .chatbot-message-action {\n background: #667eea;\n color: white;\n border: none;\n padding: 6px 12px;\n border-radius: 16px;\n font-size: 12px;\n cursor: pointer;\n transition: background 0.2s;\n }\n\n .chatbot-message-action:hover {\n background: #5a67d8;\n }\n\n .chatbot-quick-suggestions {\n padding: 16px;\n border-top: 1px solid #e0e6ed;\n background: #f8f9fa;\n }\n\n .chatbot-post-chat-actions {\n padding: 12px 16px;\n border-top: 1px solid #e0e6ed;\n background: #f8f9fa;\n display: flex;\n gap: 8px;\n justify-content: space-between;\n }\n\n .chatbot-post-chat-actions button {\n flex: 1;\n border: 1px solid #dee2e6;\n background: white;\n color: #2180a9;\n font-weight: 600;\n border-radius: 10px;\n padding: 10px 12px;\n cursor: pointer;\n transition: all 0.2s;\n font-size: 13px;\n }\n\n .chatbot-post-chat-actions button:hover {\n border-color: #2caae1;\n color: #2caae1;\n }\n\n .chatbot-post-chat-actions button:disabled {\n background: #f1f2f6;\n color: #999;
2\n cursor: not-allowed;\n }\n\n .chatbot-suggestions-title {\n font-size: 12px;\n color: #6c757d;\n margin-bottom: 8px;\n font-weight: 500;\n }\n\n .chatbot-suggestions-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n\n .chatbot-suggestion {\n background: white;\n border: 1px solid #dee2e6;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 13px;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .chatbot-suggestion:hover {\n background: #2caae1;\n color: white;\n border-color: #2caae1;\n }\n\n .chatbot-input-container {\n padding: 14px 16px 16px;\n border-top: 1px solid #e0e6ed;\n display: flex;\n gap: 10px;\n align-items: flex-end;\n background: #ffffff;\n }\n\n .chatbot-input {\n flex: 1;\n border: 1px solid #d7e6ee;\n border-radius: 18px;\n padding: 10px 16px;\n font-size: 14px;\n outline: none;\n transition: border-color 0.2s;\n resize: none;\n font-family: inherit;\n line-height: 1.4;\n max-height: 120px;\n overflow-y: auto;\n min-height: 40px;\n }\n\n .chatbot-input:focus {\n border-color: #2caae1;\n }\n\n .chatbot-send {\n background: linear-gradient(135deg, #176f95 0%, #2caae1 100%);\n color: white;\n border: none;\n width: 40px;\n height: 40px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .chatbot-send:disabled {\n background: #dee2e6;\n cursor: not-allowed;\n }\n\n .chatbot-send:not(:disabled):hover {\n background: #2180a9;\n transform: scale(1.05);\n }\n\n .chatbot-send svg {\n width: 16px;\n height: 16px;\n }\n\n .chatbot-loading {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 16px;\n }\n\n .chatbot-typing {\n display: flex;\n gap: 4px;\n }\n\n .chatbot-typing span {\n width: 8px;\n height: 8px;\n background: #667eea;\n border-radius: 50%;\n animation: chatbot-typing 1.4s infinite ease-in-out;\n }\n\n .chatbot-typing span:nth-child(1) { animation-delay: -0.32s; }\n .chatbot-typing span:nth-child(2) { animation-delay: -0.16s; }\n\n .chatbot-typing-animation {\n display: flex;\n gap: 4px;\n padding: 4px 0;\n }\n\n .chatbot-typing-animation span {\n width: 8px;\n height: 8px;\n background: #667eea;\n border-radius: 50%;\n animation: chatbot-typing-bounce 1.4s infinite ease-in-out;\n }\n\n .chatbot-typing-animation span:nth-child(1) { animation-delay: -0.32s; }\n .chatbot-typing-animation span:nth-child(2) { animation-delay: -0.16s; }\n .chatbot-typing-animation span:nth-child(3) { animation-delay: 0s; }\n\n @keyframes chatbot-typing {\n 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }\n 40% { transform: scale(1); opacity: 1; }\n }\n\n @keyframes chatbot-typing-bounce {\n 0%, 80%, 100% {\n transform: translateY(0) scale(0.8);\n opacity: 0.5;\n }\n 40% {\n transform: translateY(-4px) scale(1);\n opacity: 1;\n }\n }\n\n .chatbot-article-preview {\n background: #f8f9fa;\n border: 1px solid #dee2e6;\n border-radius: 8px;\n padding: 12px;\n margin-top: 8px;\n }\n\n .chatbot-article-title {\n font-weight: 600;\n color: #667eea;\n margin-bottom: 4px;\n font-size: 13px;\n }\n\n .chatbot-article-excerpt {\n font-size: 12px;\n color: #6c757d;\n line-height: 1.3;\n }\n\n .chatbot-welcome-screen {\n flex: 1;\n padding: 6px 12px 2px;\n display: flex;\n flex-direction: column;\n }\n\n .chatbot-welcome-content {\n display: flex;\n flex-direction: column;\n }\n\n .chatbot-welcome-header {\n margin-bottom: 8px;\n }\n\n .chatbot-welcome-avatar {\n width: 28px;\n height: 28px;\n border-radius: 50%;\n background: #eef6fb;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n margin-bottom: 0;\n margin-right: 6px;\n vertical-align: middle;\n }\n\n .chatbot-welcome-greeting {\n font-size: 17px;\n color: #1a2332;\n margin-bottom: 2px;\n line-height: 1.2;\n display: inline-block;\n vertical-align: middle;\n }\n\n .chatbot-welcome-heading {\n font-size: 17px;\n font-weight: 700;\n color: #1a2332;\n margin-bottom: 2px;\n line-height: 1.2;\n }\n\n .chatbot-welcome-subtitle {\n font-size: 12px;\n color: #6b7b8f;\n line-height: 1.3;\n }\n\n .chatbot-welcome-suggestions {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin-bottom: 4px;\n }\n\n .chatbot-welcome-suggestion {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 5px 10px;\n background: #ffffff;\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n cursor: pointer;\n text-align: left;\n font-size: 12px;\n color: #1a2332;\n transition: all 0.2s ease;\n width: 100%;\n }\n\n .chatbot-welcome-suggestion:hover {\n border-color: #2caae1;\n box-shadow: 0 2px 8px rgba(44, 170, 225, 0.12);\n }\n\n .chatbot-welcome-suggestion-icon {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n flex-shrink: 0;\n }\n\n .chatbot-welcome-icon-blue {\n background: #e8f4fd;\n }\n\n .chatbot-welcome-icon-green {\n background: #e6f7ed;\n }\n\n .chatbot-welcome-icon-orange {\n background: #fff4e6;\n }\n\n .chatbot-welcome-icon-purple {\n background: #f0e6ff;\n }\n\n .chatbot-welcome-icon-teal {\n background: #e0f7f7;\n }\n\n .chatbot-welcome-suggestion-text {\n flex: 1;\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .chatbot-welcome-suggestion-arrow {\n font-size: 16px;\n color: #94a3b8;\n flex-shrink: 0;\n }\n\n .chatbot-welcome-suggestion:hover .chatbot-welcome-suggestion-arrow {\n color: #2caae1;\n }\n\n .chatbot-welcome-divider {\n display: flex;\n align-items: center;\n text-align: center;\n color: #94a3b8;\n font-size: 11px;\n margin: 2px 0 2px;\n }\n\n .chatbot-welcome-divider::before,\n .chatbot-welcome-divider::after {\n content: \'\';\n flex: 1;\n border-bottom: 1px solid #e2e8f0;\n }\n\n .chatbot-welcome-divider span {\n padding: 0 12px;\n }\n\n .chatbot-disclaimer {\n padding: 10px 16px 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n font-size: 12px;\n color: #8898aa;\n background: #ffffff;\n text-align: center;\n }\n\n .chatbot-disclaimer svg {\n flex-shrink: 0;\n color: #8898aa;\n }\n\n @media (max-width: 480px) {\n .chatbot-window {\n width: calc(100vw - 32px);\n height: auto;\n max-height: min(440px, calc(100vh - 120px));\n border-radius: 18px;\n }\n\n .chatbot-header {\n cursor: default;\n }\n\n .chatbot-drag-handle {\n display: none;\n }\n\n .chatbot-modal {\n width: 90%;\n max-width: none;\n }\n }\n\n /*\n * Dashboard dark mode. Only dashboards set data-bs-theme="dark" (and define the --me-* tokens),\n * so public sites and the signup flow never match these rules. The brand gradients stay.\n */\n [data-bs-theme="dark"] .chatbot-window {\n background: var(--me-surface);\n border-color: var(--me-border);\n color: var(--me-text);\n box-shadow: var(--me-shadow-lg);\n }\n\n [data-bs-theme="dark"] .chatbot-support-banner {\n background: var(--me-warning-soft);\n color: var(--me-warning-text);\n border-bottom-color: var(--me-border);\n }\n\n [data-bs-theme="dark"] .chatbot-messages {\n background: var(--me-surface);\n scrollbar-color: var(--me-border-strong) transparent;\n }\n\n [data-bs-theme="dark"] .chatbot-message-content {\n background: var(--me-surface-alt);\n border-color: var(--me-border);\n color: var(--me-text);\n }\n\n [data-bs-theme="dark"] .chatbot-message.user .chatbot-message-content {\n background: linear-gradient(135deg, #176f95 0%, #2caae1 100%);\n border-color: transparent;\n color: white;\n }\n\n [data-bs-theme="dark"] .chatbot-message:not(.user) .chatbot-message-content a {\n color: var(--me-link);\n }\n\n [data-bs-theme="dark"] .chatbot-message:not(.user) .chatbot-message-content code,\n [data-bs-theme="dark"] .chatbot-message:not(.user) .chatbot-message-content pre {\n background: var(--me-surface-muted);\n color: var(--me-text-emphasis);\n }\n\n [data-bs-theme="dark"] .chatbot-agent-name {\n color: var(--me-accent);\n }\n\n [data-bs-theme="dark"] .chatbot-message-time {\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-disclaimer-btn {\n background: var(--me-surface-muted);\n box-shadow: none;\n }\n\n [data-bs-theme="dark"] .chatbot-disclaimer-btn:hover {\n background: var(--me-surface-hover);\n }\n\n [data-bs-theme="dark"] .chatbot-typing span,\n [data-bs-theme="dark"] .chatbot-typing-animation span {\n background: var(--me-accent);\n }\n\n [data-bs-theme="dark"] .chatbot-quick-suggestions,\n [data-bs-theme="dark"] .chatbot-post-chat-actions {\n background: var(--me-surface-alt);\n border-top-color: var(--me-border);\n }\n\n [data-bs-theme="dark"] .chatbot-suggestions-title {\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-suggestion {\n background: var(--me-surface);\n border-color: var(--me-border);\n color: var(--me-text);\n }\n\n [data-bs-theme="dark"] .chatbot-suggestion:hover {\n background: #2caae1;\n border-color: #2caae1;\n color: white;\n }\n\n [data-bs-theme="dark"] .chatbot-post-chat-actions button {\n background: var(--me-surface);\n border-color: var(--me-border);\n color: #4fbde9;\n }\n\n [data-bs-theme="dark"] .chatbot-post-chat-actions button:hover {\n border-color: #2caae1;\n color: #6fcbf0;\n }\n\n [data-bs-theme="dark"] .chatbot-post-chat-actions button:disabled {\n background: var(--me-surface-muted);\n border-color: var(--me-border);\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-article-preview {\n background: var(--me-surface-alt);\n border-color: var(--me-border);\n }\n\n [data-bs-theme="dark"] .chatbot-article-title {\n color: var(--me-accent);\n }\n\n [data-bs-theme="dark"] .chatbot-article-excerpt {\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-welcome-avatar {\n background: var(--me-surface-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-welcome-greeting,\n [data-bs-theme="dark"] .chatbot-welcome-heading {\n color: var(--me-heading);\n }\n\n [data-bs-theme="dark"] .chatbot-welcome-subtitle {\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-welcome-suggestion {\n background: var(--me-surface-alt);\n border-color: var(--me-border);\n color: var(--me-text-emphasis);\n }\n\n [data-bs-theme="dark"] .chatbot-welcome-suggestion:hover {\n background: var(--me-surface-hover);\n border-color: #2caae1;\n box-shadow: none;\n }\n\n [data-bs-theme="dark"] .chatbot-welcome-icon-blue { background: rgba(56, 189, 248, 0.16); }\n [data-bs-theme="dark"] .chatbot-welcome-icon-green { background: rgba(52, 199, 120, 0.16); }\n [data-bs-theme="dark"] .chatbot-welcome-icon-orange { background: rgba(247, 185, 36, 0.16); }\n [data-bs-theme="dark"] .chatbot-welcome-icon-purple
2 { background: rgba(167, 139, 250, 0.18); }\n [data-bs-theme="dark"] .chatbot-welcome-icon-teal { background: rgba(45, 212, 191, 0.16); }\n\n [data-bs-theme="dark"] .chatbot-welcome-suggestion-arrow,\n [data-bs-theme="dark"] .chatbot-welcome-divider {\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-welcome-suggestion:hover .chatbot-welcome-suggestion-arrow {\n color: #2caae1;\n }\n\n [data-bs-theme="dark"] .chatbot-welcome-divider::before,\n [data-bs-theme="dark"] .chatbot-welcome-divider::after {\n border-bottom-color: var(--me-border);\n }\n\n [data-bs-theme="dark"] .chatbot-input-container {\n background: var(--me-surface);\n border-top-color: var(--me-border);\n }\n\n [data-bs-theme="dark"] .chatbot-input {\n background: var(--me-surface-alt);\n border-color: var(--me-border);\n color: var(--me-text-emphasis);\n scrollbar-color: var(--me-border-strong) transparent;\n }\n\n [data-bs-theme="dark"] .chatbot-input::placeholder {\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-input:focus {\n border-color: #2caae1;\n }\n\n [data-bs-theme="dark"] .chatbot-send:disabled {\n background: var(--me-surface-muted);\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-disclaimer {\n background: var(--me-surface);\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-disclaimer svg {\n color: var(--me-text-muted);\n }\n\n /* Prompt modals (end chat, new chat, feedback, login, AI disclaimer) */\n [data-bs-theme="dark"] #chatbot-end-chat-prompt-overlay,\n [data-bs-theme="dark"] #chatbot-new-chat-prompt-overlay,\n [data-bs-theme="dark"] #chatbot-feedback-prompt-overlay,\n [data-bs-theme="dark"] #chatbot-login-prompt-overlay,\n [data-bs-theme="dark"] #chatbot-disclaimer-prompt-overlay {\n background: var(--me-overlay);\n }\n\n [data-bs-theme="dark"] .chatbot-end-chat-prompt-modal,\n [data-bs-theme="dark"] .chatbot-new-chat-prompt-modal,\n [data-bs-theme="dark"] .chatbot-feedback-prompt-modal,\n [data-bs-theme="dark"] .chatbot-login-prompt-modal,\n [data-bs-theme="dark"] .chatbot-disclaimer-prompt-modal {\n background: var(--me-surface);\n border: 1px solid var(--me-border);\n box-shadow: var(--me-shadow-lg);\n color: var(--me-text);\n }\n\n [data-bs-theme="dark"] .chatbot-end-chat-prompt-title,\n [data-bs-theme="dark"] .chatbot-new-chat-prompt-title,\n [data-bs-theme="dark"] .chatbot-feedback-prompt-title,\n [data-bs-theme="dark"] .chatbot-login-prompt-title,\n [data-bs-theme="dark"] .chatbot-disclaimer-prompt-title {\n color: var(--me-heading);\n }\n\n [data-bs-theme="dark"] .chatbot-end-chat-prompt-desc,\n [data-bs-theme="dark"] .chatbot-new-chat-prompt-desc,\n [data-bs-theme="dark"] .chatbot-feedback-prompt-desc,\n [data-bs-theme="dark"] .chatbot-login-prompt-desc,\n [data-bs-theme="dark"] .chatbot-disclaimer-prompt-desc,\n [data-bs-theme="dark"] .chatbot-login-prompt-modal label {\n color: var(--me-text);\n }\n\n [data-bs-theme="dark"] .chatbot-login-prompt-modal label small {\n color: var(--me-text-muted) !important;\n }\n\n [data-bs-theme="dark"] .chatbot-end-chat-prompt-close,\n [data-bs-theme="dark"] .chatbot-new-chat-prompt-close,\n [data-bs-theme="dark"] .chatbot-feedback-prompt-close,\n [data-bs-theme="dark"] .chatbot-login-prompt-close,\n [data-bs-theme="dark"] .chatbot-disclaimer-prompt-close {\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-end-chat-cancel,\n [data-bs-theme="dark"] .chatbot-new-chat-cancel,\n [data-bs-theme="dark"] .chatbot-feedback-skip {\n background: var(--me-surface-muted);\n border-color: var(--me-border);\n color: var(--me-text-emphasis);\n }\n\n [data-bs-theme="dark"] .chatbot-end-chat-cancel:hover,\n [data-bs-theme="dark"] .chatbot-new-chat-cancel:hover,\n [data-bs-theme="dark"] .chatbot-feedback-skip:hover {\n background: var(--me-surface-hover);\n }\n\n [data-bs-theme="dark"] .chatbot-feedback-star {\n color: var(--me-border-strong);\n }\n\n [data-bs-theme="dark"] .chatbot-feedback-star:hover,\n [data-bs-theme="dark"] .chatbot-feedback-star.active,\n [data-bs-theme="dark"] .chatbot-feedback-star.hovered {\n color: #f5a623;\n }\n\n [data-bs-theme="dark"] .chatbot-feedback-submit:disabled {\n background: var(--me-surface-muted);\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-feedback-success {\n color: var(--me-success-text);\n }\n\n [data-bs-theme="dark"] .chatbot-feedback-comments,\n [data-bs-theme="dark"] .chatbot-login-prompt-modal input,\n [data-bs-theme="dark"] .chatbot-login-prompt-modal textarea {\n background: var(--me-surface-alt);\n border-color: var(--me-border);\n color: var(--me-text-emphasis);\n }\n\n [data-bs-theme="dark"] .chatbot-feedback-comments::placeholder,\n [data-bs-theme="dark"] .chatbot-login-prompt-modal input::placeholder,\n [data-bs-theme="dark"] .chatbot-login-prompt-modal textarea::placeholder {\n color: var(--me-text-muted);\n }\n\n [data-bs-theme="dark"] .chatbot-feedback-comments:focus,\n [data-bs-theme="dark"] .chatbot-login-prompt-modal input:focus,\n [data-bs-theme="dark"] .chatbot-login-prompt-modal textarea:focus {\n border-color: #2caae1;\n }\n '),document.head.appendChild(t),!document.getElementById("chatbot-tooltip-zindex")){var e=document.createElement("style");e.id="chatbot-tooltip-zindex",e.textContent="\n .tooltip, .bs-tooltip {\n z-index: 1000100 !important;\n }\n ",document.head.appendChild(e)}}}},{key:"restoreWidgetPosition",value:function(){var t=this.getSavedWidgetPosition();if(t){var e=this.getActiveWidgetElement().getBoundingClientRect(),n=this.clampWidgetPosition(t.right-e.width,t.bottom-e.height,e);this.setWidgetPosition(n.left,n.top)}}},{key:"resetSavedWidgetPosition",value:function(){localStorage.removeItem(this.POSITION_KEY)}},{key:"resetWidgetToDefaultPosition",value:function(){this.resetSavedWidgetPosition(),this.widget.style.left="",this.widget.style.top="",this.widget.style.right="",this.widget.style.bottom=""}},{key:"getSavedWidgetPosition",value:function(){try{var t=localStorage.getItem(this.POSITION_KEY);if(!t)return null;var e=JSON.parse(t);if(Number.isFinite(null==e?void 0:e.right)&&Number.isFinite(null==e?void 0:e.bottom))return e;if(Number.isFinite(null==e?void 0:e.left)&&Number.isFinite(null==e?void 0:e.top)){var n=this.getActiveWidgetElement().getBoundingClientRect();return{right:e.left+n.width,bottom:e.top+n.height}}}catch(t){localStorage.removeItem(this.POSITION_KEY)}return null}},{key:"getActiveWidgetElement",value:function(){return this.isOpen?this.chatWindow:this.chatToggle}},{key:"saveCurrentWidgetAnchor",value:function(){var t=this.getActiveWidgetElement().getBoundingClientRect();localStorage.setItem(this.POSITION_KEY,JSON.stringify({right:Math.round(t.right),bottom:Math.round(t.bottom)}))}}
2,{key:"setWidgetPosition",value:function(t,e){this.widget.style.left="".concat(t,"px"),this.widget.style.top="".concat(e,"px"),this.widget.style.right="auto",this.widget.style.bottom="auto"}},{key:"startWidgetDrag",value:function(t){if(!(void 0!==t.button&&0!==t.button||window.matchMedia("(max-width: 480px)").matches||t.target.closest(".chatbot-actions"))){var e=this.getActiveWidgetElement().getBoundingClientRect();this.isDraggingWidget=!0,this.hasDraggedWidget=!1,this.dragOffsetX=t.clientX-e.left,this.dragOffsetY=t.clientY-e.top,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.widget.classList.add("chatbot-dragging")}}},{key:"dragWidget",value:function(t){if(this.isDraggingWidget){var e=this.getActiveWidgetElement().getBoundingClientRect(),n=this.clampWidgetPosition(t.clientX-this.dragOffsetX,t.clientY-this.dragOffsetY,e);this.hasDraggedWidget=this.hasDraggedWidget||Math.abs(t.clientX-this.dragStartX)>3||Math.abs(t.clientY-this.dragStartY)>3,this.setWidgetPosition(n.left,n.top),t.preventDefault()}}},{key:"stopWidgetDrag",value:function(){this.isDraggingWidget&&(this.isDraggingWidget=!1,this.widget.classList.remove("chatbot-dragging"),this.saveCurrentWidgetAnchor(),this.collision.resolve(),this.hasDraggedWidget&&!this.isOpen&&(this.preventNextToggleClick=!0))}},{key:"clampWidgetPosition",value:function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.getActiveWidgetElement().getBoundingClientRect(),i=12,s=Math.max(i,window.innerWidth-n.width-i),o=Math.max(i,window.innerHeight-n.height-i);return{left:Math.min(Math.max(t,i),s),top:Math.min(Math.max(e,i),o)}}},{key:"attachEventListeners",value:function(){var t=this;this.chatToggle.addEventListener("click",function(e){if(t.preventNextToggleClick)return t.preventNextToggleClick=!1,void e.preventDefault();t.toggleChat()}),this.chatToggle.addEventListener("pointerdown",function(e){return t.startWidgetDrag(e)}),this.chatHeader.addEventListener("pointerdown",function(e){return t.startWidgetDrag(e)}),document.addEventListener("pointermove",function(e){return t.dragWidget(e)}),document.addEventListener("pointerup",function(){return t.stopWidgetDrag()}),document.addEventListener("pointercancel",function(){return t.stopWidgetDrag()}),window.addEventListener("resize",function(){t.restoreWidgetPosition(),t.collision.resolve()}),window.addEventListener("platform-floating-widgets:changed",function(){t.resetWidgetToDefaultPosition(),t.collision.scheduleChecks()}),window.addEventListener("scroll",function(){return t.collision.scheduleCheck()},{passive:!0}),document.addEventListener("mousemove",function(e){t.widget.contains(e.target)||t.collision.scheduleCheck()},{passive:!0}),this.closeButton.addEventListener("click",function(){return t.closeChat()}),this.sendButton.addEventListener("click",function(){return t.sendMessage()}),this.chatInput.addEventListener("keydown",function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),t.sendMessage())}),this.chatInput.addEventListener("input",function(){t.sendButton.disabled=""===t.chatInput.value.trim(),t.autoResizeTextarea(),t.handleTypingIndicator()}),this.escalateButton.addEventListener("click",function(){return t.escalateChat()}),this.endLiveChatButton.addEventListener("click",function(){return t.showEndLiveChatConfirmation()}),this.newChatButton=this.widget.querySelector(".chatbot-new"),this.newChatButton.addEventListener("click",function(){return t.showStartNewChatConfirmation()}),this.emailTranscriptButton.addEventListener("click",function(){return t.emailTranscript()}),this.startNewChatButton.addEventListener("click",function(){return t.showStartNewChatConfirmation()}),this.widget.querySelectorAll(".chatbot-welcome-suggestion").forEach(function(e){e.addEventListener("click",function(e){var n=e.currentTarget.dataset.question;n&&t.askQuestion(n)})})}},{key:"startNewChat",value:(p=D(R().m(function t(){var e,n;return R().w(function(t){for(;;)switch(t.p=t.n){case 0:if(null===(e=this.session)||void 0===e||!e.uuid){t.n=4;break}return t.p=1,t.n=2,fetch("".concat(this.options.apiBaseUrl,"/sessions/close"),{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({reason:"User started a new chat"})});case 2:t.v.ok,t.n=4;break;case 3:t.p=3,t.v;case 4:return null!==(n=this.session)&&void 0!==n&&n.uuid&&window.Echo.leave("chat-session.".concat(this.session.uuid)),this.session=null,this.messages=[],this.websocketChannel=null,this.isConnected=!1,this.isLiveChat=!1,this.isEscalated=!1,this.chatMessages.querySelectorAll(".chatbot-message").forEach(function(t){return t.remove()}),this.enableChatInput(),this.updateLiveChatState(!1),t.n=5,this.startSession();case 5:return t.a(2)}},t,this,[[1,3]])}
2)),function(){return p.apply(this,arguments)})},{key:"toggleChat",value:(u=D(R().m(function t(){return R().w(function(t){for(;;)switch(t.n){case 0:if(!this.isOpen){t.n=1;break}this.closeChat(),t.n=2;break;case 1:return t.n=2,this.openChat();case 2:return t.a(2)}},t,this)})),function(){return u.apply(this,arguments)})},{key:"openChat",value:(d=D(R().m(function t(){return R().w(function(t){for(;;)switch(t.n){case 0:if(this.saveCurrentWidgetAnchor(),this.isOpen=!0,this.chatWindow.style.display="flex",this.chatToggle.style.display="none",this.restoreWidgetPosition(),this.chatTooltip&&(this.chatTooltip.style.display="none"),this.session){t.n=1;break}return t.n=1,this.startSession();case 1:this.chatInput.focus();case 2:return t.a(2)}},t,this)})),function(){return d.apply(this,arguments)})},{key:"askQuestion",value:(l=D(R().m(function t(e){return R().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.openChat();case 1:if(e&&this.chatInput){t.n=2;break}return t.a(2);case 2:return this.chatInput.value=e,this.chatInput.dispatchEvent(new Event("input",{bubbles:!0})),t.n=3,this.sendMessage();case 3:return t.a(2)}},t,this)})),function(t){return l.apply(this,arguments)})},{key:"closeChat",value:function(){this.saveCurrentWidgetAnchor(),this.isOpen=!1,this.chatWindow.style.display="none",this.chatToggle.style.display="flex",this.restoreWidgetPosition(),this.chatTooltip&&"true"!==this.getCookie("chatbot-tooltip")&&(this.chatTooltip.style.display="block")}},{key:"startSession",value:(h=D(R().m(function t(){var e,n,i,s;return R().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.showLoading(!0),t.n=1,fetch("".concat(this.options.apiBaseUrl,"/sessions"),{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({site_type:this.options.siteType,context:{current_url:window.location.href,referrer:document.referrer,user_agent:navigator.userAgent,site_uuid:"undefined"!=typeof siteUuid?siteUuid:null},internal:this.internalChat})});case 1:return e=t.v,t.n=2,e.json();case 2:(n=t.v).success?(this.session=n.data.session,this.messages=n.data.messages,this.userName=n.data.user_name||this.userName,this.welcomeGreeting&&(i=this.userName?H("welcome_greeting",{name:this.userName}):H("welcome_greeting_default"),this.welcomeGreeting.textContent=i),"live_chat"===this.session.status||"escalated"===this.session.status?this.updateLiveChatState(this.session.status):this.updateLiveChatState(!1),this.renderMessages(),this.connectWebSocket(),"resolved"===this.session.status&&(this.updateLiveChatState(!1),this.disableChatInput(H("session_ended")))):this.showError(n.message||H("error_start_session")),t.n=4;break;case 3:t.p=3,s=t.v,this.showError(s.message);case 4:return t.p=4,this.showLoading(!1),t.f(4);case 5:return t.a(2)}},t,this,[[0,3,4,5]])})),function(){return h.apply(this,arguments)})},{key:"sendMessage",value:(c=D(R().m(function t(){var e,n,i,s,o,r;return R().w(function(t){for(;;)switch(t.p=t.n){case 0:if((e=this.chatInput.value.trim())&&this.session){t.n=1;break}return t.a(2);case 1:return clearTimeout(this.typingDebounceTimeout),clearTimeout(this.typingStopTimeout),this.isTypingSent&&(this.isTypingSent=!1,this.sendTypingIndicator(!1)),this.chatInput.value="",this.sendButton.disabled=!0,this.resetTextareaHeight(),n="temp-"+Date.now(),this.addMessage({uuid:n,sender_type:"user",sender_name:"You",message:e,created_at:(new Date).toISOString(),pending:!0}),t.p=2,t.n=3,fetch("".concat(this.options.apiBaseUrl,"/sessions/messages"),{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({message:e,internal:this.internalChat,site_uuid:"undefined"!=typeof siteUuid?siteUuid:null})});case 3:return i=t.v,t.n=4,i.json();case 4:(s=t.v).success&&s.data.message?(s.data.live_chat||s.data.escalated||(this.isAiResponding=!0,this.disableInputWhileResponding(),this.showTypingIndicator(!0)),(o=document.getElementById("chat-message-".concat(n)))&&(o.id="chat-message-".concat(s.data.message.uuid),o.classList.remove("chatbot-message-pending"))):(r=s.message||H("error_send_message"),this.removePendingMessage(n),this.isAiResponding=!1,this.enableInputAfterResponse(),this.showError(r),this.showTypingIndicator(!1),403!==i.status&&429!==i.status||this.disableBlockedSession(r)),t.n=6;break;case 5:t.p=5,t.v,this.removePendingMessage(n),this.isAiResponding=!1,this.enableInputAfterResponse(),this.showError(H("error_connection")),this.showTypingIndicator(!1);case 6:return t.a(2)}},t,this,[[2,5]])})),function(){return c.apply(this,arguments)})},{key:"autoResizeTextarea",value:function(){this.chatInput.style.height="auto";var t=Math.min(this.chatInput.scrollHeight,120);this.chatInput.style.height=t+"px"}},{key:"resetTextareaHeight",value:function(){this.chatInput.style.height="auto"}},{key:"handleTypingIndicator",value:function(){var t=this;this.session&&(clearTimeout(this.typingDebounceTimeout),clearTimeout(this.typingStopTimeout),this.isTypingSent||(this.isTypingSent=!0,this.sendTypingIndicator(!0)),this.typingDebounceTimeout=setTimeout(function(){t.isTypingSent=!1},500),this.typingStopTimeout=setTimeout(function(){t.isTypingSent=!1,t.sendTypingIndicator(!1)},5e3))}},{key:"sendTypingIndicator",value:(a=D(R().m(function t(e){return R().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.session){t.n=1;break}return t.a(2);case 1:return t.p=1,t.n=2,fetch("".concat(this.options.apiBaseUrl,"/sessions/typing"),{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({typing:e})});case 2:t.n=4;break;case 3:t.p=3,t.v;case 4:return t.a(2)}},t,this,[[1,3]])}
2)),function(t){return a.apply(this,arguments)})},{key:"escalateChat",value:(r=D(R().m(function t(){var e,n,i,s,o,r=arguments;return R().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e=r.length>0&&void 0!==r[0]?r[0]:null,this.session){t.n=1;break}return t.a(2);case 1:if(n=(null==e?void 0:e.reason)||this.getLatestUserMessageText()){t.n=2;break}return this.addLocalBotMessage(H("escalation_reason_required")),this.chatInput.focus(),t.a(2);case 2:return t.p=2,i=e?{reason:n,user_name:e.name,user_email:e.email,site_url:e.site_url,site_name:e.site_name}:{reason:n},t.n=3,fetch("".concat(this.options.apiBaseUrl,"/sessions/escalate"),{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify(i)});case 3:return s=t.v,t.n=4,s.json();case 4:if(o=t.v,400!==s.status){t.n=7;break}if("USER_NOT_AUTHENTICATED"!==o.error){t.n=5;break}return this.showUserLoginForm(),t.a(2);case 5:if("SESSION_ALREADY_ESCALATED"!==o.error){t.n=6;break}return this.showError(H("error_already_escalated")),t.a(2);case 6:if("NEED_ESCALATION_REASON"!==o.error){t.n=7;break}return this.addLocalBotMessage(o.message||H("escalation_reason_required")),this.chatInput.focus(),t.a(2);case 7:o.success?(o.data.bot_message&&this.addMessage(o.data.bot_message),this.updateLiveChatState("escalated")):this.showError(o.message||H("error_escalate")),t.n=9;break;case 8:t.p=8,t.v,this.showError(H("error_connection"));case 9:return t.a(2)}},t,this,[[2,8]])})),function(){return r.apply(this,arguments)})},{key:"getLatestUserMessageText",value:function(){for(var t=this.messages.length-1;t>=0;t--){var e,n=this.messages[t];if("user"===n.sender_type&&null!==(e=n.message)&&void 0!==e&&e.trim())return n.message.trim()}return""}},{key:"addLocalBotMessage",value:function(t){this.addMessage({uuid:"local-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2)),sender_type:"bot",sender_name:H("system_name"),message:t,created_at:(new Date).toISOString()})}},{key:"updateLiveChatState",value:function(t){this.isLiveChat="live_chat"===t,this.isEscalated="escalated"===t,"live_chat"===t?(this.escalateButton.style.display="none",this.endLiveChatButton.style.display="block",this.widget.querySelector(".chatbot-status").textContent=H("status_live_chat")):"escalated"===t?(this.escalateButton.style.display="none",this.endLiveChatButton.style.display="none",this.widget.querySelector(".chatbot-status").textContent=H("status_escalated")):(this.escalateButton.style.display=this.escalateButtonEnabled?"block":"none",this.endLiveChatButton.style.display="none",this.widget.querySelector(".chatbot-status").textContent=H("status_online"))}},{key:"endLiveChat",value:(o=D(R().m(function t(){var e;return R().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.session){t.n=1;break}return t.a(2);case 1:return t.p=1,t.n=2,fetch("".concat(this.options.apiBaseUrl,"/sessions/close"),{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({reason:"User ended live chat"})});case 2:return e=t.v,t.n=3,e.json();case 3:t.v.success?(this.addMessage({sender_type:"bot",sender_name:H("system_name"),message:H("system_ended_chat"),created_at:(new Date).toISOString()}),this.updateLiveChatState(!1),this.showFeedbackModal()):this.showError(H("error_end_chat")),t.n=5;break;case 4:t.p=4,t.v,this.showError(H("error_connection"));case 5:return t.a(2)}},t,this,[[1,4]])})),function(){return o.apply(this,arguments)})},{key:"showEndLiveChatConfirmation",value:function(){var t=this,e=document.getElementById("chatbot-end-chat-prompt-overlay");if(e&&e.remove(),!document.getElementById("chatbot-end-chat-prompt-style")){var n=document.createElement("style");n.id="chatbot-end-chat-prompt-style",n.textContent="\n #chatbot-end-chat-prompt-overlay {\n position: fixed;\n top: 0; left: 0; right: 0; bottom: 0;\n background: rgba(0,0,0,0.32);\n z-index: 1000001;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .chatbot-end-chat-prompt-modal {\n background: #fff;\n border-radius: 12px;\n box-shadow: 0 4px 32px rgba(0,0,0,0.18);\n padding: 28px 28px 18px 28px;\n min-width: 320px;\n max-width: 90vw;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n position: relative;\n }\n .chatbot-end-chat-prompt-title {\n font-size: 17px;\n font-weight: 600;\n margin-bottom: 8px;\n color: #333;\n text-align: center;\n }\n .chatbot-end-chat-prompt-desc {\n font-size: 14px;\n color: #444;\n margin-bottom: 18px;\n text-align: center;\n }\n .chatbot-end-chat-prompt-actions {\n display: flex;\n gap: 10px;\n justify-content: center;\n }\n .chatbot-end-chat-prompt-actions button {\n min-width: 100px;\n padding: 8px 16px;\n font-size: 14px;\n border-radius: 6px;\n cursor: pointer;\n }\n .chatbot-end-chat-cancel {\n background: #f1f2f6;\n border: 1px solid #dee2e6;\n color: #333;\n }\n .chatbot-end-chat-cancel:hover {\n background: #e9ecef;\n }\n .chatbot-end-chat-confirm {\n background: #dc3545;\n border: none;\n color: white;\n }\n .chatbot-end-chat-confirm:hover {\n background: #c82333;\n }\n .chatbot-end-chat-prompt-close {\n position: absolute;\n top: 10px;\n right: 12px;\n background: none;\n border: none;\n font-size: 20px;\n color: #888;\n cursor: pointer;\n }\n ",document.head.appendChild(n)}var i=document.createElement("div");i.id="chatbot-end-chat-prompt-overlay",i.tabIndex=-1,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true");var s=document.createElement("div");
2s.className="chatbot-end-chat-prompt-modal",s.innerHTML='\n <button class="chatbot-end-chat-prompt-close" title="'.concat(H("button_close"),'" aria-label="').concat(H("button_close"),'">×</button>\n <div class="chatbot-end-chat-prompt-title">').concat(H("end_chat_title"),'</div>\n <div class="chatbot-end-chat-prompt-desc">').concat(H("end_chat_message"),'</div>\n <div class="chatbot-end-chat-prompt-actions">\n <button type="button" class="chatbot-end-chat-cancel">').concat(H("end_chat_cancel"),'</button>\n <button type="button" class="chatbot-end-chat-confirm">').concat(H("end_chat_confirm"),"</button>\n </div>\n "),i.appendChild(s),document.body.appendChild(i);var o=function(){i.remove()};s.querySelector(".chatbot-end-chat-prompt-close").onclick=o,s.querySelector(".chatbot-end-chat-cancel").onclick=o,i.onclick=function(t){t.target===i&&o()},document.addEventListener("keydown",function t(e){"Escape"===e.key&&(o(),document.removeEventListener("keydown",t))}),s.querySelector(".chatbot-end-chat-confirm").onclick=function(){s.querySelector(".chatbot-end-chat-confirm").disabled=!0,s.querySelector(".chatbot-end-chat-confirm").textContent=H("end_chat_ending"),o(),t.endLiveChat()}}},{key:"showStartNewChatConfirmation",value:function(){var t=this,e=document.getElementById("chatbot-new-chat-prompt-overlay");if(e&&e.remove(),!document.getElementById("chatbot-new-chat-prompt-style")){var n=document.createElement("style");n.id="chatbot-new-chat-prompt-style",n.textContent="\n #chatbot-new-chat-prompt-overlay {\n position: fixed;\n top: 0; left: 0; right: 0; bottom: 0;\n background: rgba(0,0,0,0.32);\n z-index: 1000001;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .chatbot-new-chat-prompt-modal {\n background: #fff;\n border-radius: 12px;\n box-shadow: 0 4px 32px rgba(0,0,0,0.18);\n padding: 28px 28px 18px 28px;\n min-width: 320px;\n max-width: 90vw;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n position: relative;\n }\n .chatbot-new-chat-prompt-title {\n font-size: 17px;\n font-weight: 600;\n margin-bottom: 8px;\n color: #333;\n text-align: center;\n }\n .chatbot-new-chat-prompt-desc {\n font-size: 14px;\n color: #444;\n margin-bottom: 18px;\n text-align: center;\n }\n .chatbot-new-chat-prompt-actions {\n display: flex;\n gap: 10px;\n justify-content: center;\n }\n .chatbot-new-chat-prompt-actions button {\n min-width: 100px;\n padding: 8px 16px;\n font-size: 14px;\n border-radius: 6px;\n cursor: pointer;\n }\n .chatbot-new-chat-cancel {\n background: #f1f2f6;\n border: 1px solid #dee2e6;\n color: #333;\n }\n .chatbot-new-chat-cancel:hover {\n background: #e9ecef;\n }\n .chatbot-new-chat-confirm {\n background: linear-gradient(45deg, #2180a9 0%, #299ed1 100%);\n border: none;\n color: white;\n }\n .chatbot-new-chat-confirm:hover {\n background: linear-gradient(45deg, #1a6a8c 0%, #2180a9 100%);\n }\n .chatbot-new-chat-prompt-close {\n position: absolute;\n top: 10px;\n right: 12px;\n background: none;\n border: none;\n font-size: 20px;\n color: #888;\n cursor: pointer;\n }\n ",document.head.appendChild(n)}var i=document.createElement("div");i.id="chatbot-new-chat-prompt-overlay",i.tabIndex=-1,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true");var s=document.createElement("div");
2s.className="chatbot-new-chat-prompt-modal",s.innerHTML='\n <button class="chatbot-new-chat-prompt-close" title="'.concat(H("button_close"),'" aria-label="').concat(H("button_close"),'">×</button>\n <div class="chatbot-new-chat-prompt-title">').concat(H("new_chat_title"),'</div>\n <div class="chatbot-new-chat-prompt-desc">').concat(H("new_chat_message"),'</div>\n <div class="chatbot-new-chat-prompt-actions">\n <button type="button" class="chatbot-new-chat-cancel">').concat(H("new_chat_cancel"),'</button>\n <button type="button" class="chatbot-new-chat-confirm">').concat(H("new_chat_confirm"),"</button>\n </div>\n "),i.appendChild(s),document.body.appendChild(i);var o=function(){i.remove()};s.querySelector(".chatbot-new-chat-prompt-close").onclick=o,s.querySelector(".chatbot-new-chat-cancel").onclick=o,i.onclick=function(t){t.target===i&&o()},document.addEventListener("keydown",function t(e){"Escape"===e.key&&(o(),document.removeEventListener("keydown",t))}),s.querySelector(".chatbot-new-chat-confirm").onclick=function(){s.querySelector(".chatbot-new-chat-confirm").disabled=!0,s.querySelector(".chatbot-new-chat-confirm").textContent=H("new_chat_starting"),o(),t.startNewChat()}}},{key:"showFeedbackModal",value:function(){var t=this,e=document.getElementById("chatbot-feedback-prompt-overlay");if(e&&e.remove(),!document.getElementById("chatbot-feedback-prompt-style")){var n=document.createElement("style");n.id="chatbot-feedback-prompt-style",n.textContent="\n #chatbot-feedback-prompt-overlay {\n position: fixed;\n top: 0; left: 0; right: 0; bottom: 0;\n background: rgba(0,0,0,0.32);\n z-index: 1000001;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .chatbot-feedback-prompt-modal {\n background: #fff;\n border-radius: 12px;\n box-shadow: 0 4px 32px rgba(0,0,0,0.18);\n padding: 28px 28px 18px 28px;\n min-width: 340px;\n max-width: 90vw;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n position: relative;\n }\n .chatbot-feedback-prompt-title {\n font-size: 17px;\n font-weight: 600;\n margin-bottom: 8px;\n color: #333;\n text-align: center;\n }\n .chatbot-feedback-prompt-desc {\n font-size: 14px;\n color: #444;\n margin-bottom: 18px;\n text-align: center;\n }\n .chatbot-feedback-rating {\n display: flex;\n justify-content: center;\n gap: 8px;\n margin-bottom: 16px;\n }\n .chatbot-feedback-star {\n font-size: 28px;\n cursor: pointer;\n color: #ddd;\n transition: color 0.2s, transform 0.15s;\n background: none;\n border: none;\n padding: 0;\n }\n .chatbot-feedback-star:hover,\n .chatbot-feedback-star.active {\n color: #f5a623;\n transform: scale(1.15);\n }\n .chatbot-feedback-star.hovered {\n color: #f5a623;\n }\n .chatbot-feedback-comments {\n width: 100%;\n min-height: 70px;\n border: 1px solid #ccc;\n border-radius: 6px;\n padding: 10px;\n font-size: 14px;\n resize: vertical;\n margin-bottom: 16px;\n font-family: inherit;\n }\n .chatbot-feedback-comments:focus {\n border-color: #2caae1;\n outline: none;\n }\n .chatbot-feedback-prompt-actions {\n display: flex;\n gap: 10px;\n justify-content: center;\n }\n .chatbot-feedback-prompt-actions button {\n min-width: 100px;\n padding: 8px 16px;\n font-size: 14px;\n border-radius: 6px;\n cursor: pointer;\n }\n .chatbot-feedback-skip {\n background: #f1f2f6;\n border: 1px solid #dee2e6;\n color: #333;\n }\n .chatbot-feedback-skip:hover {\n background: #e9ecef;\n }\n .chatbot-feedback-submit {\n background: linear-gradient(45deg, #2180a9 0%, #299ed1 100%);\n border: none;\n color: white;\n }\n .chatbot-feedback-submit:hover {\n background: linear-gradient(45deg, #1a6a8c 0%, #2180a9 100%);\n }\n .chatbot-feedback-submit:disabled {\n background: #ccc;
2\n cursor: not-allowed;\n }\n .chatbot-feedback-prompt-close {\n position: absolute;\n top: 10px;\n right: 12px;\n background: none;\n border: none;\n font-size: 20px;\n color: #888;\n cursor: pointer;\n }\n .chatbot-feedback-success {\n text-align: center;\n color: #28a745;\n font-size: 15px;\n padding: 20px 0;\n }\n ",document.head.appendChild(n)}var i=document.createElement("div");i.id="chatbot-feedback-prompt-overlay",i.tabIndex=-1,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true");var s=document.createElement("div");s.className="chatbot-feedback-prompt-modal",s.innerHTML='\n <button class="chatbot-feedback-prompt-close" title="'.concat(H("button_close"),'" aria-label="').concat(H("button_close"),'">×</button>\n <div class="chatbot-feedback-prompt-title">').concat(H("feedback_title"),'</div>\n <div class="chatbot-feedback-prompt-desc">').concat(H("feedback_description"),'</div>\n <div class="chatbot-feedback-rating">\n <button type="button" class="chatbot-feedback-star" data-rating="1" aria-label="').concat(H("feedback_star_label",{count:1}),'">â
</button>\n <button type="button" class="chatbot-feedback-star" data-rating="2" aria-label="').concat(H("feedback_star_label",{count:2}),'">â
</button>\n <button type="button" class="chatbot-feedback-star" data-rating="3" aria-label="').concat(H("feedback_star_label",{count:3}),'">â
</button>\n <button type="button" class="chatbot-feedback-star" data-rating="4" aria-label="').concat(H("feedback_star_label",{count:4}),'">â
</button>\n <button type="button" class="chatbot-feedback-star" data-rating="5" aria-label="').concat(H("feedback_star_label",{count:5}),'">â
</button>\n </div>\n <textarea class="chatbot-feedback-comments" placeholder="').concat(H("feedback_placeholder"),'" maxlength="1000"></textarea>\n <div class="chatbot-feedback-prompt-actions">\n <button type="button" class="chatbot-feedback-skip">').concat(H("feedback_skip"),'</button>\n <button type="button" class="chatbot-feedback-submit" disabled>').concat(H("feedback_submit"),"</button>\n </div>\n "),i.appendChild(s),document.body.appendChild(i);var o=0,r=s.querySelectorAll(".chatbot-feedback-star"),a=s.querySelector(".chatbot-feedback-submit"),c=s.querySelector(".chatbot-feedback-comments"),h=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r.forEach(function(n,i){i<t?e?n.classList.add("hovered"):(n.classList.add("active"),n.classList.remove("hovered")):e?n.classList.remove("hovered"):n.classList.remove("active")})};r.forEach(function(t){t.addEventListener("click",function(){o=parseInt(t.dataset.rating),h(o,!1),a.disabled=!1}),t.addEventListener("mouseenter",function(){h(parseInt(t.dataset.rating),!0)}),t.addEventListener("mouseleave",function(){r.forEach(function(t){return t.classList.remove("hovered")})})});var l=function(){i.remove()};s.querySelector(".chatbot-feedback-prompt-close").onclick=l,s.querySelector(".chatbot-feedback-skip").onclick=l,i.onclick=function(t){t.target===i&&l()},document.addEventListener("keydown",function t(e){"Escape"===e.key&&(l(),document.removeEventListener("keydown",t))}),a.onclick=D(R().m(function e(){return R().w(function(e){for(;;)switch(e.n){case 0:if(0!==o){e.n=1;break}return e.a(2);case 1:return a.disabled=!0,a.textContent=H("feedback_submitting"),e.n=2,t.submitFeedback(o,c.value.trim());case 2:e.v?(s.innerHTML='\n <button class="chatbot-feedback-prompt-close" title="'.concat(H("button_close"),'" aria-label="').concat(H("button_close"),'">×</button>\n <div class="chatbot-feedback-success">\n <div style="font-size: 40px; margin-bottom: 10px;">ð</div>\n ').concat(H("feedback_thank_you"),"\n </div>\n "),s.querySelector(".chatbot-feedback-prompt-close").onclick=l,setTimeout(l,2e3)):(a.disabled=!1,a.textContent=H("feedback_submit"));case 3:return e.a(2)}},e)}))}},{key:"submitFeedback",value:(s=D(R().m(function t(e,n){var i,s;return R().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.session){t.n=1;break}return t.a(2,!1);case 1:return t.p=1,t.n=2,fetch("".concat(this.options.apiBaseUrl,"/sessions/session-feedback"),{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({rating:e,comments:n||null})});case 2:return i=t.v,t.n=3,i.json();case 3:return s=t.v,t.a(2,s.success);case 4:return t.p=4,t.v,t.a(2,!1)}},t,this,[[1,4]])})),function(t,e){return s.apply(this,arguments)})},{key:"showUserLoginForm",value:function(){var t=this,e=document.getElementById("chatbot-login-prompt-overlay");if(e&&e.remove(),!document.getElementById("chatbot-login-prompt-style")){var n=document.createElement("style");n.id="chatbot-login-prompt-style",n.textContent="\n #chatbot-login-prompt-overlay {\n position: fixed;\n top: 0; left: 0; right: 0; bottom: 0;\n background: rgba(0,0,0,0.32);\n z-index: 1000001;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .chatbot-login-prompt-modal {\n background: #fff;\n border-radius: 12px;\n box-shadow: 0 4px 32px rgba(0,0,0,0.18);\n padding: 28px 28px 18px 28px;\n min-width: 320px;\n max-width: 90vw;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n position: relative;\n }\n .chatbot-login-prompt-title {\n font-size: 17px;\n font-weight: 600;\n margin-bottom: 8px;\n color: #333;\n text-align: center;\n }\n .chatbot-login-prompt-desc {\n font-size: 14px;\n color: #444;\n margin-bottom: 18px;\n text-align: center;\n }\n .chatbot-login-prompt-modal label {\n font-size: 13px;\n margin-bottom: 4px;\n color: #333;\n }\n .chatbot-login-prompt-modal input,\n .chatbot-login-prompt-modal textarea {\n font-size: 14px;\n padding: 7px 10px;\n border-radius: 6px;\n border: 1px solid #ccc;\n margin-bottom: 14px;\n width: 100%;\n box-sizing: border-box;\n }\n .chatbot-login-prompt-modal textarea {\n resize: vertical;\n min-height: 60px;\n font-family: inherit;\n }\n .chatbot-login-prompt-modal button {\n align-self: flex-end;\n min-width: 90px;\n padding: 7px 16px;\n font-size: 14px;\n border-radius: 6px;\n }\n .chatbot-login-prompt-close {\n position: absolute;\n top: 10px;\n right: 12px;\n background: none;\n border: none;\n font-size: 20px;\n color: #888;\n cursor: pointer;\n }\n ",document.head.appendChild(n)}this.addMessage({sender_type:"bot",sender_name:H("system_name"),message:H("login_info_message"),created_at:(new Date).toISOString()});var i=document.createElement("div");i.id="chatbot-login-prompt-overlay",i.tabIndex=-1,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true");var s=document.createElement("div");
2s.className="chatbot-login-prompt-modal",s.innerHTML='\n <button class="chatbot-login-prompt-close" title="'.concat(H("button_close"),'" aria-label="').concat(H("button_close"),'">×</button>\n <div class="chatbot-login-prompt-title">').concat(H("login_title"),'</div>\n <div class="chatbot-login-prompt-desc">').concat(H("login_description"),'</div>\n <label for="chatbot_prompt_name">').concat(H("login_label_name"),'</label>\n <input type="text" id="chatbot_prompt_name" name="name" required autocomplete="name" />\n <label for="chatbot_prompt_email">').concat(H("login_label_email"),'</label>\n <input type="email" id="chatbot_prompt_email" name="email" required autocomplete="email" />\n <label for="chatbot_prompt_site_info">').concat(H("login_label_site_info"),' <small style="color: #888;">(').concat(H("optional"),')</small></label>\n <textarea id="chatbot_prompt_site_info" name="site_info" placeholder="').concat(H("login_placeholder_site_info"),'" rows="2"></textarea>\n <button type="button" class="btn btn-primary" id="chatbot-login-prompt-submit">').concat(H("login_button_continue"),"</button>\n "),i.appendChild(s),document.body.appendChild(i),setTimeout(function(){s.querySelector("#chatbot_prompt_name").focus()},100);var o=function(){i.remove()};s.querySelector(".chatbot-login-prompt-close").onclick=o,i.onclick=function(t){t.target===i&&o()},document.addEventListener("keydown",function t(e){"Escape"===e.key&&(o(),document.removeEventListener("keydown",t))}),s.querySelector("#chatbot-login-prompt-submit").onclick=function(){var e=s.querySelector("#chatbot_prompt_name").value.trim(),n=s.querySelector("#chatbot_prompt_email").value.trim(),i=s.querySelector("#chatbot_prompt_site_info").value.trim();if(e&&n){s.querySelector("#chatbot-login-prompt-submit").disabled=!0,o();var r=null,a=null;if(i){var c=i.match(/https?:\/\/[^\s]+/i);c?(r=c[0],a=i.replace(c[0],"").trim()||null):a=i}t.escalateChat({name:e,email:n,site_url:r,site_name:a})}else s.querySelector("#chatbot_prompt_name").focus()},s.querySelectorAll("input").forEach(function(t){t.addEventListener("keydown",function(t){"Enter"===t.key&&(t.preventDefault(),s.querySelector("#chatbot-login-prompt-submit").click())})})}},{key:"renderMessages",value:function(){var t,e=this,n=this.messages&&this.messages.length>0,i="resolved"===(null===(t=this.session)||void 0===t?void 0:t.status);this.welcomeScreen&&(this.welcomeScreen.style.display=n||i?"none":"flex"),this.chatMessages.querySelectorAll(".chatbot-message").forEach(function(t){return t.remove()}),this.messages.forEach(function(t){return e.addMessage(t)})}},{key:"addMessage",value:function(t){if(!document.getElementById("chat-message-".concat(t.uuid))){var e=document.createElement("div");e.className="chatbot-message ".concat(t.sender_type);var n=t.pending?" chatbot-message-pending":"",i="";"agent"===t.sender_type&&t.sender_name&&(i='<div class="chatbot-agent-name"><strong>'.concat(this.sanitizeHTML(t.sender_name),"</strong></div>"));var s=this.formatTimestamp(t.created_at),o="user"===t.sender_type,r=(void 0!==t.parsed_message?t.parsed_message:this.formatMessage(t.message,o)).trim(),a="";"bot"===t.sender_type&&(a='<button class="chatbot-disclaimer-btn" onclick="window.chatbot.showDisclaimerModal()" title="'.concat(H("view_disclaimer"),'">\n <i class="fa fa-exclamation-triangle"></i>\n </button>'));var c="".concat(i,'<div class="chatbot-message-content').concat(n,'" id="chat-message-').concat(t.uuid,'">').concat(a).concat(r,'</div><div class="chatbot-message-time">').concat(s,"</div>");e.innerHTML=c,this.chatMessages.appendChild(e),this.chatMessages.scrollTop=this.chatMessages.scrollHeight,this.messages.length>1&&(this.widget.querySelector(".chatbot-quick-suggestions").style.display="none"),this.messages.push(t),this.welcomeScreen&&"none"!==this.welcomeScreen.style.display&&(this.welcomeScreen.style.display="none",this.chatMessages.scrollTop=this.chatMessages.scrollHeight)}}},{key:"sanitizeHTML",value:function(t){if("undefined"!=typeof DOMPurify)return DOMPurify.sanitize(t,{ALLOWED_TAGS:[]});var e=document.createElement("div");return e.textContent=t,e.innerHTML}},{key:"formatMessage",value:function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(t=this.sanitizeHTML(t)),t.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/\n/g,"<br>")}},{key:"formatTimestamp",value:function(t){if(!t)return"";var e=new Date(t),n=new Date;return e.toDateString()===n.toDateString()?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString([],{month:"short",day:"numeric"})+" "+e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}},{key:"showLoading",value:function(t){$("#chatbot-loading").display=t?"flex":"none"}},{key:"showTypingIndicator",value:function(t){var e=this.chatMessages.querySelector(".chatbot-typing-indicator");
2t?e||((e=document.createElement("div")).className="chatbot-message bot chatbot-typing-indicator",e.innerHTML='<div class="chatbot-message-content"><div class="chatbot-typing-animation"><span></span><span></span><span></span></div></div>',this.chatMessages.appendChild(e),this.chatMessages.scrollTop=this.chatMessages.scrollHeight):e&&e.remove()}},{key:"showError",value:function(t){this.addMessage({sender_type:"bot",sender_name:"System",message:"â ï¸ ".concat(t),parsed_message:"â ï¸ ".concat(this.sanitizeHTML(t)),created_at:(new Date).toISOString()})}},{key:"removePendingMessage",value:function(t){var e,n=document.getElementById("chat-message-".concat(t));n&&(null===(e=n.closest(".chatbot-message"))||void 0===e||e.remove()),this.messages=this.messages.filter(function(e){return e.uuid!==t})}},{key:"disableBlockedSession",value:function(t){var e;null!==(e=this.session)&&void 0!==e&&e.uuid&&window.Echo.leave("chat-session.".concat(this.session.uuid)),this.websocketChannel=null,this.isConnected=!1,this.isLiveChat=!1,this.isEscalated=!1,this.disableChatInput(H("chat_disabled")),this.showPostChatActions(!1)}},{key:"connectWebSocket",value:function(){var t=this;this.session&&this.session.uuid&&(this.websocketChannel=window.Echo.channel("chat-session.".concat(this.session.uuid)).listen(".message.sent",function(e){e&&e.message&&("user"!==e.message.sender_type&&(t.isAiResponding=!1,t.enableInputAfterResponse(),t.showTypingIndicator(!1)),t.addMessage(e.message))}).listen(".agent.typing",function(e){e&&void 0!==e.typing&&t.showTypingIndicator(e.typing)}).listen(".chat-session.updated",function(e){"resolved"===e.status?(t.updateLiveChatState(!1),t.disableChatInput(H("session_ended"))):"live_chat"===e.status?t.updateLiveChatState("live_chat"):"escalated"===e.status&&t.updateLiveChatState("escalated")}),this.isConnected=!0)}},{key:"disableChatInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.chatInput.disabled=!0,this.chatInput.placeholder=t||H("chat_disabled"),this.sendButton.disabled=!0,this.escalateButton.style.display="none",this.endLiveChatButton.style.display="none",this.showPostChatActions(!0)}},{key:"enableChatInput",value:function(){this.chatInput.disabled=!1,this.chatInput.placeholder=H("placeholder_type_question"),this.sendButton.disabled=""===this.chatInput.value.trim(),this.showPostChatActions(!1),this.isLiveChat?(this.escalateButton.style.display="none",this.endLiveChatButton.style.display="block"):(this.escalateButton.style.display=this.escalateButtonEnabled?"block":"none",this.endLiveChatButton.style.display="none")}},{key:"disableInputWhileResponding",value:function(){this.chatInput.disabled=!0,this.sendButton.disabled=!0,this.chatInput.placeholder=H("ai_responding")}},{key:"enableInputAfterResponse",value:function(){this.chatInput.disabled&&(this.chatInput.disabled=!1,this.chatInput.placeholder=H("placeholder_type_question"),this.sendButton.disabled=""===this.chatInput.value.trim())}},{key:"showPostChatActions",value:function(t){this.postChatActions&&(this.postChatActions.style.display=t?"flex":"none")}},{key:"emailTranscript",value:(i=D(R().m(function t(){var e,n;return R().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.session){t.n=1;break}return t.a(2);case 1:return this.emailTranscriptButton.disabled=!0,this.emailTranscriptButton.textContent=H("button_sending"),t.p=2,t.n=3,fetch("".concat(this.options.apiBaseUrl,"/sessions/email-transcript"),{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"}});case 3:return e=t.v,t.n=4,e.json();case 4:(n=t.v).success?(this.emailTranscriptButton.textContent=H("button_sent"),this.addMessage({sender_type:"bot",sender_name:H("system_name"),message:H("system_transcript_sent"),created_at:(new Date).toISOString()})):(this.emailTranscriptButton.textContent=H("button_email_transcript"),this.emailTranscriptButton.disabled=!1,this.showError(n.message||H("error_send_transcript"))),t.n=6;break;case 5:t.p=5,t.v,this.emailTranscriptButton.textContent=H("button_email_transcript"),this.emailTranscriptButton.disabled=!1,this.showError(H("error_connection"));case 6:return t.a(2)}},t,this,[[2,5]])})),function(){return i.apply(this,arguments)})},{key:"getCookie",value:function(t){var e="; ".concat(document.cookie).split("; ".concat(t,"="));return 2===e.length?e.pop().split(";").shift():null}},{key:"setCookie",value:function(t,e,n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),document.cookie="".concat(t,"=").concat(e,";expires=").concat(i.toUTCString(),";path=/")}
2},{key:"showDisclaimerModal",value:function(){var t=document.getElementById("chatbot-disclaimer-prompt-overlay");if(t&&t.remove(),!document.getElementById("chatbot-disclaimer-prompt-style")){var e=document.createElement("style");e.id="chatbot-disclaimer-prompt-style",e.textContent="\n #chatbot-disclaimer-prompt-overlay {\n position: fixed;\n top: 0; left: 0; right: 0; bottom: 0;\n background: rgba(0,0,0,0.32);\n z-index: 1000001;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .chatbot-disclaimer-prompt-modal {\n background: #fff;\n border-radius: 12px;\n box-shadow: 0 4px 32px rgba(0,0,0,0.18);\n padding: 28px 28px 18px 28px;\n min-width: 320px;\n max-width: 90vw;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n position: relative;\n }\n .chatbot-disclaimer-prompt-title {\n font-size: 17px;\n font-weight: 600;\n margin-bottom: 8px;\n color: #333;\n text-align: center;\n }\n .chatbot-disclaimer-prompt-desc {\n font-size: 14px;\n color: #444;\n margin-bottom: 18px;\n text-align: center;\n line-height: 1.6;\n }\n .chatbot-disclaimer-prompt-actions {\n display: flex;\n gap: 10px;\n justify-content: center;\n }\n .chatbot-disclaimer-ok {\n background: linear-gradient(45deg, #2180a9 0%, #299ed1 100%);\n border: none;\n color: white;\n min-width: 100px;\n padding: 8px 16px;\n font-size: 14px;\n border-radius: 6px;\n cursor: pointer;\n }\n .chatbot-disclaimer-ok:hover {\n background: linear-gradient(45deg, #1a6a8c 0%, #2180a9 100%);\n }\n .chatbot-disclaimer-prompt-close {\n position: absolute;\n top: 10px;\n right: 12px;\n background: none;\n border: none;\n font-size: 20px;\n color: #888;\n cursor: pointer;\n }\n ",document.head.appendChild(e)}var n=document.createElement("div");n.id="chatbot-disclaimer-prompt-overlay",n.tabIndex=-1,n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true");var i=document.createElement("div");i.className="chatbot-disclaimer-prompt-modal",i.innerHTML='\n <button class="chatbot-disclaimer-prompt-close" title="'.concat(H("button_close"),'" aria-label="').concat(H("button_close"),'">×</button>\n <div class="chatbot-disclaimer-prompt-title">').concat(H("ai_disclaimer_title"),'</div>\n <div class="chatbot-disclaimer-prompt-desc">').concat(H("ai_disclaimer_message"),'</div>\n <div class="chatbot-disclaimer-prompt-actions">\n <button type="button" class="chatbot-disclaimer-ok">').concat(H("button_close"),"</button>\n </div>\n "),n.appendChild(i),document.body.appendChild(n);var s=function(){n.remove()};i.querySelector(".chatbot-disclaimer-prompt-close").onclick=s,i.querySelector(".chatbot-disclaimer-ok").onclick=s,n.onclick=function(t){t.target===n&&s()},document.addEventListener("keydown",function t(e){"Escape"===e.key&&(s(),document.removeEventListener("keydown",t))})}},{key:"closeDisclaimerModal",value:function(){var t=document.getElementById("chatbot-disclaimer-prompt-overlay");t&&t.remove()}}],e&&N(t.prototype,e),n&&N(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,i,s,o,r,a,c,h,l,d,u,p}();document.addEventListener("DOMContentLoaded",function(){var t,e;window.chatbot=new W({siteType:(t="undefined"!=typeof isMfr&&isMfr,e="undefined"!=typeof isWebsiteWorks&&isWebsiteWorks,t?"myfunrun":e?"websiteworks":"myevent"),apiBaseUrl:"/api/v1/chatbot",internalChat:"undefined"!=typeof internalChat&&internalChat,escalateButtonEnabled:"undefined"==typeof escalateButtonEnabled||escalateButtonEnabled,supportHours:"undefined"!=typeof supportHours?supportHours:null,agentAvailable:"undefined"==typeof agentAvailable||agentAvailable,userName:"undefined"!=typeof userFirstName?userFirstName:null})}),$(function(){$('[data-bs-toggle="tooltip"]').tooltip()})})()})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.