var PAclassExists=(typeof PushAlertCo!=='undefined');var PushAlertCo=new function(){this.pa_id=48548;this.domain="cosmetic.cl";this.pa_subdomain="https://cosmetic398.pushalert.co";this.pa_domain_id=1;this.seg_id=0;this.subs_id="";this.default_storage_key='pa_web_push';this.script_id="49753";this.local_str={"lt-subscribe-box-1":"Thanks for Subscribing!","lt-subscribe-box-2":"Press close to continue.","lt-popup-title":"Click on Allow to get notifications.","lt-popup-subtitle":"Get real-time updates through Push Notifications.","lt-close":"Close","lt-side-widget-title":"Notificaciones","lt-widget-title":"Notificaciones de sitio web","lt-widget-text":"Obtenga notificaciones en tiempo real para mantenerse al d\u00eda con el contenido que le importa.","lt-widget-more-options-desktop":"M\u00e1s opciones","lt-widget-more-options-mobile":"Toque para m\u00e1s opciones","lt-subscribe":"Subscribirse","lt-unsubscribe":"Desuscribirse","lt-not-now":"No Ahora","lt-unsubscribe-box-1":"\u00bfEst\u00e1s seguro de que quieres cancelar la suscripci\u00f3n?","lt-yes":"Si","lt-no":"No","lt-unblock-box-1":"Desbloquee la notificaci\u00f3n para suscribirse.","lt-unblock":"Desbloquear","lt-cancel":"Cancelar","lt-notf-pref-title":"Notification Preferences","lt-notf-pref-info-text":"You are currently subscribed to receive notifications.","lt-notf-pref-stop-usage":"Stop Usage Tracking","lt-notf-pref-stop-usage-confirm":"Usage tracking has been stopped.","lt-notf-pref-view-data":"Ver mis datos","lt-notf-pref-view-data-confirm":"Please wait, getting your data...","lt-notf-pref-unsubscribe":"Unsubscribe & Delete All Data","lt-notf-pref-unsubscribe-confirm":"Unsubscribed and all data deleted.","lt-unblock-mobile":"Has bloqueado las notificaciones. Haga clic en el icono de bloqueo en la barra de direcciones, vaya a la configuraci\u00f3n del sitio y habilite \"notificaciones\" en \"Permiso\". Recarga la p\u00e1gina.","lt-unblock-chrome":"Has bloqueado las notificaciones. Haga clic en el icono de bloqueo en la barra de direcciones, luego configure el permiso de \"notificaciones\" para \"preguntar (predeterminado)\". Recarga la p\u00e1gina.","lt-unblock-firefox":"Has bloqueado las notificaciones. Haga clic en el icono de bloqueo en la barra de direcciones, luego haga clic en \"X\" junto a \"bloqueado\/bloqueado temporalmente\". Recarga la p\u00e1gina.","lt-a2hs-text":"Add {app_name} App<\/strong> to your Home Screen to get regular updates. Tap Share {share_icon} and then Add to Home Screen<\/strong> {add_icon}"};this.local_multi_str=[];this.requestedSubscribeFetch=!1;this.old_subs_id="";this.cookie_id="48548_1_";this.safariEnabled=!1;this.safari_web_push_id="";this.safariReqInitiated=!1;this.safari_icon="https://cdn.pushalert.co/safari-icon/default.png";this.safari_web_name="";this.ringingAnimation=!1;this.frameRateMS=400;this.ringCount=0;this.enableSubdomainIntegration=!1;this.byPassSubdomainCheck=!1;this.enableWidget=1;this.widgetTheme='round';this.widgetColor='#dc2e80';this.widgetIcon='https://cdn.pushalert.co/widget-icons/widget_default.png';this.widgetText='Obtenga notificaciones en tiempo real para mantenerse al día con el contenido que le importa.';this.widgetPosition={"pa-ticker-position":"left","pa-ticker-left":"10","pa-ticker-right":"10","pa-ticker-bottom":"10","pa-notification-left":50,"pa-notification-right":50,"pa-notification-bottom":70};this.isCSSEmbeded=!1;this.enableAutoSubs=!0;this.enableUnsubs=!0;this.enableContentRecommendation=!1;this.PARecContentHide=!1;this.PAContentRecScrollPosition=0.5;this.PARecTheme="pa-rec-light";this.PARecShowOnHomepage=!0;this.PARecHideOn=[];this.subscriptionStyle={"subscriptionTheme":4,"subscriptionThemeFallback":1,"subscriptionThemePos":1,"subscriptionOverlayOpacity":0,"subscriptionBoxColor":"#ffffff","subscriptionBtnAllowTxt":"SI POR FAVOR","subscriptionBtnAllowColor":"#e85f99","subscriptionBtnAllowTxtColor":"#fff","subscriptionBtnDenyTxt":"NO","subscriptionBtnDenyColor":"#d3d3d3","subscriptionBtnDenyTxtColor":"#888","subscriptionTitle":"\u00a1No te pierdas las ofertas y novedades!","subscriptionTitleTxtColor":"#333","subscriptionMessage":"Activa las notificaciones y mantente al d\u00eda, \u00bfLas activamos?","subscriptionMessageTxtColor":"#777","subscriptionBoxDelay":3000,"subscriptionTrigger":{"trigger":"on-landing","scroll-pos":"40","inactive-time":"7","pageviews-num":"3"}};this.subscriptionStyleMobileSeparate=!1;this.subscriptionStyleMobile={"subscriptionTheme":1,"subscriptionThemeFallback":1,"subscriptionThemePos":1,"subscriptionOverlayOpacity":0,"subscriptionBoxColor":"#ffffff","subscriptionBtnAllowTxt":"Allow","subscriptionBtnAllowColor":"#0e82e5","subscriptionBtnAllowTxtColor":"#fff","subscriptionBtnDenyTxt":"Later","subscriptionBtnDenyColor":"#d3d3d3","subscriptionBtnDenyTxtColor":"#888","subscriptionTitle":"GET THE LATEST UPDATES FROM US","subscriptionTitleTxtColor":"#333","subscriptionMessage":"Click on Allow to get notifications","subscriptionMessageTxtColor":"#777","subscriptionBoxDelay":3000,"subscriptionTrigger":{"trigger":"on-landing","scroll-pos":"40","inactive-time":"7","pageviews-num":"3"}};this.shopifyCustomization={"backInStockEnable":!1,"backInStockTitle":"Back In-stock Alert","backInStockBarColor":"#0e82e5","backInStockBarTextColor":"#ffffff","backInStockBarPosition":"Right","backInStockBarPositionMargin":"10","backInStockSecondLine":"Get an update when its back in stock.","backInStockButtonTitle":"Notify Me","backInStockSuccess":"We'll notify you.","backInStockNotificationTitle":"Back in Stock","backInStockNotificationMessage":"Good news! {{product_name}} is back in stock and available for order.","backInStockNotificationAddtoCart":"Add to Cart","priceDropEnable":!1,"priceDropTitle":"Price Drop Alert","priceDropBarColor":"#1083e6","priceDropBarTextColor":"#ffffff","priceDropBarPosition":"Bottom Right","priceDropBarPositionMargin":"10","priceDropCurrentPrice":"Current Price","priceDropSecondLine":"Let me know when price drops.","priceDropButtonTitle":"Notify Me","priceDropSuccess":"We'll notify you.","priceDropNotificationTitle":"Price Drop Alert","priceDropNotificationMessage":"{{product_name}} price just dropped to {{product_price}}, grab now before it goes out of stock.","priceDropNotificationAddtoCart":"Add to Cart","abandonedCartUTMEnable":!1,"abandonedCartUTMSource":null,"abandonedCartUTMMedium":null,"abandonedCartUTMName":null,"fulfilledUTMEnable":!0,"fulfilledUTMSource":"pushalert","fulfilledUTMMedium":"push_notification","fulfilledUTMName":"pushalert_campaign_fulfiled","priceDropUTMEnable":!1,"priceDropUTMSource":"pushalert","priceDropUTMMedium":"push_notification","priceDropUTMName":"pushalert_campaign","backInStockUTMEnable":!1,"backInStockUTMSource":"pushalert","backInStockUTMMedium":"push_notification","backInStockUTMName":"pushalert_campaign","currency":"${{ amount_no_decimals_with_comma_separator }}","subs_assoc_message":"\u00bfQuieres recibir notificaciones importantes?","subs_assoc_yes":"Si","subs_assoc_no":"No"};this.priceDropAlertAlt=!1;this.priceDropAlertAltMobileOnly=!0;this.activateProductAlert=!1;this.shopifyProductInfo=null;this.paProductInfo=null;this.forceTrigger=!1;this.isRTL=!1;this.reSubscribe=!1;this.checkVA=0;this.initCalled=!1;this.browseAbandonments=[];this.iOSAddToHomescreenSettings={"appName":"Cosmetic","htmlContent":"A\u00f1ade {app_name} App<\/strong> a tu pantalla de inicio para enterarte de las \u00faltimas ofertas y novedades. Toca en Compartir {share_icon} y A\u00f1adir a Pantalla de Inicio<\/strong> {add_icon}","color":"#5d5d5d","backgroundColor":"#f9f9f9","appIcon":"https:\/\/cdn.pushalert.co\/icons\/app-icon-48548-1.png?1690828138"};this.showiOSA2HS=!1;this.init=function(){if(this.showiOSA2HS){setTimeout(function(){PushAlertCo.iOSAddToHomescreen(PushAlertCo.iOSAddToHomescreenSettings)},250)} this.initCalled=!0;var hostname=location.hostname.replace(/^www\./,'');this.seg_id=this.checkSegmentIDValue();this.checkCookieLife();if(hostname.indexOf(this.domain)!==-1&&hostname.indexOf(this.domain)==(hostname.length-this.domain.length)){if(this.checkShopify()){PushAlertCo.checkSubscription()}else{if(document.readyState==='complete'){PushAlertCo.checkSubscription()}else{this.PushAlertAddLoadEvent(function(){PushAlertCo.checkSubscription()})}}}} this.initSW=function(){var hostname=location.hostname.replace(/^www\./,'');this.seg_id=this.checkSegmentIDValue();if(hostname.indexOf(this.domain)!==-1&&hostname.indexOf(this.domain)==(hostname.length-this.domain.length)){var sw_url="/sw.js";var sw_scope="/";if(PushAlertCo.checkShopify()){sw_url="/apps/pushalert/sw-"+this.script_id+".js"}else if(typeof pushalert_sw_file!=="undefined"){sw_url=pushalert_sw_file} if(typeof pushalert_sw_scope!=="undefined"){sw_scope=pushalert_sw_scope} if('serviceWorker' in navigator){navigator.serviceWorker.register(sw_url,{}).then(function(reg){}).catch(function(err){})}}} this.checkShopify=function(){return(typeof Shopify!=="undefined"&&typeof Shopify.shop!=="undefined")} this.checkWooCommerce=function(){return(typeof pa_woo_product_info!=="undefined")} this.checkPrestaShop=function(){return(typeof pa_presta_product_info!=="undefined")} this.checkMagento=function(){return(typeof pa_magento_product_info!=="undefined")} this.checkCustomShop=function(){return(typeof pa_custom_product_info!=="undefined")} this.eCommerceAssociate=function(alreadySubscribed){if(typeof pa_ecomm_cid!=="undefined"&&pa_ecomm_cid!=0){var cookie_name="pushalert-ecommerce-"+this.md5(pa_ecomm_cid);if(this.getCookie(cookie_name)===''){if(alreadySubscribed){pa_head=document.head||document.getElementsByTagName('head')[0];var css='.pa-receive-notification{position:fixed;top:0;z-index:999999;left:0;right:0;text-align:center;background:#fff;padding:10px;box-shadow:0 0 5px rgba(0,0,0,0.2)}.pa-receive-notification form{margin:0 !important;display:inline-block;}.pa-receive-notification button{padding:5px 20px;margin:0 5px;font-weight:400;border:0;outline:0;font-size: 14px;text-transform: none;float: none;width: auto;font-family: inherit;}.pa-receive-notification button.yes{background:#000;color:#fff}.pa-receive-notification button.no{background:#fff;color:#000}';var style=document.createElement('style');style.type='text/css';if(style.styleSheet){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))} pa_head.appendChild(style);var associate_dialog="\ "+PushAlertCo.shopifyCustomization.subs_assoc_message+"\
\ \ \
";var paReceiveNotification=document.createElement('div');paReceiveNotification.className='pa-receive-notification';paReceiveNotification.innerHTML=associate_dialog;document.body.appendChild(paReceiveNotification);document.querySelector("button[name='pa-rec-notf-yes']").addEventListener("click",function(){(pushalertbyiw=window.pushalertbyiw||[]).push(['addAttributes',{"user_id":pa_ecomm_cid}]);PushAlertCo.setCookie(cookie_name,'1',400);document.querySelector(".pa-receive-notification").remove()});document.querySelector("button[name='pa-rec-notf-no']").addEventListener("click",function(){PushAlertCo.setCookie(cookie_name,'-1',400);document.querySelector(".pa-receive-notification").remove()})}else{(pushalertbyiw=window.pushalertbyiw||[]).push(['addAttributes',{"user_id":pa_ecomm_cid}]);PushAlertCo.setCookie(cookie_name,'1',400)}}}} this.eCommerceUnAssociate=function(type,now){if(now&&type===1&&typeof pa_ecomm_cid!=="undefined"&&pa_ecomm_cid!=0){var cookie_name="pushalert-ecommerce-"+this.md5(pa_ecomm_cid);PushAlertCo.setCookie(cookie_name,'-1',-1);(pushalertbyiw=window.pushalertbyiw||[]).push(['addAttributes',{"user_id":"-"}])}} this.shopifyAssociate=function(alreadySubscribed){if(this.checkShopify()&&typeof __st!=="undefined"&&typeof __st.cid!=="undefined"){var cookie_name="pushalert-shopify-"+this.md5(__st.cid+"-"+this.subs_id);if(this.getCookie(cookie_name)===''){if(alreadySubscribed){pa_head=document.head||document.getElementsByTagName('head')[0];var css='.pa-receive-notification{position:fixed;top:0;z-index:999999;left:0;right:0;text-align:center;background:#fff;padding:10px;box-shadow:0 0 5px rgba(0,0,0,0.2)}.pa-receive-notification form{margin:0 !important;display:inline-block;}.pa-receive-notification button{padding:5px 20px;margin:0 5px;font-weight:400;border:0;outline:0;font-size: 14px;text-transform: none;float: none;width: auto;font-family: inherit;}.pa-receive-notification button.yes{background:#000;color:#fff}.pa-receive-notification button.no{background:#fff;color:#000}';var style=document.createElement('style');style.type='text/css';if(style.styleSheet){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))} pa_head.appendChild(style);var associate_dialog="\ "+PushAlertCo.shopifyCustomization.subs_assoc_message+"\
\ \ \
";var paReceiveNotification=document.createElement('div');paReceiveNotification.className='pa-receive-notification';paReceiveNotification.innerHTML=associate_dialog;document.body.appendChild(paReceiveNotification);document.querySelector("button[name='pa-rec-notf-yes']").addEventListener("click",function(){(pushalertbyiw=window.pushalertbyiw||[]).push(['addAttributes',{"user_id":__st.cid}]);PushAlertCo.setCookie(cookie_name,'1',400);document.querySelector(".pa-receive-notification").remove()});document.querySelector("button[name='pa-rec-notf-no']").addEventListener("click",function(){PushAlertCo.setCookie(cookie_name,'-1',400);document.querySelector(".pa-receive-notification").remove()})}else{(pushalertbyiw=window.pushalertbyiw||[]).push(['addAttributes',{"user_id":__st.cid}]);PushAlertCo.setCookie(cookie_name,'1',400)}}}else if(this.checkShopify()&&typeof __st!=="undefined"){this.shopifyCartAssoc()}} this.shopifyUnAssociate=function(type,now){if(now&&type===1&&PushAlertCo.checkShopify()&&typeof __st!=="undefined"&&typeof __st.cid!=="undefined"){var cookie_name="pushalert-shopify-"+this.md5(__st.cid+"-"+this.subs_id);PushAlertCo.setCookie(cookie_name,'-1',-1);(pushalertbyiw=window.pushalertbyiw||[]).push(['addAttributes',{"user_id":"-"}])}} this.shopifyCartAssocCheck=function(){if(!this.checkShopify()){return} var shopify_allowed_url=["/cart/add.js","/cart/update.js","/cart/change.js","/cart/add","/cart/update","/cart/change"];var shopify_add_to_cart_url=["/cart/add.js","/cart/add"];var{fetch:originalFetch}=window;window.fetch=async(...args)=>{let[resource,config]=args;const response=await originalFetch(resource,config);var formatted_url=resource;if(formatted_url.indexOf("?")>0){formatted_url=formatted_url.substr(0,formatted_url.indexOf("?"))} if(shopify_allowed_url.includes(formatted_url)){const data=await response.clone().json();PushAlertCo.shopifyCartAssoc();setTimeout(function(){PushAlertCo.shopifyCheckAbandonedCart()},5000)} if(shopify_add_to_cart_url.includes(formatted_url)){const check_ba=PushAlertCo.getCookie("pa_ba_"+this.cookie_id+"status");if(check_ba=='1'){PushAlertCo.setCookie("pa_oc_"+PushAlertCo.cookie_id+"completed",'1',1);PushAlertCo.checkForBrowseAbandonmentCompletion()}} return response};var origOpen=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(){var formatted_url=arguments[1];if(formatted_url.indexOf("?")>0){formatted_url=formatted_url.substr(0,formatted_url.indexOf("?"))} if(shopify_allowed_url.includes(formatted_url)){this.addEventListener("load",function(){if(this.readyState===this.DONE){if(this.status===200){var response=JSON.parse(this.responseText,response);PushAlertCo.shopifyCartAssoc();setTimeout(function(){PushAlertCo.shopifyCheckAbandonedCart()},5000)}}})} return origOpen.apply(this,arguments)}};this.shopifyInitAbandonedCart=function(){fetch('/cart.js').then(function(response){if(response.status!==200){console.log('Looks like there was a problem. Status Code: '+response.status);return} response.json().then(function(data){if(data.hasOwnProperty("item_count")&&data.item_count>0){var extra_info={} extra_info.cart_url=document.location.origin+"/cart";extra_info.checkout_url=document.location.origin+"/cart";extra_info.total_items=data.item_count;extra_info.type=10;extra_info.cart_token=PushAlertCo.getCookie("cart");extra_info.image=data.items[0].image;extra_info.product_name=data.items[0].product_title;(pushalertbyiw=window.pushalertbyiw||[]).push(['abandonedCart','add-to-cart',extra_info])}})})};this.shopifyCartAssoc=function(){if(this.checkShopify()&&PushAlertCo.getSubsInfo().status=='subscribed'&&typeof __st!=="undefined"){var cart_id=this.getCookie("cart");var cookie_name="pushalert-shopify-"+this.md5(cart_id+"-"+PushAlertCo.getSubsInfo().subs_id);if(cart_id!==''&&this.getCookie(cookie_name)===''){PushAlertCo.addAttributes({"pa_cart_id":cart_id});PushAlertCo.setCookie(cookie_name,'1',400);PushAlertCo.shopifyInitAbandonedCart();return 1}} return 0} this.shopifyCheckAbandonedCart=function(){if(this.checkShopify()&&PushAlertCo.getSubsInfo().status=='subscribed'&&typeof __st!=="undefined"){var cart_id=this.getCookie("cart");var cookie_name="pushalert-shopify-"+this.md5(cart_id+"-"+PushAlertCo.getSubsInfo().subs_id);if(cart_id!==''&&this.getCookie(cookie_name)!==''){PushAlertCo.shopifyInitAbandonedCart();return 1}} return 0} this.priceDropAlert=function(){this.appendPACSS();var paSubsHeader=document.createElement('div');paSubsHeader.className='pushalert-alerts-header';paSubsHeader.style.zIndex='9999';paSubsHeader.style.position='fixed';paSubsHeader.style.background=PushAlertCo.shopifyCustomization.priceDropBarColor;paSubsHeader.style.color=PushAlertCo.shopifyCustomization.priceDropBarTextColor;paSubsHeader.style.bottom='0';if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Bottom Right"){paSubsHeader.style.right=PushAlertCo.shopifyCustomization.priceDropBarPositionMargin+'%'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Bottom Left"){paSubsHeader.style.left=PushAlertCo.shopifyCustomization.priceDropBarPositionMargin+'%'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left Center"){paSubsHeader.style.top='50%';paSubsHeader.style.left='0';paSubsHeader.style.right='auto';paSubsHeader.style.bottom='auto';paSubsHeader.style.transform='rotate(90deg)'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right Center"){paSubsHeader.style.top='50%';paSubsHeader.style.left='auto';paSubsHeader.style.right='0';paSubsHeader.style.bottom='auto';paSubsHeader.style.transform='rotate(-90deg)'} paSubsHeader.style.lineHeight='1';paSubsHeader.style.borderRadius='3px 3px 0 0';paSubsHeader.style.padding='10px 25px';paSubsHeader.style.cursor='pointer';paSubsHeader.innerHTML='\ \ \ \ \ \ \  '+PushAlertCo.shopifyCustomization.priceDropTitle;paSubsHeader.onclick=function(){var shopify_params=PushAlertCo.getProductInfoShopifyParamas();document.getElementById('pushalert-alerts-price').innerHTML=PushAlertCo.formatMoneyShopify(shopify_params.price,PushAlertCo.shopifyCustomization.currency);document.getElementById('pushalert-alerts-img').src=shopify_params.image;var paAlertButton=document.querySelector(".pushalert-alerts-button-container");if(localStorage.getItem('pushalert_'+PushAlertCo.cookie_id+'price_drop_'+shopify_params.product_id+'_'+shopify_params.variant_id)){paAlertButton.innerHTML=PushAlertCo.shopifyCustomization.priceDropSuccess}else{paAlertButton.innerHTML=''} var paAlertContent=document.querySelector(".pushalert-alerts-content");PushAlertCo.paToggleClassName(paAlertContent,"pa-opened");if(document.querySelector('.pushalert-alerts-content-button')!==null){document.querySelector('.pushalert-alerts-content-button').onclick=function(event){event.stopPropagation();if(PushAlertCo.subs_id!==""){this.parentElement.innerHTML=PushAlertCo.shopifyCustomization.priceDropSuccess;var extras_json={title:shopify_params.title,url:window.location.href};PushAlertCo.sendProductAlerts('price_drop',shopify_params.product_id,shopify_params.variant_id,shopify_params.price,extras_json);localStorage.setItem('pushalert_'+PushAlertCo.cookie_id+'price_drop_'+shopify_params.product_id+'_'+shopify_params.variant_id,!0)}else{PushAlertCo.activateProductAlert=!0;PushAlertCo.forceSubscribe()}}}} document.body.appendChild(paSubsHeader);if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left Center"){paSubsHeader.style.marginLeft=-Math.round((paSubsHeader.offsetWidth-paSubsHeader.offsetHeight)/2)+'px';paSubsHeader.style.marginTop=-Math.round((paSubsHeader.offsetHeight)/2)+'px'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right Center"){paSubsHeader.style.marginRight=-Math.round((paSubsHeader.offsetWidth-paSubsHeader.offsetHeight)/2)+'px';paSubsHeader.style.marginTop=-Math.round((paSubsHeader.offsetHeight)/2)+'px'} var shopify_params=PushAlertCo.getProductInfoShopifyParamas();var paAlertContent=document.createElement('div');paAlertContent.className='pushalert-alerts-content';var innerHtml='
\n\ product image\n\

