/*! * ··· Chatra | https://chatra.io/ */ !function(a,b){function c(){}function d(a,b){a=a||{},b=b||{};for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function e(a){var b=0;for(var c in a)a.hasOwnProperty(c)&&b++;return b}function f(a,b){if(e(a)!=e(b))return!1;for(var c in a)if(a.hasOwnProperty(c)&&b[c]!=a[c])return!1;return!0}function g(a,b){new RegExp("(\\s|^)"+b+"(\\s|$)").test(a.className)||(a.className+=" "+b)}function h(a,b){a.className=a.className.replace(new RegExp("(\\s+|^)"+b+"(\\s+|$)","g")," ").replace(/^\s+|\s+$/g,"")}function i(a){a.parentNode&&a.parentNode.removeChild(a)}function j(a){var c=["Webkit","Moz","ms"],d=b.createElement("div");if(void 0!==d.style[a])return!0;a=a.charAt(0).toUpperCase()+a.slice(1);for(var e in c)if(void 0!==d.style[c[e]+a])return!0;return!1}function k(a,b,c,d){return b?(a.addEventListener(b,c,!!d),function(){l(a,b,c,d)}):void 0}function l(a,b,c,d){b&&a.removeEventListener(b,c,!!d)}function m(a,c){var d=new Date;d.setTime(d.getTime()+31536e7),b.cookie=a+"="+c+";expires="+d.toGMTString()+";SameSite=None;secure;"}function n(a){var c=b.cookie.split(";");a+="=";for(var d=0;d800){var v=t(b.referrer);s=encodeURIComponent(v.protocol+"//"+v.host)}if(u.length>800){var w=t(C._referrer);u=encodeURIComponent(w.protocol+"//"+w.host)}}var z="hostId="+n+"&mode="+encodeURIComponent(e)+"&clientId="+encodeURIComponent(p)+("undefined"!=typeof d.groupId?"&groupId="+encodeURIComponent(d.groupId):"")+(C._isMobile?"&isMobile=1":"")+(d.buttonStyle?"&buttonType="+encodeURIComponent(d.buttonStyle):"")+(d.language&&"string"==typeof d.language?"&langOverride="+encodeURIComponent(d.language):"")+"&lang="+encodeURIComponent(r)+"¤tPage="+encodeURIComponent(location.href)+"¤tPageTitle="+encodeURIComponent(b.title)+"&prevPage="+s+"&referrer="+u,A=l+"//"+m+"/#"+z;switch(e){case"frame":var D,E=d.injectTo;if(!E)return console.warn("Chatra: `ChatraSetup.injectTo` is required when using `frame` mode!"),void C.kill();q(function(){return"string"==typeof E?D=b.getElementById(E):E[0]&&E[0].appendChild?D=E[0]:E.appendChild&&(D=E),D?(f.src=A,f.className="chatra__iframe--mode-frame",D.innerHTML="",D.appendChild(f),void(C._attachedToDom=!0)):(console.warn("Chatra: something is wrong with your `ChatraSetup.injectTo`"),void C.kill())});break;default:C._isMobile&&C._addClass("mobile-widget"),C._setButtonType("tab"),C._setChatPosition("br"),f.src=A,f.style.position="absolute",h.appendChild(f),g.appendChild(h),q(function(){if("webkit"==c.browser.engine&&C._addAutoRemovableEvent(g,"wheel",function(a){C._chatExpanded&&o(a)}),C._isMobile&&C._features.transform){setTimeout(function(){C._adjustZoomLevel()},100);var d=C._adjustZoomLevel.bind(C);C._addAutoRemovableEvent(b.body,"touchend",d),C._addAutoRemovableEvent(a,"scroll",d),C._addAutoRemovableEvent(a,"orientationchange",d),C._addAutoRemovableEvent(a,"resize",d)}if(b.body.appendChild(g),C._attachedToDom=!0,a.Shopify&&"function"==typeof a.doShift){var e=a.doShift;a.doShift=function(){var a,b=g.style.position;return g.style.position="absolute",a=e.apply(this,arguments),g.style.position=b,a}}})}a.ChatraIntegration&&C.setIntegrationData(a.ChatraIntegration),d.startHidden&&C.hide(),C.setZIndex("number"==typeof d.zIndex?d.zIndex:C._zIndex),d.colors&&C.setColors(d.colors),d.chatWidth&&C.setChatWidth(d.chatWidth),d.buttonSize&&C.setButtonSize(d.buttonSize),d.chatHeight&&C.setChatHeight(d.chatHeight),d.buttonPosition&&C.setButtonPosition(d.buttonPosition),d.locale&&C.setLocale(d.locale),"function"==typeof d.onInit&&d.onInit(),C.pageView();for(var F=0;Fa&&(a=20),C._roundButtonSize=a,C._recalcChatSize())},setChatHeight:function(a){"number"==typeof a&&(C._chatHeight=a,C._recalcChatSize())},setZIndex:function(a){"number"==typeof a&&(C._zIndex=a,C._refreshZIndex())},setButtonPosition:function(a){return-1==["lt","lm","lb","bl","bc","br","rt","rm","rb"].indexOf(a)?void console.warn("Chatra: invalid `positionCode`!"):void C._postMessage("setPosition",a)},resetButtonPosition:function(){C._postMessage("resetPosition")},setColors:function(a){C._postMessage("colors",a)},resetColors:function(){C._postMessage("resetColors")},setLocale:function(a){C._postMessage("setLocale",a)},_openChat:function(a){C._postMessage("openChat",!!a)},openChat:function(a){"widget"==C._displayMode&&C._openChat(!!a)},expandWidget:function(a){"widget"==C._displayMode&&(C._isMobile||C._openChat(!!a))},minimizeWidget:function(){"widget"==C._displayMode&&C._postMessage("collapseChat")},expandChat:e("expandWidget"),collapseChat:e("minimizeWidget"),closeChat:e("minimizeWidget"),hide:function(){"widget"==C._displayMode&&(C._chatHiddenByUser=!0,C._refreshChatVisibility())},show:function(){"widget"==C._displayMode&&(C._chatHiddenByUser=!1,C._refreshChatVisibility())},hideChat:e("hide"),showChat:e("show"),setGroupId:function(a){"undefined"!=typeof a&&C._postMessage("setGroupId",a)},_messageHandler:function(a,b){switch(a){case"setHostedItem":if(!b||"object"!=typeof b||"string"!=typeof b.key)return;C._setHostedItem(b.key,b.value);break;case"apiReady":C._apiReady=!0,C._sendMessageQ();break;case"readyToRetriveHostedStorage":C._sendHostedStorage();break;case"readyToRetriveData":C._chatReady=!0,C._sendFocus(),C._resolvePageInfoQ();break;case"headerReady":C._chatRendered=!0,"function"==typeof C._setup.onRendered&&C._setup.onRendered();break;case"collapseWindow":C._collapseChatWindow();break;case"expandWindow":C._expandChatWindow(b);break;case"hideChat":C._hideChatFromFrame();break;case"showChat":C._showChatFromFrame();break;case"setPosition":if(!b||"string"!=typeof b)return;C._setChatPosition(b);break;case"buttonType":if(!b||"string"!=typeof b)return;C._setButtonType(b);break;case"titleBlink":C._titleBlink(b);break;case"banned":C._setStoredItem("Chatra.banned",b?C._clientId:""),C._refreshChatVisibility();break;case"restart":C.restart();break;case"analyticsEvent":if(!b)return;"string"==typeof b?C._logAnalyticsEvent(b):"object"==typeof b&&C._logAnalyticsEvent(b[0],b[1]);break;case"labelWidth":if("number"!=typeof b&&null!==b)return;C._animating(),C._computedLabelWidth=b,C._recalcChatSize();break;case"transparentChatHeight":if("number"!=typeof b)return;C._transparentChatHeight=b,C._recalcChatSize();break;case"s":C.kill()}},_hideChatFromFrame:function(){C._chatHiddenByFrame=!0,C._refreshChatVisibility()},_showChatFromFrame:function(){C._chatHiddenByFrame=!1,C._refreshChatVisibility()},_getScaleLevel:function(){var c,d=a.screen,e=d.width;return{90:1,"-90":1}[a.orientation]&&"winphone"==C._sniff.os.name&&"trident"==C._sniff.browser.engine&&(e=d.height),c=ea&&(a=1),a=a.toFixed(2),a!=C._scale&&(C._transform.scale=a,C._recalcTransform(),C._scale=a)}},_transform:{},_recalcTransform:function(){var a=(C._transform,"");for(var b in C._transform)C._transform[b]&&C._transform.hasOwnProperty(b)&&(a+=" "+b+"("+C._transform[b]+")");a||(a="none"),C._wrapper.style.transform=C._wrapper.style.WebkitTransform=C._wrapper.style.MozTransform=C._wrapper.style.msTransform=a},_refreshZIndex:function(){C._wrapper.style.zIndex=C._chatExpanded?2147483647:C._zIndex},_refreshChatVisibility:function(){!C._chatRendered||C._chatHiddenByUser||C._chatHiddenByFrame||C._getStoredItem("Chatra.banned")===C._clientId?(C._visible=!1,C._removeClass("visible"),C._postMessage("visible",!1)):(C._visible=!0,C._addClass("visible"),C._postMessage("visible",!0),C._isSafari&&C._safariForceRedraw()),C._refreshMobileBodyFix(),C._refreshMobileViewportFix()},_refreshMobileBodyFix:function(){if(C._isMobile&&"widget"==C._displayMode)if(C._visible&&C._chatExpanded&&!C._chatTransparent){if(C._mobileBodyFixEnabled)return;C._lastScrollTop=a.pageYOffset,C._lastScrollLeft=a.pageXOffset,g(b.body,"chatra-mobile-widget-expanded"),g(b.documentElement,"chatra-mobile-widget-expanded"),C._mobileBodyFixEnabled=!0}else{if(!C._mobileBodyFixEnabled)return;h(b.body,"chatra-mobile-widget-expanded"),h(b.documentElement,"chatra-mobile-widget-expanded"),a.scrollTo(C._lastScrollLeft,C._lastScrollTop),C._mobileBodyFixEnabled=!1}},_refreshMobileViewportFix:function(){if(C._isMobile&&"widget"==C._displayMode&&("android"==C._sniff.os.name&&"webkit"==C._sniff.browser.engine&&C._sniff.os.majorVersion>=4||"ios"==C._sniff.os.name&&"webkit"==C._sniff.browser.engine||"gecko"==C._sniff.browser.engine))if(C._visible&&C._chatExpanded&&!C._chatTransparent){var a=u();a||(a=b.createElement("meta"),a.setAttribute("name","viewport"),document.head.appendChild(a)),C._lastMetaViewportValue=a.getAttribute("content")||"width=none",a.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no")}else{var a=u();a&&"string"==typeof C._lastMetaViewportValue&&a.setAttribute("content",C._lastMetaViewportValue)}},_chatExpanded:!1,_expandChatWindow:function(a){var b=C._chatTransparent;C._chatExpanded=!0,C._addClass("expanded"),a?(C._chatTransparent=!0,C._addClass("transparent")):(C._chatTransparent=!1,C._removeClass("transparent")),C._refreshZIndex(),C._adjustZoomLevel(),C._isToggling=!0,C._addClass("toggling"),C._animating(function(){C._isToggling=!1,C._removeClass("toggling"),C._isSafari&&C._recalcChatSize(),C._refreshMobileViewportFix(),setTimeout(C._refreshMobileBodyFix.bind(C),250)},b),C._recalcChatSize()},_collapseChatWindow:function(){var a=C._chatTransparent;C._chatExpanded=!1,C._chatTransparent=!1,C._refreshMobileViewportFix(),C._refreshMobileBodyFix(),C._removeClass("expanded"),C._removeClass("transparent"),C._isToggling=!0,C._addClass("toggling"),C._animating(function(){C._isToggling=!1,C._removeClass("toggling"),C._isSafari&&C._recalcChatSize(),C._adjustZoomLevel(),C._refreshZIndex()},a),C._recalcChatSize()},_animating:function(a,b){if(!C._features.transition||!C._chatRendered)return void(a&&a());if("round"==C._buttonType||C._isMobile||C._chatTransparent||b)return C._addClass("fast-toggle"),void(a&&a());C._removeClass("fast-toggle"),C._addClass("animating"),clearTimeout(C._animatingTimer);var c=z+30;C._animatingTimer=setTimeout(function(){C._removeClass("animating"),a&&a()},c)},_setChatPosition:function(a){var b={r:"right",l:"left",c:"center",t:"top",b:"bottom",m:"middle"},c=b[a.charAt(0)],d=b[a.charAt(1)];if(C._isMobile){var e=["0%","0%"];"center"==d&&(e[0]="50%"),"right"!=d&&"right"!=c||(e[0]="100%"),"middle"==d&&(e[1]="50%"),"bottom"==d&&(e[1]="100%"),"bottom"==c&&(e[1]="100%"),C._wrapper.style.transformOrigin=C._wrapper.style.WebkitTransformOrigin=C._wrapper.style.MozTransformOrigin=C._wrapper.style.msTransformOrigin=e.join(" ")}C._side&&C._removeClass("side-"+C._side),C._position&&C._removeClass("pos-"+C._position),C._addClass("side-"+c),C._addClass("pos-"+d),C._side=c,C._position=d,C._recalcChatSize()},_setButtonType:function(a){C._buttonType&&C._removeClass("style-"+C._buttonType),C._addClass("style-"+a),C._buttonType=a,C._recalcChatSize()},_recalcChatSize:function(){var a,b,c=Math.max(C._chatWidth,C._chatMinWidth),d=C._chatHeight,e=Math.max(C._computedLabelWidth||C._chatWidth,C._labelMinWidth),f=C._chatExpanded&&C._isMobile&&!C._chatTransparent,g=!!{left:1,right:1}[C._side];C._iframe.style.width=Math.max(c,g?0:e)+"px",C._iframe.style.height=Math.max(d,g?e:0)+"px",C._chatExpanded?C._chatTransparent?(a=C._isMobile?C._mobileTransparentChatWidth:C._transparentChatWidth,b=C._transparentChatHeight?Math.min(C._transparentChatHeight,d):d):(a=c,b=d):"round"==C._buttonType?a=b=C._roundButtonSize:(a=e,b=C._isMobile?C._mobileLabelHeight:C._labelHeight,g&&(b=[a,a=b][0])),"center"==C._position&&!f&&q(a)&&a++,"middle"==C._position&&!C._chatExpanded&&q(b)&&b++,f?(C._wrapper.style.width="100%",C._wrapper.style.height="100%"):(C._wrapper.style.width=a+"px",C._wrapper.style.height=b+"px"),"middle"!=C._position||C._chatExpanded?"top"!=C._position||C._chatExpanded||"round"==C._buttonType?C._transform.translateY=void 0:C._transform.translateY=C._isToggling&&C._isSafari?b+"px":"100%":C._transform.translateY=C._isToggling&&C._isSafari?b/2+"px":"50%","center"!=C._position||f?C._transform.translateX=void 0:C._transform.translateX="-50%",C._recalcTransform()},_postMessageQ:[],_postMessage:function(a,b){C._apiReady?C._iframe.contentWindow&&C._iframe.contentWindow.postMessage(JSON.stringify({type:a,data:b,sender:"Chatra"}),"*"):C._postMessageQ.push([a,b])},_sendMessageQ:function(){for(;C._postMessageQ.length;)C._postMessage.apply(C,C._postMessageQ.shift())},_pageInfoQ:[],_resolvePageInfoQ:function(){for(;C._pageInfoQ.length;)C._sendPageInfo(C._pageInfoQ.shift())},_sendPageInfo:function(a){C._postMessage("clientData",a)},_sendFocus:function(){var a=b.hasFocus?b.hasFocus():!0;C._postMessage(a?"focus":"blur")},_getClientId:function(){var a=C._getStoredItem("Chatra.clientId"),b=C._setup.clientId;if(b){var c=typeof b;"string"!==c&&"number"!==c||(a=b)}if(a)return a;try{a=w(40)}catch(d){for(var e=(+new Date+"").split(""),f="abcdefghijklmnopqrstuvwxyz".split("");f.length;)e.splice(p(e.length-1),0,f.splice(p(f.length-1),1)[0]);a=e.join("")}return C._setStoredItem("Chatra.clientId",a),a},_setReferrer:function(){var a=b.referrer;if(a&&t(a).host!==location.host)C._referrer=a;else{var c=+(C._getStoredItem("Chatra.lastPageViewAt")||"");new Date-c>36e5?C._referrer=a:C._referrer=C._getStoredItem("Chatra.referrer")||""}C._setStoredItem("Chatra.referrer",C._referrer||"")},_getHostedStorage:function(){var a;try{a=JSON.parse(C._getStoredItem("Chatra.hostedItems"))}catch(b){a={},C._setStoredItem("Chatra.hostedItems","{}")}return a},_sendHostedStorage:function(){C._postMessage("hostedStorage",C._getHostedStorage())},_setHostedItem:function(a,b){if("string"==typeof a){var c=C._getHostedStorage();c[a]=b,C._setStoredItem("Chatra.hostedItems",JSON.stringify(c))}},_getStoredItem:function(a){var b;try{b=localStorage.getItem(a)}catch(c){}return b||n(a)},_setStoredItem:function(a,b){try{localStorage.setItem(a,b)}catch(c){m(a,b)}},_addClass:function(a){for(var b=C._wrapper,c=[].concat(a),d=c.length-1;d>=0;d--)g(b,"chatra--"+c[d])},_removeClass:function(a){for(var b=C._wrapper,c=[].concat(a),d=c.length-1;d>=0;d--)h(b,"chatra--"+c[d])},_safariForceRedraw:function(){C._wrapper.style.zIndex=C._zIndex-1,C._wrapper.offsetWidth,C._refreshZIndex()},_titleBlink:function(a){clearTimeout(C._titleBlink._timeout),C._titleBlink.originalNow&&a?(C._titleBlink.originalTitle=b.title,b.title=C._titleBlink.newTitle=a):(b.title!==C._titleBlink.newTitle&&(C._titleBlink.originalTitle=b.title),b.title=C._titleBlink.originalTitle),C._titleBlink.originalNow=!a||!C._titleBlink.originalNow,a&&(C._titleBlink._timeout=setTimeout(function(){C._titleBlink(a)},p(1e3,2e3)))},_logAnalyticsEvent:function(b,c){if(c=c||{custom:!0,metrika:!0,ga:!0},c.custom)try{"function"==typeof C._setup.onAnalyticEvent&&C._setup.onAnalyticEvent(b)}catch(d){console.warn("Chatra: Error while trying to execute `ChatraSetup.onAnalyticEvent` function:",d)}if(c.ga&&!C._setup.disableGaTracking)try{var e,f;if("function"==typeof a.ga&&(f=a.ga),e=a.GoogleAnalyticsObject&&"function"==typeof a[a.GoogleAnalyticsObject]?a[a.GoogleAnalyticsObject]:f)if(C._setup.gaTrackerName){if("function"==typeof e.getByName){var g=e.getByName(C._setup.gaTrackerName);!g&&f&&e!==f&&"function"==typeof f.getByName&&(g=f.getByName(C._setup.gaTrackerName)),g&&"function"==typeof g.send&&g.send("event","Chatra",b),g||console.warn("Chatra: Could’t find Google Analytics tracker named “"+C._setup.gaTrackerName+"”.")}}else if(C._setup.gaTrackingId){if("function"==typeof e.getAll){var h=(e.getAll()||[]).some(function(a){return a&&"function"==typeof a.get&&a.get("trackingId")==C._setup.gaTrackingId?("function"==typeof a.send&&a.send("event","Chatra",b),!0):void 0});!h&&f&&e!==f&&"function"==typeof f.getAll&&(h=(f.getAll()||[]).some(function(a){return a&&"function"==typeof a.get&&a.get("trackingId")==C._setup.gaTrackingId?("function"==typeof a.send&&a.send("event","Chatra",b),!0):void 0})),h||console.warn("Chatra: Could’t find Google Analytics tracker with tracking ID “"+C._setup.gaTrackingId+"”.")}}else{var g="function"==typeof e.getAll?(e.getAll()||[])[0]:void 0;g&&"function"==typeof g.send?g.send("event","Chatra",b):e("send","event","Chatra",b)}else a._gaq&&"function"==typeof a._gaq.push&&a._gaq.push(["_trackEvent","Chatra",b])}catch(d){console.warn("Chatra: Error while trying to create Google Analytics event:",d)}if(c.metrika&&!C._setup.disableYaTracking)try{var i;if(C._setup.yaCounterId)a["yaCounter"+C._setup.yaCounterId]?i=a["yaCounter"+C._setup.yaCounterId]:console.warn("Chatra: Could’t find Yandex Metrika counter with ID “"+C._setup.yaCounterId+"”.");else{var j=a.Ya&&(a.Ya.Metrika||a.Ya.Metrika2),k=j&&"function"==typeof j.counters&&j.counters(),l=k&&k[0]&&k[0].id;l&&a["yaCounter"+l]&&(i=a["yaCounter"+l])}i&&i.reachGoal&&i.reachGoal("Chatra_"+b.replace(/\s/g,"_"))}catch(d){console.warn("Chatra: Error while trying to create Yandex.Metrika event:",d)}},_eventRemovers:[],_addAutoRemovableEvent:function(){C._eventRemovers.push(k.apply(C,arguments))},_cleanEventListeners:function(){for(var a=C._eventRemovers.length-1;a>=0;a--)C._eventRemovers[a]()},_exitIntentBorderThreshold:30,_handleExitIntent:function(){var a=C._exitIntentBorderThreshold,b=!1;C._addAutoRemovableEvent(document,"mousemove",function(c){var d=c.clientX,e=c.clientY,f=window.innerHeight,g=window.innerWidth;b&&a>=e&&C._postMessage("exit-intent"),b=e>a&&f-a>e&&d>a&&g-a>d})},restart:function(){C.kill(),v()},kill:function(){if(!C._killed){C._cleanEventListeners(),C._style&&(i(C._style),delete C._style),C._iframe&&(i(C._iframe),C._iframe.src="",delete C._iframe),C._iframeWrapper&&(i(C._iframeWrapper),delete C._iframeWrapper),C._wrapper&&(i(C._wrapper),delete C._wrapper),C._killed=!0;for(var a in C)C.hasOwnProperty(a)&&"function"==typeof C[a]&&"restart"!=a&&(C[a]=c)}}}),a.Chatra&&a.Chatra.kill&&a.Chatra.kill(),a.Chatra=l,l._init()}var w;!function(){var a="Uint8ArdomValuesObj012345679BCDEFGHIJKLMNPQRSTWXYZ_cfghkpqvwxyz-";w=function(b){b=b||21;var c=window.crypto||window.msCrypto;if(!c)throw new Error("This browser doesn’t support `crypto` :—(");for(var d="",e=c.getRandomValues(new Uint8Array(b));0