'+i+''+D('max_agent',W).replace('{{operator}}',t).replace('{{agent}}',t)+' '+Ht(e).replace(/({{newline}})/gm,"
")+'
'+D('max_agent',W).replace('{{operator}}',a).replace('{{agent}}',a)+' '+Ht(e).replace(/({{newline}})/gm,"
")+'
'+D('max_me',W)+'\t'+'[loading...]'+'
','me');if(t==1){f()}return true}};SaveToFile=function(e){try{if(U('chattext')!=""){document.getElementById("onwebchat-widget-settings-submenu-ul").style.setProperty("display","none");var t=new Date;var n=t.getFullYear()+'-'+(t.getMonth()+1)+'-'+t.getDate();var o='Chat transcript from '+qn(window.location.href)+' on '+n+'
'+D('max_me',W)+'\t'+Ht(t)+'
','me');je="me";C=B();obj={};obj.version=te;obj.url=window.location.href;obj.userAgent=navigator.userAgent;obj.realAgentOnline=R;obj.agentOnline=q;obj.durationInSeconds=(C-ne)/1e3;obj.socketDurationInSeconds=(C-k)/1e3;obj.isConnected=X;obj.firstConnection=G;obj.timeoutTime_userconnect=T;obj.tryToReconnect=Y;obj.pos=3850;if(U('chattext')){obj.chattext=U('chattext').substring(0,20)}let e=0;if(!X){e=5400;if(X==false&&Y==false){obj.socketReconnect=1;gn()}}setTimeout(function(){C=B();obj.durationInSeconds2=(C-ne)/1e3;obj.socketDurationInSeconds2=(C-k)/1e3;obj.isConnected2=X;obj.tryToReconnect2=Y;obj.firstConnection2=G;obj.timeoutTime_userconnect2=T;obj.sendChatDelay=e;setTimeout(function(){J.emit('sendchat',t,undefined,0,ot,3850,we,Q,Pt,obj)},400)},e);Ot(1);Ot(2);Se="chat";fn();return false}};if(document.getElementById('onwc_consent_checkbox_offline'))document.getElementById('onwc_consent_checkbox_offline').addEventListener('change',function(){if(document.getElementById("onwc_consent_checkbox_offline").checked==true){document.getElementById("onwc_consent_l_offline_span").style.setProperty("color","#545454","important")}});if(document.getElementById('onwc_consent_checkbox_prechat'))document.getElementById('onwc_consent_checkbox_prechat').onchange=function(){if(document.getElementById("onwc_consent_checkbox_prechat").checked==true){document.getElementById("onwc_consent_l_prechat_span").style.setProperty("color","#545454","important")}};if(document.getElementById('onwebchatoffemail'))document.getElementById('onwebchatoffemail').onkeyup=function(){if(dn(document.getElementById('onwebchatoffemail').value)){document.getElementById("onwebchatoffemail").style.setProperty("border","1px solid #ccc","important");ee()}};if(document.getElementById('onwebchatemailtext'))document.getElementById('onwebchatemailtext').onkeyup=function(){if(document.getElementById('onwebchatemailtext').value.length>=1){document.getElementById("onwebchatemailtext").style.setProperty("border","1px solid #ccc","important");ee()}};if(document.getElementById('onwebchatofftel'))document.getElementById('onwebchatofftel').onkeyup=function(){checkPhone(document.getElementById('onwebchatofftel'));if(document.getElementById('onwebchatofftel').value.length>=4){document.getElementById("onwebchatofftel").style.setProperty("border","1px solid #ccc","important");ee()}};if(document.getElementById('onwebchatoffname'))document.getElementById('onwebchatoffname').onkeyup=function(){if(document.getElementById('onwebchatoffname').value.length>=2){document.getElementById("onwebchatoffname").style.setProperty("border","1px solid #ccc","important");ee()}};if(document.getElementById('onprechatemail'))document.getElementById('onprechatemail').onkeyup=function(){if(dn(document.getElementById('onprechatemail').value)){document.getElementById("onprechatemail").style.setProperty("border","1px solid #ccc","important");ee()}};document.getElementById('onprechattext').onkeyup=function(){if(document.getElementById('onprechattext').value.length>=1){document.getElementById("onprechattext").style.setProperty("border","1px solid #ccc","important");ee()}};if(document.getElementById('onprechattel'))document.getElementById('onprechattel').onkeyup=function(){checkPhone(document.getElementById('onprechattel'));if(document.getElementById('onprechattel').value.length>=4){document.getElementById("onprechattel").style.setProperty("border","1px solid #ccc","important");ee()}};if(document.getElementById('onprechatname'))document.getElementById('onprechatname').onkeyup=function(){if(document.getElementById('onprechatname').value.length>=2){document.getElementById("onprechatname").style.setProperty("border","1px solid #ccc","important");ee()}};loadEmoticons=function(){if(document.getElementById('onwebchat-emoticons-div').innerHTML==""){document.getElementById('onwebchat-emoticons-div').insertAdjacentHTML('beforeend','😉 😀 🙂 😂 😃 😁'+D('max_me',W)+'\t'+Ht(e)+'
',"me");je="me"});J.on('updatechat',function(e,t,n,o){if(o==null||o=="")o="operator";if(o=='aibot'){Te=1;V("chatWithBot",1);L=ft;document.getElementById('onwbtxtarea').maxLength=ke;if(document.getElementById("operatorImage"))document.getElementById("operatorImage").setAttribute('src',$+'//'+serverIP+'/filesUpload/operatorImages/'+ft);V("servingOpImage",ft)}else{Te=0;V("chatWithBot",0)}if(n=='command:typing...'){if(document.getElementById('agenttypingimage'))document.getElementById('agenttypingimage').remove();let e="";if(fe==1){e=" big-margin-left "}if(U('chattext')!=null&&U('chattext')!=''){document.getElementById('chat_area_id').insertAdjacentHTML("beforeend","'+a+''+D('max_agent',W).replace('{{operator}}',o).replace('{{agent}}',o)+' '+Ht(n)+'
');je="agent";if(e!=""&&U('maxChat')!=1){MaximizeWindowInit()}if(q!=1){if(U('chattext')!=null&&U('chattext')!=''){}vn()}if(document.getElementById('prechat_form').style.display=='block'){vn()}ie=1;V("AHSALOM",1)}});removeLoadingImage=function(e){if(document.getElementById(e))document.getElementById(e).style.background="none";Ln(document.getElementById('chat_area_id'),10,10)};var t=0;var n=0;var o=0;var l="";function i(){if(K){document.getElementById("onwbtxtarea").blur()}if(h==1){return}var n=document.getElementById('onwbtxtarea').value;document.getElementById('onwbtxtarea').value="";document.getElementById("onwbtxtarea").placeholder=D('max_placeholder',W);if(n.trim()!=""){var e="";e=" me-bubble";var o="";if(je!="me"){e=e+" me-first "}l=n;de(n,"visitor");n=n.replace(/\n/g,"{{newline}}");var i="";if(isRTLlanguage(n.substr(0,1))==true){i=' style="direction: rtl;text-align:right;" '}Nn(''+D('max_me',W)+'\t'+Ht(n)+'
',"me");je="me";if(_t==0||_t==1&&ie==0){Ot(2)}oe=1;C=B();obj={};obj.version=te;obj.url=window.location.href;obj.userAgent=navigator.userAgent;obj.realAgentOnline=R;obj.agentOnline=q;obj.durationInSeconds=(C-ne)/1e3;obj.socketDurationInSeconds=(C-k)/1e3;obj.isConnected=X;obj.tryToReconnect=Y;obj.firstConnection=G;obj.timeoutTime_userconnect=T;obj.pos=5183;if(U('chattext')){obj.chattext=U('chattext').substring(0,20)}let t=300;if(!X){t=900;if(X==false&&Y==false){obj.socketReconnect=1;gn()}}if(Yt('sessionStorage')&&U('mustSendTriggerText')||!Yt('sessionStorage')&&_==true){const a=U('triggerText');setTimeout(function(){J.emit('sendchat',n,a,0,0,5183,we,Q,Pt,obj)},t);V('mustSendTriggerText',false);_=false;Ut('triggerText')}else{setTimeout(function(){C=B();obj.durationInSeconds2=(C-ne)/1e3;obj.socketDurationInSeconds2=(C-k)/1e3;obj.isConnected2=X;obj.tryToReconnect2=Y;obj.firstConnection2=G;obj.timeoutTime_userconnect2=T;obj.sendChatDelay=t;obj.pos=5191;let e=300;if(!X){e=5300}setTimeout(function(){C=B();obj.durationInSeconds3=(C-ne)/1e3;obj.socketDurationInSeconds3=(C-k)/1e3;obj.isConnected3=X;obj.tryToReconnect3=Y;obj.firstConnection3=G;obj.timeoutTime_userconnect3=T;obj.sendChatDelay2=e;obj.pos=5191;J.emit('sendchat',n,undefined,0,0,5191,we,Q,Pt,obj)},e)},t)}}t=0}function a(){var e=document.getElementById('onwbtxtarea').value;if(e.trim()!=""&&h==0){C=B();obj={};obj.version=te;obj.url=window.location.href;obj.userAgent=navigator.userAgent;obj.realAgentOnline=R;obj.agentOnline=q;obj.durationInSeconds=(C-ne)/1e3;obj.socketDurationInSeconds=(C-k)/1e3;obj.isConnected=X;obj.firstConnection=G;obj.timeoutTime_userconnect=T;obj.tryToReconnect=Y;obj.pos=5217;if(U('chattext')){obj.chattext=U('chattext').substring(0,20)}J.emit('sendchat',e,undefined,1,0,5217,we,Q,Pt,obj)}}document.getElementById("onwc_chat_message_div").addEventListener("paste",function(e){if(X==false&&Y==false){gn()}setTimeout(function(){checkText2ShowSendButton()},0)});document.getElementById("onwc_chat_message_div").addEventListener("keydown",function(e){if(e.key=="Enter"&&!e.shiftKey){e.preventDefault();if(!Ce){i();clearTimeout(o);o=0}}else{if(ue!=1&&U('hasStartedWriting')!=1){E();V('hasStartedWriting',1)}ue=1;if(X==false&&Y==false){gn()}if(t==0&&h==0){if(Te!=1){C=B();obj={};obj.version=te;obj.url=window.location.href;obj.userAgent=navigator.userAgent;obj.realAgentOnline=R;obj.agentOnline=q;obj.durationInSeconds=(C-ne)/1e3;obj.socketDurationInSeconds=(C-k)/1e3;obj.isConnected=X;obj.firstConnection=G;obj.timeoutTime_userconnect=T;obj.tryToReconnect=Y;obj.pos=5265;if(U('chattext')){obj.chattext=U('chattext').substring(0,20)}J.emit('sendchat','command:typing...',undefined,0,0,5265,we,Q,Pt,obj)}t=1}let e=200;if(Oe=='free'){e=1500}if(1==1){if(o==0){o=setTimeout(function(){a();o=0},e)}}clearTimeout(n);n=setTimeout(function(){t=0;clearTimeout(o);if(Te!=1){C=B();obj={};obj.version=te;obj.url=window.location.href;obj.userAgent=navigator.userAgent;obj.realAgentOnline=R;obj.agentOnline=q;obj.durationInSeconds=(C-ne)/1e3;obj.socketDurationInSeconds=(C-k)/1e3;obj.isConnected=X;obj.firstConnection=G;obj.timeoutTime_userconnect=T;obj.tryToReconnect=Y;obj.pos=5281;if(U('chattext')){obj.chattext=U('chattext').substring(0,20)}J.emit('sendchat','command:notyping...',undefined,0,0,5281,we,Q,Pt,obj)}},1800)}});document.getElementById("wb-send-image").addEventListener("click",function(e){i();if(!K)document.getElementById("onwbtxtarea").focus();checkText2ShowSendButton()});isRTLlanguage=function(e){var t=/[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\uFB50-\uFC3F\uFE70-\uFEFC]/;result=t.test(e);return result};function s(){if(isRTLlanguage(D('max_placeholder',W).trim().substring(0,2))){r("rtl","right")}else{r("","left")}}s();document.getElementById("onwc_chat_message_div").addEventListener("keyup",function(e){if(e.key=='ArrowUp'&&document.getElementById('onwbtxtarea').value==''){document.getElementById('onwbtxtarea').value=l}if(document.getElementById('onwbtxtarea').value.trim().substring(0,2)!=""){if(isRTLlanguage(document.getElementById('onwbtxtarea').value.trim().substring(0,2))){r("rtl","right")}else{r("","left")}}else if(document.getElementById('onwbtxtarea').value==""){s()}if(N==1&&z('consentvalue')!=1&&z('consentvalue')!=2){toggleModal("onwcConsentModal",true)}checkText2ShowSendButton()});checkText2ShowSendButton=function(){if(document.getElementById('onwbtxtarea').value.trim()==""){document.getElementById("wb-send-image").style.visibility="hidden";if(Le&&kn()){document.getElementById("wb-mic-image").style.visibility="visible";document.getElementById("wb-mic-image").style.display="block"}}else{document.getElementById("wb-send-image").style.visibility="visible";document.getElementById("wb-mic-image").style.visibility="hidden";document.getElementById("wb-mic-image").style.display="none"}};checkText2ShowSendButton();function r(e,t){document.getElementById('onwbtxtarea').style.setProperty("direction",e,"important");document.getElementById('onwbtxtarea').style.setProperty("text-align",t,"important")}document.getElementById('onwebchatemailtext').addEventListener("keyup",function(e){if(isRTLlanguage(document.getElementById('onwebchatemailtext').value.substring(0,2))){document.getElementById("onwebchatemailtext").style.setProperty("direction","rtl","important");document.getElementById("onwebchatemailtext").style.setProperty("text-align","right","important")}else{document.getElementById("onwebchatemailtext").style.setProperty("direction","","important");document.getElementById("onwebchatemailtext").style.setProperty("text-align","left","important")}});document.getElementById('onprechattext').addEventListener("keyup",function(e){if(isRTLlanguage(document.getElementById("onprechattext").value.substring(0,2))){document.getElementById("onprechattext").style.setProperty("direction","rtl","important");document.getElementById("onprechattext").style.setProperty("text-align","right","important")}else{document.getElementById("onprechattext").style.setProperty("direction","","important");document.getElementById("onprechattext").style.setProperty("text-align","left","important")}});var c=0;var m,u;var d=parseInt(document.getElementById("onwbchat_window").style.getPropertyValue('width'));function g(){window.removeEventListener('mousemove',f,true)}function p(e){var t;if(e.target)t=e.target;else if(e.srcElement)t=e.srcElement;if(t.id!="onweb_minimize_btn_icon_id"){if(U('maxChat')==1){c=1;window.addEventListener('mousemove',f,true);document.getElementById("webchat_header").style.setProperty('cursor','move')}}}function f(e){var t=window.innerHeight;var n=Math.max(document.documentElement["clientWidth"],document.body["scrollWidth"],document.documentElement["scrollWidth"],document.body["offsetWidth"],document.documentElement["offsetWidth"]);var o=parseInt(document.getElementById("onwbchat_window").style.getPropertyValue('height'));var i=parseInt(document.getElementById("onwbchat_window").offsetWidth);var a=e.clientX,l=e.clientY;if(c==1){var s=document.body.scrollTop;var r=document.body.scrollLeft;divTop=document.getElementById('onwbchat_window').offsetTop-s;divLeft=document.getElementById('onwbchat_window').offsetLeft-r;m=a-divLeft;u=l-divTop}c=0;ae=1;var d=document.getElementById('onwbchat_window');d.style.position='absolute';v=l-u;if(l-u<0)v=0;if(l-u>t-o)v=t-o;d.style.top=v+'px';w=a-m;if(a-m<0)w=0;if(a-m>n-i)w=n-i;d.style.left=w+'px'}try{if(!K){document.getElementById('webchat_header').addEventListener('mousedown',p,false)}document.getElementById('onweb_minimize_btn_icon_id').removeEventListener('mousedown',p);window.addEventListener('mouseup',g,false)}catch(e){}setTimeout(function(){ce()},500)}function Nn(t,e,n){Ot(1);if(n&&U('maxChat')==1){n=false}if(e==undefined)e="";let o="onwcouter_agent";if(e=="me"){o="onwcouter_me"}if(document.getElementById("onwc_welcome_message"))document.getElementById('onwc_welcome_message').style.display="none";if(document.getElementById("triangle_down"))document.getElementById("triangle_down").style.setProperty("display","none");t=Zn(t);let i=/(\b(https?|ftp|file):\/\/(?![-A-Z0-9+\/:.]*filesUpload\/operatorImages)[-A-Z0-9+&@#\/%?=~_|!:,.;()]*[-A-Z0-9+&@#\/%=~_|()])/gi;let a;if(!Fn(t)){a=t.match(i)}else{}if(a!=null){a=a[0];var l=qn(a);if(l==qn(window.location.href)){t=t.replace(i,"$1")}else t=t.replace(i,"$1")}let s=/(^|[^\/])(www\.[-A-Z0-9+&@#\/%?=~_|!:,.;()]*[-A-Z0-9+&@#\/%=~_|()])/gi;let r;if(!Fn(t)){r=t.match(s)}else{}if(r!=null){r=r[0];var l=qn(r);if(l==qn(window.location.href))t=t.replace(s,"$1$2");else t=t.replace(s,"$1$2")}var d=false;while(t.indexOf("{{fileuploaded:")>-1){var c=t.indexOf("{{fileuploaded:")+1;var m=t.indexOf("{{fileuploaded:")+15;var u=t.indexOf("}}",m);var g=t.substring(m,u);var p=g.replace(/^.*[\\\/]/,'');var f="";if(p.toLowerCase().endsWith(".png")||p.toLowerCase().endsWith(".jpg")||p.toLowerCase().endsWith(".jpeg")||p.toLowerCase().endsWith(".svg")||p.toLowerCase().endsWith(".gif")){d=true;Pe++;f=']*>/,'').replace(/<\/p>$/,'');return i}function Fn(e){var t=/]*href=["']/i;return t.test(e)}function Dn(e){const t=/\*\*(.*?)\*\*/g;return e.replace(t,'$1')}function Zn(e){if(e){const t=/\[([^\]]+)\]\(((http:\/\/|https:\/\/|www\.)[^\)]+)\)/g;const n=e.replace(t,(e,t,n)=>{if(n.startsWith("www.")){n="https://"+n}let o=qn(n);if(o==qn(window.location.href)){return`${t}`}else{return`${t}`}});return n}else return""}let zn=900;let Un=null;return{init:function(e){tn=e},set:function(e,t){if(e=="name"&&h==0){P=t;try{J.emit('setclientdetails',Q,A,P,"","","")}catch(e){}}else if(e=="email"&&h==0){j=t;try{J.emit('setclientdetails',Q,A,"",j,"","")}catch(e){}}else if(e=="phone"&&h==0){M=t;try{J.emit('setclientdetails',Q,A,"","",M,"")}catch(e){}}else if(e=="notes"&&h==0){I=t;try{J.emit('setclientdetails',Q,A,"","","",I)}catch(e){}}else if(e=="pageUrl"&&h==0){try{J.emit('setclientpageurl',Q,A,"",t)}catch(e){}}else if(e=="pageTitle"&&h==0){try{J.emit('setclientpageurl',Q,A,t,"")}catch(e){}}else if(e=="max"&&h==0){if(t==1){pn();document.getElementById("onwbtxtarea").focus()}else if(t==0){yn()}}else if(e=="show"&&h==0){if(t==1){O=1;vn()}else if(t==0){O=0;bn()}}else if(e=="online"&&h==0){}else if(e=="hideImage"&&h==0){if(t==1){}else if(t==0){}}else if(e=="language"&&h==0){W=t}else if(e=="languageFile"&&h==0){}else if(e=="onClick"&&h==0){re=t}else if(e=="onMaximize"&&h==0){l=t}else if(e=="onMinimize"&&h==0){s=t}else if(e=="onTrigger"&&h==0){r=t}else if(e=="onStartWriting"&&h==0){E=t}else if(e=="onUpdateOperators"&&h==0){x=t}else if(e=="onNewMessage"&&h==0){de=t}else if(e=="onWebChatLoaded"&&h==0){ce=t}else if(e=="onlineColor"&&h==0){me=t;if(q==1&&me!=""){document.getElementById("webchat_header").style.setProperty('background-color',me,'important')}}else if(e=="offlineColor"&&h==0){S=t;if(q!=1&&S!=""){document.getElementById("webchat_header").style.setProperty('background-color',S,'important');document.getElementById("offlineform_btn").style.setProperty('background-color',S,'important')}}},get:function(e){if(e=="name"){return P}else if(e=="email"){return j}else if(e=="phone"){return M}else if(e=="notes"){return I}else if(e=="status"){if(q==1)return"online";else return"offline"}else return""}}}();