!function(){"use strict";const t=window?.bit_assist_?.api?.base,i="1"!==window?.bit_assist_?.isDev?`${t}/iframe`:"http://localhost:5000",o=new URL(i).origin,e=window?.bit_assist_?.api?.separator||"?",n="http:"===window.location.protocol?"i":"s",a="localhost"===window.location.hostname?window.location.host:window.location.hostname,s=window.location.href,d=document.documentElement.offsetWidth,r=window.innerHeight;let c="100px",w="100px",l=0;const h=`\n#bit-assist-widget-container{--ba-top:auto;--ba-left:auto;--ba-bottom:10;--ba-right:10;position:fixed;z-index:2147483646;bottom:0;right:0;width:${w};height:${c};max-width:100%}\n#bit-assist-widget-container.bottom-right{left:var(--ba-left);right:var(--ba-right);top:var(--ba-top);bottom:var(--ba-bottom)}\n#bit-assist-widget-container.bottom-left{left:var(--ba-left);right:var(--ba-right);top:var(--ba-top);bottom:var(--ba-bottom)}\n#bit-assist-widget-container.top-right{left:var(--ba-left);right:var(--ba-right);top:var(--ba-top);bottom:var(--ba-bottom)}\n#bit-assist-widget-container.top-left{left:var(--ba-left);right:var(--ba-right);top:var(--ba-top);bottom:var(--ba-bottom)}\n#bit-assist-widget-iframe{width:100%;height:100%;border:none;}\n.bit-assist-hide{visibility:hidden;pointer-events:none}\n`,p=document.createElement("style");p.appendChild(document.createTextNode(h));const u=document.createElement("div");u.id="bit-assist-widget-container",T();const f=document.createElement("iframe");function b(t,i=!1){const o=window.scrollY,e=document.body.offsetHeight,n=window.innerHeight,a=Math.round(o/(e-n)*100);if(!i)return a;!l&&a>=i?(l=1,g(a)):l&&a{u.classList.contains("bit-assist-open")&&!t.target.closest("#bit-assist-widget-container")&&f.contentWindow.postMessage({action:"clickOutside"},o)})),window.addEventListener("message",(i=>{if(i.origin!==o)return;const{action:e}=i.data;if("getClientInfo"===e){const i=b();f.contentWindow.postMessage({action:"windowLoaded",url:s,winWidth:d,winHeight:r,scrollPercent:i,apiEndPoint:t},o)}else if("widgetLoaded"===e){const{height:t,width:o,position:e,top:n,bottom:a,left:s,right:d,pageScroll:r}=i.data;!function(t,i,o,e,n){t.includes("top")&&u.style.setProperty("--ba-top",`${i}px`);t.includes("bottom")&&u.style.setProperty("--ba-bottom",`${o}px`);t.includes("left")&&u.style.setProperty("--ba-left",`${e}px`);t.includes("right")&&u.style.setProperty("--ba-right",`${n}px`)}(e,n,a,s,d),u.classList.remove("bit-assist-hide"),u.classList.add(e),m(o,t),r>0&&window.addEventListener("scroll",(t=>b(0,r)))}else if("widgetOpen"===e){C()&&!0===Boolean(window.Tawk_API?.isChatMaximized?.())&&window.Tawk_API?.minimize();const{isWidgetOpen:t}=i.data;u.classList.toggle("bit-assist-open",t)}else if("removeWidget"===e)u.remove(),p.remove();else if("resetWidgetSize"===e){const{height:t,width:o}=i.data;m(o,t)}else if("chatWidgetClick"===e){const{chatWidgetName:t}=i.data;!function(t){L(),"tawk"===t&&function(){if(!v)return x("Tawk"),null;try{window.Tawk_API.showWidget(),window.Tawk_API.toggle(),T()}catch(t){console.log(t),x("Tawk"),_()}}();"crisp"===t&&function(){if(!A)return x("Crisp"),null;try{window.$crisp.push(["do","chat:show"]),window.$crisp.push(["do","chat:toggle"]),T()}catch{x("Crisp"),_()}}();"intercom"===t&&function(){if(!$)return x("Intercom"),null;try{window.Intercom("show"),T()}catch(t){console.log(t),x("Intercom"),_()}}();"tidio"===t&&function(){if(!y)return x("Tidio"),null;try{window.tidioChatApi.open(),window.tidioChatApi.show(),T()}catch(t){console.log(t),x("Tawk"),_()}}()}(t)}else if("bitAssistChannelClick"===e){const{channelInfo:t}=i.data;window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"bitAssistChannel",...t})}})),window.addEventListener("load",(()=>{C()&&(window.Tawk_API.onLoad=function(){v=!0,window.Tawk_API.hideWidget()},window.Tawk_API.onChatMinimized=function(){window.Tawk_API.hideWidget(),_()}),I()&&(A=!0,window.$crisp.push(["do","chat:hide"]),window.$crisp.push(["on","chat:closed",function(){window.$crisp.push(["do","chat:hide"]),_()}])),k()&&($=!0,window.Intercom("update",{hide_default_launcher:!0}),window.Intercom("onShow",(()=>{T()})),window.Intercom("onHide",(()=>{_()}))),P()&&(window.tidioChatApi.hide(),window.tidioChatApi.on("ready",(()=>{y=!0,window.tidioChatApi.hide()})),window.tidioChatApi.on("close",(()=>{_(),window.tidioChatApi.hide()})))}));let v=!1,y=!1,A=!1,$=!1;function C(){return"undefined"!=typeof Tawk_API}function I(){return"undefined"!=typeof $crisp}function k(){return"undefined"!=typeof Intercom}function P(){return"undefined"!=typeof tidioChatApi}function _(){u.classList.remove("bit-assist-hide"),L()}function L(){C()&&window.Tawk_API?.minimize?.(),I()&&window.$crisp?.push?.(["do","chat:hide"]),k()&&window.Intercom?.("hide"),P()&&window.tidioChatApi?.hide?.()}function T(){u.classList.add("bit-assist-hide")}function x(t){return alert(`Sorry, ${t} is not loaded yet!`)}}();