diff --git a/dist/pathfora.js b/dist/pathfora.js index ee4c8ca..6c58308 100644 --- a/dist/pathfora.js +++ b/dist/pathfora.js @@ -266,27 +266,27 @@ var templates = { 'subscription': { 'bar': '

', - 'gate': '

', + 'gate': '

', 'inline': '

', - 'modal': '

', + 'modal': '

', 'slideout': '

' }, 'sitegate': { - 'gate': '

' + 'gate': '

' }, 'message': { 'bar': '

', 'button': '', - 'gate': '

', + 'gate': '

', 'inline': '

', - 'modal': '

', + 'modal': '

', 'slideout': '

' }, 'includes': {}, 'form': { - 'gate': '

', + 'gate': '

', 'inline': '

', - 'modal': '

', + 'modal': '

', 'slideout': '

' }, 'assets': { diff --git a/dist/pathfora.min.js b/dist/pathfora.min.js index aaa3d83..ed0b6b4 100644 --- a/dist/pathfora.min.js +++ b/dist/pathfora.min.js @@ -1 +1 @@ -!function(){"use strict";function o(o){return o.generic={className:"pathfora",branding:!1,responsive:!0,headline:"",themes:{dark:{background:"#333",headline:"#fefefe",text:"#aaa",close:"#888",actionText:"#fff",actionBackground:"#444",cancelText:"#888",cancelBackground:"#333"},light:{background:"#f1f1f1",headline:"#444",text:"#888",close:"#bbb",actionText:"#444",actionBackground:"#fff",cancelText:"#bbb",cancelBackground:"#f1f1f1"}},displayConditions:{showOnInit:!0,showOnExitIntent:!1,showDelay:0,hideAfter:0,displayWhenElementVisible:"",scrollPercentageToDisplay:0}},o.message={layout:"modal",position:"",okMessage:"Confirm",cancelMessage:"Cancel",okShow:!0,cancelShow:!0},o.subscription={layout:"modal",position:"",placeholders:{email:"Email"},okMessage:"Confirm",cancelMessage:"Cancel",okShow:!0,cancelShow:!0},o.form={layout:"modal",position:"",placeholders:{name:"Name",title:"Title",email:"Email",message:"Message",company:"Company",phone:"Phone Number",country:"Country",referralEmail:"Referral Email"},required:{name:!0,email:!0},fields:{company:!1,phone:!1,country:!1,referralEmail:!1},okMessage:"Send",okShow:!0,cancelMessage:"Cancel",cancelShow:!0},o.sitegate={layout:"gate",position:"",placeholders:{name:"Name",title:"Title",email:"Email",message:"Message",company:"Company",phone:"Phone Number",country:"Country",referralEmail:"Referral Email"},required:{name:!0,email:!0},fields:{message:!1,phone:!1,country:!1,referralEmail:!1},okMessage:"Submit",okShow:!0,cancelShow:!1,showForm:!0},o}function t(o){return o.delayedWidgets={},o.openedWidgets=[],o.initializedWidgets=[],o.prioritizedWidgets=[],o.readyWidgets=[],o.triggeredWidgets={},o.dependentDataWidgets=[],o}function e(o){return o.pageViews=0,o.timeSpentOnPage=0,o.closedWidgets=[],o.completedActions=[],o.cancelledActions=[],o.displayedWidgets=[],o.abTestingGroups=[],o}function i(){for(var o=[],t=0;t1){var i=1/e;o=o.map(function(o){return o*i})}return{groups:o,groupsNumber:o.length}}var n="1.2.20",a="en-US",p={},l="PathforaRecommend_",r="PathforaUnlocked_",u="PathforaImpressions_",s="PathforaTotalImpressionsSince_",d="PathforaConfirm_",c="PathforaCancel_",v="PathforaClosed_",f="PathforaTest_",g="PathforaPageView",m="\\{{2}.*?\\}{2}",h=["msg","headline","image","confirmAction.callback"],y="ordered",b="entityField",w="segment",S={modal:"",slideout:"bottom-left",button:"top-left",bar:"top-absolute"},C="widgetInitialized",A="widgetLoaded",M="buttonClicked",E="formSubmitted",T="modalOpened",I="modalClosed",k="modalConfirm",B=t({}),N=o({}),G=e({}),P={100:i(100),"50/50":i(50,50),"80/20":i(80,20)},L={subscription:{bar:"

",gate:"",inline:"

",modal:"",slideout:"

"},sitegate:{gate:""},message:{bar:"

",button:"",gate:"",inline:"

",modal:"",slideout:"

"},includes:{},form:{gate:"",inline:"

",modal:"",slideout:"

"},assets:{lytics:"lytics"}},x=window,R=x.document;function D(o){var t,e=this,i=R.documentElement.doScroll,n="DOMContentLoaded";(i?/^loaded|^c/:/^loaded|^i|^c/).test(R.readyState)?(e.DOMLoaded=!0,o()):R.addEventListener(n,t=function(){R.removeEventListener(n,t),e.DOMLoaded=!0,o()})}function W(o){return String(o).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function O(o,t){var e=new RegExp(["(^|\\b)",W(t.split(" ").join("|")),"(\\b|$)"].join(""),"gi");o.className=o.className.replace(e," ")}function H(o,t){O(o,t),o.className=[o.className,t].join(" ")}function K(o,t){return new RegExp("(^| )"+W(t)+"( |$)","gi").test(o.className)}function U(o){try{return decodeURIComponent(o)}catch{return o}}function q(o){var t=R.cookie,e=t.match("(^|;)\\s*"+encodeURIComponent(W(o))+"\\s*=\\s*([^;]+)");return null==e&&(e=t.match("(^|;)\\s*"+W(o)+"\\s*=\\s*([^;]+)")),null!=e?U(e.pop()):null}function z(o,t,e){var i;i=e?"; expires="+e.toUTCString():"; expires=0",R.cookie=[encodeURIComponent(o),"=",encodeURIComponent(t),i,"; path = /"].join("")}function F(o){z(o,"",new Date("Thu, 01 Jan 1970 00:00:01 GMT"))}var V="$",Z="@",j="PATHFORA";function J(o){try{return JSON.parse(o)}catch(o){}}function Y(o){return Boolean(o[Z])&&Date.parse(o[Z])0&&e.push("&"),e.push(i+"[]="+o[i][n]));else e.push(i+"="+o[i]);t++}return e.join("")}function eo(o,t){t||(t={});var e=o.length,i=[],n=t.usePlus||!1,a=t.keepEscaped||!1;function p(o){return/[0-9A-Fa-f]/.test(o)}function l(o){return"0123456789ABCDEF"[o]}function r(o){return!(-1!==["#",":",";","/","?","$","&","+",",","@","="].indexOf(o))&&function(o,t){return!!(o[t>>5]&1<<(31&t))}([4294967295,4160751869,2013265921,3087007745,4294967295,4294967295,4294967295,4294967295],o.charCodeAt(0))}for(var u=0;u=u+2&&p(o[u+1])&&p(o[u+2])?i.push("%"):r(s)?i.push("%",l(d>>4),l(15&d)):i.push(s)}return i.join("")}function io(o,t){for(var e in t)t.hasOwnProperty(e)&&"object"==typeof t[e]&&null!==t[e]&&!Array.isArray(t[e])?t.hasOwnProperty(e)&&(void 0===o[e]&&(o[e]={}),io(o[e],t[e])):t.hasOwnProperty(e)&&(o[e]=t[e])}function no(o,t,e){for(var i=o,n=t.split("."),a=0;a()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/g.test(o)}var ro={addClass:H,hasClass:K,removeClass:O,readCookie:q,saveCookie:z,deleteCookie:F,updateLegacyCookies:function(){var o=[l,r,u,d,c,v,f,g],t=0,e=function(e){return 0===e.trim().indexOf(o[t])},i=function(o){var t=o.trim().split("=");if(2===t.length){var e=t[0],i=t[1];F(e),$(e,U(i))}},n=function(o){var t=sessionStorage.getItem(o);X(t)&&(sessionStorage.removeItem(o),sessionStorage.setItem(encodeURIComponent(o),encodeURIComponent(t)))};for(t=0;tt}},gte:function(o,t){return function(e){return parseInt(e[o],10)>=t}},lt:function(o,t){return function(e){return parseInt(e[o],10)0&&o.global.duration>0){var g=function(){$(p,"0|"+f,t.expiration)};(n=oo(p))?void 0!==(e=n.split("|"))[1]&&Math.abs(e[1]-f)/1e3>=o.global.duration&&g():g()}if(l||(l=0),l>=o.widget.session)return!1;if(v){if(e=v.split("|"),i=parseInt(e[0],10),void 0!==e[1]){if(o.widget.buffer>0&&Math.abs(e[1]-f)/1e30&&i%o.widget.total===0&&Math.abs(e[1]-f)/1e3=o.widget.total&&void 0===o.widget.duration)return!1;if(o.global.session>0)for(var m=0;m<~~sessionStorage.length;m++){var h=sessionStorage.key(m);void 0!==h&&h.includes(u)&&(r+=~~sessionStorage.getItem(h))}if(r>=o.global.session)return!1;if(o.global.total>0||o.global.buffer>0){for(var y=0;y<~~localStorage.length;y++){var b=localStorage.key(y);void 0!==b&&b.includes(u)&&(e=oo(b).split("|"),d+=i=parseInt(e[0],10),void 0!==e[1]&&(c=Math.max(e[1],c)))}if(c>0&&o.global.buffer>0&&Math.abs(c-f)/1e30&&(e=(n=oo(p)).split("|"))[0]>=o.global.total)&&!(d>=o.global.total&&void 0===o.global.duration)}function go(o,t){var e,i;if("object"==typeof jstag&&x.jstag.send(t.censorTrackingKeys?function(o,t){return Object.keys(o).filter(function(o){return!t.some(function(t){return"string"==typeof t?o===t:t.test(o)})}).reduce(function(t,e){return t[e]=o[e],t},{})}(o,t.censorTrackingKeys):o),!0===x.pathfora.enableGA&&"function"==typeof x.ga&&"function"==typeof x.ga.getAll){e=o["pf-widget-action"]||o["pf-widget-event"],i=x.ga.getAll();for(var n=0;n0&&(p["pf-widget-content"]=t.content[0]),o){case"show":G.displayedWidgets.push(p);break;case"close":p["pf-widget-action"]=!!t.closeAction&&t.closeAction.name||"close",G.closedWidgets.push(p);break;case"confirm":e&&K(e,"pf-content-unit")?p["pf-widget-action"]="content recommendation":(p["pf-widget-action"]=!!t.confirmAction&&t.confirmAction.name||"default confirm",G.completedActions.push(p));break;case"cancel":p["pf-widget-action"]=!!t.cancelAction&&t.cancelAction.name||"default cancel",G.cancelledActions.push(p);break;case"success.confirm":p["pf-widget-action"]=!!t.formStates&&!!t.formStates.success&&!!t.formStates.success.confirmAction&&t.formStates.success.confirmAction.name||"success confirm",G.completedActions.push(p);break;case"success.cancel":p["pf-widget-action"]=!!t.formStates&&!!t.formStates.success&&!!t.formStates.success.cancelAction&&t.formStates.success.cancelAction.name||"success cancel",G.cancelledActions.push(p);break;case"error.confirm":p["pf-widget-action"]=!!t.formStates&&!!t.formStates.error&&!!t.formStates.error.confirmAction&&t.formStates.error.confirmAction.name||"error confirm",G.completedActions.push(p);break;case"error.cancel":p["pf-widget-action"]=!!t.formStates&&!!t.formStates.error&&!!t.formStates.error.cancelAction&&t.formStates.error.cancelAction.name||"error cancel",G.cancelledActions.push(p);break;case"submit":case"unlock":for(n in K(e,"pf-custom-form")&&(p["pf-custom-form"]={}),e.children)if(e.children.hasOwnProperty(n))if(K(i=e.children[n],"pf-widget-radio-group")||K(i,"pf-widget-checkbox-group")){var l=[],u="",s=i.querySelectorAll("input");for(a=0;an)&&!(e&&i0&&setTimeout(function(){bo(t.id,!0)},i)}}function So(o,t,e){"function"==typeof t.onModalClose&&t.onModalClose(I,{widget:o,config:t,event:e})}function Co(o,t){var e,i=oo(o),n=Date.now();i?(i=i.split("|"),e=Math.min(parseInt(i[0],10),9998)+1):e=1,$(o,e+"|"+n,t)}function Ao(o,t,e,i){var n,a,p,l;switch(t){case"close":n=v,a=I,p=e.closeAction,l=!0;break;case"cancel":case"success.cancel":case"error.cancel":n=c,p=e.cancelAction,l="inline"!==e.layout,"success.cancel"===t&&(p=e.formStates.success.cancelAction),"error.cancel"===t&&(p=e.formStates.error.cancelAction);break;case"confirm":case"success.confirm":case"error.confirm":n=d,l="inline"!==e.layout,"success.confirm"===t&&(p=e.formStates.success.confirmAction),"error.confirm"===t&&(p=e.formStates.error.confirmAction)}o.onmouseenter=function(o){mo("hover",e,o.target)},o.onclick=function(o){mo(t,e),Co(n+i.id,e.expiration),"object"==typeof p&&(!1===p.close&&(l=!1),"function"==typeof p.callback&&p.callback(a,{widget:i,config:e,event:o})),l&&(bo(i.id,!0),So(i,e,o))}}function Mo(o,t){var e,i,n,a,p,l,r=R.createElement("div"),u=o.hasOwnProperty("groupType");if(u)r.className="pf-widget-"+o.type,e=R.createElement("div");else{switch(o.type){case"email":(e=R.createElement("input")).setAttribute("type","email");break;case"us-postal-code":(e=R.createElement("input")).setAttribute("type","text"),o.pattern||(o.pattern="^[0-9]{5}$");break;case"text":case"input":(e=R.createElement("input")).setAttribute("type","text");break;case"date":(e=R.createElement("input")).setAttribute("type","date");break;default:e=R.createElement(o.type)}if(o.pattern&&e.setAttribute("enforcePattern",o.pattern),e.setAttribute("name",o.name),e.setAttribute("id",o.name),"textarea"===o.type&&e.setAttribute("rows",5),"date"===o.type){var s=new Date,d=s.getTimezoneOffset(),c=new Date(s.getTime()-60*d*1e3),v=o.maxDate?"today"===o.maxDate?c:new Date(o.maxDate):null,f=o.minDate?"today"===o.minDate?c:new Date(o.minDate):null;null!=v&&e.setAttribute("max",v.toISOString().split("T")[0]),null!=f&&e.setAttribute("min",f.toISOString().split("T")[0])}}if(o.label&&(u?((a=R.createElement("span")).id=o.name,e.setAttribute("aria-labelledby",o.name)):(a=R.createElement("label")).setAttribute("for",o.name),a.innerHTML=o.label,a.className="pf-form-label",H(e,"pf-has-label"),!0===o.required&&(a.innerHTML+=' *'),r.appendChild(a)),!0===o.required&&(H(r,"pf-form-required"),e.setAttribute("data-required","true"),o.label&&((p=R.createElement("div")).className="pf-required-flag",p.innerHTML="required",l=R.createElement("span"),p.appendChild(l),r.appendChild(p))),o.pattern&&(e.setAttribute("data-validate","true"),H(r,"pf-form-required-validation")),"date"!==o.type&&"email"!==o.type||(H(r,"pf-form-required"),e.setAttribute("data-validate","true"),o.label&&((p=R.createElement("div")).className="pf-invalid-flag",p.innerHTML="invalid",l=R.createElement("span"),p.appendChild(l),r.appendChild(p))),o.placeholder){if("select"===o.type){var g=R.createElement("option");g.setAttribute("value",""),g.innerHTML=o.placeholder,e.appendChild(g)}else e.placeholder=o.placeholder;o.label||e.setAttribute("aria-label",o.placeholder)}if(o.values)for(i=0;i=0;n--)r[n].innerHTML=t.headline;if(t.image){var g=R.createElement("img");g.src=t.image,g.className="pf-widget-img",g.alt="","button"===t.layout||("modal"===t.layout||"inline"===t.layout?a.appendChild(g):u.appendChild(g))}switch(t.type){case"sitegate":case"form":if(t.formElements&&t.formElements.length){var m=o.querySelector("form");H(m,"pf-custom-form");for(var h=m.children,y=0;y0&&mo("form_start",t,o.target)},s=function(o){mo("focus",t,o.target)};for(var c in n.childNodes)if(n.children.hasOwnProperty(c)){var f=n.children[c];void 0!==f.getAttribute&&null!==f.getAttribute("name")&&(f.onfocus=s,f.onchange=u)}i=function(o){o.preventDefault();var t,e,i,a=!0,p=Array.prototype.slice.call(n.querySelectorAll("[data-required=true]")),l=Array.prototype.slice.call(n.querySelectorAll("[data-validate=true]"));for(t=0;t0&&(new RegExp(c).test(e.value)||(a=!1,d=!1)),d||(H(i,"bad-validation"),e&&0===t&&e.focus())}}else e.hasAttribute("data-validate")&&(O(e,"bad-validation"),"email"!==e.getAttribute("type")||lo(e.value)||""===e.value||(a=!1,H(e,"bad-validation"),e&&0===t&&e.focus()))}return a}}switch(t.layout){case"button":"function"==typeof t.onClick&&(e=function(e){t.onClick(M,{widget:o,config:t,event:e})});break;case"modal":t.listeners.escape={type:"keydown",target:document,fn:function(e){27===(e=e||window.event).keyCode&&(mo("close",t),Co(v+o.id,t.expiration),bo(o.id,!0),So(o,t,e))}}}l&&Ao(l,"close",t,o),p&&Ao(p,"cancel",t,o),a&&(a.onmouseenter=function(o){mo("hover",t,o.target)},a.onclick=function(a){var p,l,r=!0;if("function"==typeof i){switch(t.type){case"form":l="gate"===t.layout?"unlock":"submit";break;case"subscription":l="subscribe"}if(!l||!i(a))return;n&&(mo(l,t,n),p=Array.prototype.slice.call(n.querySelectorAll("input, textarea, select")).filter(function(o){return!o.type||"checkbox"!==o.type&&"radio"!==o.type||o.checked}).map(function(o){return{name:o.name||o.id,value:o.value}}),"function"==typeof t.onSubmit&&t.onSubmit(E,{widget:o,config:t,event:a,data:p}))}if(mo("confirm",t),Co(d+o.id,t.expiration),"function"==typeof e&&e(a),"object"==typeof t.confirmAction&&(!1===t.confirmAction.close&&(r=!1),"function"==typeof t.confirmAction.callback)){var u={widget:o,config:t,event:a};if(p&&(u.data=p),!0===t.confirmAction.waitForAsyncResponse)return void t.confirmAction.callback(k,u,function(e){wo(e,o,t)});t.confirmAction.callback(k,u)}r&&("inline"===t.layout||t.formStates&&t.formStates.success?wo(!0,o,t):(bo(o.id,!0),So(o,t,a)))}),r&&(r.onmouseenter=function(o){mo("hover",t,o.target)},r.onclick=function(e){mo("confirm",t,e.target),Co(d+o.id,t.expiration)})}(t,o),function(o,t){var e=o.querySelector(".pf-content-unit"),i=t.recommend;if(t.recommend&&t.content&&Object.keys(t.content).length>0){var n=t.content[0],l=R.createElement("div"),r=R.createElement("div"),u=R.createElement("h4"),s=R.createElement("p"),d=R.createElement("span");if(e.href=n.url,!n.image||i.display&&!1===i.display.image||(l.className="pf-content-unit-img",l.style.backgroundImage="url('"+n.image+"')",e.appendChild(l)),r.className="pf-content-unit-meta",!n.title||i.display&&!1===i.display.title||(u.innerHTML=n.title,r.appendChild(u)),n.author&&i.display&&!0===i.display.author&&(d.innerHTML="by "+n.author),n.date&&i.display&&!0===i.display.date){var c=new Date(n.date),v=i.display.locale,f=i.display.dateOptions;!v&&x.pathfora&&x.pathfora.locale?v=x.pathfora.locale:v||(v=a),!f&&x.pathfora&&x.pathfora.dateOptions?f=x.pathfora.dateOptions:f||(f=p),c=c.toLocaleDateString(v,f),d.innerHTML?d.innerHTML+=" | "+c:d.innerHTML=c}if(d.innerHTML&&(d.className="pf-content-unit-info",r.appendChild(d)),n.description&&(!i.display||!1!==i.display.description)){var g=n.description,m="modal"===t.layout?220:160;i.display?i.display.descriptionLimit||(i.display.descriptionLimit=m):i.display={descriptionLimit:m},g.length>i.display.descriptionLimit&&-1!==i.display.descriptionLimit&&(g=(g=g.substring(0,i.display.descriptionLimit)).substring(0,g.lastIndexOf(" "))+"..."),s.innerHTML=g,r.appendChild(s)}e.appendChild(r)}}(t,o),function(o,t){o.className=["pf-widget ","pf-"+t.type," pf-widget-"+t.layout,t.position?" pf-position-"+t.position:"",t.pushDown?" pf-has-push-down":"",t.origin?" pf-origin-"+t.origin:"",t.image?" pf-widget-has-image pf-widget-variant-2":"",t.recommend?" pf-widget-has-recommend pf-widget-variant-3":"",t.image||t.recommend?"":" pf-widget-variant-1"," pf-widget-layout-"+t.layout,t.theme?" pf-theme-"+t.theme:"",t.className?" "+t.className:"",t.branding?" pf-widget-has-branding":"",t.responsive?"":" pf-mobile-hide"].join("")}(t,o),Io(t,o),function(o,t){switch(t.theme){case"custom":t.colors&&ko(o,t.colors);break;case"none":break;default:t.theme&&ko(o,N.generic.themes[t.theme])}}(t,o),t}function No(o,t){if("inline"===o.layout||"modal"===o.layout&&o.recommend){var e=t.querySelector(".pf-content-unit");e&&(t.offsetWidth<650&&!K(e,"stack")?H(e,"stack"):t.offsetWidth>=650&&O(e,"stack"))}}function Go(o){var t=function(o){for(var t=0;t0))throw new Error("Could not get account id from Lytics Javascript tag.");t=x.jstag.config.cid[0]}if(!t)throw new Error("Lytics Javascript tag returned an empty account id.");o.acctid=t}}function Wo(o,t){var e,i=this;!function(o){if(o.target){o.common=o.common||[];for(var t=0;t0&&(e[n.id][w]?e[n.id][w].concat(t):e[n.id][w]=t)}B.dependentDataWidgets=e},n=function(o,t){var e=B.dependentDataWidgets,i=0;for(i=0;i0&&(sessionStorage.setItem(l+e,encodeURIComponent(JSON.stringify(a.data))),i(a.data)))}var p,r="seerid",u="_uids";window.jstag&&window.jstag.config&&""!==window.jstag.config.cookie&&(r=window.jstag.config.cookie),p=q(r),window.liosetup&&window.liosetup.field&&""!==window.liosetup.field&&window.liosetup.value&&""!==window.liosetup.value&&(u=window.liosetup.field,p=window.liosetup.value),u||p||(console.warn("Could not determine BY field and value from config"),i([]));var s=["https://c.lytics.io","api","content","recommend",o,"user",u,p],d=t.ql,c=t.ast,v=t.display;delete t.ql,delete t.ast,delete t.display;var f=to(t);if(t.display=v,!t.contentsegment&&(d&&d.raw||c))if(f.length>0?f+="&":f+="?",d&&d.raw)f+="ql="+d.raw;else{var g={table:"content",ast:c};f+="contentsegments=["+encodeURIComponent(JSON.stringify(g))+"]"}var m,h,y,b,w=s.join("/")+f;m=w,h=function(o){var t;try{t=JSON.parse(o)}catch(o){return console.warn("Could not parse json response:"+o),void i([])}if(t.data&&t.data.length>0){for(var n=0;n1&&(t.data[n].url="http://"+a)}sessionStorage.setItem(l+e,encodeURIComponent(JSON.stringify(t))),i(t.data)}else i([])},y=function(){i([])},(b=new XMLHttpRequest).onreadystatechange=function(){4===b.readyState&&200===b.status?h(b.responseText):4===b.readyState&&y(b.responseText)},b.open("GET",m),b.send()}else console.warn("Could not make recommendation - missing callback function.")}function qo(o,t,e){Ho(o)?(function(o){if("message"!==o.type)throw new Error("Unsupported widget type for content recommendation");if("slideout"!==o.layout&&"modal"!==o.layout&&"inline"!==o.layout)throw new Error("Unsupported layout for content recommendation");if(o.content&&o.content[0]&&!o.content[0].default)throw new Error("Cannot define recommended content unless it is a default")}(o),function(o,t,e){var i=t.recommend;i&&i.collection&&(i.contentsegment=t.recommend.collection,delete i.collection),Uo(o,i,t.id,function(o){if(o[0]){var i=o[0];t.content=[{title:i.title,description:i.description,url:i.url,image:i.primary_image,date:i.created,author:i.author}]}if(!t.content)throw new Error("Could not get recommendation and no default defined");e()})}(t.acctid,o,e)):e()}function zo(o,t){var e=this;B.prioritizedWidgets=[];var i=function(o,t,n){if(!(t>=o.length)){var a=o[t],p=N[a.type],l=N.generic;if(io(a,l),io(a,p),io(a,a.config),!(B.initializedWidgets.indexOf(a.id)<0))throw new Error("Cannot add two widgets with the same id");B.initializedWidgets.push(a.id),a.success&&(a.formStates||(a.formStates={}),a.formStates.success||(a.formStates.success=a.success)),Ko(a,e,function(){qo(a,e,function(){if(e.initializeWidget(a,n),n&&n.priority===y){if(B.prioritizedWidgets.length&&B.prioritizedWidgets[0].id===a.id)return;i(o,t+1,n)}})}),n&&n.priority===y||i(o,t+1,n)}};i(o,0,t)}function Fo(o,t,e,i){if(!e||!e.length)return!0;var n,a,p,l=ao(o,t),r=!1;"function"==typeof l&&(p=l.toString(),l=p.substring(p.indexOf("{")+1,p.lastIndexOf("}")),""!==(a=p.match(/function[^(]*\(([^)]*)\)/)[1])&&(n=a.split(/\W+/)),r=!0);for(var u=0;u1&&(d=s[1].trim());var c,v,f,g=s[0].trim().split(".");if(x.lio&&x.lio.data)c=x.lio.data;else if(x.jstag&&"function"==typeof x.jstag.getEntity){var m=x.jstag.getEntity();m&&m.data&&m.data.user&&(c=m.data.user)}for(v=0;v1){e=e[1].split("&");for(var i=0;i1&&"lytics_variation_preview_id"!==n[0]&&(t[n[0]]=n[1])}}return t}function Zo(o,t,e){if("exact"===e)if(Object.keys(t).length!==Object.keys(o).length)return!1;for(var i in t)if(t.hasOwnProperty(i)&&t[i]!==o[i])return!1;return!0}function jo(o,t,e,i){var n=!1;switch(typeof o){case"string":-1!==t.indexOf(eo(o.split("?")[0],{keepEscaped:!0}))&&(n=Zo(i,Vo(o),"substring"));break;case"object":if(o.match&&o.value){var a=eo(o.value,{keepEscaped:!0}),p=Vo(a);switch(o.match){case"simple":"/"===e.slice(-1)&&(e=e.slice(0,-1)),"/"===o.value.slice(-1)&&(o.value=o.value.slice(0,-1)),e===o.value&&(n=!0);break;case"exact":n=Object.keys(p).length>0&&t.split("?")[0].replace(/\/$/,"")===a.split("?")[0].replace(/\/$/,"")?Zo(i,p,o.match):t.replace(/\/$/,"")===a.replace(/\/$/,"");break;case"regex":new RegExp(o.value).test(t)&&(n=!0);break;default:n=Object.keys(p).length>0&&-1!==t.indexOf(a.split("?")[0])?Zo(i,p,o.match):-1!==t.indexOf(a)}}else console.log("invalid display conditions");break;default:console.log("invalid display conditions")}return n}var Jo=[],Yo={add:function(o,t,e){o.addEventListener(t,e),Jo.push({target:o,type:t,listener:e})},remove:function(o,t,e){o.removeEventListener(t,e)},removeAll:function(){var o=this;Jo.forEach(function(t){o.remove(t.target,t.type,t.listener)}),Jo.length=0}};function _o(o){return o.scrollListener=function(){Po(o,function(){"function"==typeof x.addEventListener?Yo.remove(x,"scroll",o.scrollListener):x.onscroll=null})},"function"==typeof x.addEventListener?Yo.add(x,"scroll",o.scrollListener):x.onscroll=o.scrollListener,!0}var Qo=null;function $o(o){return{check:function(){var t=R.scrollingElement||function(){if(Qo)return Qo;if(document.body.scrollTop)return Qo=document.body;var o=document.createElement("iframe");o.style.height="1px",document.documentElement.appendChild(o);var t=o.contentWindow.document;t.write('
x
'),t.close();var e=t.documentElement.scrollHeight>t.body.scrollHeight;return o.parentNode.removeChild(o),Qo=e?document.documentElement:document.body}();return t.scrollTop/(t.scrollHeight-t.clientHeight)*100>=o}}}function Xo(o,t){var e,i=o.displayConditions;if(o.watchers=[],o.listeners=[],o.expiration=new Date,o.expiration.setDate(o.expiration.getDate()+365),("gate"!==o.layout||"true"!==oo(r+o.id))&&!0!==o.hiddenViaABTests){if(o.pushDown){if("bar"!==o.layout||"top-fixed"!==o.position&&"top-absolute"!==o.position)throw new Error("Only top positioned bar widgets may have a pushDown property");H(R.querySelector(o.pushDown),"pf-push-down")}var n,a,p,l;o.valid=o.valid&&function(o,t){for(var e,i=!0,n=[],a=0;a0){for(var r=0;r0&&(B.dependentDataWidgets[o.id]||(B.dependentDataWidgets[o.id]={}),B.dependentDataWidgets[o.id][b]=n),i}(o,this.customData),i.date&&(o.valid=o.valid&&(n=i.date,a=!0,p=Date.now(),n.start_at&&pnew Date(n.end_at).getTime()&&(a=!1),a)),i.pageVisits&&(o.valid=o.valid&&(l=i.pageVisits,oo(g)>=l)),i.hideAfterAction&&(o.valid=o.valid&&function(o,t){var e,i=!0,n=Date.now(),a=oo(d+t.id),p=oo(c+t.id),l=oo(v+t.id);return o.confirm&&a&&(e=a.split("|"),parseInt(e[0],10)>=o.confirm.hideCount&&(i=!1),void 0!==e[1]&&Math.abs(e[1]-n)/1e3=o.cancel.hideCount&&(i=!1),void 0!==e[1]&&Math.abs(e[1]-n)/1e3=o.closed.hideCount&&(i=!1),void 0!==e[1]&&Math.abs(e[1]-n)/1e31&&(!e||"HTML"===e.nodeName)){var i=o.positions[o.positions.length-1].y,n=o.positions[o.positions.length-2].y,a=Math.abs(i-n);if(o.positions=[],i-a<=50&&i30&&t.positions.shift()},o.exitIntentTrigger=function(t){Po(o,function(){"function"==typeof R.removeEventListener?(Yo.remove(R,"mousemove",o.exitIntentListener),Yo.remove(R,"mouseout",o.exitIntentTrigger)):(R.onmousemove=null,R.onmouseout=null)},t)},"function"==typeof R.addEventListener?(Yo.add(R,"mousemove",o.exitIntentListener),Yo.add(R,"mouseout",o.exitIntentTrigger)):(R.onmousemove=o.exitIntentListener,R.onmouseout=o.exitIntentTrigger))}(o,e)),i.displayWhenElementVisible&&(e=function(o){var t={elem:R.querySelector(o),check:function(){var o=R.body.scrollTop||R.documentElement.scrollTop,e=x.innerHeight+o>=R.body.offsetHeight;return!!(t.elem.offsetTop-x.innerHeight/2<=o||e)}};return t}(i.displayWhenElementVisible),o.watchers.push(e),_o(o)),i.scrollPercentageToDisplay&&(e=$o(i.scrollPercentageToDisplay),o.watchers.push(e),_o(o)),i.manualTrigger&&(e=function(o,t){return{check:function(){return!!(o&&B.triggeredWidgets[t.id]||B.triggeredWidgets["*"])}}}(i.manualTrigger,o),o.watchers.push(e),B.readyWidgets.push(o),Lo(o)),0!==o.watchers.length||i.showOnExitIntent||o.valid&&Go(o)}}function ot(o){return o.id=po(),Bo(o)}function tt(o){if(Array.isArray(o)){var t=B.openedWidgets,e=[];t.forEach(function(t,i){-1!==o.indexOf(t)&&e.push({widget:t,index:i})}),e.forEach(function(o){var t=o.widget,e=R.getElementById(t.id);for(var i in e&&(O(e,"opened"),e.parentNode&&e.parentNode.removeChild(e)),t.listeners)if(t.listeners.hasOwnProperty(i)){var n=t.listeners[i];n.target.removeEventListener(n.type,n.fn)}}),e.sort(function(o,t){return t.index-o.index}).forEach(function(o){t.splice(o.index,1)})}else console.warn("clearWidget: widgets must be an array")}function et(o){if(Array.isArray(o)){var t=B.delayedWidgets;o.forEach(function(o){var e,i;t.hasOwnProperty(o)&&(e=o,(i=B.delayedWidgets[e])&&(clearTimeout(i),delete B.delayedWidgets[e]))})}else console.warn("cancelDelayedWidgets: widgetIds must be an array")}function it(){var i=B.openedWidgets,n=B.delayedWidgets;tt(i),et(Object.keys(n)),Yo.removeAll(),t(B),e(G),o(N),this.callbacks=[],this.acctid=""}function nt(o){if(Array.isArray(o)){var t=B.openedWidgets,e=[];t.forEach(function(t){-1!==o.indexOf(t.id)&&e.push(t)}),tt(e),et(o),o.forEach(function(o){var t=B.initializedWidgets.indexOf(o);-1!==t&&B.initializedWidgets.splice(t,1);for(var e=B.prioritizedWidgets.length-1;e>=0;e--)B.prioritizedWidgets[e].id===o&&B.prioritizedWidgets.splice(e,1);for(var i=B.readyWidgets.length-1;i>=0;i--)B.readyWidgets[i].id===o&&B.readyWidgets.splice(i,1);B.triggeredWidgets.hasOwnProperty(o)&&delete B.triggeredWidgets[o],B.dependentDataWidgets.hasOwnProperty(o)&&delete B.dependentDataWidgets[o]})}else console.warn("clearById: widgetIds must be an array")}function at(o,t){var e={valid:!0,type:o};if(!t)throw new Error("Config object is missing");if(e.config=t,!t.id)throw new Error("All widgets must have an id value");return e.id=t.id,e}function pt(o){return at("message",o)}function lt(o){return at("subscription",o)}function rt(o){return at("form",o)}function ut(o){return at("sitegate",o)}function st(){return B.dependentDataWidgets}function dt(o){o.forEach(function(o){var t=o.type,e=oo(o.cookieId),i=0,n=new Date;e||(e=Math.random()),n.setDate(n.getDate()+365),$(o.cookieId,e,n);for(var a=0;a<1&&!(e<=(a+=t.groups[i]));)i++;if(o.groups.forEach(function(o,t){o.forEach(function(o){if(void 0!==o.abTestingGroup)throw new Error("Widget #"+o.config.id+" is defined in more than one AB test.");o.abTestingGroup=t,o.hiddenViaABTests=i===t})}),void 0!==G.abTestingGroups[o.id])throw new Error("AB test with ID="+o.id+" has been already defined.");G.abTestingGroups[o.id]=i})}function ct(o){return function(o){var t={};if(!o)throw new Error("Config object is missing");if(t.id=o.id,t.cookieId=f+o.id,t.groups=o.groups,!P[o.type])throw new Error("Unknown AB testing type: "+o.type);return t.type=P[o.type],t}(o)}function vt(o){var t={},e=R.querySelectorAll("["+o+"]");this.elements=this.elements.concat(e);for(var i=0;i1){var i=1/e;o=o.map(function(o){return o*i})}return{groups:o,groupsNumber:o.length}}var n="1.2.20",a="en-US",p={},l="PathforaRecommend_",r="PathforaUnlocked_",u="PathforaImpressions_",s="PathforaTotalImpressionsSince_",d="PathforaConfirm_",c="PathforaCancel_",v="PathforaClosed_",f="PathforaTest_",g="PathforaPageView",m="\\{{2}.*?\\}{2}",h=["msg","headline","image","confirmAction.callback"],y="ordered",b="entityField",w="segment",S={modal:"",slideout:"bottom-left",button:"top-left",bar:"top-absolute"},C="widgetInitialized",A="widgetLoaded",M="buttonClicked",E="formSubmitted",T="modalOpened",I="modalClosed",k="modalConfirm",B=t({}),N=o({}),G=e({}),P={100:i(100),"50/50":i(50,50),"80/20":i(80,20)},L={subscription:{bar:"

",gate:"",inline:"

",modal:"",slideout:"

"},sitegate:{gate:""},message:{bar:"

",button:"",gate:"",inline:"

",modal:"",slideout:"

"},includes:{},form:{gate:"",inline:"

",modal:"",slideout:"

"},assets:{lytics:"lytics"}},x=window,R=x.document;function D(o){var t,e=this,i=R.documentElement.doScroll,n="DOMContentLoaded";(i?/^loaded|^c/:/^loaded|^i|^c/).test(R.readyState)?(e.DOMLoaded=!0,o()):R.addEventListener(n,t=function(){R.removeEventListener(n,t),e.DOMLoaded=!0,o()})}function W(o){return String(o).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function O(o,t){var e=new RegExp(["(^|\\b)",W(t.split(" ").join("|")),"(\\b|$)"].join(""),"gi");o.className=o.className.replace(e," ")}function H(o,t){O(o,t),o.className=[o.className,t].join(" ")}function K(o,t){return new RegExp("(^| )"+W(t)+"( |$)","gi").test(o.className)}function U(o){try{return decodeURIComponent(o)}catch{return o}}function q(o){var t=R.cookie,e=t.match("(^|;)\\s*"+encodeURIComponent(W(o))+"\\s*=\\s*([^;]+)");return null==e&&(e=t.match("(^|;)\\s*"+W(o)+"\\s*=\\s*([^;]+)")),null!=e?U(e.pop()):null}function z(o,t,e){var i;i=e?"; expires="+e.toUTCString():"; expires=0",R.cookie=[encodeURIComponent(o),"=",encodeURIComponent(t),i,"; path = /"].join("")}function F(o){z(o,"",new Date("Thu, 01 Jan 1970 00:00:01 GMT"))}var V="$",Z="@",j="PATHFORA";function J(o){try{return JSON.parse(o)}catch(o){}}function Y(o){return Boolean(o[Z])&&Date.parse(o[Z])0&&e.push("&"),e.push(i+"[]="+o[i][n]));else e.push(i+"="+o[i]);t++}return e.join("")}function eo(o,t){t||(t={});var e=o.length,i=[],n=t.usePlus||!1,a=t.keepEscaped||!1;function p(o){return/[0-9A-Fa-f]/.test(o)}function l(o){return"0123456789ABCDEF"[o]}function r(o){return!(-1!==["#",":",";","/","?","$","&","+",",","@","="].indexOf(o))&&function(o,t){return!!(o[t>>5]&1<<(31&t))}([4294967295,4160751869,2013265921,3087007745,4294967295,4294967295,4294967295,4294967295],o.charCodeAt(0))}for(var u=0;u=u+2&&p(o[u+1])&&p(o[u+2])?i.push("%"):r(s)?i.push("%",l(d>>4),l(15&d)):i.push(s)}return i.join("")}function io(o,t){for(var e in t)t.hasOwnProperty(e)&&"object"==typeof t[e]&&null!==t[e]&&!Array.isArray(t[e])?t.hasOwnProperty(e)&&(void 0===o[e]&&(o[e]={}),io(o[e],t[e])):t.hasOwnProperty(e)&&(o[e]=t[e])}function no(o,t,e){for(var i=o,n=t.split("."),a=0;a()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/g.test(o)}var ro={addClass:H,hasClass:K,removeClass:O,readCookie:q,saveCookie:z,deleteCookie:F,updateLegacyCookies:function(){var o=[l,r,u,d,c,v,f,g],t=0,e=function(e){return 0===e.trim().indexOf(o[t])},i=function(o){var t=o.trim().split("=");if(2===t.length){var e=t[0],i=t[1];F(e),$(e,U(i))}},n=function(o){var t=sessionStorage.getItem(o);X(t)&&(sessionStorage.removeItem(o),sessionStorage.setItem(encodeURIComponent(o),encodeURIComponent(t)))};for(t=0;tt}},gte:function(o,t){return function(e){return parseInt(e[o],10)>=t}},lt:function(o,t){return function(e){return parseInt(e[o],10)0&&o.global.duration>0){var g=function(){$(p,"0|"+f,t.expiration)};(n=oo(p))?void 0!==(e=n.split("|"))[1]&&Math.abs(e[1]-f)/1e3>=o.global.duration&&g():g()}if(l||(l=0),l>=o.widget.session)return!1;if(v){if(e=v.split("|"),i=parseInt(e[0],10),void 0!==e[1]){if(o.widget.buffer>0&&Math.abs(e[1]-f)/1e30&&i%o.widget.total===0&&Math.abs(e[1]-f)/1e3=o.widget.total&&void 0===o.widget.duration)return!1;if(o.global.session>0)for(var m=0;m<~~sessionStorage.length;m++){var h=sessionStorage.key(m);void 0!==h&&h.includes(u)&&(r+=~~sessionStorage.getItem(h))}if(r>=o.global.session)return!1;if(o.global.total>0||o.global.buffer>0){for(var y=0;y<~~localStorage.length;y++){var b=localStorage.key(y);void 0!==b&&b.includes(u)&&(e=oo(b).split("|"),d+=i=parseInt(e[0],10),void 0!==e[1]&&(c=Math.max(e[1],c)))}if(c>0&&o.global.buffer>0&&Math.abs(c-f)/1e30&&(e=(n=oo(p)).split("|"))[0]>=o.global.total)&&!(d>=o.global.total&&void 0===o.global.duration)}function go(o,t){var e,i;if("object"==typeof jstag&&x.jstag.send(t.censorTrackingKeys?function(o,t){return Object.keys(o).filter(function(o){return!t.some(function(t){return"string"==typeof t?o===t:t.test(o)})}).reduce(function(t,e){return t[e]=o[e],t},{})}(o,t.censorTrackingKeys):o),!0===x.pathfora.enableGA&&"function"==typeof x.ga&&"function"==typeof x.ga.getAll){e=o["pf-widget-action"]||o["pf-widget-event"],i=x.ga.getAll();for(var n=0;n0&&(p["pf-widget-content"]=t.content[0]),o){case"show":G.displayedWidgets.push(p);break;case"close":p["pf-widget-action"]=!!t.closeAction&&t.closeAction.name||"close",G.closedWidgets.push(p);break;case"confirm":e&&K(e,"pf-content-unit")?p["pf-widget-action"]="content recommendation":(p["pf-widget-action"]=!!t.confirmAction&&t.confirmAction.name||"default confirm",G.completedActions.push(p));break;case"cancel":p["pf-widget-action"]=!!t.cancelAction&&t.cancelAction.name||"default cancel",G.cancelledActions.push(p);break;case"success.confirm":p["pf-widget-action"]=!!t.formStates&&!!t.formStates.success&&!!t.formStates.success.confirmAction&&t.formStates.success.confirmAction.name||"success confirm",G.completedActions.push(p);break;case"success.cancel":p["pf-widget-action"]=!!t.formStates&&!!t.formStates.success&&!!t.formStates.success.cancelAction&&t.formStates.success.cancelAction.name||"success cancel",G.cancelledActions.push(p);break;case"error.confirm":p["pf-widget-action"]=!!t.formStates&&!!t.formStates.error&&!!t.formStates.error.confirmAction&&t.formStates.error.confirmAction.name||"error confirm",G.completedActions.push(p);break;case"error.cancel":p["pf-widget-action"]=!!t.formStates&&!!t.formStates.error&&!!t.formStates.error.cancelAction&&t.formStates.error.cancelAction.name||"error cancel",G.cancelledActions.push(p);break;case"submit":case"unlock":for(n in K(e,"pf-custom-form")&&(p["pf-custom-form"]={}),e.children)if(e.children.hasOwnProperty(n))if(K(i=e.children[n],"pf-widget-radio-group")||K(i,"pf-widget-checkbox-group")){var l=[],u="",s=i.querySelectorAll("input");for(a=0;an)&&!(e&&i0&&setTimeout(function(){bo(t.id,!0)},i)}}function So(o,t,e){"function"==typeof t.onModalClose&&t.onModalClose(I,{widget:o,config:t,event:e})}function Co(o,t){var e,i=oo(o),n=Date.now();i?(i=i.split("|"),e=Math.min(parseInt(i[0],10),9998)+1):e=1,$(o,e+"|"+n,t)}function Ao(o,t,e,i){var n,a,p,l;switch(t){case"close":n=v,a=I,p=e.closeAction,l=!0;break;case"cancel":case"success.cancel":case"error.cancel":n=c,p=e.cancelAction,l="inline"!==e.layout,"success.cancel"===t&&(p=e.formStates.success.cancelAction),"error.cancel"===t&&(p=e.formStates.error.cancelAction);break;case"confirm":case"success.confirm":case"error.confirm":n=d,l="inline"!==e.layout,"success.confirm"===t&&(p=e.formStates.success.confirmAction),"error.confirm"===t&&(p=e.formStates.error.confirmAction)}o.onmouseenter=function(o){mo("hover",e,o.target)},o.onclick=function(o){mo(t,e),Co(n+i.id,e.expiration),"object"==typeof p&&(!1===p.close&&(l=!1),"function"==typeof p.callback&&p.callback(a,{widget:i,config:e,event:o})),l&&(bo(i.id,!0),So(i,e,o))}}function Mo(o,t){var e,i,n,a,p,l,r=R.createElement("div"),u=o.hasOwnProperty("groupType");if(u)r.className="pf-widget-"+o.type,e=R.createElement("div");else{switch(o.type){case"email":(e=R.createElement("input")).setAttribute("type","email");break;case"us-postal-code":(e=R.createElement("input")).setAttribute("type","text"),o.pattern||(o.pattern="^[0-9]{5}$");break;case"text":case"input":(e=R.createElement("input")).setAttribute("type","text");break;case"date":(e=R.createElement("input")).setAttribute("type","date");break;default:e=R.createElement(o.type)}if(o.pattern&&e.setAttribute("enforcePattern",o.pattern),e.setAttribute("name",o.name),e.setAttribute("id",o.name),"textarea"===o.type&&e.setAttribute("rows",5),"date"===o.type){var s=new Date,d=s.getTimezoneOffset(),c=new Date(s.getTime()-60*d*1e3),v=o.maxDate?"today"===o.maxDate?c:new Date(o.maxDate):null,f=o.minDate?"today"===o.minDate?c:new Date(o.minDate):null;null!=v&&e.setAttribute("max",v.toISOString().split("T")[0]),null!=f&&e.setAttribute("min",f.toISOString().split("T")[0])}}if(o.label&&(u?((a=R.createElement("span")).id=o.name,e.setAttribute("aria-labelledby",o.name)):(a=R.createElement("label")).setAttribute("for",o.name),a.innerHTML=o.label,a.className="pf-form-label",H(e,"pf-has-label"),!0===o.required&&(a.innerHTML+=' *'),r.appendChild(a)),!0===o.required&&(H(r,"pf-form-required"),e.setAttribute("data-required","true"),o.label&&((p=R.createElement("div")).className="pf-required-flag",p.innerHTML="required",l=R.createElement("span"),p.appendChild(l),r.appendChild(p))),o.pattern&&(e.setAttribute("data-validate","true"),H(r,"pf-form-required-validation")),"date"!==o.type&&"email"!==o.type||(H(r,"pf-form-required"),e.setAttribute("data-validate","true"),o.label&&((p=R.createElement("div")).className="pf-invalid-flag",p.innerHTML="invalid",l=R.createElement("span"),p.appendChild(l),r.appendChild(p))),o.placeholder){if("select"===o.type){var g=R.createElement("option");g.setAttribute("value",""),g.innerHTML=o.placeholder,e.appendChild(g)}else e.placeholder=o.placeholder;o.label||e.setAttribute("aria-label",o.placeholder)}if(o.values)for(i=0;i=0;n--)r[n].innerHTML=t.headline;if(t.image){var g=R.createElement("img");g.src=t.image,g.className="pf-widget-img",g.alt="","button"===t.layout||("modal"===t.layout||"inline"===t.layout?a.appendChild(g):u.appendChild(g))}switch(t.type){case"sitegate":case"form":if(t.formElements&&t.formElements.length){var m=o.querySelector("form");H(m,"pf-custom-form");for(var h=m.children,y=0;y0&&mo("form_start",t,o.target)},s=function(o){mo("focus",t,o.target)};for(var c in n.childNodes)if(n.children.hasOwnProperty(c)){var f=n.children[c];void 0!==f.getAttribute&&null!==f.getAttribute("name")&&(f.onfocus=s,f.onchange=u)}i=function(o){o.preventDefault();var t,e,i,a=!0,p=Array.prototype.slice.call(n.querySelectorAll("[data-required=true]")),l=Array.prototype.slice.call(n.querySelectorAll("[data-validate=true]"));for(t=0;t0&&(new RegExp(c).test(e.value)||(a=!1,d=!1)),d||(H(i,"bad-validation"),e&&0===t&&e.focus())}}else e.hasAttribute("data-validate")&&(O(e,"bad-validation"),"email"!==e.getAttribute("type")||lo(e.value)||""===e.value||(a=!1,H(e,"bad-validation"),e&&0===t&&e.focus()))}return a}}switch(t.layout){case"button":"function"==typeof t.onClick&&(e=function(e){t.onClick(M,{widget:o,config:t,event:e})});break;case"modal":t.listeners.escape={type:"keydown",target:document,fn:function(e){27===(e=e||window.event).keyCode&&(mo("close",t),Co(v+o.id,t.expiration),bo(o.id,!0),So(o,t,e))}}}l&&Ao(l,"close",t,o),p&&Ao(p,"cancel",t,o),a&&(a.onmouseenter=function(o){mo("hover",t,o.target)},a.onclick=function(a){var p,l,r=!0;if("function"==typeof i){switch(t.type){case"form":l="gate"===t.layout?"unlock":"submit";break;case"subscription":l="subscribe"}if(!l||!i(a))return;n&&(mo(l,t,n),p=Array.prototype.slice.call(n.querySelectorAll("input, textarea, select")).filter(function(o){return!o.type||"checkbox"!==o.type&&"radio"!==o.type||o.checked}).map(function(o){return{name:o.name||o.id,value:o.value}}),"function"==typeof t.onSubmit&&t.onSubmit(E,{widget:o,config:t,event:a,data:p}))}if(mo("confirm",t),Co(d+o.id,t.expiration),"function"==typeof e&&e(a),"object"==typeof t.confirmAction&&(!1===t.confirmAction.close&&(r=!1),"function"==typeof t.confirmAction.callback)){var u={widget:o,config:t,event:a};if(p&&(u.data=p),!0===t.confirmAction.waitForAsyncResponse)return void t.confirmAction.callback(k,u,function(e){wo(e,o,t)});t.confirmAction.callback(k,u)}r&&("inline"===t.layout||t.formStates&&t.formStates.success?wo(!0,o,t):(bo(o.id,!0),So(o,t,a)))}),r&&(r.onmouseenter=function(o){mo("hover",t,o.target)},r.onclick=function(e){mo("confirm",t,e.target),Co(d+o.id,t.expiration)})}(t,o),function(o,t){var e=o.querySelector(".pf-content-unit"),i=t.recommend;if(t.recommend&&t.content&&Object.keys(t.content).length>0){var n=t.content[0],l=R.createElement("div"),r=R.createElement("div"),u=R.createElement("h4"),s=R.createElement("p"),d=R.createElement("span");if(e.href=n.url,!n.image||i.display&&!1===i.display.image||(l.className="pf-content-unit-img",l.style.backgroundImage="url('"+n.image+"')",e.appendChild(l)),r.className="pf-content-unit-meta",!n.title||i.display&&!1===i.display.title||(u.innerHTML=n.title,r.appendChild(u)),n.author&&i.display&&!0===i.display.author&&(d.innerHTML="by "+n.author),n.date&&i.display&&!0===i.display.date){var c=new Date(n.date),v=i.display.locale,f=i.display.dateOptions;!v&&x.pathfora&&x.pathfora.locale?v=x.pathfora.locale:v||(v=a),!f&&x.pathfora&&x.pathfora.dateOptions?f=x.pathfora.dateOptions:f||(f=p),c=c.toLocaleDateString(v,f),d.innerHTML?d.innerHTML+=" | "+c:d.innerHTML=c}if(d.innerHTML&&(d.className="pf-content-unit-info",r.appendChild(d)),n.description&&(!i.display||!1!==i.display.description)){var g=n.description,m="modal"===t.layout?220:160;i.display?i.display.descriptionLimit||(i.display.descriptionLimit=m):i.display={descriptionLimit:m},g.length>i.display.descriptionLimit&&-1!==i.display.descriptionLimit&&(g=(g=g.substring(0,i.display.descriptionLimit)).substring(0,g.lastIndexOf(" "))+"..."),s.innerHTML=g,r.appendChild(s)}e.appendChild(r)}}(t,o),function(o,t){o.className=["pf-widget ","pf-"+t.type," pf-widget-"+t.layout,t.position?" pf-position-"+t.position:"",t.pushDown?" pf-has-push-down":"",t.origin?" pf-origin-"+t.origin:"",t.image?" pf-widget-has-image pf-widget-variant-2":"",t.recommend?" pf-widget-has-recommend pf-widget-variant-3":"",t.image||t.recommend?"":" pf-widget-variant-1"," pf-widget-layout-"+t.layout,t.theme?" pf-theme-"+t.theme:"",t.className?" "+t.className:"",t.branding?" pf-widget-has-branding":"",t.responsive?"":" pf-mobile-hide"].join("")}(t,o),Io(t,o),function(o,t){switch(t.theme){case"custom":t.colors&&ko(o,t.colors);break;case"none":break;default:t.theme&&ko(o,N.generic.themes[t.theme])}}(t,o),t}function No(o,t){if("inline"===o.layout||"modal"===o.layout&&o.recommend){var e=t.querySelector(".pf-content-unit");e&&(t.offsetWidth<650&&!K(e,"stack")?H(e,"stack"):t.offsetWidth>=650&&O(e,"stack"))}}function Go(o){var t=function(o){for(var t=0;t0))throw new Error("Could not get account id from Lytics Javascript tag.");t=x.jstag.config.cid[0]}if(!t)throw new Error("Lytics Javascript tag returned an empty account id.");o.acctid=t}}function Wo(o,t){var e,i=this;!function(o){if(o.target){o.common=o.common||[];for(var t=0;t0&&(e[n.id][w]?e[n.id][w].concat(t):e[n.id][w]=t)}B.dependentDataWidgets=e},n=function(o,t){var e=B.dependentDataWidgets,i=0;for(i=0;i0&&(sessionStorage.setItem(l+e,encodeURIComponent(JSON.stringify(a.data))),i(a.data)))}var p,r="seerid",u="_uids";window.jstag&&window.jstag.config&&""!==window.jstag.config.cookie&&(r=window.jstag.config.cookie),p=q(r),window.liosetup&&window.liosetup.field&&""!==window.liosetup.field&&window.liosetup.value&&""!==window.liosetup.value&&(u=window.liosetup.field,p=window.liosetup.value),u||p||(console.warn("Could not determine BY field and value from config"),i([]));var s=["https://c.lytics.io","api","content","recommend",o,"user",u,p],d=t.ql,c=t.ast,v=t.display;delete t.ql,delete t.ast,delete t.display;var f=to(t);if(t.display=v,!t.contentsegment&&(d&&d.raw||c))if(f.length>0?f+="&":f+="?",d&&d.raw)f+="ql="+d.raw;else{var g={table:"content",ast:c};f+="contentsegments=["+encodeURIComponent(JSON.stringify(g))+"]"}var m,h,y,b,w=s.join("/")+f;m=w,h=function(o){var t;try{t=JSON.parse(o)}catch(o){return console.warn("Could not parse json response:"+o),void i([])}if(t.data&&t.data.length>0){for(var n=0;n1&&(t.data[n].url="http://"+a)}sessionStorage.setItem(l+e,encodeURIComponent(JSON.stringify(t))),i(t.data)}else i([])},y=function(){i([])},(b=new XMLHttpRequest).onreadystatechange=function(){4===b.readyState&&200===b.status?h(b.responseText):4===b.readyState&&y(b.responseText)},b.open("GET",m),b.send()}else console.warn("Could not make recommendation - missing callback function.")}function qo(o,t,e){Ho(o)?(function(o){if("message"!==o.type)throw new Error("Unsupported widget type for content recommendation");if("slideout"!==o.layout&&"modal"!==o.layout&&"inline"!==o.layout)throw new Error("Unsupported layout for content recommendation");if(o.content&&o.content[0]&&!o.content[0].default)throw new Error("Cannot define recommended content unless it is a default")}(o),function(o,t,e){var i=t.recommend;i&&i.collection&&(i.contentsegment=t.recommend.collection,delete i.collection),Uo(o,i,t.id,function(o){if(o[0]){var i=o[0];t.content=[{title:i.title,description:i.description,url:i.url,image:i.primary_image,date:i.created,author:i.author}]}if(!t.content)throw new Error("Could not get recommendation and no default defined");e()})}(t.acctid,o,e)):e()}function zo(o,t){var e=this;B.prioritizedWidgets=[];var i=function(o,t,n){if(!(t>=o.length)){var a=o[t],p=N[a.type],l=N.generic;if(io(a,l),io(a,p),io(a,a.config),!(B.initializedWidgets.indexOf(a.id)<0))throw new Error("Cannot add two widgets with the same id");B.initializedWidgets.push(a.id),a.success&&(a.formStates||(a.formStates={}),a.formStates.success||(a.formStates.success=a.success)),Ko(a,e,function(){qo(a,e,function(){if(e.initializeWidget(a,n),n&&n.priority===y){if(B.prioritizedWidgets.length&&B.prioritizedWidgets[0].id===a.id)return;i(o,t+1,n)}})}),n&&n.priority===y||i(o,t+1,n)}};i(o,0,t)}function Fo(o,t,e,i){if(!e||!e.length)return!0;var n,a,p,l=ao(o,t),r=!1;"function"==typeof l&&(p=l.toString(),l=p.substring(p.indexOf("{")+1,p.lastIndexOf("}")),""!==(a=p.match(/function[^(]*\(([^)]*)\)/)[1])&&(n=a.split(/\W+/)),r=!0);for(var u=0;u1&&(d=s[1].trim());var c,v,f,g=s[0].trim().split(".");if(x.lio&&x.lio.data)c=x.lio.data;else if(x.jstag&&"function"==typeof x.jstag.getEntity){var m=x.jstag.getEntity();m&&m.data&&m.data.user&&(c=m.data.user)}for(v=0;v1){e=e[1].split("&");for(var i=0;i1&&"lytics_variation_preview_id"!==n[0]&&(t[n[0]]=n[1])}}return t}function Zo(o,t,e){if("exact"===e)if(Object.keys(t).length!==Object.keys(o).length)return!1;for(var i in t)if(t.hasOwnProperty(i)&&t[i]!==o[i])return!1;return!0}function jo(o,t,e,i){var n=!1;switch(typeof o){case"string":-1!==t.indexOf(eo(o.split("?")[0],{keepEscaped:!0}))&&(n=Zo(i,Vo(o),"substring"));break;case"object":if(o.match&&o.value){var a=eo(o.value,{keepEscaped:!0}),p=Vo(a);switch(o.match){case"simple":"/"===e.slice(-1)&&(e=e.slice(0,-1)),"/"===o.value.slice(-1)&&(o.value=o.value.slice(0,-1)),e===o.value&&(n=!0);break;case"exact":n=Object.keys(p).length>0&&t.split("?")[0].replace(/\/$/,"")===a.split("?")[0].replace(/\/$/,"")?Zo(i,p,o.match):t.replace(/\/$/,"")===a.replace(/\/$/,"");break;case"regex":new RegExp(o.value).test(t)&&(n=!0);break;default:n=Object.keys(p).length>0&&-1!==t.indexOf(a.split("?")[0])?Zo(i,p,o.match):-1!==t.indexOf(a)}}else console.log("invalid display conditions");break;default:console.log("invalid display conditions")}return n}var Jo=[],Yo={add:function(o,t,e){o.addEventListener(t,e),Jo.push({target:o,type:t,listener:e})},remove:function(o,t,e){o.removeEventListener(t,e)},removeAll:function(){var o=this;Jo.forEach(function(t){o.remove(t.target,t.type,t.listener)}),Jo.length=0}};function _o(o){return o.scrollListener=function(){Po(o,function(){"function"==typeof x.addEventListener?Yo.remove(x,"scroll",o.scrollListener):x.onscroll=null})},"function"==typeof x.addEventListener?Yo.add(x,"scroll",o.scrollListener):x.onscroll=o.scrollListener,!0}var Qo=null;function $o(o){return{check:function(){var t=R.scrollingElement||function(){if(Qo)return Qo;if(document.body.scrollTop)return Qo=document.body;var o=document.createElement("iframe");o.style.height="1px",document.documentElement.appendChild(o);var t=o.contentWindow.document;t.write('
x
'),t.close();var e=t.documentElement.scrollHeight>t.body.scrollHeight;return o.parentNode.removeChild(o),Qo=e?document.documentElement:document.body}();return t.scrollTop/(t.scrollHeight-t.clientHeight)*100>=o}}}function Xo(o,t){var e,i=o.displayConditions;if(o.watchers=[],o.listeners=[],o.expiration=new Date,o.expiration.setDate(o.expiration.getDate()+365),("gate"!==o.layout||"true"!==oo(r+o.id))&&!0!==o.hiddenViaABTests){if(o.pushDown){if("bar"!==o.layout||"top-fixed"!==o.position&&"top-absolute"!==o.position)throw new Error("Only top positioned bar widgets may have a pushDown property");H(R.querySelector(o.pushDown),"pf-push-down")}var n,a,p,l;o.valid=o.valid&&function(o,t){for(var e,i=!0,n=[],a=0;a0){for(var r=0;r0&&(B.dependentDataWidgets[o.id]||(B.dependentDataWidgets[o.id]={}),B.dependentDataWidgets[o.id][b]=n),i}(o,this.customData),i.date&&(o.valid=o.valid&&(n=i.date,a=!0,p=Date.now(),n.start_at&&pnew Date(n.end_at).getTime()&&(a=!1),a)),i.pageVisits&&(o.valid=o.valid&&(l=i.pageVisits,oo(g)>=l)),i.hideAfterAction&&(o.valid=o.valid&&function(o,t){var e,i=!0,n=Date.now(),a=oo(d+t.id),p=oo(c+t.id),l=oo(v+t.id);return o.confirm&&a&&(e=a.split("|"),parseInt(e[0],10)>=o.confirm.hideCount&&(i=!1),void 0!==e[1]&&Math.abs(e[1]-n)/1e3=o.cancel.hideCount&&(i=!1),void 0!==e[1]&&Math.abs(e[1]-n)/1e3=o.closed.hideCount&&(i=!1),void 0!==e[1]&&Math.abs(e[1]-n)/1e31&&(!e||"HTML"===e.nodeName)){var i=o.positions[o.positions.length-1].y,n=o.positions[o.positions.length-2].y,a=Math.abs(i-n);if(o.positions=[],i-a<=50&&i30&&t.positions.shift()},o.exitIntentTrigger=function(t){Po(o,function(){"function"==typeof R.removeEventListener?(Yo.remove(R,"mousemove",o.exitIntentListener),Yo.remove(R,"mouseout",o.exitIntentTrigger)):(R.onmousemove=null,R.onmouseout=null)},t)},"function"==typeof R.addEventListener?(Yo.add(R,"mousemove",o.exitIntentListener),Yo.add(R,"mouseout",o.exitIntentTrigger)):(R.onmousemove=o.exitIntentListener,R.onmouseout=o.exitIntentTrigger))}(o,e)),i.displayWhenElementVisible&&(e=function(o){var t={elem:R.querySelector(o),check:function(){var o=R.body.scrollTop||R.documentElement.scrollTop,e=x.innerHeight+o>=R.body.offsetHeight;return!!(t.elem.offsetTop-x.innerHeight/2<=o||e)}};return t}(i.displayWhenElementVisible),o.watchers.push(e),_o(o)),i.scrollPercentageToDisplay&&(e=$o(i.scrollPercentageToDisplay),o.watchers.push(e),_o(o)),i.manualTrigger&&(e=function(o,t){return{check:function(){return!!(o&&B.triggeredWidgets[t.id]||B.triggeredWidgets["*"])}}}(i.manualTrigger,o),o.watchers.push(e),B.readyWidgets.push(o),Lo(o)),0!==o.watchers.length||i.showOnExitIntent||o.valid&&Go(o)}}function ot(o){return o.id=po(),Bo(o)}function tt(o){if(Array.isArray(o)){var t=B.openedWidgets,e=[];t.forEach(function(t,i){-1!==o.indexOf(t)&&e.push({widget:t,index:i})}),e.forEach(function(o){var t=o.widget,e=R.getElementById(t.id);for(var i in e&&(O(e,"opened"),e.parentNode&&e.parentNode.removeChild(e)),t.listeners)if(t.listeners.hasOwnProperty(i)){var n=t.listeners[i];n.target.removeEventListener(n.type,n.fn)}}),e.sort(function(o,t){return t.index-o.index}).forEach(function(o){t.splice(o.index,1)})}else console.warn("clearWidget: widgets must be an array")}function et(o){if(Array.isArray(o)){var t=B.delayedWidgets;o.forEach(function(o){var e,i;t.hasOwnProperty(o)&&(e=o,(i=B.delayedWidgets[e])&&(clearTimeout(i),delete B.delayedWidgets[e]))})}else console.warn("cancelDelayedWidgets: widgetIds must be an array")}function it(){var i=B.openedWidgets,n=B.delayedWidgets;tt(i),et(Object.keys(n)),Yo.removeAll(),t(B),e(G),o(N),this.callbacks=[],this.acctid=""}function nt(o){if(Array.isArray(o)){var t=B.openedWidgets,e=[];t.forEach(function(t){-1!==o.indexOf(t.id)&&e.push(t)}),tt(e),et(o),o.forEach(function(o){var t=B.initializedWidgets.indexOf(o);-1!==t&&B.initializedWidgets.splice(t,1);for(var e=B.prioritizedWidgets.length-1;e>=0;e--)B.prioritizedWidgets[e].id===o&&B.prioritizedWidgets.splice(e,1);for(var i=B.readyWidgets.length-1;i>=0;i--)B.readyWidgets[i].id===o&&B.readyWidgets.splice(i,1);B.triggeredWidgets.hasOwnProperty(o)&&delete B.triggeredWidgets[o],B.dependentDataWidgets.hasOwnProperty(o)&&delete B.dependentDataWidgets[o]})}else console.warn("clearById: widgetIds must be an array")}function at(o,t){var e={valid:!0,type:o};if(!t)throw new Error("Config object is missing");if(e.config=t,!t.id)throw new Error("All widgets must have an id value");return e.id=t.id,e}function pt(o){return at("message",o)}function lt(o){return at("subscription",o)}function rt(o){return at("form",o)}function ut(o){return at("sitegate",o)}function st(){return B.dependentDataWidgets}function dt(o){o.forEach(function(o){var t=o.type,e=oo(o.cookieId),i=0,n=new Date;e||(e=Math.random()),n.setDate(n.getDate()+365),$(o.cookieId,e,n);for(var a=0;a<1&&!(e<=(a+=t.groups[i]));)i++;if(o.groups.forEach(function(o,t){o.forEach(function(o){if(void 0!==o.abTestingGroup)throw new Error("Widget #"+o.config.id+" is defined in more than one AB test.");o.abTestingGroup=t,o.hiddenViaABTests=i===t})}),void 0!==G.abTestingGroups[o.id])throw new Error("AB test with ID="+o.id+" has been already defined.");G.abTestingGroups[o.id]=i})}function ct(o){return function(o){var t={};if(!o)throw new Error("Config object is missing");if(t.id=o.id,t.cookieId=f+o.id,t.groups=o.groups,!P[o.type])throw new Error("Unknown AB testing type: "+o.type);return t.type=P[o.type],t}(o)}function vt(o){var t={},e=R.querySelectorAll("["+o+"]");this.elements=this.elements.concat(e);for(var i=0;i +