function htmlUnescape(e){return String(e).replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function ajaxCall(e,t,n){var o=!1,i=!1;return window.XMLHttpRequest&&(o=new XMLHttpRequest,"withCredentials"in o&&(i=!0)),o?(o.onreadystatechange=function(){n&&4==this.readyState&&200==this.status&&n(this.responseText)},t?(o.open("POST",e,!0),o.setRequestHeader&&o.setRequestHeader("Content-type","text/plain")):o.open("GET",e,!0),i&&(o.withCredentials=!0),void(t?o.send(JSON.stringify(t)):o.send(null))):!1}function insertContent(e,t,n){if(!_TConnecto.messageContentInserted[n.id]&&null!=e){if(n.notification.hasDynamicContent&&n.notification.segmentId&&""!==n.notification.segmentId&&n.notification.segmentEvalFunctionResult.result){if(Array.isArray(n.notification.segmentEvalFunctionResult.attrDetails)&&n.notification.segmentEvalFunctionResult.attrDetails.length>0&&Array.isArray(n.notification.segmentEvalFunctionResult.attrDetails[0].events)&&n.notification.segmentEvalFunctionResult.attrDetails[0].events.length>0)var o=n.notification.segmentEvalFunctionResult.attrDetails[0].events[0].properties||n.notification.segmentEvalFunctionResult.attrDetails[0].events[0].data||{};t=_TConnecto.Mustache.render(t,{dynamicContentVariables:_TConnecto.getVariables(),dataLayer:_TConnecto.dataLayer,segmentResult:o})}e.contentWindow.document.open("text/html","replace"),e.contentWindow.document.write(t),e.contentWindow.document.close(),_TConnecto.messageContentInserted[n.id]=!0}}function _getWindowHeight(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0}function _getWindowYscroll(){return window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop||0}function _getDocHeight(){return Math.max(document.body.scrollHeight||0,document.documentElement.scrollHeight||0,document.body.offsetHeight||0,document.documentElement.offsetHeight||0,document.body.clientHeight||0,document.documentElement.clientHeight||0)}function getScrollPercentage(){return(_getWindowYscroll()+_getWindowHeight())/_getDocHeight()*100}function isScrollable(){return _getDocHeight()>_getWindowHeight()}function toggleOnEnterExit(e){e.notification.exitIntent.toggleOnEnterExitVar&&(document.getElementsByTagName("html")[0].addEventListener("mouseenter",function(){document.getElementById("connecto-modal-overlay-"+e.id).style.display="none",document.getElementById("connecto_"+e.id+"_bg_element").style.display="none"}),document.getElementsByTagName("html")[0].addEventListener("mouseleave",function(){document.getElementById("connecto-modal-overlay-"+e.id).style.display="block",document.getElementById("connecto_"+e.id+"_bg_element").style.display="block"}))}function showContent(e,t,n,o,i){if(o>0&&isScrollable())window.addEventListener("scroll",function(){getScrollPercentage()>o?_TConnecto.messageContentInserted[i.id]&&i.notification.hideOnScrollUp?0==_getWindowYscroll()?document.getElementById("container-notification-frame-"+i.id).contentWindow.hideIfShown():document.getElementById("container-notification-frame-"+i.id).contentWindow.showIfHidden():_TConnecto.segmentAndClientSideVariablesOk(i)&&insertContent(e,t,i):_TConnecto.messageContentInserted[i.id]&&i.notification.hideOnScrollUp&&document.getElementById("container-notification-frame-"+i.id).contentWindow.hideIfShown()},!1);else if(i.notification.exitIntent&&i.notification.exitIntent.showExitIntent)i.notification.dontShowAfter&&i.notification.dontShowAfter>0&&_TConnecto.timeouts.push(setTimeout(function(){_TConnecto.idToExitIntentObjMap[i.id]&&_TConnecto.idToExitIntentObjMap[i.id].disable&&_TConnecto.idToExitIntentObjMap[i.id].disable()},1e3*i.notification.dontShowAfter)),_TConnecto.timeouts.push(setTimeout(function(){var n=exitIntentLib(document.getElementById("container-notification-frame-"+i.id),{agressive:i.notification.exitIntent.useAgressiveMode||!1,sensitivity:i.notification.exitIntent.sensitivity||65,cookieExpire:i.notification.exitIntent.cookieExpire||0,timer:i.notification.exitIntent.timer||0,cookieDomain:i.notification.exitIntent.cookieDomain||"",id:i.id,callback:function(){_TConnecto.segmentAndClientSideVariablesOk(i)&&(insertContent(e,t,i),toggleOnEnterExit(i))}});_TConnecto.idToExitIntentObjMap[i.id]=n},n));else if(i.notification.notificationOriginSelector){var a=i.notification.notificationOriginSelector.split(",");for(var c in a)for(var s=document.querySelectorAll(a[c].trim())||[],r=0;r=0&&(o=!0);break;case 2:-1===t.indexOf(n)&&(o=!0);break;case 3:t==n&&(o=!0);break;case 4:t!=n&&(o=!0);break;case 5:t>n&&(o=!0);break;case 6:n>t&&(o=!0);break;case 7:t>=n&&(o=!0);break;case 8:n>=t&&(o=!0);break;case 9:null!=t&&(o=!0);break;case 10:null==t&&(o=!0)}return o}function _processConnectoMessages(){if(_TConnecto.messages)for(var e=0;e<_TConnecto.messages.length;e++){var t=_TConnecto.messages[e];if(!_TConnecto.messageProcessed[t.id]&&!_TConnecto.messageContentInserted[t.id]&&(!t.notification.hasDynamicContent||_TConnecto.Mustache)&&(_TConnecto.pageLoaded||12!==t.notification.notification_type)&&(_TConnecto.pageLoaded&&_TConnecto.Sizzle||!t.notification.clientSideVariableMatches||!(t.notification.clientSideVariableMatches.length>0))){var n=htmlUnescape(t.snippet);_TConnecto.messageMap[t.id]=t,_TConnecto.messageProcessed[t.id]=!0;var o;if(12===t.notification.notification_type)_TConnecto.embedElements[t.notification.embeddedSlot]?(o=_TConnecto.embedElements[t.notification.embeddedSlot],o.innerHTML=n):_TConnecto.messageContentInserted[t.id]=!0;else if(o=document.createElement("div"),o.setAttribute("id","connecto_"+t.id),o.innerHTML=n,document.body)document.body.insertBefore(o,null);else{var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(o,i)}if(5!==t.notification.closeBehaviour){var a=document.getElementById("container-notification-frame-"+t.id),c=htmlUnescape(t.innerHTML);!t.notification.hasDynamicContent||t.notification.segmentId&&""!==t.notification.segmentId||(c=_TConnecto.Mustache.render(c,{dynamicContentVariables:_TConnecto.getVariables(),dataLayer:_TConnecto.dataLayer})),showContent(a,c,t.delay,t.scroll,t)}}}}function __co_loadMustache(){var e;"undefined"!=typeof Mustache&&(e=Mustache),"undefined"!=typeof require&&"undefined"!=typeof requirejs&&require&&requirejs?(require.config({paths:{_co_mustache:"https://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.8.1/mustache.min"}}),require(["_co_mustache"],function(e){_TConnecto.Mustache=e})):_loadScript("https://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.8.1/mustache.min.js",function(){Mustache&&(_TConnecto.Mustache=Mustache,Mustache=e,_processConnectoMessages())})}function exitIntentLib(e,t){function n(e,t){return"undefined"==typeof e?t:e}function o(e){var t=24*e*60*60*1e3,n=new Date;return n.setTime(n.getTime()+t),"; expires="+n.toGMTString()}function i(){b.addEventListener("mouseleave",a),b.addEventListener("mouseenter",c),b.addEventListener("keydown",s)}function a(e){e.clientY>m||r("viewedOnExit"+h,"true")&&!g||(y=setTimeout(l,C))}function c(e){y&&(clearTimeout(y),y=null)}function s(e){E||r("viewedOnExit"+h,"true")&&!g||e.metaKey&&76==e.keyCode&&(E=!0,y=setTimeout(l,C))}function r(e,t){var n=document.cookie.split("; ").reduce(function(e,t){var n=t.split("=");return e[n[0]]=n[1],e},{});return n[e]===t}function l(){d(),_()}function d(){e&&(e.style.display="block"),u()}function u(e){var e=e||{};"undefined"!=typeof e.cookieExpire&&(T=o(e.cookieExpire)),e.sitewide===!0&&(v=";path=/"),"undefined"!=typeof e.cookieDomain&&(p=";domain="+e.cookieDomain),document.cookie="viewedOnExit"+h+"=true"+T+p+v,b.removeEventListener("mouseleave",a),b.removeEventListener("mouseenter",c),b.removeEventListener("keydown",s)}var t=t||{},g=t.aggressive||!1,m=n(t.sensitivity,65),f=n(t.timer,1e3),C=n(t.delayExit,200),_=t.callback||function(){},T=o(t.cookieExpire)||"",p=t.cookieDomain?";domain="+t.cookieDomain:"",v=t.sitewide===!0?";path=/":"",h=t.id||"",y=null,b=document.getElementsByTagName("html")[0];setTimeout(i,f);var E=!1;return{fire:d,disable:u}}var _TConnecto=_TConnecto||{};_TConnecto.initPage=function(){if(_TConnecto.clearMessages(),_TConnecto.initialized=!1,_TConnecto.pageLoaded=_TConnecto.pageLoaded||!1,_TConnecto.variables=_TConnecto.variables||{},_TConnecto.messages=null,_TConnecto.messageContentInserted={},_TConnecto.messageProcessed={},_TConnecto.embedElements={},_TConnecto.messageMap={},_TConnecto.usesNewVariables=!1,_TConnecto.idToExitIntentObjMap)for(var e in _TConnecto.idToExitIntentObjMap)_TConnecto.idToExitIntentObjMap[e]&&_TConnecto.idToExitIntentObjMap[e].disable&&_TConnecto.idToExitIntentObjMap[e].disable();if(_TConnecto.idToExitIntentObjMap={},_TConnecto.timeouts&&_TConnecto.timeouts.length>0)for(var t=0;t<_TConnecto.timeouts.length;t++)clearTimeout(_TConnecto.timeouts[t]);_TConnecto.timeouts=[]},_TConnecto.trackConversion=function(e){if(e=e?e:sessionStorage.getItem("_connecto_cur_msg_id")){var t=document.location.protocol+"//server.connecto.io/action?action=8&id="+e;ajaxCall(t),_TConnecto.resetMessageId()}},_TConnecto.resetMessageId=function(){sessionStorage.removeItem("_connecto_cur_msg_id")},_TConnecto.clearMessages=function(){if("object"==typeof _TConnecto.messageContentInserted)for(var e in _TConnecto.messageContentInserted){var t=document.getElementById("connecto_"+e);t&&t.remove()}},_TConnecto.initPage(),_TConnecto.addVariable=function(e,t){_TConnecto.usesNewVariables=!0,e&&t&&(_TConnecto.variables[e]=t)},_TConnecto.getVariables=function(){if(!_TConnecto.usesNewVariables&&(_TConnecto.customVariables&&(_TConnecto.variables=_TConnecto.customVariables),_TConnecto.dynamicVariables))for(var e in _TConnecto.dynamicVariables)_TConnecto.variables[e]=_TConnecto.dynamicVariables[e];return _TConnecto.variables},_TConnecto.segmentAndClientSideVariablesOk=function(e){var t=e.notification.segmentId;return _TConnecto._evaluateSegmentEvalFn(e.notification),t&&""!==t&&!e.notification.segmentEvalFunctionResult.result?!1:e.notification.clientSideVariableMatches&&e.notification.clientSideVariableMatches.length>0&&!_TConnecto.matchClientSideVariables(e.notification.clientSideVariableMatches,e.notification)?!1:!0},_TConnecto.matchClientSideVariables=function(andClauses,notification){for(var conjunction=!0,i=0;i0){var selectorValue=selectorElements[0].textContent;selectorValue=selectorValue.toUpperCase(),value=value.toUpperCase(),_checkValueMatch(matchType,selectorValue,value)&&(clauseMatch=!0)}}else if(2==clauseType&&_TConnecto.dataLayer&&dataLayerVariable&&matchType)try{var evaluatedDataLayerValue=eval(dataLayerVariable);evaluatedDataLayerValue=evaluatedDataLayerValue.toUpperCase(),value=value.toUpperCase(),_checkValueMatch(matchType,evaluatedDataLayerValue,value)&&(clauseMatch=!0)}catch(e){}else if(3==clauseType&&value)clauseMatch=eval("("+orClauses[j].value+")()");else if(4==clauseType&&_TConnecto.dataLayer&&dataLayerVariable&&matchType)try{var evaluatedDataLayerValue=eval(dataLayerVariable);evaluatedDataLayerValue=evaluatedDataLayerValue.toUpperCase();var segmentEvalFunctionResults=[];if(notification.segmentEvalFunctionResult&¬ification.segmentEvalFunctionResult.attrDetails)for(var index in notification.segmentEvalFunctionResult.attrDetails){var attrDetail=notification.segmentEvalFunctionResult.attrDetails[index];segmentEvalFunctionResults.push(attrDetail.joinAttrVal.toUpperCase())}1!=matchType&&2!=matchType||!_checkValueMatch(matchType,segmentEvalFunctionResults,evaluatedDataLayerValue)||(clauseMatch=!0)}catch(e){}disjunction=disjunction||clauseMatch}conjunction=conjunction&&disjunction}return conjunction},_TConnecto._loadSizzleJS=function(){var e;"undefined"!=typeof Sizzle&&(e=Sizzle),"undefined"!=typeof require&&"undefined"!=typeof requirejs&&require&&requirejs?(require.config({paths:{_co_sizzle:"https://cdnjs.cloudflare.com/ajax/libs/sizzle/2.2.0/sizzle.min"}}),require(["_co_sizzle"],function(e){_TConnecto.Sizzle=e})):_loadScript("https://cdnjs.cloudflare.com/ajax/libs/sizzle/2.2.0/sizzle.min.js",function(){Sizzle&&(_TConnecto.Sizzle=Sizzle,Sizzle=e,_processConnectoMessages())})},_TConnecto.getMessage=function(e){return _TConnecto.messageMap[e]?_TConnecto.messageMap[e].notification:null},_TConnecto.showMessage=function(e){if(_TConnecto.messageMap[e])if(_TConnecto.messageContentInserted[e])document.getElementById("container-notification-frame-"+e).contentWindow.toggleWidget();else{var t=_TConnecto.messageMap[e],n=document.getElementById("container-notification-frame-"+t.id),o=htmlUnescape(t.innerHTML);showContent(n,o,t.delay,t.scroll,t)}},_TConnecto.stopMessage=function(e){_TConnecto.messageContentInserted[e]=!0},_TConnecto.getConnectoStorage=function(e){var t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(n){return{}}return null},_TConnecto.initConnectoStorage=function(){if(localStorage.getItem("_connecto"))return _TConnecto.getConnectoStorage("_connecto");var e={source:document.referrer,landingPage:document.URL,firstVisitOn:new Date};return localStorage.setItem("_connecto",JSON.stringify(e)),e},_TConnecto.saveToConnectoStorage=function(e,t){var n=_TConnecto.getConnectoStorage("_connecto");n||(n=_TConnecto.initConnectoStorage()),n[e]=t,localStorage.setItem("_connecto",JSON.stringify(n))},_TConnecto.connectoLogsUpdated=!1,_TConnecto.updateConnectoLogs=function(){if(!_TConnecto.connectoLogsUpdated){var e=_TConnecto.getConnectoLogs(),t=new Date;if(e.pages.push({url:window.location.href,time:t}),e.sessions.length>0&&_TConnecto._readCookie("_co_session_active")){var n=e.sessions[e.sessions.length-1];n.pagesViewed=n.pagesViewed?n.pagesViewed+1:1,n.lastPageLoadTime=t}else e.sessions.push({startTime:t.getTime(),pagesViewed:1});var o=new Date;o.setTime(t.getTime()+144e5),document.cookie="_co_session_active=1;expires="+o.toGMTString()+"; path=/",e.pages.length>100&&e.pages.shift(),e.sessions.length>50&&e.sessions.shift(),localStorage.setItem("_connecto_logs",JSON.stringify(e)),_TConnecto.connectoLogsUpdated=!0}},_TConnecto.getConnectoLogs=function(){var e={pages:[],sessions:[]},t=e,n=localStorage.getItem("_connecto_logs");if(n)try{t=JSON.parse(n)}catch(o){console.log("Error1 : err"+o),console.log("Error1 : stack"+o.stack)}return t||(t=e),t.pages&&"[object Array]"===Object.prototype.toString.call(t.pages)||(t.pages=[]),t.sessions&&"[object Array]"===Object.prototype.toString.call(t.sessions)||(t.sessions=[]),t},_TConnecto.getEventsSummary=function(){var e=localStorage.getItem("_co_events");if(e)try{return connectoEvents=JSON.parse(e),connectoEvents.summary}catch(t){console.log("Error1 : err"+t),console.log("Error1 : stack"+t.stack)}return null},_TConnecto._readCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o-1&&(t=e[n].getAttribute("data-connecto-slot"),t&&(_TConnecto.embedElements[t]=e[n]))}_processConnectoMessages()},_TConnecto._evaluateSegmentEvalFn=function(notification){if(notification.segmentId&&""!==notification.segmentId)try{notification.segmentEvalFunctionResult=eval(notification.segmentEvalFunction)}catch(err){console.log("It shoudn't have happened, check the evalFn of notificationId: "+notification._id),notification.segmentEvalFunctionResult={result:!1}}},function(){if(!_TConnecto.initialized){_TConnecto.initialized=!0,"function"==typeof _TConnecto.initConnecto&&_TConnecto.initConnecto(),__co_loadMustache(),_TConnecto._loadSizzleJS(),_TConnecto.dataLayer=_TConnecto.dataLayer||window.dataLayer;var e=_TConnecto.getFromConnectoStorage("firstVisitOn"),t=_TConnecto.getFromConnectoStorage("landingPage"),n=document.location.protocol+"//server.connecto.io/?v=1.2&url="+encodeURIComponent(window.location),o={};try{_TConnecto.updateConnectoLogs();var i=_TConnecto.initConnectoStorage(),a=i.source,c=_TConnecto.getConnectoLogs(),s=_TConnecto.getEventsSummary(),r=1,l=1,d=null;c&&c.sessions&&(r=c.sessions.length,r>0&&(l=c.sessions[r-1].pagesViewed,d=c.sessions[r-1].startTime)),e&&(o.firstVisitTime=e),s&&(o.eventsSummary=s),t&&(o.landingPage=t),a&&(o.referer=a),r&&(o.sessionNum=r),l&&(o.sessionLen=l),d&&(o.sessionStart=d),_TConnecto.engageId&&(o.engageId=_TConnecto.engageId),_TConnecto.getVariables()&&(o.customVariables=JSON.stringify(_TConnecto.getVariables())),_TConnecto.licenseKey&&(o.licenseKey=_TConnecto.licenseKey);var u=_TConnecto.getAnonymousId(),g=_TConnecto.getIdentity(),m={};g&&(m.userId=g),u&&(m.anonymousId=u),m&&(o.segmentData=JSON.stringify(m)),_TConnecto.saveToConnectoStorage("lastVisitTime",new Date)}catch(f){console.log("Error : err"+f),console.log("Error : stack"+f.stack)}ajaxCall(n,o,function(e){if(res=JSON.parse(e),"1"==res.response||"2"==res.response){for(var t=0;t