"use strict";!function(){var c,i,m,p,n,o,u,e=document.querySelector("#countdown-timer-2012"),l="/",a="",y=null,r=null,h={},g=(window.location.pathname.includes("product-page"),window.location.pathname.includes("shop"),""),s=8,t=604,f=[],x="";function d(){window.wixDevelopersAnalytics.register("753cf37c-91a0-44f6-a71e-a2d98c7c84c8",function(e,t){console.log("Analytics:",e,t),"AddProductImpression"===e&&t.contents.forEach(function(e){"out of stock"===e.dimension3&&(f[f.length]=e.id)})})}function v(){s=document.querySelectorAll('div[data-hook="product-item-root"]').length,document.querySelectorAll('div[data-hook="product-item-root"]').forEach(function(e,t){"Fixed deadline"!==c.deadlineState&&(l=e.innerHTML.split(" ")[1].split("/")[4].replace('"',""),(null===localStorage.getItem("randomtimeobj")||!JSON.parse(localStorage.getItem("randomtimeobj"))[l]||x>JSON.parse(localStorage.getItem("randomtimeobj"))[l]+60*c.sameMinutes*1e3)&&(h[l]=x+1e3*Math.floor(Math.random()*(p-m)+m),localStorage.setItem("randomtimeobj",JSON.stringify(h))));var i="",n="112px",o=0,a=0,o=-(e.querySelector("div[data-hook='product-item-product-details']").offsetHeight+16+e.querySelector("a").getBoundingClientRect().height),a="Center"===c.homepositionState?0:"Right"===c.homepositionState?e.querySelector("div[data-hook='product-item-product-details']").style.paddingLeft:-e.querySelector("div[data-hook='product-item-product-details']").style.paddingLeft,i=c.milisecondschecked?"<div class='cdtimer' style=\"background:rgba(0,0,0,0.59);font-size:14px;padding:0 8px;height:28px;position:relative;top:"+o+"px;z-index:0;display:flex;justify-content: center;align-items: center;width:"+n+";left:"+a+';"><span style= "color:#FFFFFF;display:flex"><img src="https://wix.salesdish.com/static/timericon.svg" style="width:15px;height:15px;margin-right: 7px;"><span id="time_d'+t+'" data-hook="time_d"></span>:<span id="time_h'+t+'" data-hook="time_h"></span>:<span id="time_m'+t+'" data-hook="time_m"></span>:<span id="time_s'+t+'" data-hook="time_s"></span></span></div>':"<div class='cdtimer' style=\"background:rgba(0,0,0,0.59);font-size:14px;padding:0 8px;height:28px;position:relative;top:"+o+"px;z-index:0;display:flex;justify-content: center;align-items: center;width:"+(n="92px")+";left:"+a+';"><span style= "color:#FFFFFF;display:flex"><img src="https://wix.salesdish.com/static/timericon.svg" style="width:15px;height:15px;margin-right: 7px;"><span id="time_d'+t+'" data-hook="time_d"></span>:<span id="time_h'+t+'" data-hook="time_h"></span>:<span id="time_m'+t+'" data-hook="time_m"></span></span></div>';e.querySelector(".cdtimer")||((r=document.createElement("div")).id="countdowntimerhome_id"+t,r.innerHTML=i,"Center"===c.homepositionState?r.style="display:flex;width:100%;justify-content:center":"Right"===c.homepositionState?r.style="display:flex;width:100%;justify-content:flex-end":r.style="display:flex;width:100%;justify-content:flex-start",e.querySelector("div[data-hook='product-item-product-details']").appendChild(r)),"Fixed deadline"===c.deadlineState?w(c.begin,c.end):(e.querySelector("[id*=countdowntimerhome_id]").style.display="flex",n=JSON.parse(localStorage.getItem("randomtimeobj"))[l],x<n?(a=n-x,a-=864e5*(t=Math.floor(a/864e5)),a-=36e5*(i=Math.floor(a/36e5)),a-=6e4*(n=Math.floor(a/6e4)),t<10&&(t="0"+t),i<10&&(i="0"+i),n<10&&(n="0"+n),(a=Math.floor(a/1e3))<10&&(a="0"+a),e.querySelector("[id*=time_d]")&&(e.querySelector("[id*=time_d]").innerText=t,e.querySelector("[id*=time_h]").innerText=i,e.querySelector("[id*=time_m]").innerText=n),e.querySelector("[id*=time_s]")&&(e.querySelector("[id*=time_s]").innerText=a)):e.querySelector("[id*=countdowntimerhome_id]").style.display="none"),(null!==e.innerHTML.match(/Out of stock/gi)||e.querySelector('[data-hook="product-item-out-of-stock"]')||f.includes(u[e.innerHTML.split(" ")[1].split("/")[4].replace('"',"")]))&&(e.querySelector("[id*=countdowntimerhome_id]").style.display="none")})}function w(e,t){var i,n,o,a,l=x,e=new Date(e).getTime(),t=new Date(t).getTime();e<=l&&l<t?(l=t-l,l-=864e5*(i=Math.floor(l/864e5)),l-=36e5*(n=Math.floor(l/36e5)),l-=6e4*(o=Math.floor(l/6e4)),a=Math.floor(l/1e3),i<10&&(i="0"+i),n<10&&(n="0"+n),o<10&&(o="0"+o),a<10&&(a="0"+a),document.querySelectorAll('span[data-hook="time_d"]').forEach(function(e){e.innerHTML=i}),document.querySelectorAll('span[data-hook="time_h"]').forEach(function(e){e.innerHTML=n}),document.querySelectorAll('span[data-hook="time_m"]').forEach(function(e){e.innerHTML=o}),document.querySelectorAll('span[data-hook="time_s"]').forEach(function(e){e.innerHTML=a})):document.querySelectorAll('div[data-hook="product-item-root"]').forEach(function(e){e.querySelector('[id*="countdowntimerhome_id"]')&&(e.querySelector('[id*="countdowntimerhome_id"]').style.display="none")})}navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/SymbianOS/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)||navigator.userAgent.match(/mobi/i),e&&(t=e.getAttribute("src").split("?")[1].split("=")[1],"undefined"==typeof jQuery&&((e=document.createElement("script")).src="https://wix.salesdish.com/page/js/jquery-3.4.1.min.js",document.head.appendChild(e)),window.wixDevelopersAnalytics?d():window.addEventListener("wixDevelopersAnalyticsReady",d),fetch("https://gateway.salesdish.com/shopify-service/app-config/pass/2012?params=Countdown+timer&store_id="+t+"&is_preview=1").then(function(e){return e.json()}).then(function(e){e.success&&(c=JSON.parse(e.data["Countdown timer"]),i=e.is_open["Countdown timer"],m=86400*c.minDays+3600*c.minHours+60*c.minMinutes,p=86400*c.maxDays+3600*c.maxHours+60*c.maxMinutes,fetch("https://gateway.salesdish.com/wix-service/app_tools/pass/queryProduct/"+t).then(function(e){return e.json()}).then(function(e){var t;e.success&&(u=e.data,i&&(l="/",t=!0,null===localStorage.getItem("timeobj")?localStorage.setItem("timeobj",JSON.stringify(c)):(localStorage.setItem("timeobjnew",JSON.stringify(c)),localStorage.getItem("timeobj")===localStorage.getItem("timeobjnew")||(localStorage.setItem("randomtimeobj",JSON.stringify(h)),localStorage.setItem("timeobj",JSON.stringify(c)))),localStorage.getItem("randomtimeobj")&&(h=JSON.parse(localStorage.getItem("randomtimeobj"))),setInterval(function(){var e;"undefined"==typeof jQuery&&((e=document.createElement("script")).src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js",document.head.appendChild(e)),t&&(x=new Date($.ajax({async:!1}).getResponseHeader("Date")).getTime(),t=!1),0===Number(x%1e4)?x=new Date($.ajax({async:!1}).getResponseHeader("Date")).getTime():x+=1e3,n=window.location.pathname.includes("product-page"),o=window.location.pathname.includes("shop"),n?(void 0===(a=window.location.pathname.split("/")[2])&&(a=document.querySelector('[property="og:url"]').getAttribute("content").split("/")[4]),function(e){document.getElementById("countdowntimer_id")||((y=document.createElement("div")).id="countdowntimer_id",document.querySelector("div[data-hook=payment-methods-banner]")&&document.querySelector("div[data-hook=payment-methods-banner]").appendChild(y));var t=c.blockTitle,i=c.positionState,n=c.colorIBC,o=c.colorIC,a=c.color3,l=c.color4,r=c.color5||"#505050",s=c.milisecondschecked;"Fixed deadline"!==c.deadlineState&&(null===localStorage.getItem("randomtimeobj")||!JSON.parse(localStorage.getItem("randomtimeobj"))[e]||x>JSON.parse(localStorage.getItem("randomtimeobj"))[e]+60*c.sameMinutes*1e3)&&(console.log("重新赋值时间"+e),h[e]=x+1e3*Math.floor(Math.random()*(p-m)+m),localStorage.setItem("randomtimeobj",JSON.stringify(h)));g="";var d="left";d="Left"===c.positionState?(y.style="display: flex;justify-content: left;align-items: center;","left"):"Center"===c.positionState?(y.style="display: flex;justify-content: center;align-items: center;","center"):(y.style="display: flex;justify-content: right;align-items: center;","right");y.style.fontFamily=getComputedStyle(document.querySelector("[data-hook='product-title']"),!1).fontFamily.replace(/"/g,"'"),"Classic"===c.themeState?(g='<div>\n            <p style="font-size:16px;text-align:'+d+';"><span style="color:'+n+';white-space:pre-wrap;">'+t+' </span><span style="color:'+o+';white-space:nowrap;font-weight:bold;"> <span id="saletime_d"></span> : <span id="saletime_h"></span> : <span id="saletime_m"></span>',!0===s&&(g+=' : <span id="saletime_s"></span></span></p></div>')):"Minimalist"===c.themeState?(g=(g="Left"===i?'<div style="display:flex;flex-direction:column;align-items:flex-start;">\n        <div style="display: flex;justify-content: left;align-items: center;text-align:left;margin-bottom:10px;"><p style="font-size:16px;"><span style="color:'+n+';white-space:pre-wrap;">'+t+"</span></p></div>":"Center"===i?'<div style="display:flex;flex-direction:column;align-items:center;">\n        <div style="display: flex;justify-content: center;align-items: center;text-align:center;margin-bottom:10px;"><p style="font-size:16px;"><span style="color:'+n+';white-space:pre-wrap;">'+t+"</span></p></div>":'<div style="display:flex;flex-direction:column;align-items:flex-end;">\n        <div style="display: flex;justify-content: right;align-items: center;text-align:right;margin-bottom:10px;">\n        <p style="font-size:16px;"><span style="color:'+n+';white-space:pre-wrap;">'+t+"</span></p>\n        </div>")+'\n        <div style="display:flex;height:3.8rem;">\n          <div >\n            <div style="display: flex;flex-direction: column;justify-content: space-between;align-items: center;height:3.9rem;">\n              <p style="font-size: 30px;color:'+o+';"><span id="saletime_d" style="font-weight:200;"></span></p>\n              <p style="color:#000000;font-size: 12px;color:'+r+';">Days</p>\n            </div>\n          </div>\n          <div style="width:1px;background:'+l+';transform:rotate(13deg);margin:0 1rem 0 1rem;"></div>\n          <div>\n            <div style="display: flex;flex-direction: column;justify-content: space-between;align-items: center;height:3.9rem;">\n              <p style="font-size: 30px;color:'+o+';"><span id="saletime_h" style="font-weight:200;"></span></p>\n              <p style="color:#000000;font-size: 12px;color:'+r+';">Hours</p>\n            </div>\n          </div>\n          <div style="width:1px;background:'+l+';transform:rotate(13deg);margin:0 1rem 0 1rem;"></div>\n          <div>\n            <div style="display: flex;flex-direction: column;justify-content: space-between;align-items: center;height:3.9rem;">\n              <p style="font-size: 30px;color:'+o+';"><span id="saletime_m" style="font-weight:200;"></span></p>\n              <p style="color:#000000;font-size: 12px;color:'+r+';">Minutes</p>\n            </div>\n          </div>\n        ',!0===s&&(g=g+'\n        <div style="width:1px;background:'+l+';transform:rotate(13deg);margin:0 1rem 0 1rem;"></div>\n        <div>\n        <div style="display: flex;flex-direction: column;justify-content: space-between;align-items: center;height:3.9rem;">\n          <p style="font-size: 30px;color:'+o+';"><span id="saletime_s" style="font-weight:200;"></span></p>\n          <p style="color:\'#000000\';font-size: 12px;color:'+r+';">Seconds</p>\n        </div>\n      </div>\n        </div>')):(g=(g="Left"===i?'<div style="display:flex;flex-direction:column;align-items:flex-start;">\n        <div style="display: flex;justify-content: left;align-items: center;text-align:left;margin-bottom:10px;"><p style="font-size:16px;"><span style="color:'+n+';white-space:pre-wrap;">'+t+"</span></p></div>":"Center"===i?'<div style="display:flex;flex-direction:column;align-items:center;">\n        <div style="display: flex;justify-content: center;align-items: center;text-align:center;margin-bottom:10px;"><p style="font-size:16px;"><span style="color:'+n+';white-space:pre-wrap;">'+t+"</span></p></div>":'<div style="display:flex;flex-direction:column;align-items:flex-end;">\n        <div style="display: flex;justify-content: right;align-items: center;text-align:right;margin-bottom:10px;">\n        <p style="font-size:16px;"><span style="color:'+n+';white-space:pre-wrap;">'+t+"</span></p>\n        </div>")+'\n      <div style="display:flex;height:3rem;">\n        <div >\n          <div style="display: flex;justify-content: center;align-items: center;height: 3rem;width: 2.8rem;border-radius: 4px;background:'+a+';">\n            <p style="font-size: 30px;color:'+o+';"><span id="saletime_d" style="font-weight:200;"></span></p>\n          </div>\n        </div>\n        <div style="width:1rem;display:flex;justify-content:center;align-items:center;"><p style="font-zize:2.5rem;color:#B6B6B6;">:</p></div>\n        <div>\n          <div style="display: flex;justify-content: center;align-items: center;height: 3rem;width: 2.8rem;border-radius: 4px;background:'+a+';">\n            <p style="font-size: 30px;color:'+o+';"><span id="saletime_h" style="font-weight:200;"></span></p>\n          </div>\n        </div>\n        <div style="width:1rem;display:flex;justify-content:center;align-items:center;"><p style="font-zize:2.5rem;color:#B6B6B6;">:</p></div>\n        <div>\n          <div style="display: flex;justify-content: center;align-items: center;height: 3rem;width: 2.8rem;border-radius: 4px;background:'+a+';">\n            <p style="font-size: 30px;color:'+o+';"><span id="saletime_m" style="font-weight:200;"></span></p>\n          </div>\n        </div>\n      ',!0===s&&(g=g+'\n        <div style="width:1rem;display:flex;justify-content:center;align-items:center;"><p style="font-zize:2.5rem;color:#B6B6B6;">:</p></div>\n        <div>\n          <div style="display: flex;justify-content: center;align-items: center;height: 3rem;width: 2.8rem;border-radius: 4px;background:'+a+';">\n            <p style="font-size: 30px;color:'+o+';"><span id="saletime_s" style="font-weight:200;"></span></p>\n          </div>\n        </div>'));document.getElementById("countdowntimer_id")&&document.getElementById("countdowntimer_id").childNodes.length<1&&(y.innerHTML=g);(f.includes(u[e])||"true"===document.querySelector('[data-hook="add-to-cart"]').getAttribute("aria-disabled")||"Out of Stock"===document.querySelector('[data-hook="add-to-cart"]').innerText)&&document.querySelector("#countdowntimer_id")&&(document.querySelector("#countdowntimer_id").style.display="none");"Fixed deadline"===c.deadlineState?function(e,t){var i=x,e=new Date(e).getTime(),t=new Date(t).getTime();{var n;e<=i&&i<t?(n=t-i,e=Math.floor(n/864e5),n-=864e5*e,t=Math.floor(n/36e5),n-=36e5*t,i=Math.floor(n/6e4),n-=6e4*i,n=Math.floor(n/1e3),e<10&&(e="0"+e),t<10&&(t="0"+t),i<10&&(i="0"+i),n<10&&(n="0"+n),document.querySelector("#saletime_d")&&(document.querySelector("#saletime_d").innerText=e,document.querySelector("#saletime_h").innerText=t,document.querySelector("#saletime_m").innerText=i),document.querySelector("#saletime_s")&&(document.querySelector("#saletime_s").innerText=n)):y.style.display="none"}}(c.begin,c.end):function(e,t){var i=JSON.parse(localStorage.getItem("randomtimeobj"))[t],n=x;(e=new Date(e).getTime())<=n&&n<i?(t=i-n,e=Math.floor(t/864e5),t-=864e5*e,i=Math.floor(t/36e5),t-=36e5*i,n=Math.floor(t/6e4),t-=6e4*n,t=Math.floor(t/1e3),e<10&&(e="0"+e),i<10&&(i="0"+i),n<10&&(n="0"+n),t<10&&(t="0"+t),document.querySelector("#saletime_d")&&(document.querySelector("#saletime_d").innerText=e,document.querySelector("#saletime_h").innerText=i,document.querySelector("#saletime_m").innerText=n),document.querySelector("#saletime_s")&&(document.querySelector("#saletime_s").innerText=t)):y.style.display="none"}(x,e)}(l=a)):"/"===window.location.pathname?c.homechecked&&(document.getElementById("countdowntimerhome_id0")&&document.querySelectorAll('div[data-hook="product-item-root"]').length===s&&"Fixed deadline"===c.deadlineState?w(c.begin,c.end):v()):o&&c.catalogchecked&&(document.getElementById("countdowntimerhome_id0")&&document.querySelectorAll('div[data-hook="product-item-root"]').length===s&&"Fixed deadline"===c.deadlineState?w(c.begin,c.end):(document.getElementById("countdowntimerhome_id0")&&(e=document.getElementById("countdowntimerhome_id0")).parentNode.removeChild(e),v()))},1e3)))}))}))}();