'+PushAlertCo.shopifyCustomization.priceDropCurrentPrice+': '+PushAlertCo.formatMoneyShopify(shopify_params.price,PushAlertCo.shopifyCustomization.currency)+'

\n\

'+PushAlertCo.shopifyCustomization.priceDropSecondLine+'

';if(localStorage.getItem('pushalert_'+PushAlertCo.cookie_id+'price_drop_'+shopify_params.product_id+'_'+shopify_params.variant_id)){innerHtml+='

'+PushAlertCo.shopifyCustomization.priceDropSuccess+'

'}else{innerHtml+='

'} innerHtml+='
';paAlertContent.innerHTML=innerHtml;if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Bottom Right"){paAlertContent.style.right=PushAlertCo.shopifyCustomization.priceDropBarPositionMargin+'%';paAlertContent.style.marginRight=(document.querySelector(".pushalert-alerts-header").offsetWidth-250)/2+'px'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Bottom Left"){paAlertContent.style.left=PushAlertCo.shopifyCustomization.priceDropBarPositionMargin+'%';paAlertContent.style.marginLeft=(document.querySelector(".pushalert-alerts-header").offsetWidth-250)/2+'px'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left Center"){paAlertContent.className='pushalert-alerts-content pushalert-alerts-content-left'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right Center"){paAlertContent.className='pushalert-alerts-content pushalert-alerts-content-right'} document.body.appendChild(paAlertContent);if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left Center"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right Center"){paAlertContent.style.marginTop=-Math.round((paAlertContent.offsetHeight)/2)+'px'}} this.priceDropAlertNative=function(){this.appendPACSS();var paSubsHeader=document.createElement('div');paSubsHeader.className='pushalert-alerts-header pa-price-drop-container';paSubsHeader.style.zIndex='9999';paSubsHeader.style.position='fixed';paSubsHeader.style.background=PushAlertCo.shopifyCustomization.priceDropBarColor;paSubsHeader.style.color=PushAlertCo.shopifyCustomization.priceDropBarTextColor;paSubsHeader.style.bottom='0';if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Bottom Right"){paSubsHeader.style.right=PushAlertCo.shopifyCustomization.priceDropBarPositionMargin+'%'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Bottom Left"){paSubsHeader.style.left=PushAlertCo.shopifyCustomization.priceDropBarPositionMargin+'%'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left Center"){paSubsHeader.style.top='50%';paSubsHeader.style.left='0';paSubsHeader.style.right='auto';paSubsHeader.style.bottom='auto';paSubsHeader.style.transform='rotate(90deg)'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right Center"){paSubsHeader.style.top='50%';paSubsHeader.style.left='auto';paSubsHeader.style.right='0';paSubsHeader.style.bottom='auto';paSubsHeader.style.transform='rotate(-90deg)'} paSubsHeader.style.lineHeight='1';paSubsHeader.style.borderRadius='3px 3px 0 0';paSubsHeader.style.padding='10px 25px';paSubsHeader.style.cursor='pointer';if(this.priceDropAlertAlt){if((this.priceDropAlertAltMobileOnly&&this.isMobile)||!this.priceDropAlertAltMobileOnly){paSubsHeader.style.display='none';var $paPDAPrevEleme=document.querySelector(this.priceDropAlertAlt);if($paPDAPrevEleme!==null){if($paPDAPrevEleme.nextElementSibling.tagName.toLowerCase()=="p"){$paPDAPrevEleme=$paPDAPrevEleme.nextElementSibling} var newEl=document.createElement('div');newEl.className='paPriceDropAltContainer';newEl.innerHTML='
Price Drop Alert Enabled!
';$paPDAPrevEleme.parentNode.insertBefore(newEl,$paPDAPrevEleme.nextSibling);document.querySelector('#paPriceDropAlt').onclick=function(event){document.querySelector('.pushalert-alerts-content-button').click()}}else{this.priceDropAlertAlt=!1}}else{this.priceDropAlertAlt=!1}} paSubsHeader.innerHTML='\ \ \ \ \ \ \  '+PushAlertCo.shopifyCustomization.priceDropTitle;paSubsHeader.onclick=function(){var product_params=PushAlertCo.paProductInfo;document.getElementById('pushalert-alerts-price').innerHTML=product_params.price_formatted;document.getElementById('pushalert-alerts-img').src=product_params.image;var paAlertContent=document.querySelector(".pushalert-alerts-content");PushAlertCo.paToggleClassName(paAlertContent,"pa-opened")} document.body.appendChild(paSubsHeader);if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left Center"){paSubsHeader.style.marginLeft=-Math.round((paSubsHeader.offsetWidth-paSubsHeader.offsetHeight)/2)+'px';paSubsHeader.style.marginTop=-Math.round((paSubsHeader.offsetHeight)/2)+'px'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right Center"){paSubsHeader.style.marginRight=-Math.round((paSubsHeader.offsetWidth-paSubsHeader.offsetHeight)/2)+'px';paSubsHeader.style.marginTop=-Math.round((paSubsHeader.offsetHeight)/2)+'px'} var product_params=PushAlertCo.paProductInfo;var paAlertContent=document.createElement('div');paAlertContent.className='pushalert-alerts-content pa-price-drop-content';var innerHtml='
\n\ product image\n\

'+PushAlertCo.shopifyCustomization.priceDropCurrentPrice+': '+product_params.price_formatted+'

\n\

'+PushAlertCo.shopifyCustomization.priceDropSecondLine+'

';if(localStorage.getItem('pushalert_'+PushAlertCo.cookie_id+'price_drop_'+product_params.id+'_'+product_params.variant_id)){innerHtml+='

'+PushAlertCo.shopifyCustomization.priceDropSuccess+'

';if(PushAlertCo.priceDropAlertAlt){document.getElementById("paPriceDropAlt").setAttribute("disabled","disabled")}}else{innerHtml+='

'} innerHtml+='
';paAlertContent.innerHTML=innerHtml;if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Bottom Right"){paAlertContent.style.right=PushAlertCo.shopifyCustomization.priceDropBarPositionMargin+'%';paAlertContent.style.marginRight=(document.querySelector(".pushalert-alerts-header").offsetWidth-250)/2+'px'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Bottom Left"){paAlertContent.style.left=PushAlertCo.shopifyCustomization.priceDropBarPositionMargin+'%';paAlertContent.style.marginLeft=(document.querySelector(".pushalert-alerts-header").offsetWidth-250)/2+'px'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left Center"){paAlertContent.className='pushalert-alerts-content pa-price-drop-content pushalert-alerts-content-left'}else if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right Center"){paAlertContent.className='pushalert-alerts-content pa-price-drop-content pushalert-alerts-content-right'} document.body.appendChild(paAlertContent);if(PushAlertCo.shopifyCustomization.priceDropBarPosition=="Left Center"||PushAlertCo.shopifyCustomization.priceDropBarPosition=="Right Center"){paAlertContent.style.marginTop=-Math.round((paAlertContent.offsetHeight)/2)+'px'} if(document.querySelector('.pushalert-alerts-content-button')!==null){document.querySelector('.pushalert-alerts-content-button').onclick=function(event){event.stopPropagation();if(PushAlertCo.subs_id!==""){this.parentElement.innerHTML=PushAlertCo.shopifyCustomization.priceDropSuccess;if(PushAlertCo.priceDropAlertAlt){document.getElementById("paPriceDropAlt").setAttribute("disabled","disabled");document.getElementById("paPriceDropMsg").style.bottom="65px";setTimeout(function(){document.getElementById("paPriceDropMsg").style.bottom="-50px"},2000)} var extras_json={title:product_params.title,url:window.location.href};PushAlertCo.sendProductAlerts('price_drop',product_params.id,product_params.variant_id,product_params.price*100,extras_json);localStorage.setItem('pushalert_'+PushAlertCo.cookie_id+'price_drop_'+product_params.id+'_'+product_params.variant_id,!0)}else{PushAlertCo.activateProductAlert=!0;PushAlertCo.forceSubscribe()}}}} this.outOfStockAlert=function(){this.appendPACSS();var paSubsHeader=document.createElement('div');paSubsHeader.className='pushalert-alerts-header';paSubsHeader.style.zIndex='9999';paSubsHeader.style.position='fixed';paSubsHeader.style.background=PushAlertCo.shopifyCustomization.backInStockBarColor;paSubsHeader.style.color=PushAlertCo.shopifyCustomization.backInStockBarTextColor;paSubsHeader.style.bottom='0';if(PushAlertCo.shopifyCustomization.backInStockBarPosition=="Right"){paSubsHeader.style.right=PushAlertCo.shopifyCustomization.backInStockBarPositionMargin+'%'}else{paSubsHeader.style.left=PushAlertCo.shopifyCustomization.backInStockBarPositionMargin+'%'} paSubsHeader.style.lineHeight='1';paSubsHeader.style.borderRadius='3px 3px 0 0';paSubsHeader.style.padding='10px 25px';paSubsHeader.style.cursor='pointer';paSubsHeader.innerHTML='\ \ \ \ \ \ \  '+PushAlertCo.shopifyCustomization.backInStockTitle;paSubsHeader.onclick=function(){var paAlertContent=document.querySelector(".pushalert-alerts-content");PushAlertCo.paToggleClassName(paAlertContent,"pa-opened")} document.body.appendChild(paSubsHeader);var shopify_params=PushAlertCo.getProductInfoShopifyParamas();var paAlertContent=document.createElement('div');paAlertContent.className='pushalert-alerts-content';var innerHtml='
\n\ product image\n\

'+shopify_params.title+'

\n\

'+PushAlertCo.shopifyCustomization.backInStockSecondLine+'

';if(localStorage.getItem('pushalert_'+PushAlertCo.cookie_id+'oos_'+shopify_params.product_id+'_'+shopify_params.variant_id)){innerHtml+='

'+PushAlertCo.shopifyCustomization.backInStockSuccess+'

'}else{innerHtml+='

'} innerHtml+='
';paAlertContent.innerHTML=innerHtml;if(PushAlertCo.shopifyCustomization.backInStockBarPosition=="Right"){paAlertContent.style.right=PushAlertCo.shopifyCustomization.backInStockBarPositionMargin+'%';paAlertContent.style.marginRight=(document.querySelector(".pushalert-alerts-header").offsetWidth-250)/2+'px'}else{paAlertContent.style.left=PushAlertCo.shopifyCustomization.backInStockBarPositionMargin+'%';paAlertContent.style.marginLeft=(document.querySelector(".pushalert-alerts-header").offsetWidth-250)/2+'px'} document.body.appendChild(paAlertContent);if(document.querySelector('.pushalert-alerts-content-button')!==null){document.querySelector('.pushalert-alerts-content-button').onclick=function(event){event.stopPropagation();if(PushAlertCo.subs_id!==""){this.parentElement.innerHTML=PushAlertCo.shopifyCustomization.backInStockSuccess;var extras_json={title:shopify_params.title,url:window.location.href};PushAlertCo.sendProductAlerts('oos',shopify_params.product_id,shopify_params.variant_id,shopify_params.price,extras_json);localStorage.setItem('pushalert_'+PushAlertCo.cookie_id+'oos_'+shopify_params.product_id+'_'+shopify_params.variant_id,!0)}else{PushAlertCo.activateProductAlert=!0;PushAlertCo.forceSubscribe()}}}} this.outOfStockAlertNative=function(){this.appendPACSS();var paSubsHeader=document.createElement('div');paSubsHeader.className='pushalert-alerts-header';paSubsHeader.style.zIndex='9999';paSubsHeader.style.position='fixed';paSubsHeader.style.background=PushAlertCo.shopifyCustomization.backInStockBarColor;paSubsHeader.style.color=PushAlertCo.shopifyCustomization.backInStockBarTextColor;paSubsHeader.style.bottom='0';if(PushAlertCo.shopifyCustomization.backInStockBarPosition=="Right"){paSubsHeader.style.right=PushAlertCo.shopifyCustomization.backInStockBarPositionMargin+'%'}else{paSubsHeader.style.left=PushAlertCo.shopifyCustomization.backInStockBarPositionMargin+'%'} paSubsHeader.style.lineHeight='1';paSubsHeader.style.borderRadius='3px 3px 0 0';paSubsHeader.style.padding='10px 25px';paSubsHeader.style.cursor='pointer';paSubsHeader.innerHTML='\ \ \ \ \ \ \  '+PushAlertCo.shopifyCustomization.backInStockTitle;paSubsHeader.onclick=function(){var paAlertContent=document.querySelector(".pushalert-alerts-content");PushAlertCo.paToggleClassName(paAlertContent,"pa-opened")} document.body.appendChild(paSubsHeader);var product_params=PushAlertCo.paProductInfo;var paAlertContent=document.createElement('div');paAlertContent.className='pushalert-alerts-content';var innerHtml='
\n\ product image\n\

'+product_params.title+'

\n\

'+PushAlertCo.shopifyCustomization.backInStockSecondLine+'

';if(localStorage.getItem('pushalert_'+PushAlertCo.cookie_id+'oos_'+product_params.id+'_'+product_params.variant_id)){innerHtml+='

'+PushAlertCo.shopifyCustomization.backInStockSuccess+'

'}else{innerHtml+='

