!function(window,document,px,pxName,apiUrl,v){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function setTags(tags){for(var tagEvalResult={},i=0;i<tags.length;++i)try{if(tagEvalResult[tags[i].id]={status:"SUCCESS"},"px"===tags[i].type)_sendImg(tags[i].url);else if("script"===tags[i].type){var tag=document.createElement("script");tag.setAttribute("src",tags[i].url),document.body.appendChild(tag)}else"js"===tags[i].type&&eval(tags[i].source)}catch(err){throw tagEvalResult[tags[i].id].status="FAILURE",tagEvalResult[tags[i].id].msg=JSON.stringify(err,Object.getOwnPropertyNames(err)),tagEvalResult}}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Config={id:"",version:v,options:{debug:!1},disabled:!1},isset=function(e){return"undefined"!=typeof e&&null!==e&&""!==e},now=function(){return 1*new Date},uuid=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},serializeData=function t(e){return isset(e)===!1?"":"object"===("undefined"==typeof e?"undefined":_typeof(e))?t(JSON.stringify(e)):"function"==typeof e?t(e()):String(e)},getLocation=function(){var e=isInIFrame()?document.referrer:window.location.href;return""===e&&(e=window.location.href),e},isInIFrame=function(){return window.top===window.self?0:1},sendError=function(e){var t=SITE_CENTRIC_ENDPOINT+"?v="+Config.version+"&aid="+Config.id+"&a=error&cid="+Cookie.get("_vb")+"&url="+encodeURIComponent(getLocation())+"&err="+encodeURIComponent(e),n=new Image;n.src=t,"undefined"!=typeof console},_sendImg=function(e){var t=document.createElement("img");return t.src=e,t.style.display="none",t.width="1",t.height="1",document.body?document.body.appendChild(t):document.addEventListener("DOMContentLoaded",function(e){document.body.appendChild(t)}),t},Cookie={set:function(e,t,n){var i="";if(isset(n)){var o=new Date;o.setTime(o.getTime()+60*n*1e3),i="; expires="+o.toUTCString()}document.cookie=e+"="+t+i+"; path=/; SameSite=None; Secure"},get:function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}},exists:function(e){return isset(this.get(e))}},Pixel=function(){function e(t,n,i,o,r){_classCallCheck(this,e),this.params=[],this.event=n,this.timestamp=i,this.optional=serializeData(r),this.commandName=t,this.buildParams(),this.send()}return _createClass(e,[{key:"buildParams",value:function(){var e=this.getAttribute();for(var t in e)e.hasOwnProperty(t)&&this.setParam(t,e[t])}},{key:"getAttribute",value:function(){return{aid:Config.id,cid:Cookie.get("_vb"),gid:Cookie.get("_ga"),eid:uuid(),a:this.event,ed:this.optional,v:Config.version,url:getLocation(),ifr:isInIFrame(),ref:document.referrer,ts:this.timestamp,sr:window.screen.width+"x"+window.screen.height,vp:window.innerWidth+"x"+window.innerHeight,trk:Config.trkParam}}},{key:"setParam",value:function(e,t){isset(t)?this.params.push(e+"="+encodeURIComponent(t)):this.params.push(e+"=")}},{key:"send",value:function(){Config.disabled||("xhr"===this.commandName?this.sendXmlHttpRequest(function(e){}):window.navigator.sendBeacon?this.sendBeacon():this.sendImg())}},{key:"sendXmlHttpRequest",value:function(e){try{var t=window.XMLHttpRequest?new window.XMLHttpRequest:window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null;t?(this.setParam("t","xhr"),t.open("GET",this.getSourceUrl(),!0),t.withCredentials=!0,t.timeout=5e3,t.onerror=t.onabort=t.ontimeout=function(t){e(t)},t.onreadystatechange=function(){4===this.readyState&&this.status>=200&&this.status<300&&e()},t.send()):(this.commandName="beacon",send())}catch(n){e(n)}}},{key:"sendBeacon",value:function(){this.setParam("t","bea"),window.navigator.sendBeacon(this.getSourceUrl())}},{key:"sendImg",value:function(){this.setParam("t","img"),this.img=_sendImg(this.getSourceUrl())}},{key:"getSourceUrl",value:function(){return SITE_CENTRIC_ENDPOINT+"?"+this.params.join("&")}}]),e}();Cookie.exists("_vb")?Cookie.set("_vb",Cookie.get("_vb"),43200):Cookie.set("_vb",uuid(),43200);var SITE_CENTRIC_ENDPOINT=apiUrl+"/s";px.process=function(e,t,n){try{"init"==e?(Config.id=t,Config.trkParam=n&&n.trkParam?n.trkParam:"trkid"):"event"==e?new Pixel("xhr",t,now(),Config.options,n):"beaconEvent"==e&&new Pixel("beacon",t,now(),Config.options,n)}catch(i){var o=i.message||JSON.stringify(i);sendError(o)}};for(var i=0,l=px.queue.length;i<l;i++)px.process.apply(px,px.queue[i])}(window,document,window.vbpx,"vbpx","https://t.vibe.co/pixel",4);