(function(){var GkJSON,Gokeep,cookie,domain,getAllUrlParams,gokeep,keepie,extend=function(e,t){function n(){this.constructor=e}for(var o in t)hasProp.call(t,o)&&(e[o]=t[o]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},hasProp={}.hasOwnProperty,indexOf=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};GkJSON={parse:function(sJSON){return eval("("+sJSON+")")},stringify:function(){var e,t,n,o,r,i;return o=Object.prototype.toString,r=Array.isArray||function(e){return"[object Array]"===o.call(e)},t={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},e=function(e){return t[e]||"\\u"+(e.charCodeAt(0)+65536).toString(16).substr(1)},n=/[\\"\u0000-\u001F\u2028\u2029]/g,i=function(t){var a,u,c,p;if(null===t)return"null";if("number"==typeof t)return isFinite(t)?t.toString():"null";if("boolean"==typeof t)return t.toString();if("object"==typeof t){if("function"==typeof t.toJSON)return t.toJSON();if(r(t)){for(p="[",c=0;c<t.length;)p+=(c?", ":"")+i(t[c]),c++;return p+"]"}if("[object Object]"===o.call(t)){a=[];for(u in t)t.hasOwnProperty(u)&&a.push(i(u)+": "+i(t[u]));return"{"+a.join(", ")+"}"}}return t=t.toString().replace(/&/g,"GkEC"),'"'+t.toString().replace(n,e)+'"'}}()},this.GkXhr=function(){function e(e){this.domain=e}return e.prototype.create=function(e,t){var n;if(n=new XMLHttpRequest,"withCredentials"in n)n.open(e,""+this.domain+t,!0);else{if("undefined"==typeof XDomainRequest||null===XDomainRequest)return;n=new XDomainRequest,n.open(e,""+this.domain+t)}return n},e.prototype.post=function(e,t,n){var o,r,i,a,u,c,p,s,l;for(l=this.create("POST",e),o="",this.verify,i=u=0,p=n.length;p>u;i=++u)r=n[i],l.setRequestHeader(r.type,r.content);for(i=c=0,s=t.length;s>c;i=++c)a=t[i],o+=encodeURI(a.name)+"="+encodeURI(a.value)+"&";return null!=o?l.send(o):void 0},e.prototype.verify=function(e){null==e&&console.log("CORS not supported")},e}(),this.GkCookie=function(){function e(){}return e.prototype.set=function(e,t,n){var o,r;return n?(o=new Date,o.setTime(o.getTime()+n),r="; expires="+o.toGMTString()):r="",document.cookie=e+"="+t+r+"; path=/"},e.prototype.get=function(e){var t,n,o,r;for(r=e+"=",n=document.cookie.split(";"),o=0;o<n.length;){for(t=n[o];" "===t.charAt(0);)t=t.substring(1,t.length);if(0===t.indexOf(r))return t.substring(r.length,t.length);o++}return null},e.prototype["delete"]=function(e){return this.setCookie(e,"",-1)},e}(),domain="https://tracking.gokeep.me",keepie="RYGHDIcJyBZcnezCWcdguSqEVcevntwrzHTEXAFIZsCUQPZeSG",cookie=new GkCookie,getAllUrlParams=function(e){var t,n,o,r,i,a,u,c,p,s,l;if(l=e?e.split("?")[1]:window.location.search.slice(1),u={},l)for(l=l.split("#")[0],n=l.split("&"),o=i=0,a=n.length;a>i;o=++i)r=n[o],t=n[o].split("="),p=void 0,c=t[0].replace(/\[\d*\]/,function(e){return p=e.slice(1,-1),""}),s="undefined"==typeof t[1]?!0:t[1],c=c.toLowerCase(),s=s.toLowerCase(),u[c]?("string"==typeof u[c]&&(u[c]=[u[c]]),"undefined"==typeof p?u[c].push(s):u[c][p]=s):u[c]=s;return u},this.GkSend=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return extend(t,e),t.prototype.pageview=function(){return this.post("/pageview",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store".replace(/&/g,"GkEC"))},{name:"url",value:window.location.href.replace(/&/g,"GkEC")},{name:"title",value:document.title.replace(/&/g,"GkEC")},{name:"user_agent",value:navigator.userAgent},{name:"newsession",value:cookie.get("gokeep_newsession")}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}]),cookie.set("gokeep_newsession","false",18e5)},t.prototype.productimpression=function(e){return this.post("/productimpression",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store")},{name:"products",value:GkJSON.stringify(e)}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}])},t.prototype.productview=function(e){var t;return t=Array.isArray(e)?e[0]:e,this.post("/productview",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store")},{name:"product",value:GkJSON.stringify(t)}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}])},t.prototype.cartadd=function(e){return this.post("/cart/add",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store")},{name:"products",value:GkJSON.stringify(e)}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}])},t.prototype.cartremove=function(e){return this.post("/cart/remove",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store")},{name:"products",value:GkJSON.stringify(e)}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}])},t.prototype.cartupdate=function(e){return this.post("/cart/update",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store")},{name:"products",value:GkJSON.stringify(e)}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}])},t.prototype.order=function(e){return this.post("/order",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store")},{name:"order",value:GkJSON.stringify(e)},{name:"utm",value:cookie.get("gokeep_utm")},{name:"journey",value:cookie.get("gokeep_journey")}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}])},t.prototype.checkout=function(e){return this.post("/checkout",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store")},{name:"order",value:GkJSON.stringify(e)}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}])},t.prototype.lead=function(e){return this.post("/lead",[{name:"keepie",value:keepie},{name:"store_id",value:cookie.get("gokeep_store")},{name:"lead",value:GkJSON.stringify(e)}],[{type:"Content-type",content:"application/x-www-form-urlencoded"}])},t}(GkXhr),Gokeep=function(){function e(){}return e.prototype.initializer=function(){var e,t,n,o,r,i;for(e=this.getEvents(),o=r=0,i=e.length;i>r;o=++r)switch(t=e[o],t.name){case"create":this.events.create(t.method),this.events.include(cookie.get("gokeep_store"),"plugins");break;case"send":this.events.send(t.method,t.data,t.additionalData);break;case"include":this.events.include(t.method,"stores")}this.emailGrabber(),n=this,window.setInterval(function(){return n.emailGrabber()},5e3)},e.prototype.sync=function(e){return"send"===e[0]?this.events.send(e[1],e[2],e[3]):void 0},e.prototype.events={liberateEvents:["pageview","productview","productimpression","cartadd","cartremove","cartupdate","checkout","order","lead"],executeRecent:[],create:function(e){var t,n,o,r,i;return r="gokeep_store",t=getAllUrlParams(),o=JSON.parse(cookie.get("gokeep_utm")),n=cookie.get("gokeep_journey")&&"null"!==cookie.get("gokeep_journey")?JSON.parse(cookie.get("gokeep_journey")):new Array,Object.keys(t).length&&(t.hasOwnProperty("utm_campaign")||t.hasOwnProperty("utm_medium")||t.hasOwnProperty("utm_source"))&&(i={utm_campaign:t.hasOwnProperty("utm_campaign")?t.utm_campaign:"",utm_medium:t.hasOwnProperty("utm_medium")?t.utm_medium:"",utm_source:t.hasOwnProperty("utm_source")?t.utm_source:""},n.push(i),cookie.set("gokeep_utm",GkJSON.stringify(i),36e5),cookie.set("gokeep_journey",GkJSON.stringify(n),12096e5)),null===cookie.get(r)||cookie.get(r)!==e&&"checkoutview"!==e?cookie.set(r,e,63072e8):void 0},send:function(e,t,n){return null==n&&(n=""),indexOf.call(this.liberateEvents,e)>=0&&indexOf.call(this.executeRecent,e)<0&&"pageview"===e&&new GkSend(domain).pageview(),indexOf.call(this.liberateEvents,e)>=0&&indexOf.call(this.executeRecent,e)<0&&"productview"===e&&new GkSend(domain).productview(t),indexOf.call(this.liberateEvents,e)>=0&&indexOf.call(this.executeRecent,e)<0&&"productimpression"===e&&new GkSend(domain).productimpression(t),indexOf.call(this.liberateEvents,e)>=0&&indexOf.call(this.executeRecent,e)<0&&"cartadd"===e&&new GkSend(domain).cartadd(t),indexOf.call(this.liberateEvents,e)>=0&&indexOf.call(this.executeRecent,e)<0&&"cartremove"===e&&new GkSend(domain).cartremove(t),indexOf.call(this.liberateEvents,e)>=0&&indexOf.call(this.executeRecent,e)<0&&"cartupdate"===e&&new GkSend(domain).cartupdate(t),indexOf.call(this.liberateEvents,e)>=0&&"checkout"===e&&new GkSend(domain).checkout(t),indexOf.call(this.liberateEvents,e)>=0&&indexOf.call(this.executeRecent,e)<0&&"order"===e&&(new GkSend(domain).order(t),cookie.set("gokeep_utm",null,0),cookie.set("gokeep_journey",null,0)),indexOf.call(this.liberateEvents,e)>=0&&indexOf.call(this.executeRecent,e)<0&&"lead"===e&&new GkSend(domain).lead(t),this.executeRecent.push(e)},include:function(e,t){var n,o,r;return r="plugins"===t?domain+"/script/plugins/"+e:domain+"/script/stores/"+e,o=document.createElement("script"),o.async=1,o.src=r,n=document.getElementsByTagName("script").length-1,n=document.getElementsByTagName("script")[n],n.parentNode.insertBefore(o,n.nextSibling)}},e.prototype.getEvents=function(){var e,t,n,o,r,i;for(e=window.gokeep.q,t=[],o=r=0,i=e.length;i>r;o=++r)n=e[o],null!==n&&t.push({name:n[0],method:n[1],data:null!=n[2]?n[2]:void 0,additionalData:null!=n[3]?n[3]:void 0});return t},e.prototype.emailGrabber=function(){var e,t,n,o,r;for(t=window.document.getElementsByTagName("input"),r=[],n=0,o=t.length;o>n;n++)e=t[n],"text"!==e.type&&"email"!==e.type||"true"!==e.dataset.gokeep&&e.addEventListener("blur",function(){var e,t,n;return e=this.value,t=/^(([^<>()\[\]\\.,;:\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,}))$/.test(e),t?(n={name:"",email:e},new GkSend(domain).lead(n)):void 0}),r.push(e.dataset.gokeep="true");return r},e}(),gokeep=new Gokeep,gokeep.initializer(),window.gokeep.q.push=function(){return gokeep.sync(arguments[0]),Array.prototype.push.apply(this,arguments)},this.GkBounce=function(){function e(){}var t;return t=void 0,e.prototype.setBounce=function(e){t=e,document.documentElement.addEventListener("mouseleave",this.handleMouseleave)},e.prototype.handleMouseleave=function(e){e.clientY<20&&t()},e}()}).call(this);