'} innerHtml+='
';paAlertContent.innerHTML=innerHtml;if(PushAlertCo.shopifyCustomization.backInStockBarPosition=="Right"){paAlertContent.style.right=PushAlertCo.shopifyCustomization.backInStockBarPositionMargin+'%';paAlertContent.style.marginRight=(document.querySelector(".pushalert-alerts-header").offsetWidth-250)/2+'px'}else{paAlertContent.style.left=PushAlertCo.shopifyCustomization.backInStockBarPositionMargin+'%';paAlertContent.style.marginLeft=(document.querySelector(".pushalert-alerts-header").offsetWidth-250)/2+'px'} document.body.appendChild(paAlertContent);if(document.querySelector('.pushalert-alerts-content-button')!==null){document.querySelector('.pushalert-alerts-content-button').onclick=function(event){event.stopPropagation();if(PushAlertCo.subs_id!==""){this.parentElement.innerHTML=PushAlertCo.shopifyCustomization.backInStockSuccess;var extras_json={title:product_params.title,url:window.location.href};PushAlertCo.sendProductAlerts('oos',product_params.id,product_params.variant_id,product_params.price*100,extras_json);localStorage.setItem('pushalert_'+PushAlertCo.cookie_id+'oos_'+product_params.id+'_'+product_params.variant_id,!0)}else{PushAlertCo.activateProductAlert=!0;PushAlertCo.forceSubscribe()}}}} this.productInfoShopifyInit=function(){if(typeof __st!=="undefined"&&typeof __st.p!=="undefined"&&__st.p==='product'){if(PushAlertCo.shopifyProductInfo!==null){if(PushAlertCo.shopifyProductInfo.available){if(PushAlertCo.shopifyCustomization.priceDropEnable){PushAlertCo.priceDropAlert()}}else{if(PushAlertCo.shopifyCustomization.backInStockEnable){PushAlertCo.outOfStockAlert()}}}else{var pageurl=__st.pageurl;var product_handle=pageurl.match(/products\/(.*?)(\?|$)/);if(product_handle!==null){fetch('/products/'+product_handle[1]+'.js').then(function(response){if(response.status!==200){console.log('Looks like there was a problem. Status Code: '+response.status);return} response.json().then(function(data){PushAlertCo.shopifyProductInfo=data;if(data.available){if(PushAlertCo.shopifyCustomization.priceDropEnable){PushAlertCo.priceDropAlert()}}else{if(PushAlertCo.shopifyCustomization.backInStockEnable){PushAlertCo.outOfStockAlert()}} document.addEventListener('click',function(event){var specifiedElemContent=document.querySelector(".pushalert-alerts-content");var specifiedElemHeader=document.querySelector(".pushalert-alerts-header");if(specifiedElemContent!==null&&specifiedElemContent.className.indexOf("pa-opened")>0){var isClickInside=specifiedElemContent.contains(event.target)||specifiedElemHeader.contains(event.target);console.log(specifiedElemContent.className);if(!isClickInside){specifiedElemContent.className=specifiedElemContent.className.replace("pa-opened","").trim()}}});PushAlertCo.processBrowseAbandonments()})})}}} var cart_add_buttons=document.querySelectorAll('form[action="/cart/add"] button[type=submit],form[action="/cart/add"] input[type=submit]');for(var l=0;l(.*?)<\/del>/,'').replace(/<\/?[^>]+(>|$)/g,""):pa_woo_product_info.price_formatted,'type':pa_woo_product_info.type,'image':image_src,'outofstock':!woo_product_variant[i].is_in_stock,'icon':icon_src,'url':pa_woo_product_info.url,'add_to_cart':store_url+"/cart?add-to-cart="+woo_product_variant[i].variation_id} if(document.querySelector('.pushalert-alerts-content')!=null){document.querySelector('.pushalert-alerts-content').remove()} if(document.querySelector('.paPriceDropAltContainer')!=null){document.querySelector(".paPriceDropAltContainer").remove()} if(document.querySelector('.pushalert-alerts-header')!=null){document.querySelector('.pushalert-alerts-header').remove()} if(PushAlertCo.paProductInfo.outofstock&&PushAlertCo.shopifyCustomization.backInStockEnable){PushAlertCo.outOfStockAlertNative()}else if(PushAlertCo.shopifyCustomization.priceDropEnable&&!PushAlertCo.paProductInfo.outofstock){PushAlertCo.priceDropAlertNative()} break}}});jQuery("input[name='variation_id']").trigger("change")}else{var image_src=pa_woo_product_info.image;if(woo_product_variant[0].image_src!=null&&woo_product_variant[0].image_src!=""){image_src=woo_product_variant[0].image_src}else if(typeof woo_product_variant[0].image!=="undefined"&&woo_product_variant[0].image.src!=null&&woo_product_variant[0].image.src!=""){image_src=woo_product_variant[0].image.src} var icon_src=pa_woo_product_info.icon;if(woo_product_variant[0].gallery_thumbnail_src!=null&&woo_product_variant[0].gallery_thumbnail_src!=""){icon_src=woo_product_variant[0].gallery_thumbnail_src} PushAlertCo.paProductInfo={'id':pa_woo_product_info.id,'variant_id':woo_product_variant[0].variation_id,'title':pa_woo_product_info.title,'price':woo_product_variant[0].display_price,'price_formatted':(woo_product_variant[0].price_html!="")?woo_product_variant[0].price_html.replace(/(.*?)<\/del>/,'').replace(/<\/?[^>]+(>|$)/g,""):pa_woo_product_info.price_formatted,'type':pa_woo_product_info.type,'image':image_src,'outofstock':!woo_product_variant[0].is_in_stock,'icon':icon_src,'url':pa_woo_product_info.url,'add_to_cart':store_url+"/cart?add-to-cart="+woo_product_variant[0].variation_id} if(PushAlertCo.paProductInfo.outofstock&&PushAlertCo.shopifyCustomization.backInStockEnable){PushAlertCo.outOfStockAlertNative()}else if(PushAlertCo.shopifyCustomization.priceDropEnable){PushAlertCo.priceDropAlertNative()}}} document.addEventListener('click',function(event){var specifiedElemContent=document.querySelector(".pushalert-alerts-content");var specifiedElemHeader=document.querySelector(".pushalert-alerts-header");if(specifiedElemContent!==null&&specifiedElemContent.className.indexOf("pa-opened")>0){var isClickInside=specifiedElemContent.contains(event.target)||specifiedElemHeader.contains(event.target);console.log(specifiedElemContent.className);if(!isClickInside){specifiedElemContent.className=specifiedElemContent.className.replace("pa-opened","").trim()}}})} this.productInfoPrestaShopInit=function(){if(pa_presta_product_info.type=="simple"){PushAlertCo.paProductInfo=pa_presta_product_info;PushAlertCo.processBrowseAbandonments();if(pa_presta_product_info.outofstock&&PushAlertCo.shopifyCustomization.backInStockEnable){PushAlertCo.outOfStockAlertNative()}else if(PushAlertCo.shopifyCustomization.priceDropEnable&&!pa_presta_product_info.outofstock){PushAlertCo.priceDropAlertNative()}}else if(pa_presta_product_info.type=="variable"){presta_product_variant=pa_presta_product_info.variants;if(typeof jQuery!=="undefined"){function changeItemAttributes(){var selected_id;if(jQuery("input[name='id_product_attribute']").length>0){selected_id=jQuery("input[name='id_product_attribute']").val()}else{function compareObjects(o1,o2){for(var p in o1){if(o1.hasOwnProperty(p)){if(o1[p]!==o2[p]){return!1}}} for(var p in o2){if(o2.hasOwnProperty(p)){if(o1[p]!==o2[p]){return!1}}} return!0};var product_attrs=jQuery("[name^='group[']");var search_attrs={};for(var k=0;k0){jQuery("#attributes select, #attributes input").change(function(){setTimeout(changeItemAttributes,500)});jQuery("#attributes a").click(function(){setTimeout(changeItemAttributes,500)})}else{jQuery(document).on("change","[name^='group[']",function(){setTimeout(changeItemAttributes,500)})} changeItemAttributes()}else{PushAlertCo.paProductInfo={'id':pa_presta_product_info.id,'variant_id':presta_product_variant[0].variant_id,'title':pa_presta_product_info.title,'price':presta_product_variant[0].price,'price_formatted':presta_product_variant[0].price_formatted,'type':pa_presta_product_info.type,'image':(presta_product_variant[0].image!=null)?presta_product_variant[0].image:pa_presta_product_info.image,'outofstock':presta_product_variant[0].outofstock,'icon':presta_product_variant[0].icon,'url':presta_product_variant[0].url,'add_to_cart':presta_product_variant[0].add_to_cart} PushAlertCo.processBrowseAbandonments();if(PushAlertCo.paProductInfo.outofstock&&PushAlertCo.shopifyCustomization.backInStockEnable){PushAlertCo.outOfStockAlertNative()}else if(PushAlertCo.shopifyCustomization.priceDropEnable){PushAlertCo.priceDropAlertNative()}}} document.addEventListener('click',function(event){var specifiedElemContent=document.querySelector(".pushalert-alerts-content");var specifiedElemHeader=document.querySelector(".pushalert-alerts-header");if(specifiedElemContent!==null&&specifiedElemContent.className.indexOf("pa-opened")>0){var isClickInside=specifiedElemContent.contains(event.target)||specifiedElemHeader.contains(event.target);console.log(specifiedElemContent.className);if(!isClickInside){specifiedElemContent.className=specifiedElemContent.className.replace("pa-opened","").trim()}}})} this.productInfoMagentoInit=function(){if(pa_magento_product_info.type=="simple"){PushAlertCo.paProductInfo=pa_magento_product_info;PushAlertCo.processBrowseAbandonments();if(pa_magento_product_info.outofstock&&PushAlertCo.shopifyCustomization.backInStockEnable){PushAlertCo.outOfStockAlertNative()}else if(PushAlertCo.shopifyCustomization.priceDropEnable&&!pa_magento_product_info.outofstock){PushAlertCo.priceDropAlertNative()}}else if(pa_magento_product_info.type=="variable"){magento_product_variant=pa_magento_product_info.variants;if(typeof spConfig!=="undefined"){var superAttrs=document.querySelectorAll(".super-attribute-select");for(var k=0;k=0;i--){var selected=spConfig.settings[i].options[spConfig.settings[i].selectedIndex];proceed=!0;if(selected.config){if(output==null){output=selected.config.products}else{output=output.filter(function(n){return selected.config.products.indexOf(n)!==-1})}}else{proceed=!1;break}} if(proceed&&output!=null&&output.length==1){var selected_id=output[0];for(var i=0;i0){proceed=!0;output=found_ids}else{proceed=!1} if(proceed&&output!=null&&output.length==1){var selected_id=output[0];for(var i=0;i0){var isClickInside=specifiedElemContent.contains(event.target)||specifiedElemHeader.contains(event.target);console.log(specifiedElemContent.className);if(!isClickInside){specifiedElemContent.className=specifiedElemContent.className.replace("pa-opened","").trim()}}})} this.pa_eq=function(a,b,aStack,bStack){if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;if(a instanceof _)a=a._wrapped;if(b instanceof _)b=b._wrapped;var className=toString.call(a);if(className!=toString.call(b))return!1;switch(className){case '[object String]':return a==String(b);case '[object Number]':return a!=+a?b!=+b:(a==0?1/a==1/b:a==+b);case '[object Date]':case '[object Boolean]':return+a==+b;case '[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase} if(typeof a!='object'||typeof b!='object')return!1;var length=aStack.length;while(length--){if(aStack[length]==a)return bStack[length]==b} aStack.push(a);bStack.push(b);var size=0,result=!0;if(className=='[object Array]'){size=a.length;result=size==b.length;if(result){while(size--){if(!(result=this.pa_eq(a[size],b[size],aStack,bStack)))break}}}else{var aCtor=a.constructor,bCtor=b.constructor;if(aCtor!==bCtor&&!(_.isFunction(aCtor)&&(aCtor instanceof aCtor)&&_.isFunction(bCtor)&&(bCtor instanceof bCtor))){return!1} for(var key in a){if(_.has(a,key)){size++;if(!(result=_.has(b,key)&&this.pa_eq(a[key],b[key],aStack,bStack)))break}} if(result){for(key in b){if(_.has(b,key)&&!(size--))break} result=!size}} aStack.pop();bStack.pop();return result};this.pa_isEqual=function(a,b){return this.pa_eq(a,b,[],[])};this.productInfoCustomInit=function(){if(pa_custom_product_info.type=="simple"){PushAlertCo.paProductInfo=pa_custom_product_info;if(pa_custom_product_info.outofstock&&PushAlertCo.shopifyCustomization.backInStockEnable){PushAlertCo.outOfStockAlertNative()}else if(PushAlertCo.shopifyCustomization.priceDropEnable&&!pa_custom_product_info.outofstock){PushAlertCo.priceDropAlertNative()}}else if(pa_custom_product_info.type=="variable"){} document.addEventListener('click',function(event){var specifiedElemContent=document.querySelector(".pushalert-alerts-content");var specifiedElemHeader=document.querySelector(".pushalert-alerts-header");if(specifiedElemContent!==null&&specifiedElemContent.className.indexOf("pa-opened")>0){var isClickInside=specifiedElemContent.contains(event.target)||specifiedElemHeader.contains(event.target);console.log(specifiedElemContent.className);if(!isClickInside){specifiedElemContent.className=specifiedElemContent.className.replace("pa-opened","").trim()}}})} this.getProductInfoShopifyParamas=function(){var output={};var data=PushAlertCo.shopifyProductInfo;var product_info;var variant_selected=document.querySelector('[role="main"] form[action="/cart/add"] [name="id"]');if(variant_selected==null){variant_selected=document.querySelector('form[action="/cart/add"] [name="id"]')} if(variant_selected!==null&&variant_selected.value!==""){var variant_id=variant_selected.value;for(var i=0;i$trigger_info['inactive-time']){callbackFunc();events.forEach(function(name){document.removeEventListener(name,resetTimer,!0)});clearInterval(inactivity_monitor)}},1000)};events.forEach(function(name){document.addEventListener(name,resetTimer,!0)});resetTimer()}else if($trigger_info.trigger==='on-scroll'){document.addEventListener("scroll",function onScroll(){var h=document.documentElement,b=document.body,st='scrollTop',sh='scrollHeight';var scrollPercent=(h[st]||b[st])/((h[sh]||b[sh])-h.clientHeight)*100;if(scrollPercent>=$trigger_info['scroll-pos']){callbackFunc();document.removeEventListener("scroll",onScroll)}})}else if($trigger_info.trigger==='on-pageviews'){var pageviews=PushAlertCo.getCookie("pushalert_"+PushAlertCo.cookie_id+"pv");if(pageviews===""){pageviews=0}else{pageviews=parseInt(pageviews)} pageviews++;if(pageviews>=$trigger_info['pageviews-num']){callbackFunc()} if(pageviews<=100){PushAlertCo.setCookie('pushalert_'+PushAlertCo.cookie_id+'pv',pageviews,400)}}};this.createSubscriptionBox=function(){var subs_box_icon="https://cdn.pushalert.co/icons/default_icon-48548.png?1717175264";var powered_by_icon='';var pa_subs_box="";var pa_thm_pos="";PushAlertCo.optinCount();if(PushAlertCo.subscriptionStyle.subscriptionTheme==1&&PushAlertCo.subscriptionStyle.subscriptionThemePos==1){pa_thm_pos="pa-th-1-top"}else if(PushAlertCo.subscriptionStyle.subscriptionTheme==1&&PushAlertCo.subscriptionStyle.subscriptionThemePos==2){pa_thm_pos="pa-th-1-bottom"}else if(PushAlertCo.subscriptionStyle.subscriptionTheme==1&&PushAlertCo.subscriptionStyle.subscriptionThemePos==3){pa_thm_pos="pa-th-1-center"}else if(PushAlertCo.subscriptionStyle.subscriptionTheme==2&&PushAlertCo.subscriptionStyle.subscriptionThemePos==1){pa_thm_pos="pa-th-2-top"}else if(PushAlertCo.subscriptionStyle.subscriptionTheme==2&&PushAlertCo.subscriptionStyle.subscriptionThemePos==2){pa_thm_pos="pa-th-2-bottom"} if(PushAlertCo.subscriptionStyle.subscriptionTheme==0){if(PushAlertCo.PAcheckBrowser()==="safari"&&'safari' in window&&'pushNotification' in window.safari){PushAlertCo.checkSafariPermission(window.safari.pushNotification.permission(PushAlertCo.safari_web_push_id))}else{PushAlertCo.initSubscription()} return}else if(PushAlertCo.subscriptionStyle.subscriptionTheme==1){PushAlertCo.initSW();pa_subs_box='
\
\
\ PushAlert\
\
\
\

'+PushAlertCo.subscriptionStyle.subscriptionTitle+'

\
\
\

'+PushAlertCo.subscriptionStyle.subscriptionMessage+'

';pa_subs_box+='
\
\ \ \
\
'}else if(PushAlertCo.subscriptionStyle.subscriptionTheme==2){PushAlertCo.initSW();pa_subs_box='
\
\
\
\

'+PushAlertCo.subscriptionStyle.subscriptionTitle+'

\
\
\ \ \
\
\ \
\
'}else if(PushAlertCo.subscriptionStyle.subscriptionTheme==3){PushAlertCo.initSW();pa_subs_box='
\
\
\ PushAlert\
\
\
\

'+PushAlertCo.subscriptionStyle.subscriptionTitle+'

\
\
\

'+PushAlertCo.subscriptionStyle.subscriptionMessage+'

\
\
\ \ \
\
'}else if(PushAlertCo.subscriptionStyle.subscriptionTheme==4){PushAlertCo.initSW();pa_subs_box='
\
\
\
\
\

'+PushAlertCo.subscriptionStyle.subscriptionTitle+'

\
\
\

'+PushAlertCo.subscriptionStyle.subscriptionMessage+'

\
\
\ Agree to the terms and conditions\
\
\ \ \
\
\
'} if(PushAlertCo.subscriptionStyle.subscriptionOverlayOpacity>0){var paSubsContainerOverlay=document.createElement('div');paSubsContainerOverlay.id='pa-push-notification-subscription-overlay';paSubsContainerOverlay.style.zIndex='9999';paSubsContainerOverlay.style.position='fixed';paSubsContainerOverlay.style.background='#000';paSubsContainerOverlay.style.opacity=0;paSubsContainerOverlay.style.top='0';paSubsContainerOverlay.style.bottom='0';paSubsContainerOverlay.style.right='0';paSubsContainerOverlay.style.left='0';paSubsContainerOverlay.onclick=function(){PushAlertCo.hideSubscriptionBox()} document.body.appendChild(paSubsContainerOverlay)} var paSubsContainer=document.createElement('div');if(PushAlertCo.isRTL){paSubsContainer.dir='rtl'} paSubsContainer.innerHTML=pa_subs_box;document.body.appendChild(paSubsContainer);setTimeout(PushAlertCo.showSubscriptionBox,50);document.getElementById("pa-allow-btn").onclick=function(){if(PushAlertCo.PAcheckBrowser()==="safari"&&'safari' in window&&'pushNotification' in window.safari){PushAlertCo.checkSafariPermission(window.safari.pushNotification.permission(PushAlertCo.safari_web_push_id))}else{PushAlertCo.initSubscription()} PushAlertCo.hideSubscriptionBox();PushAlertCo.callbackOnCustomOptInAllow();return!1} document.getElementById("pa-deny-btn").onclick=function(){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|canceled");PushAlertCo.hideSubscriptionBox();PushAlertCo.callbackOnCustomOptInDeny();return!1}};this.showSubscriptionBox=function(){PushAlertCo.setSessionCookie("pa_"+PushAlertCo.cookie_id+"sb_shown",'1');var subs_box_container=document.getElementById("pa-push-notification-subscription");subs_box_container.className=subs_box_container.className+" pa-show-subs-box";var subs_box_overlay=document.getElementById("pa-push-notification-subscription-overlay");if(subs_box_overlay!==null&&typeof subs_box_overlay!=='undefined'){subs_box_overlay.style.transition="opacity 500ms cubic-bezier(0.17, 0.04, 0.03, 0.94)";subs_box_overlay.style.opacity=PushAlertCo.subscriptionStyle.subscriptionOverlayOpacity}} this.hideSubscriptionBox=function(){var paPNSOverlay=document.getElementById("pa-push-notification-subscription-overlay");var paPNS=document.getElementById("pa-push-notification-subscription");if(typeof paPNS!=='undefined'&&paPNS!==null){paPNS.style.transition='opacity 1500ms cubic-bezier(0.17, 0.04, 0.03, 0.94), top 1500ms cubic-bezier(0.17, 0.04, 0.03, 0.94), bottom 1500ms cubic-bezier(0.17, 0.04, 0.03, 0.94)';paPNS.className=paPNS.className.replace(/pa-show-subs-box/i,'')} if(typeof paPNSOverlay!=='undefined'&&paPNSOverlay!==null){paPNSOverlay.style.opacity='0'} setTimeout(function(){var paPNSOverlay=document.getElementById("pa-push-notification-subscription-overlay");var paPNS=document.getElementById("pa-push-notification-subscription");if(typeof paPNS!=='undefined'&&paPNS!==null){paPNS.parentElement.remove()} if(typeof paPNSOverlay!=='undefined'&&paPNSOverlay!==null){paPNSOverlay.remove()}},500)} this.showSubscribeWidget=function(){var testId=document.getElementById('pushalert-ticker');if(this.enableWidget==0||(typeof testId!=='undefined'&&testId!==null)||this.getCookie("pa_"+PushAlertCo.cookie_id+"hide_widget")=="1"){return} this.appendPACSS();if(this.widgetTheme==='round'){pa_alert='\ ';var paDivContainer=document.createElement('div');paDivContainer.id='pushalert-ticker';if(this.isRTL){paDivContainer.dir='rtl'} paDivContainer.className='pa-subscribe-widget-round';if(!this.isMobile){paDivContainer.className=paDivContainer.className+' pa-desktop'} if(this.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status")==="subscribed"){paDivContainer.className=paDivContainer.className+' pa-unsubscribe'} paDivContainer.innerHTML=pa_alert;paDivContainer.style.backgroundColor=this.widgetColor;paDivContainer.style.height="0px";paDivContainer.style.left="auto";paDivContainer.style.right="auto";if(this.widgetPosition['pa-ticker-position']==="right"){paDivContainer.style.right=this.widgetPosition['pa-ticker-right']+'px'}else{paDivContainer.style.left=this.widgetPosition['pa-ticker-left']+'px'} paDivContainer.style.bottom=this.widgetPosition['pa-ticker-bottom']+'px';paDivContainer.addEventListener("click",function(){if(PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status')==='subscribed'){PushAlertCo.PA_NOTIFICATION_INFO_TOGGLE()}else if(PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status')===''&&!PushAlertCo.enableAutoSubs&&PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_dialog')===''){PushAlertCo.clearPAFirstTime(!0)}else{PushAlertCo.PA_NOTIFICATION_SUBS_INFO_TOGGLE()} PushAlertCo.hideSubscriptionBox()});document.body.appendChild(paDivContainer)}else if(this.widgetTheme==='custom'){pa_alert='\ widget icon';var paDivContainer=document.createElement('div');paDivContainer.id='pushalert-ticker';if(this.isRTL){paDivContainer.dir='rtl'} paDivContainer.className='pa-subscribe-widget-round pa-subscribe-widget-custom';if(!this.isMobile){paDivContainer.className=paDivContainer.className+' pa-desktop'} if(this.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status")==="subscribed"){paDivContainer.className=paDivContainer.className+' pa-unsubscribe'} paDivContainer.innerHTML=pa_alert;paDivContainer.style.backgroundColor=this.widgetColor;paDivContainer.style.height="0px";paDivContainer.style.left="auto";paDivContainer.style.right="auto";if(this.widgetPosition['pa-ticker-position']==="right"){paDivContainer.style.right=this.widgetPosition['pa-ticker-right']+'px'}else{paDivContainer.style.left=this.widgetPosition['pa-ticker-left']+'px'} paDivContainer.style.bottom=this.widgetPosition['pa-ticker-bottom']+'px';paDivContainer.addEventListener("click",function(){if(PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status')==='subscribed'){PushAlertCo.PA_NOTIFICATION_INFO_TOGGLE()}else if(PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status')===''&&!PushAlertCo.enableAutoSubs&&PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_dialog')===''){PushAlertCo.clearPAFirstTime(!0)}else{PushAlertCo.PA_NOTIFICATION_SUBS_INFO_TOGGLE()} PushAlertCo.hideSubscriptionBox()});document.body.appendChild(paDivContainer)}else{pa_alert='\ '+PushAlertCo.local_str['lt-side-widget-title']+'\ ';var paDivContainer=document.createElement('div');paDivContainer.id='pushalert-ticker';paDivContainer.className='pa-subscribe-widget-side';if(!this.isMobile){paDivContainer.className=paDivContainer.className+' pa-desktop'} if(this.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status")==="subscribed"){paDivContainer.className=paDivContainer.className+' pa-unsubscribe'} if(this.widgetPosition['pa-ticker-position']==="left"){paDivContainer.className=paDivContainer.className+' pa-widget-left'} paDivContainer.innerHTML=pa_alert;paDivContainer.style.backgroundColor=this.widgetColor;paDivContainer.style.height="0px";paDivContainer.style.zIndex='2147483647';paDivContainer.addEventListener("click",function(){if(PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status')==='subscribed'){PushAlertCo.PA_NOTIFICATION_INFO_TOGGLE()}else if(PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status')===''&&!PushAlertCo.enableAutoSubs&&PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_dialog')===''){PushAlertCo.clearPAFirstTime(!0)}else{PushAlertCo.PA_NOTIFICATION_SUBS_INFO_TOGGLE()} PushAlertCo.hideSubscriptionBox()});document.body.appendChild(paDivContainer);var tmp_height=(document.getElementById("pa-subscribe-widget-side-text").offsetWidth+49);document.getElementById("pushalert-ticker").style.setProperty("height",tmp_height+"px","important");document.getElementById("pushalert-ticker").style.setProperty("margin-top","-"+(tmp_height/2)+"px");if(this.isMobile){}else{}} this.addPANotificationInfo(!(this.widgetTheme==='round'||this.widgetTheme==='custom'))} this.confirmUnsubscribe=function(){this.appendPACSS();pa_alert='
\ \

'+PushAlertCo.local_str['lt-unsubscribe-box-1']+'

\

\ \

\ \
';var paDivContainer=document.createElement('div');paDivContainer.id='pa-push-notification-confirm';paDivContainer.innerHTML=pa_alert;paDivContainer.style.backgroundColor='rgba(0,0,0,0.5)';paDivContainer.style.zIndex='2147483647';document.body.appendChild(paDivContainer);var paDiv=document.getElementById('pa-push-notification-confirm').getElementsByTagName("div")[0];var body=document.body,html=document.documentElement;var height=Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight);paDivContainer.style.height=height+'px';margin_left=(300+30)/2;paDiv.style.marginLeft='-'+margin_left+'px';margin_top=(paDiv.clientHeight+34)/2;paDiv.style.marginTop='-'+margin_top+'px';if(this.isMobile&&this.mobilePos==='mobileCenter'){paDiv.style.setProperty('margin-top','-'+margin_top+'px','important')}else{paDiv.style.setProperty('margin-top','-'+margin_top+'px')}} this.hidePushAlertConfirm=function(){var paConfirm=document.getElementById('pa-push-notification-confirm');if(typeof paConfirm!=='undefined'&&paConfirm!==null){paConfirm.remove()}} this.confirmSafariUnblock=function(){this.appendPACSS();pa_alert='
\

'+PushAlertCo.local_str['lt-unblock-box-1']+'

\
\ unblock instructions\
\ logo\ '+this.safari_web_name+'\
\
\ Powered by PushAlert\
\ \ \ \
\
';var paDivContainer=document.createElement('div');paDivContainer.id='pa-push-notification-confirm';paDivContainer.innerHTML=pa_alert;paDivContainer.style.backgroundColor='rgba(0,0,0,0.5)';paDivContainer.style.zIndex='2147483647';document.body.appendChild(paDivContainer);var paDiv=document.getElementById('pa-push-notification-confirm').getElementsByTagName("div")[0];var body=document.body,html=document.documentElement;var height=Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight);paDivContainer.style.height=height+'px';margin_left=(920+30)/2;paDiv.style.marginLeft='-'+margin_left+'px';margin_top=(paDiv.clientHeight+34)/2;paDiv.style.marginTop='-'+margin_top+'px';var paConfirmClose=document.getElementById("pa-close-confirm");paConfirmClose.addEventListener("click",function(){PushAlertCo.hidePushAlertConfirm()})} this.hidePushAlertConfirm=function(){var paConfirm=document.getElementById('pa-push-notification-confirm');if(typeof paConfirm!=='undefined'&&paConfirm!==null){paConfirm.remove()}} this.addPANotificationInfo=function(isSideWidget){if(document.getElementsByClassName("pushalert-notification-info").length==0){var more_opts_text=PushAlertCo.local_str['lt-widget-more-options-desktop'];if(this.isMobile){var more_opts_text=PushAlertCo.local_str['lt-widget-more-options-mobile']} var elem='\
'+PushAlertCo.local_str['lt-widget-title']+'
\
\
\
\ logo\

\ '+this.local_str['lt-widget-text']+'\

\
\

'+more_opts_text+'

\

\ \ \ Notifications by PushAlert\

\

\ \ \ Notifications by PushAlert\

\
\
\ ';var paNotificationInfo=document.createElement('div');if(this.isRTL){paNotificationInfo.dir='rtl'} paNotificationInfo.className='pushalert-notification-info pa-no-branding';if(isSideWidget){paNotificationInfo.className=paNotificationInfo.className+' pa-side-widget';if(this.widgetPosition['pa-ticker-position']==="left"){paNotificationInfo.className=paNotificationInfo.className+' pa-widget-left'}}else{paNotificationInfo.style.left="auto";paNotificationInfo.style.right="auto";paNotificationInfo.style.transformOrigin=this.widgetPosition['pa-ticker-position']+" bottom";if(this.widgetPosition['pa-ticker-position']==="right"){paNotificationInfo.style.right=this.widgetPosition['pa-notification-right']+'px'}else{paNotificationInfo.style.left=this.widgetPosition['pa-notification-left']+'px'} paNotificationInfo.style.bottom=this.widgetPosition['pa-notification-bottom']+'px'} paNotificationInfo.innerHTML=elem;paNotificationInfo.style.opacity="0";paNotificationInfo.style.transform="scale(0) translateZ(0)";document.body.appendChild(paNotificationInfo);if(isSideWidget){paNotificationInfo.style.marginTop=-paNotificationInfo.clientHeight/2+'px'} document.addEventListener('click',function(event){var specifiedElemContent=document.querySelector(".pushalert-notification-info");var specifiedElemHeader=document.querySelector("#pushalert-ticker");if(specifiedElemContent!==null&&specifiedElemContent.className.indexOf("pa-opened")>0){var isClickInside=specifiedElemContent.contains(event.target)||specifiedElemHeader.contains(event.target);if(!isClickInside){PushAlertCo.PA_NOTIFICATION_INFO_TOGGLE()}}})}} this.paToggleClassName=function(elem,className){if(typeof elem!=='undefined'&&elem!==null){if(elem.className.indexOf(className)>0){elem.className=elem.className.replace(new RegExp(className,'g'),"")}else{elem.className=elem.className+" "+className}}} this.PA_NOTIFICATION_INFO_TOGGLE=function(){var paNotificationInfo=document.getElementsByClassName("pushalert-notification-info")[0];var paDivContainer=document.getElementById("pushalert-ticker");this.paToggleClassName(paNotificationInfo,"pa-opened");this.paToggleClassName(paDivContainer,"pa-opened")} this.PA_NOTIFICATION_SUBS_INFO_TOGGLE=function(){var paNotificationInfo=document.getElementsByClassName("pushalert-notification-info")[0];var paDivContainer=document.getElementById("pushalert-ticker");this.paToggleClassName(paNotificationInfo,"pa-first-time pa-opened");this.paToggleClassName(paDivContainer,"pa-opened")} this.clearPAFirstTime=function(shouldCancel){var paNotificationInfo=document.getElementsByClassName("pushalert-notification-info")[0];var paDivContainer=document.getElementById("pushalert-ticker");this.paToggleClassName(paNotificationInfo,"pa-opened");this.paToggleClassName(paDivContainer,"pa-opened");paNotificationInfo.className=paNotificationInfo.className.replace(/pa-first-time/g,"");this.setCookie('pushalert_'+PushAlertCo.cookie_id+'subs_dialog','1',400);if(shouldCancel&&this.getCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status')==''){this.setCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status','canceled',typeof PushAlertCo.subscriptionStyle.subscriptionBoxDenyExpire!=='undefined'?PushAlertCo.subscriptionStyle.subscriptionBoxDenyExpire:7);this.setLS('cancel_count',0,1)}} this.removeSubscribeWidget=function(){var elem=document.getElementById('pushalert-ticker');if(elem!=undefined&&elem!==null){elem.remove()}};this.startRingingAnimation=function(){if(this.ringingAnimation){this.ringCount++;if(this.ringCount>2){this.ringCount=0} document.getElementById('pushalert-ticker').children[0].style.backgroundPosition="-"+32*this.ringCount+"px 0";document.getElementById('pushalert-ticker').children[0].style.backgroundPositionX="-"+31*this.ringCount+"px";if(this.ringCount==0){setTimeout(function(){PushAlertCo.startRingingAnimation()},this.frameRateMS*2)}else{setTimeout(function(){PushAlertCo.startRingingAnimation()},this.frameRateMS)}}} this.setCookie=function(cname,cvalue,exdays,cdomain="."+this.domain){var d=new Date();d.setTime(d.getTime()+(exdays*24*60*60*1000));var expires="expires="+d.toUTCString();var domain_name=cdomain;if(this.enableSubdomainIntegration){domain_name="."+location.hostname} document.cookie=cname+"="+cvalue+"; "+expires+";domain="+domain_name+";path=/; SameSite=Lax; secure"} this.setSessionCookie=function(cname,cvalue){var expires="expires=";var domain_name=this.domain;if(this.enableSubdomainIntegration){domain_name=location.hostname} document.cookie=cname+"="+cvalue+"; "+expires+";domain=."+domain_name+";path=/"} this.getCookie=function(cname){var name=cname+"=";var ca=document.cookie.split(';');for(var i=0;i80){data.title=data.title.substr(0,data.title.lastIndexOf(" ",80))+'...'} var css=document.createElement("style");css.type="text/css";css.innerHTML='.pushalert-content-recommended{font-family:Helvetica Neue,Helvetica,Arial,sans-serif;position:fixed;right:0;background:#fafafa;width:390px;overflow:hidden;height:110px;border:1px solid #ccc;transition:bottom .5s cubic-bezier(.87,0,.19,1.21);bottom:-112px;z-index:9999999999}.pushalert-content-recommended.pa-rec-opened{bottom:0}.pushalert-content-recommended-img{position:absolute;width:155px;height:110px}.pushalert-content-recommended-img img{height:100%;width:100%;background-size:cover;background-position:center center}.pushalert-content-recommended-text{margin-left:155px;padding:8px 12px}.pushalert-rec-heading{font-size:11px;color:#777}.pushalert-rec-title{display:flex;height:52px;align-items:center;line-height:1.25;font-size:14px;margin-top:5px;margin-bottom:5px;overflow:hidden}.pushalert-rec-title a{font-size:14px;color:#333;text-decoration:none;line-height:1.25}.pushalert-rec-website{font-size:11px;color:#888;position:absolute;bottom:8px;line-height:1}.pushalert-rec-branding{position:absolute;right:10px;bottom:7px;line-height:1}.pushalert-rec-branding a{color:#999;text-decoration:none;font-size:10px;line-height:1;background-position:left center;background-size:contain;padding-left:15px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAA5FBMVEUzerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerczerfPWb4IAAAAS3RSTlMAAQIDBQYHCwwOFB4fISIkJSYtLzE2OTxGSlBRVVpcYWdscHJzdHh8fZGTlJebp6utsrO2v8HDyszNz9PV19rc4eLr7PH09/j5/P6BP9L0AAAAuklEQVR4AaXK107DQBhE4UMMhF4WMBBCLxB6h9AJ3fP+78NuZK3+FZZA4rucM/zB4MpynQpZ+/zyoodEfuIHp4EhjUF2Nk1pptMAZnV4JAcsdhxd9adm2G/kXeXA0kMfwdZxuH2p63MBOF0luM9h4l2lt2GYu8Xrb9XgQNGun/YySs+KHrEKRR9YMv4XemXUTJiUMWLCtowNovFXGS+jMdwp0Y5h/zrRItFoevP8tFNIxSYVptbXHL/7Bh7TPKaTlMktAAAAAElFTkSuQmCC);background-repeat:no-repeat}#pushalert-rec-action-hide,#pushalert-rec-action-show{right:4px;font-size:10px;line-height:normal;width:14px;height:14px;background-image:url(https://cdn.pushalert.co/img/content-rec-arrows.svg);background-repeat:no-repeat;background-size:cover;overflow:hidden;text-indent:-99px;transition:opacity .3s ease-in;cursor:pointer}.pushalert-rec-branding a:hover{color:#337ab7}#pushalert-rec-action-hide{position:absolute;top:3px;background-position:-14px 0;opacity:0}.isMobile #pushalert-rec-action-hide,.pushalert-content-recommended:hover #pushalert-rec-action-hide{opacity:.3}#pushalert-rec-action-show{position:fixed;bottom:3px;background-position:0 0;opacity:0;transition-delay:0s}#pushalert-rec-action-show.pa-show-me{opacity:.3;transition-delay:.5s}@media only screen and (max-width:480px){.pushalert-content-recommended{left:0;right:0;width:100%}.pushalert-content-recommended-img{width:120px}.pushalert-content-recommended-text{margin-left:120px}}.pushalert-content-recommended.pa-rec-dark{background:#252525}.pa-rec-dark .pushalert-rec-title a{color:#fafafa}.pa-rec-dark #pushalert-rec-action-hide,.pa-rec-dark#pushalert-rec-action-show{background-image:url(https://cdn.pushalert.co/img/content-rec-arrows-dark.svg)}.pa-rec-dark .pushalert-content-recommended-img img{background-color:#eee}.pa-rec-dark .pushalert-rec-heading{color:#aaa;}';document.head.appendChild(css);var contentRecDiv=document.createElement("div");contentRecDiv.id="pushalert-content-recommended";if(this.isMobile){contentRecDiv.className="pushalert-content-recommended isMobile"}else{contentRecDiv.className="pushalert-content-recommended"} contentRecDiv.className=contentRecDiv.className+" "+this.PARecTheme;contentRecDiv.innerHTML='\ \ ';document.body.appendChild(contentRecDiv);var contentShowDiv=document.createElement("div");contentShowDiv.id='pushalert-rec-action-show';contentShowDiv.innerHTML='show';contentShowDiv.class=this.PARecTheme;document.body.appendChild(contentShowDiv);contentShowDiv.addEventListener("click",function(){var paContentRec=document.getElementById("pushalert-content-recommended");paContentRec.className=paContentRec.className+" pa-rec-opened";this.className="";PushAlertCo.PARecContentHide=!1});window.addEventListener("scroll",function(){if(PushAlertCo.PARecContentHide){return} var paContentRec=document.getElementById("pushalert-content-recommended");var top=(document.documentElement&&document.documentElement.scrollTop)||document.body.scrollTop;var showPosition=PushAlertCo.PAContentRecScrollPosition*(document.body.scrollHeight-window.innerHeight);if(typeof paContentRec!=='undefined'&&paContentRec!==null){if((top)>=showPosition&&paContentRec.className.indexOf("pa-rec-opened")===-1){paContentRec.className=paContentRec.className+" pa-rec-opened"}else if((top)-1){paContentRec.className=paContentRec.className.replace(/ pa-rec-opened/g,"")}}});document.getElementById("pushalert-rec-action-hide").addEventListener("click",function(){var paContentRec=document.getElementById("pushalert-content-recommended");paContentRec.className=paContentRec.className.replace(/ pa-rec-opened/g,"");document.getElementById("pushalert-rec-action-show").className="pa-show-me "+PushAlertCo.PARecTheme;PushAlertCo.PARecContentHide=!0})} this.PushAlertAddLoadEvent=function(func){if(window.addEventListener){window.addEventListener('load',func)}else{window.attachEvent('onload',func)}} this.checkSubscription=function(){PushAlertCo.attachUnsubscribeEvent();PushAlertCo.attachNotificationPreferencesEvent();PushAlertCo.shopifyCartAssocCheck();checkBrowser=this.PAcheckBrowser();if(('serviceWorker' in navigator&&checkBrowser&&checkBrowser!=="safari")||(this.safariEnabled&&checkBrowser==="safari"&&'safari' in window&&'pushNotification' in window.safari)){var isSubscribed=this.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status");var safariPermissionData="";if(checkBrowser==="safari"){safariPermissionData=window.safari.pushNotification.permission(this.safari_web_push_id)} if(isSubscribed=="subscribed"&&(Notification.permission=='granted'||(Notification.permission=='default'&&checkBrowser==="safarin")||PushAlertCo.byPassSubdomainCheck)&&(checkBrowser!=="safari"||(checkBrowser==="safari"&&(safariPermissionData.permission==='granted'||PushAlertCo.byPassSubdomainCheck)))){this.subs_id=decodeURIComponent(this.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id"));var result=[];result.success=!0;result.subscriber_id=this.subs_id;result.alreadySubscribed=!0;PushAlertCo.requestAnalytics();PushAlertCo.checkJSAPIFunction();PushAlertCo.callbackOnSuccess(result);if(PushAlertCo.enableUnsubs){PushAlertCo.showSubscribeWidget();PushAlertCo.PAAddUnsubscribeClass()} if(PushAlertCo.seg_id!=0){PushAlertCo.addToSegment(PushAlertCo.seg_id,null)}}else if(isSubscribed=="inprocess"&&(Notification.permission=='granted'||PushAlertCo.byPassSubdomainCheck)){PushAlertCo.showSubscribeWidget();PushAlertCo.initSubscription()}else if(isSubscribed=="denied"&&(Notification.permission=='denied'||PushAlertCo.byPassSubdomainCheck)&&(checkBrowser!=="safari"||(checkBrowser==="safari"&&(safariPermissionData.permission==='denied'||PushAlertCo.byPassSubdomainCheck)))){var result=[];result.status=-1;result.now=!1;PushAlertCo.callbackOnFailure(result);PushAlertCo.showSubscribeWidget()}else if(isSubscribed=="unsubscribed"){var result=[];result.status=1;result.now=!1;PushAlertCo.subs_id='';PushAlertCo.callbackOnFailure(result);PushAlertCo.showSubscribeWidget();PushAlertCo.PARemoveUnsubscribeClass();PushAlertCo.setCookie("pa_"+PushAlertCo.cookie_id+"last_url",'-1',-1);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id",'-1',-1)}else if(isSubscribed=="canceled"&&!this.forceTrigger){var result=[];result.status=0;result.now=!1;PushAlertCo.callbackOnFailure(result);PushAlertCo.showSubscribeWidget()}else{if(this.enableAutoSubs||this.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_dialog")!==""){PushAlertCo.showSubscribeWidget();var cancel_count=this.getLS('cancel_count');if(cancel_count&&cancel_count>=4&&!this.forceTrigger&&!0){return}else{this.initSubscriptionBox()}}else{this.PAShowFirstTime()} this.forceTrigger=!1} PushAlertCo.onScriptLoad();if(this.checkShopify()){this.productInfoShopifyInit()}else if(this.checkWooCommerce()){this.productInfoWooCommerceInit()}else if(this.checkPrestaShop()){this.productInfoPrestaShopInit()}else if(this.checkMagento()){this.productInfoMagentoInit()}else if(this.checkCustomShop()){this.productInfoCustomInit()} if(!this.checkShopify()&&!this.checkMagento()&&!this.checkPrestaShop()){this.processBrowseAbandonments();this.checkForBrowseAbandonmentCompletion()}else if(this.checkMagento()||this.checkPrestaShop()){this.checkForBrowseAbandonmentCompletion()}else{if(PushAlertCo.getCurrentUrl().indexOf("/checkouts/")>0||document.referrer.indexOf("/cart/add")>0||document.location.origin+"/cart"===PushAlertCo.getCurrentActualUrl()){var pass=!1;if(document.location.origin+"/cart"===PushAlertCo.getCurrentActualUrl()){let cart_info=PushAlertCo.getCookie('pushalert_'+PushAlertCo.cookie_id+'cart_info');let current_cart_info=PushAlertCo.getShopifyCartInfo() if(current_cart_info){if(cart_info){try{cart_info=JSON.parse(atob(cart_info));if(typeof cart_info.totalQuantity!=='undefined'&&typeof current_cart_info.totalQuantity!=='undefined'&¤t_cart_info.totalQuantity>cart_info.totalQuantity){pass=!0}}catch(e){}}else{pass=!0}}}else{pass=!0} const check_ba=PushAlertCo.getCookie("pa_ba_"+this.cookie_id+"status");if(pass&&check_ba=='1'){PushAlertCo.setCookie("pa_oc_"+PushAlertCo.cookie_id+"completed",'1',1);PushAlertCo.checkForBrowseAbandonmentCompletion()}} this.saveShopifyCartInfo()}}} this.PAShowFirstTime=function(){this.showSubscribeWidget();var paNotificationInfo=document.getElementsByClassName("pushalert-notification-info")[0];var paDivContainer=document.getElementById("pushalert-ticker");this.paToggleClassName(paNotificationInfo,"pa-first-time pa-opened");this.paToggleClassName(paDivContainer,"pa-opened")} this.PAAddUnsubscribeClass=function(){var paDivContainer=document.getElementById("pushalert-ticker");if(typeof paDivContainer!=='undefined'&&paDivContainer!==null){paDivContainer.className=paDivContainer.className+' pa-unsubscribe'}} this.PARemoveUnsubscribeClass=function(){var paDivContainer=document.getElementById("pushalert-ticker");if(typeof paDivContainer!=='undefined'&&paDivContainer!==null){paDivContainer.className=paDivContainer.className.replace(/pa-unsubscribe/g,'')}} this.PAcheckBrowser=function(){var userAgent=navigator.userAgent.toLocaleLowerCase();if(userAgent.indexOf('mobile')<0){this.isMobile=!1}else{this.isMobile=!0;if(PushAlertCo.subscriptionStyleMobileSeparate){PushAlertCo.subscriptionStyle=PushAlertCo.subscriptionStyleMobile}} if(userAgent.indexOf('fb_iab')>=0||userAgent.indexOf('; wv')>=0){return!1}else if(userAgent.indexOf('chrome')>=0&&userAgent.indexOf('opr\/')<0&&userAgent.indexOf('ucbrowser\/')<0&&userAgent.indexOf('edge\/')<0&&userAgent.indexOf('yabrowser\/')<0&&userAgent.indexOf('edg\/')<0){var version=userAgent.match(/chrom(e|ium)\/([0-9]+)\./);version=version?parseInt(version[2],10):!1;if(version&&version>=42){return"chrome"}else{return!1}}else if(userAgent.indexOf('firefox')>=0){var version=userAgent.match(/firefox\/([0-9]+)\./);version=version?parseInt(version[1],10):!1;if(version&&version>=44&&!this.isMobile){if(PushAlertCo.subscriptionStyle.subscriptionTheme==0){PushAlertCo.subscriptionStyle.subscriptionTheme=PushAlertCo.subscriptionStyle.subscriptionThemeFallback} return"firefox"}else if(version&&version>=48&&this.isMobile){if(PushAlertCo.subscriptionStyle.subscriptionTheme==0){PushAlertCo.subscriptionStyle.subscriptionTheme=PushAlertCo.subscriptionStyle.subscriptionThemeFallback} return"firefox"}else{return!1}}else if(userAgent.indexOf('opr\/')>=0){var version=userAgent.match(/opr\/([0-9]+)\./);version=version?parseInt(version[1],10):!1;if(version&&version>=42&&!this.isMobile){return"opera"}else if(version&&version>=37&&this.isMobile){return"opera"}else{return!1}}else if(userAgent.indexOf('ucbrowser\/')>=0){var version=userAgent.match(/ucbrowser\/([0-9]+)\./);version=version?parseInt(version[1],10):!1;if(version&&version>=12&&this.isMobile){return"ucbrowser"}else{return!1}}else if(userAgent.indexOf('edg\/')>=0){var version=userAgent.match(/edg\/([0-9]+)\./);version=version?parseInt(version[1],10):!1;if(version&&version>=79){if(PushAlertCo.subscriptionStyle.subscriptionTheme==0){PushAlertCo.subscriptionStyle.subscriptionTheme=PushAlertCo.subscriptionStyle.subscriptionThemeFallback} return"edge"}else{return!1}}else if(userAgent.indexOf('edge\/')>=0){var version=userAgent.match(/edge\/([0-9\.]+)/);version=parseFloat(version[1]);if(version&&version>=17.17134){if(PushAlertCo.subscriptionStyle.subscriptionTheme==0){PushAlertCo.subscriptionStyle.subscriptionTheme=PushAlertCo.subscriptionStyle.subscriptionThemeFallback} return"edge"}else{return!1}}else if(userAgent.indexOf('yabrowser')>=0){return'yandexbrowser'}else if(userAgent.indexOf('safari')>=0){if('PushManager' in window&&'serviceWorker' in navigator){var standalone="standalone" in window.navigator&&window.navigator.standalone;if(!this.isMobile||(this.isMobile&&standalone)){if(PushAlertCo.subscriptionStyle.subscriptionTheme==0){PushAlertCo.subscriptionStyle.subscriptionTheme=PushAlertCo.subscriptionStyle.subscriptionThemeFallback} return"safarin"}else{return!1}}else if(!this.isMobile&&'pushNotification' in window.safari){if(PushAlertCo.subscriptionStyle.subscriptionTheme==0){PushAlertCo.subscriptionStyle.subscriptionTheme=PushAlertCo.subscriptionStyle.subscriptionThemeFallback} return"safari"}else{return!1}} return!1} this.checkIncognito=function(isForced){var fs=window.RequestFileSystem||window.webkitRequestFileSystem;if(!fs){if((this.enableAutoSubs||this.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_dialog")!=="")||isForced){PushAlertCo.showSubscribeWidget();if(isForced){this.initSubscription()}else{this.initSubscriptionBox()}}else{this.PAShowFirstTime()} return} fs(window.TEMPORARY,100,function(fs){if((PushAlertCo.enableAutoSubs||PushAlertCo.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_dialog")!=="")||isForced){PushAlertCo.showSubscribeWidget();if(isForced){PushAlertCo.initSubscription()}else{PushAlertCo.initSubscriptionBox()}}else{PushAlertCo.PAShowFirstTime()}},function(err){})} this.checkSafariPermission=function(permissionData){if(permissionData==null||permissionData.permission==='default'){PushAlertCo.safariReqInitiated=!0;window.safari.pushNotification.requestPermission('https://pushalert.co/safari-v1',this.safari_web_push_id,{},this.checkSafariPermission)}else if(permissionData.permission==='denied'){var result=[];result.status=-1;result.now=!1;PushAlertCo.callbackOnFailure(result);PushAlertCo.setCookie('pushalert_'+PushAlertCo.cookie_id+'subs_status','denied',400);PushAlertCo.PARemoveUnsubscribeClass()}else if(permissionData.permission==='granted'){if(PushAlertCo.safariReqInitiated){PushAlertCo.sendSubSafari(permissionData.deviceToken);this.safariReqInitiated=!1}else{PushAlertCo.checkSubSafari(permissionData.deviceToken)}}};this.sendSubSafari=function(deviceToken){if(PushAlertCo.requestedSubscribeFetch){return} PushAlertCo.requestedSubscribeFetch=!0;var browser=[];var browser_info=PushAlertCo.getBrowserInfo();for(key in browser_info){browser.push(key+'='+encodeURIComponent(browser_info[key]))} browser=browser.join('&');browser=browser+"&pa_id="+PushAlertCo.pa_id+'&domain_id='+PushAlertCo.pa_domain_id;browser=browser+"&endpoint_url=safari";browser=browser+"&seg_id="+PushAlertCo.seg_id;browser=browser+"&referrer="+encodeURIComponent(window.location.href);var endPoint=deviceToken;browser=browser+'&endpoint='+encodeURIComponent(endPoint);fetch(PushAlertCo.pa_subdomain+"/subscribe/"+endPoint,{method:'post',headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:browser}).then(function(res){res.json().then(function(data){PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status","subscribed",400);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id",encodeURIComponent(data.subs_id),400);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"already_subscribed","false",400);var result=[];result.success=!0;result.subscriber_id=data.subs_id;result.alreadySubscribed=!1;PushAlertCo.subs_id=data.subs_id;PushAlertCo.requestAnalytics();PushAlertCo.checkJSAPIFunction();PushAlertCo.callbackOnSuccess(result);if(PushAlertCo.seg_id!=0){PushAlertCo.addSegmentID(PushAlertCo.seg_id)} if(!PushAlertCo.enableUnsubs){PushAlertCo.removeSubscribeWidget()}else{PushAlertCo.PAAddUnsubscribeClass()}}).catch(function(e){console.log('Error sending subscription to server:'+e.toString())})})};this.checkSubSafari=function(deviceToken){var browser=[];var browser_info=PushAlertCo.getBrowserInfo();for(key in browser_info){browser.push(key+'='+encodeURIComponent(browser_info[key]))} browser=browser.join('&');browser=browser+"&pa_id="+PushAlertCo.pa_id+'&domain_id='+PushAlertCo.pa_domain_id;browser=browser+"&endpoint_url=safari";browser=browser+"&seg_id="+PushAlertCo.seg_id;browser=browser+"&referrer="+encodeURIComponent(window.location.href);var endPoint=deviceToken;browser=browser+'&endpoint='+encodeURIComponent(endPoint);fetch(PushAlertCo.pa_subdomain+"/check/"+endPoint,{method:'post',headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:browser}).then(function(res){res.json().then(function(data){if(data.status){PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status","subscribed",400);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id",encodeURIComponent(data.subs_id),400);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"already_subscribed","true",400);var result=[];result.success=!0;result.subscriber_id=data.subs_id;result.alreadySubscribed=!0;PushAlertCo.subs_id=data.subs_id;PushAlertCo.requestAnalytics();PushAlertCo.checkJSAPIFunction();PushAlertCo.callbackOnSuccess(result);if(PushAlertCo.seg_id!=0){PushAlertCo.addSegmentID(PushAlertCo.seg_id)} if(!PushAlertCo.enableUnsubs){PushAlertCo.removeSubscribeWidget()}else{PushAlertCo.PAAddUnsubscribeClass()}}else{PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status","unsubscribed",400);var result=[];result.status=1;result.now=!1;PushAlertCo.subs_id='';PushAlertCo.callbackOnFailure(result);PushAlertCo.showSubscribeWidget();PushAlertCo.setCookie("pa_"+PushAlertCo.cookie_id+"last_url",'-1',-1);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id",'-1',-1)}}).catch(function(e){console.log('Error checking subscription to server:'+e.toString())})})};this.unsubscribeSafari=function(){var safariPermissionData=window.safari.pushNotification.permission(this.safari_web_push_id);if(safariPermissionData.permission==="granted"){PushAlertCo.requestedSubscribeFetch=!1;fetch(PushAlertCo.pa_subdomain+"/unsubscribe/"+safariPermissionData.deviceToken,{method:'post',headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:'pa_id='+PushAlertCo.pa_id+'&domain_id='+PushAlertCo.pa_domain_id}).then(function(res){res.json().then(function(data){PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status","unsubscribed",400);var result=[];result.status=1;result.now=!0;PushAlertCo.subs_id='';PushAlertCo.callbackOnFailure(result);PushAlertCo.PARemoveUnsubscribeClass();PushAlertCo.setCookie("pa_"+PushAlertCo.cookie_id+"last_url",'-1',-1);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id",'-1',-1)}).catch(function(e){console.log('Error sending subscription to server:',e)})})}else{PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status","unsubscribed",400);var result=[];result.status=1;result.now=!0;PushAlertCo.subs_id='';PushAlertCo.callbackOnFailure(result);PushAlertCo.PARemoveUnsubscribeClass();PushAlertCo.setCookie("pa_"+PushAlertCo.cookie_id+"last_url",'-1',-1);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id",'-1',-1)}};this.getBrowserInfo=function(){!function(e,o){this[e]=o()}("browser_info",function(){function e(e){function i(o){var i=e.match(o);return i&&i.length>1&&i[1]||""}function r(o){var i=e.match(o);return i&&i.length>1&&i[2]||""}var s,n=i(/(ipod|iphone|ipad)/i).toLowerCase(),a=/like android/i.test(e),d=!a&&/android/i.test(e),t=/CrOS/.test(e),m=/silk/i.test(e),w=/sailfish/i.test(e),b=/tizen/i.test(e),c=/(web|hpw)os/i.test(e),l=/windows phone/i.test(e),v=!l&&/windows/i.test(e),h=!n&&!m&&/macintosh/i.test(e),p=!d&&!w&&!b&&!c&&/linux/i.test(e),f=i(/edge\/(\d+(\.\d+)?)/i),u=i(/version\/(\d+(\.\d+)?)/i),k=/tablet/i.test(e)||/android/i.test(e)&&!/mobile/i.test(e),g=!k&&/[^-]mobi/i.test(e);/opera mini/i.test(e)?(s={name:"Opera Mini",operamini:o,majorVersion:i(/(?:opera mini)[\s\/](\d+(\.\d+)?)/i)||u,version:i(/(?:opera mini)\/([\d\.]+)/i)},g=o,k=!1):/opera|opr/i.test(e)?s={name:"Opera",opera:o,majorVersion:u||i(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i),version:i(/(?:opera|opr)\/([\d\.]+)/i)}:/ucbrowser/i.test(e)?s={name:"UC Browser",ucbrowser:o,majorVersion:i(/(?:ucbrowser)[\s\/](\d+(\.\d+)?)/i)||u,version:i(/(?:ucbrowser)\/([\d\.]+)/i)}:/acheetahi/i.test(e)?s={name:"CM Browser",cmbrowser:o,majorVersion:i(/(?:acheetahi)[\s\/](\d+(\.\d+)?)/i)||u,version:i(/(?:acheetahi)\/([\d\.]+)/i)}:/yabrowser/i.test(e)?s={name:"Yandex Browser",yandexbrowser:o,version:u||i(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:l?(s={name:"Windows Phone",windowsphone:o},f?(s.msedge=o,s.version=f):(s.msie=o,s.version=i(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?s={name:"Internet Explorer",msie:o,version:i(/(?:msie |rv:)([\.\d]+)/i),majorVersion:i(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:t?s={name:"Chrome",chromeos:o,chromeBook:o,chrome:o,version:i(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(e)?s={name:"Microsoft Edge",msedge:o,version:f,majorVersion:i(/(?:edge)\/(\d+(\.\d+)?)/i)}:/chrome.+? edgA/i.test(e)?s={name:"Microsoft Edge",msedgeA:o,version:f,majorVersion:i(/(?:edge)\/(\d+(\.\d+)?)/i)}:/chrome.+? edg/i.test(e)?s={name:"Microsoft Edge",msedgeA:o,version:i(/(?:edg)\/([\d\.]+)/i),majorVersion:i(/(?:edg)\/(\d+(\.\d+)?)/i)}:/edgios/i.test(e)?s={name:"Microsoft Edge",msedgeA:o,version:i(/(?:edgios)\/([\d\.]+)/i),majorVersion:i(/(?:edgios)\/(\d+(\.\d+)?)/i)}:/chrome|crios|crmo/i.test(e)?s={name:"Chrome",chrome:o,version:i(/(?:chrome|crios|crmo)\/([\d\.]+)/i),majorVersion:i(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:n?(s={name:"iphone"==n?"iPhone":"ipad"==n?"iPad":"iPod"},u&&(s.version=u)):w?s={name:"Sailfish",sailfish:o,version:i(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?s={name:"SeaMonkey",seamonkey:o,version:i(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(e)?(s={name:"Firefox",firefox:o,version:i(/(?:firefox|iceweasel)[ \/]([\d\.]+)/i),majorVersion:i(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(s.firefoxos=o)):m?s={name:"Amazon Silk",silk:o,version:i(/silk\/(\d+(\.\d+)?)/i)}:d?s={name:"Android",version:u}:/phantom/i.test(e)?s={name:"PhantomJS",phantom:o,version:i(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?s={name:"BlackBerry",blackberry:o,version:u||i(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:c?(s={name:"WebOS",webos:o,version:u||i(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(s.touchpad=o)):s=/bada/i.test(e)?{name:"Bada",bada:o,version:i(/dolfin\/(\d+(\.\d+)?)/i)}:b?{name:"Tizen",tizen:o,version:i(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||u}:/safari/i.test(e)?{name:"Safari",safari:o,version:u}:{name:i(/^(.*)\/(.*) /),version:r(/^(.*)\/(.*) /)},!s.msedge&&/(apple)?webkit/i.test(e)?(s.name=s.name||"Webkit",s.webkit=o,!s.version&&u&&(s.version=u)):!s.opera&&/gecko\//i.test(e)&&(s.name=s.name||"Gecko",s.gecko=o,s.version=s.version||i(/gecko\/(\d+(\.\d+)?)/i)),s.msedge||!d&&!s.silk?n?(s[n]=o,s.ios=o):v?s.windows=o:h?s.mac=o:p&&(s.linux=o):s.android=o;var x="";s.windowsphone?x=i(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):n?(x=i(/os (\d+([_\s]\d+)*) like mac os x/i),x=x.replace(/[_\s]/g,".")):d?x=i(/android[ \/-](\d+(\.\d+)*)/i):s.webos?x=i(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):s.blackberry?x=i(/rim\stablet\sos\s(\d+(\.\d+)*)/i):s.bada?x=i(/bada\/(\d+(\.\d+)*)/i):s.tizen?x=i(/tizen[\/\s](\d+(\.\d+)*)/i):s.windows?x=i(/windows nt[\/\s](\d+(\.\d+)*)/i):s.mac&&(x=i(/mac os x[\/\s](\d+(_\d+)*)/i)),x&&(s.osversion=x);var y=x.split(".")[0];return k||"ipad"==n||d&&(3==y||4==y&&!g)||s.silk?s.tablet=o:(g||"iphone"==n||"ipod"==n||d||s.blackberry||s.webos||s.bada)&&(s.mobile=o),s.msedge||s.msie&&s.version>=10||s.yandexbrowser&&s.version>=15||s.chrome&&s.version>=20||s.firefox&&s.version>=20||s.safari&&s.version>=6||s.opera&&s.version>=10||s.ios&&s.osversion&&s.osversion.split(".")[0]>=6||s.blackberry&&s.version>=10.1?s.a=o:s.msie&&s.version<10||s.chrome&&s.version<20||s.firefox&&s.version<20||s.safari&&s.version<6||s.opera&&s.version<10||s.ios&&s.osversion&&s.osversion.split(".")[0]<6?s.c=o:s.x=o,s}var o=!0,i=e("undefined"!=typeof navigator?navigator.userAgent:"");i.test=function(e){for(var o=0;o=16.4&&browser_info.os=="ios"&&browser_info.browser=="unknown"){browser_info.browser="safari"} return browser_info} this.listener=function(data){var data_sent=data.split("|");if(data_sent[0]=="pushalert_"+PushAlertCo.cookie_id+"subs_id"){PushAlertCo.setCookie(data_sent[0],encodeURIComponent(data_sent[1]),400);PushAlertCo.subs_id=data_sent[1]}else{if((data_sent[0]=="pushalert_subs_status"||data_sent[0]=="pushalert_"+PushAlertCo.cookie_id+"subs_status")&&data_sent[1]=="canceled"){PushAlertCo.setCookie(data_sent[0],data_sent[1],typeof PushAlertCo.subscriptionStyle.subscriptionBoxDenyExpire!=='undefined'?PushAlertCo.subscriptionStyle.subscriptionBoxDenyExpire:7);PushAlertCo.setLS('cancel_count',0,1)}else{PushAlertCo.setCookie(data_sent[0],data_sent[1],400)}} if(data_sent[1]=='denied'){var result=[];result.status=-1;result.now=!1;PushAlertCo.callbackOnFailure(result)}else if(data_sent[1]=='canceled'){var result=[];result.status=0;result.now=!1;PushAlertCo.callbackOnFailure(result)}else if(data_sent[1]=='unsubscribed'){var result=[];result.status=1;result.now=!0;PushAlertCo.subs_id='';PushAlertCo.callbackOnFailure(result);PushAlertCo.PARemoveUnsubscribeClass();PushAlertCo.setCookie("pa_"+PushAlertCo.cookie_id+"last_url",'-1',-1);PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id",'-1',-1)}} this.checkSegmentID=function(seg_id){return!1} this.addSegmentID=function(seg_id){} this.removeSegmentID=function(seg_id){} this.initArrayPush=function(){pushalertbyiw.push=function(data){if(typeof data!=='undefined'&&data!==null){if(data[0]=="addToSegment"){if(typeof data[1]!=='undefined'&&data[1]!==null&&typeof data[2]!=='undefined'&&data[2]!==null){PushAlertCo.addToSegment(data[1],data[2])}else if(typeof data[1]!=='undefined'&&data[1]!==null){PushAlertCo.addToSegment(data[1],null)}}else if(data[0]=="removeFromSegment"){if(typeof data[1]!=='undefined'&&data[1]!==null&&typeof data[2]!=='undefined'&&data[2]!==null){PushAlertCo.removeFromSegment(data[1],data[2])}else if(typeof data[1]!=='undefined'&&data[1]!==null){PushAlertCo.removeFromSegment(data[1],null)}}else if(data[0]=="checkSegment"){if(typeof data[1]!=='undefined'&&data[1]!==null&&typeof data[2]!=='undefined'&&data[2]!==null){PushAlertCo.checkSegment(data[1],data[2])}else if(typeof data[1]!=='undefined'&&data[1]!==null){PushAlertCo.checkSegment(data[1],null)}}else if(data[0]=="addAttributes"){if(typeof data[1]!=='undefined'&&data[1]!==null){PushAlertCo.addAttributes(data[1])}}else if(data[0]=="trackEvent"){if(typeof data[1]!=='undefined'&&data[1]!==null&&typeof data[2]!=='undefined'&&data[2]!==null){PushAlertCo.trackEvent(data[1],data[2],data[3],data[4],data[5])}}else if(data[0]=="cancelEvent"){if(typeof data[1]!=='undefined'&&data[1]!==null&&typeof data[2]!=='undefined'&&data[2]!==null){PushAlertCo.cancelEvent(data[1],data[2],data[3],data[4])}}else if(data[0]=="abandonedCart"){if(typeof data[1]!=='undefined'&&data[1]!==null){PushAlertCo.abandonedCart(data[1],data[2])}}else if(data[0]=="browseAbandonment"){if(typeof data[1]!=='undefined'&&data[1]!==null&&typeof data[2]!=='undefined'&&data[2]!==null){PushAlertCo.browseAbandonment(data[1],data[2])}}else if(data[0]=="onReady"){if(typeof data[1]!=='undefined'&&data[1]!==null){data[1]()}} return Array.prototype.push.call(this,data)}}} this.checkJSAPIFunction=function(){for(var i=0;i=0&&platform.toLocaleLowerCase().indexOf('version/')>=0)){document.head.appendChild(manifest);PushAlertCo.showiOSA2HS=!0} this.checkCustomLocalizeStrings();if(!this.checkDisableAutoInit()){this.init()}else{this.requestAnalyticsNoAutoInit()} this.initArrayPush()}} this.checkCustomLocalizeStrings=function(){if(typeof pa_localized_str!=="undefined"){var l_str;for(l_str in pa_localized_str){this.local_str[l_str]=pa_localized_str[l_str]} if(typeof pa_localized_str.subscriptionBtnAllowTxt!=="undefined"){this.subscriptionStyle.subscriptionBtnAllowTxt=pa_localized_str.subscriptionBtnAllowTxt} if(typeof pa_localized_str.subscriptionBtnDenyTxt!=="undefined"){this.subscriptionStyle.subscriptionBtnDenyTxt=pa_localized_str.subscriptionBtnDenyTxt} if(typeof pa_localized_str.subscriptionTitle!=="undefined"){this.subscriptionStyle.subscriptionTitle=pa_localized_str.subscriptionTitle} if(typeof pa_localized_str.subscriptionMessage!=="undefined"){this.subscriptionStyle.subscriptionMessage=pa_localized_str.subscriptionMessage} if(this.subscriptionStyleMobileSeparate){if(typeof pa_localized_str.mobileSubscriptionBtnAllowTxt!=="undefined"){this.subscriptionStyleMobile.subscriptionBtnAllowTxt=pa_localized_str.mobileSubscriptionBtnAllowTxt}else if(typeof pa_localized_str.subscriptionBtnAllowTxt!=="undefined"){this.subscriptionStyleMobile.subscriptionBtnAllowTxt=pa_localized_str.subscriptionBtnAllowTxt} if(typeof pa_localized_str.mobileSubscriptionBtnDenyTxt!=="undefined"){this.subscriptionStyleMobile.subscriptionBtnDenyTxt=pa_localized_str.mobileSubscriptionBtnDenyTxt}else if(typeof pa_localized_str.subscriptionBtnDenyTxt!=="undefined"){this.subscriptionStyleMobile.subscriptionBtnDenyTxt=pa_localized_str.subscriptionBtnDenyTxt} if(typeof pa_localized_str.mobileSubscriptionTitle!=="undefined"){this.subscriptionStyleMobile.subscriptionTitle=pa_localized_str.mobileSubscriptionTitle}else if(typeof pa_localized_str.subscriptionTitle!=="undefined"){this.subscriptionStyleMobile.subscriptionTitle=pa_localized_str.subscriptionTitle} if(typeof pa_localized_str.mobileSubscriptionMessage!=="undefined"){this.subscriptionStyleMobile.subscriptionMessage=pa_localized_str.mobileSubscriptionMessage}else if(typeof pa_localized_str.subscriptionMessage!=="undefined"){this.subscriptionStyleMobile.subscriptionMessage=pa_localized_str.subscriptionMessage}}}} this.isIframe=function(){try{return window.self!==window.top}catch(e){return!0}} this.checkDisableAutoInit=function(){(pushalertbyiw=window.pushalertbyiw||[]).push();for(var i=0;i0){paDivDenied.className='blocked mobile';paDivDenied.innerHTML=PushAlertCo.local_str['lt-unblock-mobile']}else if(userAgent.indexOf('chrome')>0){paDivDenied.className='blocked';paDivDenied.innerHTML=PushAlertCo.local_str['lt-unblock-chrome']}else if(userAgent.indexOf('firefox')>0){paDivDenied.className='blocked firefox';paDivDenied.innerHTML=PushAlertCo.local_str['lt-unblock-firefox']} var close_span=document.createElement('span');close_span.onclick=function(){paDivDenied.remove()};paDivDenied.appendChild(close_span);paDivDenied.style.display='block';document.body.appendChild(paDivDenied);setTimeout(function(){paDivDenied.className=paDivDenied.className+" show"},10)}else{Notification.requestPermission().then(function(permission){if(permission==="granted"){PushAlertCo.subscribePush()}else if(permission==='denied'){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|denied")}else{if(PushAlertCo.enableWidget==1){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|canceled")}else{var result=[];result.status=0;result.now=!1;PushAlertCo.callbackOnFailure(result)}}})}}};this.initSubscription=function(){if(PushAlertCo.PAcheckBrowser()==='firefox'){PushAlertCo.initSubscriptionFirefox()}else if('serviceWorker' in navigator){console.log('Service Worker is supported here');if(PushAlertCo.PAcheckBrowser()==='chrome'&&Notification.permission=='granted'&&!PushAlertCo.reSubscribe){PushAlertCo.unsubscribeThenSubscribe();return} var sw_url="/sw.js";var sw_scope="/";if(PushAlertCo.checkShopify()){sw_url="/apps/pushalert/sw-"+this.script_id+".js"}else if(typeof pushalert_sw_file!=="undefined"){sw_url=pushalert_sw_file} if(typeof pushalert_sw_scope!=="undefined"){sw_scope=pushalert_sw_scope} navigator.serviceWorker.register(sw_url,{}).then(function(reg){reg.pushManager.getSubscription().then(function(pushSubscription){if(pushSubscription){try{PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|subscribed")}catch(e){console.log(':^(',e)};PushAlertCo.checkSub(pushSubscription)}else{if(Notification.permission==="denied"){try{PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|denied")}catch(e){};var paDivDenied=document.createElement('div');paDivDenied.id='pa_class-blocked-info';var css="#pa_class-blocked-info.blocked{\ width: 240px;\ border: 1px solid #ddd;\ padding: 10px;\ left: 75px;\ position: fixed;\ background: #fff;\ top: 15px;\ border-radius: 3px;\ box-shadow: 0 0 10px #eee;\ font-size: 15px;\ text-align: left;\ display:none;\ opacity: 0;\ transform: rotateX(-90deg);\ transition: all 0.8s cubic-bezier(.36,-0.64,.34,1.76);\ }\ \ #pa_class-blocked-info.blocked.show{\ opacity: 1;\ transform: none;\ z-index: 2147483647;\ transition: all 0.8s cubic-bezier(.36,-0.64,.34,1.76);\ }\ \ #pa_class-blocked-info.blocked span{\ position: absolute;\ right: 4px;\ top: 1px;\ font-size: 11px;\ cursor: pointer;\ color: #ccc;\ }\ \ #pa_class-blocked-info.blocked span::after{\ content: \"\\2716\";\ }\ \ #pa_class-blocked-info.blocked:after, #pa_class-blocked-info.blocked:before {\ bottom: 100%;\ left: 60px;\ border: solid transparent;\ content: \" \";\ height: 0;\ width: 0;\ position: absolute;\ pointer-events: none;\ }\ \ #pa_class-blocked-info.blocked:after {\ border-color: transparent;\ border-bottom-color: #fff;\ border-width: 12px;\ margin-left: -12px;\ }\ #pa_class-blocked-info.blocked:before {\ border-color: transparent;\ border-bottom-color: #ddd;\ border-width: 13px;\ margin-left: -13px;\ }\ \ #pa_class-blocked-info.blocked.firefox{\ left:25px;\ }\ #pa_class-blocked-info.blocked.firefox:after, #pa_class-blocked-info.blocked.firefox:before {\ left:45px;\ }\ \ #pa_class-blocked-info.blocked.mobile{\ left:5px;\ top:11px;\ }\ \ #pa_class-blocked-info.blocked.mobile:after, #pa_class-blocked-info.blocked.mobile:before {\ left:22px;\ }\ #pa_class-blocked-info.blocked.mobile:after {\ border-width: 10px;\ margin-left: -10px;\ }\ #pa_class-blocked-info.blocked.mobile:before {\ border-width: 11px;\ margin-left: -11px;\ }";pa_head=document.head||document.getElementsByTagName('head')[0];var link=document.createElement('style');link.type='text/css';if(link.styleSheet){link.styleSheet.cssText=css}else{link.appendChild(document.createTextNode(css))} pa_head.appendChild(link);userAgent=navigator.userAgent.toLowerCase();if(userAgent.indexOf('mobile')>0){paDivDenied.className='blocked mobile';paDivDenied.innerHTML=PushAlertCo.local_str['lt-unblock-mobile']}else if(userAgent.indexOf('chrome')>0){paDivDenied.className='blocked';paDivDenied.innerHTML=PushAlertCo.local_str['lt-unblock-chrome']}else if(userAgent.indexOf('firefox')>0){paDivDenied.className='blocked firefox';paDivDenied.innerHTML=PushAlertCo.local_str['lt-unblock-firefox']} var close_span=document.createElement('span');close_span.onclick=function(){paDivDenied.remove()};paDivDenied.appendChild(close_span);paDivDenied.style.display='block';document.body.appendChild(paDivDenied);setTimeout(function(){paDivDenied.className=paDivDenied.className+" show"},10)}else{if(PushAlertCo.PAcheckBrowser()==='edge'){PushAlertCo.subscribePushVapid()}else if(PushAlertCo.PAcheckBrowser()==='chrome'||PushAlertCo.PAcheckBrowser()==='opera'||PushAlertCo.PAcheckBrowser()==='yandexbrowser'||PushAlertCo.PAcheckBrowser()==='safarin'){PushAlertCo.subscribePushVapid()}else{PushAlertCo.subscribePush()}}}}.bind(this)).catch(function(e){console.log('Error getting subscription',e)})}).catch(function(err){console.log(':^(',err)})}};this.subscribePush=function(){var sw_url="/sw.js";if(PushAlertCo.checkShopify()){sw_url="/apps/pushalert/sw-"+this.script_id+".js"}else if(typeof pushalert_sw_file!=="undefined"){sw_url=pushalert_sw_file} navigator.serviceWorker.getRegistration(sw_url).then(function(serviceWorkerRegistration){serviceWorkerRegistration.pushManager.subscribe({userVisibleOnly:!0}).then(function(pushSubscription){PushAlertCo.sendSub(pushSubscription);PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|subscribed");if(!PushAlertCo.enableUnsubs){PushAlertCo.removeSubscribeWidget()}else{PushAlertCo.PAAddUnsubscribeClass()} PushAlertCo.setCookie('pa_'+PushAlertCo.cookie_id+'last_url',PushAlertCo.getCurrentActualUrl(),400)}).catch(function(e){if(Notification.permission==='denied'){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|denied")}else{if(PushAlertCo.enableWidget==1){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|canceled")}else{var result=[];result.status=0;result.now=!1;PushAlertCo.callbackOnFailure(result)}} console.log('Unable to register push subscription - '+Notification.permission,e)})})};this.urlBase64ToUint8Array=function(base64String){var padding='='.repeat((4-base64String.length%4)%4);var base64=(base64String+padding).replace(/\-/g,'+').replace(/_/g,'/');var rawData=window.atob(base64);var outputArray=new Uint8Array(rawData.length);for(var i=0;i
Subscribe to our notifications!
Click the bell icon to enable notfications
';this.removeABNHelp();document.body.appendChild(paABNHelp);document.getElementById('pushalert-abn-help-close').onclick=function(){PushAlertCo.removeABNHelp()}}};this.removeABNHelp=function(){if(PushAlertCo.PAcheckBrowser()==='chrome'&&!PushAlertCo.isMobile){var elem=document.getElementById('pushalert-abn-help-container');if(elem!==undefined&&elem!==null){elem.remove()}}};this.subscribePushVapid=function(){PushAlertCo.setLS('nvs',1,0);PushAlertCo.checkVA=1;var sw_url="/sw.js";var sw_scope="/";if(PushAlertCo.checkShopify()){sw_url="/apps/pushalert/sw-"+this.script_id+".js"}else if(typeof pushalert_sw_file!=="undefined"){sw_url=pushalert_sw_file} if(typeof pushalert_sw_scope!=="undefined"){sw_scope=pushalert_sw_scope} navigator.serviceWorker.register(sw_url,{}).then(function(swReg){swReg.pushManager.getSubscription().then(function(subscription){isSubscribed=!(subscription===null);if(isSubscribed){PushAlertCo.sendSub(subscription);PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|subscribed");if(!PushAlertCo.enableUnsubs){PushAlertCo.removeSubscribeWidget()}else{PushAlertCo.PAAddUnsubscribeClass()} PushAlertCo.setCookie("pa_"+PushAlertCo.cookie_id+"last_url",PushAlertCo.getCurrentActualUrl(),400)}else{if(Notification.permission==='default'&&!1){setTimeout(function(){PushAlertCo.addABNHelp();var clearABNHelp=setInterval(function(){var elem=document.getElementById('pushalert-abn-help-container');if(Notification.permission!=='default'||(elem===undefined||elem===null)){PushAlertCo.removeABNHelp();clearTimeout(clearABNHelp)}},100)},1500)} swReg.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:PushAlertCo.urlBase64ToUint8Array('BHRmpTh9ugVvxhXnQqMOWRQhyzQkLm4TNJn2nErJ70sjiC6ZtzyO54QkrwLhymGwOa+64Z6gJXcTG67Agq+uc8o=')}).then(function(subscription){PushAlertCo.removeABNHelp();PushAlertCo.sendSub(subscription);PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|subscribed");if(!PushAlertCo.enableUnsubs){PushAlertCo.removeSubscribeWidget()}else{PushAlertCo.PAAddUnsubscribeClass()} PushAlertCo.setCookie("pa_"+PushAlertCo.cookie_id+"last_url",PushAlertCo.getCurrentActualUrl(),400)}).catch(function(err){PushAlertCo.removeABNHelp();if(Notification.permission==='denied'){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|denied")}else{if(PushAlertCo.enableWidget==1){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|canceled")}else{var result=[];result.status=0;result.now=!1;PushAlertCo.callbackOnFailure(result)}} console.log('Failed to subscribe the user: ',err)})}})}).catch(function(error){console.log('Service Worker Error',error)})};this.unsubscribe=function(){PushAlertCo.hidePushAlertConfirm();var checkBrowser=this.PAcheckBrowser();if(checkBrowser==="safari"){this.unsubscribeSafari()}else{var sw_url="/sw.js";var sw_scope="/";if(PushAlertCo.checkShopify()){sw_url="/apps/pushalert/sw-"+this.script_id+".js"}else if(typeof pushalert_sw_file!=="undefined"){sw_url=pushalert_sw_file} navigator.serviceWorker.getRegistration(sw_url).then(function(serviceWorkerRegistration){serviceWorkerRegistration.pushManager.getSubscription().then(function(pushSubscription){if(pushSubscription){pushSubscription.unsubscribe().then(function(successful){var endPoint;if(checkBrowser==='edge'){var url=new URL(pushSubscription.endpoint);endPoint=url.searchParams.get("token")}else{endPoint=pushSubscription.endpoint.slice(pushSubscription.endpoint.lastIndexOf('/')+1)} PushAlertCo.requestedSubscribeFetch=!1;fetch(PushAlertCo.pa_subdomain+"/unsubscribe/"+endPoint,{method:'post',headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:'pa_id='+PushAlertCo.pa_id+'&domain_id='+PushAlertCo.pa_domain_id+'&endpoint='+encodeURIComponent(endPoint)}).then(function(res){res.json().then(function(data){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed")}).catch(function(e){console.log('Error sending subscription to server:',e)})})}).catch(function(e){console.log('Error getting subscription',e)})}else{PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed")}}).catch(function(e){console.log('Error getting subscription',e)})})}};this.checkNVSStatus=function(){if(!PushAlertCo.getLS('nvs')){PushAlertCo.setLS('nvs',1,0);var browser=PushAlertCo.PAcheckBrowser();if(browser!=='safarin'&&browser!=='safari'){var subs_info=PushAlertCo.getSubsInfo();if(subs_info.status=='subscribed'){fetch(PushAlertCo.pa_subdomain+"/fcm-check/",{method:'post',headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:'pa_id='+PushAlertCo.pa_id+'&domain_id='+PushAlertCo.pa_domain_id+'&subs_id='+encodeURIComponent(subs_info.subs_id)}).then(function(res){res.json().then(function(data){if(data.hasOwnProperty("check")&&data.check==1){PushAlertCo.upgradeSubscribe(subs_info.subs_id)}}).catch(function(e){})})}}}} this.upgradeSubscribe=function(subs_id){PushAlertCo.old_subs_id=subs_id;PushAlertCo.requestedSubscribeFetch=!1;navigator.serviceWorker.ready.then(function(serviceWorkerRegistration){serviceWorkerRegistration.pushManager.getSubscription().then(function(pushSubscription){if(pushSubscription){pushSubscription.unsubscribe().then(function(successful){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed");PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()}).catch(function(e){console.log('Error getting subscription',e);PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed");PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()})}else{PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed");PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()}}).catch(function(e){console.log('Error getting subscription',e);PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed");PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()})}).catch(function(err){console.log(':^(',err);PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed");PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()})};this.unsubscribeThenSubscribe=function(){if(navigator.serviceWorker.controller==null){PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription();return} var checkBrowser=this.PAcheckBrowser();navigator.serviceWorker.ready.then(function(serviceWorkerRegistration){serviceWorkerRegistration.pushManager.getSubscription().then(function(pushSubscription){if(pushSubscription){pushSubscription.unsubscribe().then(function(successful){var endPoint;endPoint=pushSubscription.endpoint.slice(pushSubscription.endpoint.lastIndexOf('/')+1);PushAlertCo.requestedSubscribeFetch=!1;fetch(PushAlertCo.pa_subdomain+"/unsubscribe/"+endPoint,{method:'post',headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:'pa_id='+PushAlertCo.pa_id+'&domain_id='+PushAlertCo.pa_domain_id+'&endpoint='+encodeURIComponent(endPoint)}).then(function(res){res.json().then(function(data){PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed");PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()}).catch(function(e){console.log('Error sending subscription to server:',e);PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()})})}).catch(function(e){console.log('Error getting subscription',e);PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()})}else{PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_status|unsubscribed");PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()}}).catch(function(e){console.log('Error getting subscription',e);PushAlertCo.reSubscribe=!0;PushAlertCo.initSubscription()})}).catch(function(err){console.log(':^(',err)})};this.sendSub=function(pushSubscription){if(PushAlertCo.requestedSubscribeFetch){return} PushAlertCo.requestedSubscribeFetch=!0;var browser=[];var browser_info=PushAlertCo.getBrowserInfo();var browser_name=browser_info.browser;for(key in browser_info){browser.push(key+'='+encodeURIComponent(browser_info[key]))} browser=browser.join('&');browser=browser+"&pa_id="+PushAlertCo.pa_id+'&domain_id='+PushAlertCo.pa_domain_id;last_indexof_slash=pushSubscription.endpoint.lastIndexOf('/');browser=browser+"&endpoint_url="+encodeURIComponent(pushSubscription.endpoint.substr(0,last_indexof_slash));browser=browser+'&subs_info='+encodeURIComponent(JSON.stringify(pushSubscription));browser=browser+"&seg_id="+PushAlertCo.seg_id;browser=browser+"&checkva="+PushAlertCo.checkVA;var endPoint;if(browser_name==='edge'){var url=new URL(pushSubscription.endpoint);endPoint=url.searchParams.get("token")}else{endPoint=pushSubscription.endpoint.slice(last_indexof_slash+1)} browser=browser+'&endpoint='+encodeURIComponent(endPoint);browser=browser+'&referrer='+encodeURIComponent(window.location.href);browser=browser+'&osi='+encodeURIComponent(PushAlertCo.old_subs_id);fetch(PushAlertCo.pa_subdomain+"/subscribe/"+endPoint,{method:'post',headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:browser}).then(function(res){res.json().then(function(data){try{PushAlertCo.listener("pushalert_"+PushAlertCo.cookie_id+"subs_id|"+data.subs_id)}catch(e){};PushAlertCo.old_subs_id='';var result=[];result.success=!0;result.subscriber_id=data.subs_id;result.alreadySubscribed=!1;PushAlertCo.subs_id=data.subs_id;PushAlertCo.requestAnalytics();PushAlertCo.checkJSAPIFunction();PushAlertCo.callbackOnSuccess(result);if(PushAlertCo.seg_id!=0){PushAlertCo.addSegmentID(PushAlertCo.seg_id)} if(data.welcome_enable){var requireInteraction=!0;if((data.hasOwnProperty('welcome_req_interaction')&&data.welcome_req_interaction===!1)||(browser_info.os=="mac"&&browser_info.browser!='edge')){requireInteraction=!1} var actions=[];var extra_data=[];extra_data.url=data.welcome_url;if(data.hasOwnProperty('url_id')){extra_data.url_id=data.url_id}else{extra_data.url_id=0} if(data.hasOwnProperty('uid')){extra_data.uid=data.uid}else{extra_data.uid=0} if(typeof data.action1_title!=='undefined'){actions[0]={action:'action1',title:data.action1_title};extra_data.action1=data.action1_url} if(typeof data.action2_title!=='undefined'){actions[1]={action:'action2',title:data.action2_title};extra_data.action2=data.action2_url} if(typeof data.welcome_attr!=='undefined'&&data.welcome_attr){var attributes=PushAlertCo.getPendingAttributes();var twelcome_msg=PushAlertCo.substituteAttribute(data.welcome_msg_attr,data.welcome_msg,attributes);var twelcome_title=PushAlertCo.substituteAttribute(data.welcome_title_attr,data.welcome_title,attributes);var turl=PushAlertCo.substituteAttribute(data.welcome_url_attr,extra_data.url,attributes);var taction1_title,taction2_title,taction1_url,taction2_url;var taction1=!0,taction2=!0;if(typeof data.action1_title!=='undefined'){taction1_title=PushAlertCo.substituteAttribute(data.action1_title_attr,actions[0].title,attributes);taction1_url=PushAlertCo.substituteAttribute(data.action1_url_attr,extra_data.action1,attributes);taction1=taction1_title.success&&taction1_url.success} if(typeof data.action2_title!=='undefined'){taction2_title=PushAlertCo.substituteAttribute(data.action2_title_attr,actions[1].title,attributes);taction2_url=PushAlertCo.substituteAttribute(data.action2_url_attr,extra_data.action2,attributes);taction2=taction2_title.success&&taction2_url.success} if(twelcome_msg.success&&twelcome_title.success&&turl.success&&taction1&&taction2){data.welcome_msg=twelcome_msg.output;data.welcome_title=twelcome_title.output;extra_data.url=turl.output;if(typeof data.action1_title!=='undefined'){actions[0].title=taction1_title.output;extra_data.action1=taction1_url.output} if(typeof data.action2_title!=='undefined'){actions[1].title=taction2_title.output;extra_data.action2=taction2_url.output}}} if(PushAlertCo.checkShopify()){var sw_url="/apps/pushalert/sw-"+this.script_id+".js";navigator.serviceWorker.getRegistration(sw_url).then(function(serviceWorkerRegistration){serviceWorkerRegistration.showNotification(data.welcome_title,{body:data.welcome_msg,icon:data.welcome_icon,image:data.welcome_large_image,requireInteraction:requireInteraction,data:extra_data,actions:actions})});PushAlertCo.shopifyCartAssoc()}else{if(typeof pushalert_sw_file!=="undefined"){var sw_url=pushalert_sw_file;navigator.serviceWorker.getRegistration(sw_url).then(function(serviceWorkerRegistration){serviceWorkerRegistration.showNotification(data.welcome_title,{body:data.welcome_msg,icon:data.welcome_icon,image:data.welcome_large_image,requireInteraction:requireInteraction,data:extra_data,actions:actions})})}else{navigator.serviceWorker.ready.then(function(serviceWorkerRegistration){serviceWorkerRegistration.showNotification(data.welcome_title,{body:data.welcome_msg,icon:data.welcome_icon,image:data.welcome_large_image,requireInteraction:requireInteraction,data:extra_data,actions:actions})})}}}}).catch(function(e){console.log('Error sending subscription to server:'+e.toString())})})};this.substituteAttribute=function($attr_text,$default_val,$attributes){var $output="";var $success=!0;if($attr_text==""){$output=$default_val}else{var $matches=[...$attr_text.matchAll(/{{([a-zA-Z0-9_]+)}}/g)];console.log($matches) if($matches.length>0){for(var $i=0;$i<$matches.length;$i++){$attr_name=$matches[$i][1];if($attributes.hasOwnProperty($attr_name)&&$attributes[$attr_name]!=""){$attr_text=$attr_text.replaceAll($matches[$i][0],$attributes[$attr_name])}else{$success=!1;$attr_text=$default_val;break}} $output=$attr_text}else{$output=$attr_text}} return{output:$output,success:$success}} this.getPendingAttributes=function(){(pushalertbyiw=window.pushalertbyiw||[]).push();var allAttributes={} for(var i=0;i0){for(var i=0;i\n\ close\n\ \n\ \n\
\n\ logo';if(PushAlertCo.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status")==="subscribed"){paNotfPrefContainer_innerHTML+='

'+PushAlertCo.local_str['lt-notf-pref-info-text']+'

\n\
'+PushAlertCo.local_str['lt-notf-pref-stop-usage']+'
\n\
'+PushAlertCo.local_str['lt-notf-pref-view-data']+'
\n\
'+PushAlertCo.local_str['lt-notf-pref-unsubscribe']+'
'}else{paNotfPrefContainer_innerHTML+='

'+PushAlertCo.local_str['lt-widget-text']+'

\n\
'+PushAlertCo.local_str['lt-subscribe']+'
'} paNotfPrefContainer_innerHTML+='
\n\
\n\ ';paNotfPrefContainer.innerHTML=paNotfPrefContainer_innerHTML;document.body.appendChild(paNotfPrefContainer);var notfPrefDialog=document.querySelector('.pa-notification-preference-dialog');notfPrefDialog.style.marginTop=-(notfPrefDialog.clientHeight)/2+'px';if(PushAlertCo.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status")==="subscribed"){document.getElementById('pa-notf-pref-stop-tracking').onclick=function(event){if(this.className.indexOf('disabled')<0){PushAlertCo.setCookie("pushalert_"+PushAlertCo.cookie_id+"stop_usage_analytics","1",400);document.getElementById('pushalert-snackbar').innerHTML=PushAlertCo.local_str['lt-notf-pref-stop-usage-confirm'];PushAlertCo.showPASnackBar();this.className=this.className+' disabled'}};document.getElementById('pa-notf-pref-view-data').onclick=function(event){if(this.className.indexOf('disabled')<0){PushAlertCo.requestSubscriberData();document.getElementById('pushalert-snackbar').innerHTML=PushAlertCo.local_str['lt-notf-pref-view-data-confirm'];PushAlertCo.showPASnackBar()}};document.getElementById('pa-notf-pref-unsubscribe').onclick=function(event){if(this.className.indexOf('disabled')<0){PushAlertCo.unsubscribe();document.getElementById('pushalert-snackbar').innerHTML=PushAlertCo.local_str['lt-notf-pref-unsubscribe-confirm'];PushAlertCo.showPASnackBar();setTimeout(function(){document.querySelector('.pa-notf-pref-close').click()},2000)}}}else{document.getElementById('pa-notf-pref-subscribe').onclick=function(event){if(this.className.indexOf('disabled')<0){PushAlertCo.forceSubscribe();setTimeout(function(){document.querySelector('.pa-notf-pref-close').click()},1000)}}} document.querySelector('.pa-notf-pref-close').onclick=function(){var paNotfOverlay=document.querySelector('#pa-notification-preference-overlay');var paNotfDialog=document.querySelector('#pa-notification-preference-dialog-container');if(paNotfDialog!=null){paNotfDialog.remove()} if(paNotfOverlay!=null){paNotfOverlay.remove()}}};this.requestSubscriberData=function(){fetch("https://api.pushalert.co/js-api/subsInfo",{method:'post',headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:'pa_id='+PushAlertCo.pa_id+'&domain_id='+PushAlertCo.pa_domain_id+'&subs_id='+(PushAlertCo.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_id"))}).then(function(res){res.json().then(function(data){console.log(data);var data_display='';var subs_info=data.subs_info;for(var key in subs_info){data_display+=""+key+": "+subs_info[key]+"
"} data_display+="Last URL Visited: "+PushAlertCo.getCookie("pa_"+PushAlertCo.cookie_id+"last_url")+"
";var notfPrefContentChild=document.createElement('div');notfPrefContentChild.style.textAlign='left';notfPrefContentChild.style.padding='0 20px';notfPrefContentChild.style.maxHeight='250px';notfPrefContentChild.style.overflowY='auto';notfPrefContentChild.style.wordWrap='break-word';notfPrefContentChild.style.marginBottom='10px';notfPrefContentChild.innerHTML=data_display;var notfPrefContent=document.querySelector('.pa-notf-pref-content');notfPrefContent.innerHTML='';notfPrefContent.appendChild(notfPrefContentChild);var notfPrefDialog=document.querySelector('.pa-notification-preference-dialog');notfPrefDialog.style.marginTop=-(notfPrefDialog.clientHeight)/2+'px'}).catch(function(e){console.log("Error:",e)})})} this.showPASnackBar=function(){var x=document.querySelector("#pushalert-snackbar");x.className="sb-show";setTimeout(function(){x.className=x.className.replace("sb-show","")},3000)};this.attachNotificationPreferencesEvent=function(){var notificationPreferences=document.querySelectorAll('.pushalert-notification-preferences');for(var i=0;i=0&&platform.toLocaleLowerCase().indexOf('version/')>=0)){document.head.appendChild(manifest)} this.checkCustomLocalizeStrings();var actual_subscriptionTheme=PushAlertCo.subscriptionStyle.subscriptionTheme;if(actual_subscriptionTheme==-1||native_one_click){PushAlertCo.forceSubscribe()}else{var actual_subscriptionBoxDelay=PushAlertCo.subscriptionStyle.subscriptionBoxDelay;var actual_subscriptionTrigger_trigger=PushAlertCo.subscriptionStyle.subscriptionTrigger.trigger;PushAlertCo.subscriptionStyle.subscriptionBoxDelay=300;PushAlertCo.subscriptionStyle.subscriptionTrigger.trigger="on-landing";this.forceTrigger=forceTrigger;this.init();setTimeout(function(){PushAlertCo.subscriptionStyle.subscriptionBoxDelay=actual_subscriptionBoxDelay;PushAlertCo.subscriptionStyle.subscriptionTrigger.trigger=actual_subscriptionTrigger_trigger},2000)} this.initArrayPush()}} this.convertShopifyInfo2ProductInfo=function(){console.log(this.shopifyProductInfo);const shopifyParams=this.getProductInfoShopifyParamas();this.paProductInfo={'id':shopifyParams.product_id,'variant_id':shopifyParams.variant_id,'title':shopifyParams.title,'price':(shopifyParams.price/100.0).toFixed(2),'price_formatted':this.formatMoneyShopify(shopifyParams.price,this.shopifyCustomization.currency),'url':"https://"+Shopify.shop+this.shopifyProductInfo.url+"?variant="+shopifyParams.variant_id,'add_to_cart':"https://"+Shopify.shop+"/cart/add?id="+shopifyParams.variant_id,'image':(shopifyParams.image.indexOf("//")===0?"https:":"")+shopifyParams.image,'icon':(shopifyParams.image.indexOf("//")===0?"https:":"")+shopifyParams.image+'&width=256','outofstock':!shopifyParams.available}} this.processBrowseAbandonments=async function(){if(this.browseAbandonments.length==0){return} var isSubscribed=this.getCookie("pushalert_"+PushAlertCo.cookie_id+"subs_status");if(this.checkShopify()){this.convertShopifyInfo2ProductInfo()} if(!(isSubscribed==="subscribed"&&(Notification.permission==='granted'||PushAlertCo.byPassSubdomainCheck)&&this.paProductInfo!=null)){return} var allowed_ids=[];let db=null;for(var $i=0;$i{let db;let request=indexedDB.open("pushalert_"+this.getIndexedDBID(),1);request.onupgradeneeded=function(event){db=event.target.result;let objectStore=db.createObjectStore("browse_abandonment",{keyPath:"property"})};request.onsuccess=function(event){db=event.target.result;resolve(db)};request.onerror=function(event){reject(event.target.errorCode)}})} this.getIndexedDBID=function(){if(this.pa_domain_id==1){return this.pa_id}else{return this.pa_id+"_"+this.pa_domain_id}} this.setDBProperty=async function(db,$property_name,$data){return new Promise((resolve,reject)=>{const txn=db.transaction(["browse_abandonment"],'readwrite');const store=txn.objectStore('browse_abandonment');let query=store.put({property:$property_name,value:$data}) query.onsuccess=(event)=>{resolve(query.result)};query.onerror=(event)=>{reject(event.target.errorCode)}})} this.getDBProperty=async function(db,$property_name){return new Promise((resolve,reject)=>{const txn=db.transaction(["browse_abandonment"],'readonly');const store=txn.objectStore('browse_abandonment');let query=store.get($property_name);query.onsuccess=(event)=>{if(query.result){resolve(query.result.value)}else{resolve(!1)}};query.onerror=(event)=>{reject(event.target.errorCode)}})} this.checkBATime=async function(db,$ba_id,monthly_limit){let current_time=Math.round(new Date().getTime()/1000);let ba_time=await this.getDBProperty(db,"ba_time_"+$ba_id);if(!ba_time){ba_time=current_time;await this.setDBProperty(db,"ba_time_"+$ba_id,ba_time);await this.setDBProperty(db,"ba_month_time_"+$ba_id,ba_time);await this.setDBProperty(db,"ba_month_"+$ba_id,1);await this.setDBProperty(db,"ba_freq_"+$ba_id,{});await this.setDBProperty(db,"ba_recent_"+$ba_id,{});await this.setDBProperty(db,"ba_top_"+$ba_id,{});await this.setDBProperty(db,"ba_marking_"+$ba_id,{});this.browseAbandonment('start',$ba_id);this.checkBAProduct(db,$ba_id)}else{let ba_day_check=await this.getDBProperty(db,"ba_day_"+$ba_id);if(ba_time+86400>current_time&&(ba_day_check===!1||ba_day_check==0)){this.checkBAProduct(db,$ba_id)}else if(ba_time+864005){delete ba_recent[Object.keys(ba_recent)[0]]} await this.setDBProperty(db,"ba_recent_"+$ba_id,ba_recent);let current_freq=ba_freq;const array=Object.keys(current_freq).reduce((array,key)=>{array.push({key:key,value:current_freq[key]});return array},[]) const sortedArray=array.sort((x,y)=>y.value-x.value);var ba_top=await this.getDBProperty(db,"ba_top_"+$ba_id);if(!ba_top){ba_top={}} var new_ba_top={};var count=0;for(var $i=0;$i=2&&lang_code[1]=="tw"){lang_code_final="zh-tw"}else{lang_code_final="zh-cn"}}else if(lang_code[0]=="pt"){if(lang_code.length>=2&&lang_code[1]=="br"){lang_code_final="pt-br"}else{lang_code_final="pt-pt"}}else{lang_code_final=lang_code[0]} return lang_code_final} this.loadLanguage=function(){var browser_lang=this.getLanguage();if(this.local_multi_str.hasOwnProperty(browser_lang)){var l_str;for(l_str in this.local_multi_str[browser_lang]){this.local_str[l_str]=this.local_multi_str[browser_lang][l_str]} if(typeof this.local_multi_str[browser_lang].subscriptionBtnAllowTxt!=="undefined"){this.subscriptionStyle.subscriptionBtnAllowTxt=this.local_multi_str[browser_lang].subscriptionBtnAllowTxt} if(typeof this.local_multi_str[browser_lang].subscriptionBtnDenyTxt!=="undefined"){this.subscriptionStyle.subscriptionBtnDenyTxt=this.local_multi_str[browser_lang].subscriptionBtnDenyTxt} if(typeof this.local_multi_str[browser_lang].subscriptionTitle!=="undefined"){this.subscriptionStyle.subscriptionTitle=this.local_multi_str[browser_lang].subscriptionTitle} if(typeof this.local_multi_str[browser_lang].subscriptionMessage!=="undefined"){this.subscriptionStyle.subscriptionMessage=this.local_multi_str[browser_lang].subscriptionMessage} if(this.subscriptionStyleMobileSeparate){if(typeof this.local_multi_str[browser_lang].mobileSubscriptionBtnAllowTxt!=="undefined"){this.subscriptionStyleMobile.subscriptionBtnAllowTxt=this.local_multi_str[browser_lang].mobileSubscriptionBtnAllowTxt} if(typeof this.local_multi_str[browser_lang].mobileSubscriptionBtnDenyTxt!=="undefined"){this.subscriptionStyleMobile.subscriptionBtnDenyTxt=this.local_multi_str[browser_lang].mobileSubscriptionBtnDenyTxt} if(typeof this.local_multi_str[browser_lang].mobileSubscriptionTitle!=="undefined"){this.subscriptionStyleMobile.subscriptionTitle=this.local_multi_str[browser_lang].mobileSubscriptionTitle} if(typeof this.local_multi_str[browser_lang].mobileSubscriptionMessage!=="undefined"){this.subscriptionStyleMobile.subscriptionMessage=this.local_multi_str[browser_lang].mobileSubscriptionMessage}} if(typeof this.local_multi_str[browser_lang]['lt-a2hs-text']!=="undefined"){this.iOSAddToHomescreenSettings.htmlContent=this.local_multi_str[browser_lang]['lt-a2hs-text']}}} this.iOSAddToHomescreen=function(settings={}){var browser_info=PushAlertCo.getBrowserInfo();var iOS=/iphone|ipad|ipod/.test(window.navigator.userAgent.toLowerCase())&&((browser_info.browserVer>=16.4&&browser_info.browser=="safari")||(browser_info.browserMajor>=113&&browser_info.browser=="chrome"&&browser_info.osVer>=16.4)||(browser_info.browserMajor>=112&&browser_info.browser=="edge"&&browser_info.osVer>=16.4));var standalone="standalone" in window.navigator&&window.navigator.standalone;if(iOS&&!standalone&&!window.localStorage.pushalert_add2homescreen_message&&!window.sessionStorage.pushalert_session_add2homescreen_message){var backgroundColor=settings.backgroundColor||"#f9f9f9";var padding=settings.padding||"12px";var shadowColor=settings.shadowColor||"#ddd";var shadowSize=settings.shadowSize||"10px";var fontFamily=settings.fontFamily||"-apple-system, sans-serif";var color=settings.color||"#5d5d5d";var fontSize=settings.fontSize||"16px";var appName=settings.appName||"";var appIcon=settings.appIcon||`https://cdn.pushalert.co/img/pushalert-square-icon.png`;var shareIcon=``;var addIcon=``;var closeIcon=``;var htmlContent=settings.htmlContent||`Install ${appName} web app on your iOS device: tap share `+shareIcon+` and Add to Home Screen `+addIcon;htmlContent=htmlContent.replaceAll('{share_icon}',shareIcon);htmlContent=htmlContent.replaceAll('{add_icon}',addIcon);htmlContent=htmlContent.replaceAll('{app_name}',appName);var div=document.createElement("div");var style=document.createElement("style");style.innerHTML=` .pushalert_add2homescreen__container { display: flex; align-items: center; justify-content: center; position: fixed; box-sizing: border-box; box-shadow: ${shadowColor} 0 0 ${shadowSize}; background-color: ${backgroundColor}; padding: ${padding}; width: 100%; bottom: 0; right: 0; left: 0; z-index: 2147483647; } .pushalert_add2homescreen__container .pushalert_add2homescreen__close { position: absolute; top: -10px; right: -10px; width: 14px; height: 14px; line-height: 0; text-align: center; } .pushalert_add2homescreen__container .pushalert_add2homescreen__logo { padding-right: ${padding}; } .pushalert_add2homescreen__container .pushalert_add2homescreen__text { font-family: ${fontFamily}; font-size: ${fontSize}; color: ${color}; line-height: 1.4em; position:relative; }`;div.innerHTML=`
${closeIcon}
${htmlContent}
`;div.setAttribute("class","pushalert_add2homescreen__container");div.onclick=function(event){event.preventDefault();window.localStorage.setItem("pushalert_add2homescreen_message","hide");document.querySelector(".pushalert_add2homescreen__container").remove()};document.head.appendChild(style);document.body.appendChild(div);window.sessionStorage.setItem("pushalert_session_add2homescreen_message","hide")}} this.md5=function(e){function f(ba,ca){return ba<>>32-ca}function g(ba,ca){var da,ea,fa,ga,ha;return fa=2147483648&ba,ga=2147483648&ca,da=1073741824&ba,ea=1073741824&ca,ha=(1073741823&ba)+(1073741823&ca),da&ea?2147483648^ha^fa^ga:da|ea?1073741824&ha?3221225472^ha^fa^ga:1073741824^ha^fa^ga:ha^fa^ga}function h(ba,ca,da){return ba&ca|~ba&da}function i(ba,ca,da){return ba&da|ca&~da}function j(ba,ca,da){return ba^ca^da}function l(ba,ca,da){return ca^(ba|~da)}function m(ba,ca,da,ea,fa,ga,ha){return ba=g(ba,g(g(h(ca,da,ea),fa),ha)),g(f(ba,ga),ca)}function o(ba,ca,da,ea,fa,ga,ha){return ba=g(ba,g(g(i(ca,da,ea),fa),ha)),g(f(ba,ga),ca)}function p(ba,ca,da,ea,fa,ga,ha){return ba=g(ba,g(g(j(ca,da,ea),fa),ha)),g(f(ba,ga),ca)}function q(ba,ca,da,ea,fa,ga,ha){return ba=g(ba,g(g(l(ca,da,ea),fa),ha)),g(f(ba,ga),ca)}function r(ba){for(var ca,da=ba.length,ea=da+8,ga=16*((ea-ea%64)/64+1),ha=Array(ga-1),ia=0,ja=0;ja>>29,ha}function t(ba){var ea,fa,ca="",da="";for(fa=0;3>=fa;fa++)ea=255&ba>>>8*fa,da="0"+ea.toString(16),ca+=da.substr(da.length-2,2);return ca}function u(ba){ba=ba.replace(/\r\n/g,"\n");for(var ea,ca="",da=0;daea?ca+=String.fromCharCode(ea):127ea?(ca+=String.fromCharCode(192|ea>>6),ca+=String.fromCharCode(128|63&ea)):(ca+=String.fromCharCode(224|ea>>12),ca+=String.fromCharCode(128|63&ea>>6),ca+=String.fromCharCode(128|63&ea));return ca}e=e+"";var v=[],w,A,B,C,D,E,J,K,L,M=7,N=12,O=17,P=22,Q=5,R=9,S=14,T=20,U=4,V=11,W=16,X=23,Y=6,Z=10,$=15,_=21;for(e=u(e),v=r(e),E=1732584193,J=4023233417,K=2562383102,L=271733878,w=0;w-1?b:a}function s(a,b){b=b||{};var c=b.body;if("string"==typeof a)this.url=a;else{if(a.bodyUsed)throw new TypeError("Already read");this.url=a.url,this.credentials=a.credentials,b.headers||(this.headers=new i(a.headers)),this.method=a.method,this.mode=a.mode,c||null==a._bodyInit||(c=a._bodyInit,a.bodyUsed=!0)}if(this.credentials=b.credentials||this.credentials||"omit",!b.headers&&this.headers||(this.headers=new i(b.headers)),this.method=r(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&c)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(c)}function t(a){var b=new FormData;return a.trim().split("&").forEach(function(a){if(a){var c=a.split("="),d=c.shift().replace(/\+/g," "),e=c.join("=").replace(/\+/g," ");b.append(decodeURIComponent(d),decodeURIComponent(e))}}),b}function u(a){var b=new i;return a.split(/\r?\n/).forEach(function(a){var c=a.split(":"),d=c.shift().trim();if(d){var e=c.join(":").trim();b.append(d,e)}}),b}function v(a,b){b||(b={}),this.type="default",this.status="status"in b?b.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new i(b.headers),this.url=b.url||"",this._initBody(a)}if(!a.fetch){var b={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch(a){return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};if(b.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=function(a){return a&&DataView.prototype.isPrototypeOf(a)},e=ArrayBuffer.isView||function(a){return a&&c.indexOf(Object.prototype.toString.call(a))>-1};i.prototype.append=function(a,b){a=f(a),b=g(b);var c=this.map[a];this.map[a]=c?c+","+b:b},i.prototype.delete=function(a){delete this.map[f(a)]},i.prototype.get=function(a){return a=f(a),this.has(a)?this.map[a]:null},i.prototype.has=function(a){return this.map.hasOwnProperty(f(a))},i.prototype.set=function(a,b){this.map[f(a)]=g(b)},i.prototype.forEach=function(a,b){for(var c in this.map)this.map.hasOwnProperty(c)&&a.call(b,this.map[c],c,this)},i.prototype.keys=function(){var a=[];return this.forEach(function(b,c){a.push(c)}),h(a)},i.prototype.values=function(){var a=[];return this.forEach(function(b){a.push(b)}),h(a)},i.prototype.entries=function(){var a=[];return this.forEach(function(b,c){a.push([c,b])}),h(a)},b.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);var q=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];s.prototype.clone=function(){return new s(this,{body:this._bodyInit})},p.call(s.prototype),p.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},v.error=function(){var a=new v(null,{status:0,statusText:""});return a.type="error",a};var w=[301,302,303,307,308];v.redirect=function(a,b){if(w.indexOf(b)===-1)throw new RangeError("Invalid status code");return new v(null,{status:b,headers:{location:a}})},a.Headers=i,a.Request=s,a.Response=v,a.fetch=function(a,c){return new Promise(function(d,e){var f=new s(a,c),g=new XMLHttpRequest;g.onload=function(){var a={status:g.status,statusText:g.statusText,headers:u(g.getAllResponseHeaders()||"")};a.url="responseURL"in g?g.responseURL:a.headers.get("X-Request-URL");var b="response"in g?g.response:g.responseText;d(new v(b,a))},g.onerror=function(){e(new TypeError("Network request failed"))},g.ontimeout=function(){e(new TypeError("Network request failed"))},g.open(f.method,f.url,!0),"include"===f.credentials&&(g.withCredentials=!0),"responseType"in g&&b.blob&&(g.responseType="blob"),f.headers.forEach(function(a,b){g.setRequestHeader(b,a)}),g.send("undefined"==typeof f._bodyInit?null:f._bodyInit)})},a.fetch.polyfill=!0}}("undefined"!=typeof self?self:this);if(!PAclassExists){PushAlertCo.subInit()}else{console.log("Multiple integration code detected.")}